Skip to content

Commit 3f24746

Browse files
committed
Update commenting
1 parent e4ffd2d commit 3f24746

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

webhooks.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,24 @@ const quickRebuildSequence = [
1818
"gatsby build"
1919
// Add custom commands here
2020
];
21-
// You can also create your custom callback terminal sequences...
21+
// You can also create your custom callback terminal command sequences...
2222

23-
// Routing (Gatsby Update/Re-build sequences) //
23+
// Routing with callback terminal command sequences //
2424
// Default delay is 120 and 30s respectively = build will trigger only after inactivity for 2 minutes, to not to repeat the same thing multiple times.
2525
createGatsbyWebhook('/clean_gatsby_rebuild/', cleanRebuildSequence, 120000)
2626
createGatsbyWebhook('/quick_gatsby_rebuild/', quickRebuildSequence, 30000)
2727
// You can also create custom webhook callbacks with your custom sequences...
2828

2929
// FUNCTIONS //
3030

31-
/* FUNCTION: Create Gatsby webhook route.
32-
endpoint(string) "/test/" - endpoint path
33-
sequence(array) [string, ...] - callback commands, will be executed synchronously in order, same as "commands" in runSequence()
34-
delay(int) - delay in ms. The action will be fired only after inactivity of receiving the same request within delay period.
31+
/*
32+
FUNCTION: Create Gatsby webhook route.
33+
Accepts:
34+
endpoint(string) "/test/" - endpoint path
35+
sequence(array) [string, ...] - callback commands, will be executed synchronously in order, same as "commands" in runSequence()
36+
delay(int) - delay in ms. The action will be fired only after inactivity of receiving the same request within delay period.
37+
Returns:
38+
HTTP 200 OK || console.log
3539
*/
3640
function createGatsbyWebhook(endpoint, sequence, delay = 15000){
3741
gatsbyWebhookHelper.post( endpoint, ( req, res ) => {
@@ -47,8 +51,12 @@ function createGatsbyWebhook(endpoint, sequence, delay = 15000){
4751
});
4852
}
4953

50-
/* FUNCTION: Run Terminal Sequence.
51-
commands(array) [string, ...] - callback commands, will be executed synchronously in order.
54+
/*
55+
FUNCTION: Run Terminal Sequence.
56+
Accepts:
57+
commands(array || false) [string, ...] - callback commands, will be executed synchronously in order.
58+
Returns:
59+
status(boolean) - success is true, failure is false
5260
*/
5361
function runSequence (commands=false){
5462
if(commands === false) return false;
@@ -79,6 +87,8 @@ function runSequence (commands=false){
7987
return true;
8088
}
8189

90+
// /FUNCTIONS //
91+
8292
// Start //
8393
function start_gatsby_webhook_listener(){
8494
gatsbyWebhookHelper.listen( WEBHOOK_PORT, () => console.log( 'Node Webhook helper started on port '+String(WEBHOOK_PORT) ) );

0 commit comments

Comments
 (0)