watchful-cli 1.7.23 → 1.7.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,7 +10,7 @@ const action = require("../action"),
10
10
 
11
11
  const { BATCH_BUILD_FAILED_MESSAGE } = require("../messages");
12
12
 
13
- function batch(options) {
13
+ function batchAction(wait, node, debug, bundler, quietly, metrics, entryFile, processes, transpiler, bundleFile, libDirectory, tempDirectory, sourceDirectory) {
14
14
  const operations = [
15
15
  initialiseOperation,
16
16
  createTranspileFileFunctionOperation,
@@ -20,7 +20,19 @@ function batch(options) {
20
20
  bundleFilesOperation
21
21
  ],
22
22
  context = {
23
- options
23
+ wait,
24
+ node,
25
+ debug,
26
+ bundler,
27
+ quietly,
28
+ metrics,
29
+ entryFile,
30
+ processes,
31
+ transpiler,
32
+ bundleFile,
33
+ libDirectory,
34
+ tempDirectory,
35
+ sourceDirectory
24
36
  };
25
37
 
26
38
  action(operations, (success) => {
@@ -34,4 +46,4 @@ function batch(options) {
34
46
  }, context);
35
47
  }
36
48
 
37
- module.exports = batch;
49
+ module.exports = batchAction;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function help() {
3
+ function helpAction() {
4
4
  console.log(`Usage:
5
5
 
6
6
  watchful [<command>] [<options>]
@@ -55,4 +55,4 @@ Please see the readme file on GitHub:
55
55
  `);
56
56
  }
57
57
 
58
- module.exports = help;
58
+ module.exports = helpAction;
@@ -9,7 +9,7 @@ const watch = require("../watch"),
9
9
 
10
10
  const { INCREMENTAL_BUILD_FAILED_MESSAGE } = require("../messages");
11
11
 
12
- function incremental(options) {
12
+ function incrementalAction(wait, node, debug, bundler, quietly, metrics, entryFile, processes, transpiler, bundleFile, libDirectory, tempDirectory, sourceDirectory) {
13
13
  const operations = [
14
14
  initialiseOperation,
15
15
  createTranspileFileFunctionOperation,
@@ -17,7 +17,19 @@ function incremental(options) {
17
17
  retrieveFilePathsOperation
18
18
  ],
19
19
  context = {
20
- options
20
+ wait,
21
+ node,
22
+ debug,
23
+ bundler,
24
+ quietly,
25
+ metrics,
26
+ entryFile,
27
+ processes,
28
+ transpiler,
29
+ bundleFile,
30
+ libDirectory,
31
+ tempDirectory,
32
+ sourceDirectory
21
33
  };
22
34
 
23
35
  action(operations, (success) => {
@@ -31,4 +43,4 @@ function incremental(options) {
31
43
  }, context);
32
44
  }
33
45
 
34
- module.exports = incremental;
46
+ module.exports = incrementalAction;
@@ -3,11 +3,11 @@
3
3
  const { WATCHFUL_CLI } = require("../constants"),
4
4
  { getPackageVersion } = require("../utilities/packageJSON");
5
5
 
6
- function version() {
6
+ function versionAction() {
7
7
  const packageVersion = getPackageVersion(),
8
8
  version = packageVersion; ///
9
9
 
10
10
  console.log(`${WATCHFUL_CLI} version ${version}`);
11
11
  }
12
12
 
13
- module.exports = version;
13
+ module.exports = versionAction;
package/bin/actions.js CHANGED
@@ -1,33 +1,60 @@
1
1
  "use strict";
2
2
 
3
- const help = require("./action/help"),
4
- batch = require("./action/batch"),
5
- version = require("./action/version"),
6
- incremental = require("./action/incremental");
3
+ const helpAction = require("./action/help"),
4
+ batchAction = require("./action/batch"),
5
+ versionAction = require("./action/version"),
6
+ incrementalAction = require("./action/incremental");
7
7
 
8
- const { HELP_OPTION, VERSION_OPTION } = require("./options"),
9
- { HELP_COMMAND, BATCH_COMMAND, VERSION_COMMAND, INCREMENTAL_COMMAND } = require("./commands");
8
+ const { HELP_COMMAND, BATCH_COMMAND, VERSION_COMMAND, INCREMENTAL_COMMAND } = require("./commands"),
9
+ { DEFAULT_HELP,
10
+ DEFAULT_WAIT,
11
+ DEFAULT_NODE,
12
+ DEFAULT_DEBUG,
13
+ DEFAULT_VERSION,
14
+ DEFAULT_BUNDLER,
15
+ DEFAULT_QUIETLY,
16
+ DEFAULT_METRICS,
17
+ DEFAULT_ENTRY_FILE,
18
+ DEFAULT_PROCESSES,
19
+ DEFAULT_TRANSPILER,
20
+ DEFAULT_BUNDLE_FILE,
21
+ DEFAULT_LIB_DIRECTORY,
22
+ DEFAULT_TEMP_DIRECTORY,
23
+ DEFAULT_SOURCE_DIRECTORY } = require("./defaults");
10
24
 
11
25
  function actions(command, argument, options) {
12
26
  const commandMissing = (command === null),
13
- helpOptionPresent = options.hasOwnProperty(HELP_OPTION),
14
- versionOptionPresent = options.hasOwnProperty(VERSION_OPTION);
27
+ { help = DEFAULT_HELP,
28
+ wait = DEFAULT_WAIT,
29
+ node = DEFAULT_NODE,
30
+ debug = DEFAULT_DEBUG,
31
+ version = DEFAULT_VERSION,
32
+ bundler = DEFAULT_BUNDLER,
33
+ quietly = DEFAULT_QUIETLY,
34
+ metrics = DEFAULT_METRICS,
35
+ entryFile = DEFAULT_ENTRY_FILE,
36
+ processes = DEFAULT_PROCESSES,
37
+ transpiler = DEFAULT_TRANSPILER,
38
+ bundleFile = DEFAULT_BUNDLE_FILE,
39
+ libDirectory = DEFAULT_LIB_DIRECTORY,
40
+ tempDirectory = DEFAULT_TEMP_DIRECTORY,
41
+ sourceDirectory = DEFAULT_SOURCE_DIRECTORY } = options;
15
42
 
16
43
  if (false) {
17
44
  ///
18
- } else if (versionOptionPresent) {
19
- command = VERSION_COMMAND;
20
- } else if (helpOptionPresent) {
45
+ } else if (help) {
21
46
  command = HELP_COMMAND;
47
+ } else if (version) {
48
+ command = VERSION_COMMAND;
22
49
  } else if (commandMissing) {
23
50
  command = INCREMENTAL_COMMAND;
24
51
  }
25
52
 
26
53
  switch (command) {
27
- case HELP_COMMAND : help(); break;
28
- case BATCH_COMMAND : batch(options); break;
29
- case VERSION_COMMAND : version(); break;
30
- case INCREMENTAL_COMMAND : incremental(options); break;
54
+ case HELP_COMMAND : helpAction(); break;
55
+ case BATCH_COMMAND : batchAction(wait, node, debug, bundler, quietly, metrics, entryFile, processes, transpiler, bundleFile, libDirectory, tempDirectory, sourceDirectory); break;
56
+ case VERSION_COMMAND : versionAction(); break;
57
+ case INCREMENTAL_COMMAND : incrementalAction(wait, node, debug, bundler, quietly, metrics, entryFile, processes, transpiler, bundleFile, libDirectory, tempDirectory, sourceDirectory); break;
31
58
  }
32
59
  }
33
60
 
package/bin/defaults.js CHANGED
@@ -2,22 +2,36 @@
2
2
 
3
3
  const { BABEL, BROWSERIFY } = require("./constants");
4
4
 
5
- const DEFAULT_WAIT = 0,
5
+ const DEFAULT_HELP = false,
6
+ DEFAULT_WAIT = 0,
6
7
  DEFAULT_NODE = false,
7
8
  DEFAULT_DEBUG = false,
9
+ DEFAULT_VERSION = false,
8
10
  DEFAULT_BUNDLER = BROWSERIFY,
9
11
  DEFAULT_QUIETLY = false,
10
12
  DEFAULT_METRICS = false,
11
13
  DEFAULT_PROCESSES = 1,
12
- DEFAULT_TRANSPILER = BABEL;
14
+ DEFAULT_TRANSPILER = BABEL,
15
+ DEFAULT_ENTRY_FILE = null,
16
+ DEFAULT_BUNDLE_FILE = null,
17
+ DEFAULT_LIB_DIRECTORY = null,
18
+ DEFAULT_TEMP_DIRECTORY = null,
19
+ DEFAULT_SOURCE_DIRECTORY = null;
13
20
 
14
21
  module.exports = {
22
+ DEFAULT_HELP,
15
23
  DEFAULT_WAIT,
16
24
  DEFAULT_NODE,
17
25
  DEFAULT_DEBUG,
26
+ DEFAULT_VERSION,
18
27
  DEFAULT_BUNDLER,
19
28
  DEFAULT_QUIETLY,
20
29
  DEFAULT_METRICS,
21
30
  DEFAULT_PROCESSES,
22
- DEFAULT_TRANSPILER
31
+ DEFAULT_TRANSPILER,
32
+ DEFAULT_ENTRY_FILE,
33
+ DEFAULT_BUNDLE_FILE,
34
+ DEFAULT_LIB_DIRECTORY,
35
+ DEFAULT_TEMP_DIRECTORY,
36
+ DEFAULT_SOURCE_DIRECTORY
23
37
  };
@@ -2,14 +2,6 @@
2
2
 
3
3
  const { pathFromOption } = require("../utilities/path"),
4
4
  { initialiseMetrics } = require("../utilities/metrics"),
5
- { DEFAULT_WAIT,
6
- DEFAULT_NODE,
7
- DEFAULT_DEBUG,
8
- DEFAULT_BUNDLER,
9
- DEFAULT_QUIETLY,
10
- DEFAULT_METRICS,
11
- DEFAULT_PROCESSES,
12
- DEFAULT_TRANSPILER } = require("../defaults"),
13
5
  { NO_ENTRY_FILE_SPECIFIED_MESSAGE,
14
6
  NO_BUNDLE_FILE_SPECIFIED_MESSAGE,
15
7
  NO_SOURCE_DIRECTORY_SPECFIFIED_MESSAGE,
@@ -24,20 +16,19 @@ const { pathFromOption } = require("../utilities/path"),
24
16
  SOURCE_DIRECTORY_PATH_NOT_RELATIVE_TO_CURRENT_DIRECTORY_MESSAGE } = require("../messages");
25
17
 
26
18
  function initialiseOperation(proceed, abort, context) {
27
- const { options } = context,
28
- { wait = DEFAULT_WAIT,
29
- node = DEFAULT_NODE,
30
- debug = DEFAULT_DEBUG,
31
- bundler = DEFAULT_BUNDLER,
32
- quietly = DEFAULT_QUIETLY,
33
- metrics = DEFAULT_METRICS,
34
- processes = DEFAULT_PROCESSES,
35
- transpiler = DEFAULT_TRANSPILER,
36
- entryFile = null,
37
- bundleFile = null,
38
- libDirectory = null,
39
- tempDirectory = null,
40
- sourceDirectory } = options,
19
+ const { wait,
20
+ node,
21
+ debug,
22
+ bundler,
23
+ quietly,
24
+ metrics,
25
+ entryFile,
26
+ processes,
27
+ transpiler,
28
+ bundleFile,
29
+ libDirectory,
30
+ tempDirectory,
31
+ sourceDirectory } = context,
41
32
  processesLength = Number(processes); ///
42
33
 
43
34
  let entryFilePath = null,
@@ -45,7 +36,7 @@ function initialiseOperation(proceed, abort, context) {
45
36
  sourceDirectoryPath = null,
46
37
  targetDirectoryPath = null;
47
38
 
48
- if (!sourceDirectory) {
39
+ if (sourceDirectory === null) {
49
40
  console.log(NO_SOURCE_DIRECTORY_SPECFIFIED_MESSAGE);
50
41
 
51
42
  abort();
@@ -53,7 +44,7 @@ function initialiseOperation(proceed, abort, context) {
53
44
  return;
54
45
  }
55
46
 
56
- if (!libDirectory && !tempDirectory) {
47
+ if ((libDirectory === null) && (tempDirectory === null)) {
57
48
  console.log(NEITHER_LIB_NOR_TEMP_DIRECTORY_SPECIFIED_MESSAGE);
58
49
 
59
50
  abort();
@@ -61,7 +52,7 @@ function initialiseOperation(proceed, abort, context) {
61
52
  return;
62
53
  }
63
54
 
64
- if (libDirectory && tempDirectory) {
55
+ if ((libDirectory !== null) && (tempDirectory !== null)) {
65
56
  console.log(BOTH_LIB_AND_TEMP_DIRECTORIES_SPECIFIED_MESSAGE);
66
57
 
67
58
  abort();
@@ -69,8 +60,8 @@ function initialiseOperation(proceed, abort, context) {
69
60
  return;
70
61
  }
71
62
 
72
- if (tempDirectory) {
73
- if (!entryFile) {
63
+ if (tempDirectory !== null) {
64
+ if (entryFile === null) {
74
65
  console.log(NO_ENTRY_FILE_SPECIFIED_MESSAGE);
75
66
 
76
67
  abort();
@@ -78,7 +69,7 @@ function initialiseOperation(proceed, abort, context) {
78
69
  return;
79
70
  }
80
71
 
81
- if (!bundleFile) {
72
+ if (bundleFile === null) {
82
73
  console.log(NO_BUNDLE_FILE_SPECIFIED_MESSAGE);
83
74
 
84
75
  abort();
@@ -87,7 +78,7 @@ function initialiseOperation(proceed, abort, context) {
87
78
  }
88
79
  }
89
80
 
90
- if (entryFile && !bundleFile) {
81
+ if ((entryFile !== null) && (bundleFile === null)) {
91
82
  console.log(ENTRY_FILE_BUT_NO_BUNDLE_FILE_SPECIFIED_MESSAGE);
92
83
 
93
84
  abort();
@@ -95,7 +86,7 @@ function initialiseOperation(proceed, abort, context) {
95
86
  return;
96
87
  }
97
88
 
98
- if (bundleFile && !entryFile) {
89
+ if ((bundleFile !== null) && (entryFile === null)) {
99
90
  console.log(BUNDLE_FILE_BUT_NO_ENTRY_FILE_SPECIFIED_MESSAGE);
100
91
 
101
92
  abort();
@@ -103,12 +94,12 @@ function initialiseOperation(proceed, abort, context) {
103
94
  return;
104
95
  }
105
96
 
106
- if (entryFile) {
97
+ if (entryFile !== null) {
107
98
  const entryFileOption = entryFile; ///
108
99
 
109
100
  entryFilePath = pathFromOption(entryFileOption);
110
101
 
111
- if (!entryFilePath) {
102
+ if (entryFilePath === null) {
112
103
  console.log(ENTRY_FILE_PATH_NOT_RELATIVE_TO_CURRENT_DIRECTORY_MESSAGE);
113
104
 
114
105
  abort();
@@ -117,12 +108,12 @@ function initialiseOperation(proceed, abort, context) {
117
108
  }
118
109
  }
119
110
 
120
- if (bundleFile) {
111
+ if (bundleFile !== null) {
121
112
  const bundleFileOption = bundleFile; ///
122
113
 
123
114
  bundleFilePath = pathFromOption(bundleFile, bundleFileOption);
124
115
 
125
- if (!bundleFilePath) {
116
+ if (bundleFilePath === null) {
126
117
  console.log(BUNDLE_FILE_PATH_NOT_RELATIVE_TO_CURRENT_DIRECTORY_MESSAGE);
127
118
 
128
119
  abort();
@@ -131,11 +122,11 @@ function initialiseOperation(proceed, abort, context) {
131
122
  }
132
123
  }
133
124
 
134
- if (libDirectory) {
125
+ if (libDirectory !== null) {
135
126
  const libDirectoryOption = libDirectory, ///
136
127
  libDirectoryPath = pathFromOption(libDirectory, libDirectoryOption);
137
128
 
138
- if (!libDirectoryPath) {
129
+ if (libDirectoryPath === null) {
139
130
  console.log(LIB_DIRECTORY_PATH_NOT_RELATIVE_TO_CURRENT_DIRECTORY_MESSAGE);
140
131
 
141
132
  abort();
@@ -146,11 +137,11 @@ function initialiseOperation(proceed, abort, context) {
146
137
  targetDirectoryPath = libDirectoryPath; ///
147
138
  }
148
139
 
149
- if (tempDirectory) {
140
+ if (tempDirectory !== null) {
150
141
  const tempDirectoryOption = tempDirectory, ///
151
142
  tempDirectoryPath = pathFromOption(tempDirectory, tempDirectoryOption);
152
143
 
153
- if (!tempDirectoryPath) {
144
+ if (tempDirectoryPath === null) {
154
145
  console.log(TEMP_DIRECTORY_PATH_NOT_RELATIVE_TO_CURRENT_DIRECTORY_MESSAGE);
155
146
 
156
147
  abort();
@@ -161,12 +152,12 @@ function initialiseOperation(proceed, abort, context) {
161
152
  targetDirectoryPath = tempDirectoryPath; ///
162
153
  }
163
154
 
164
- if (sourceDirectory) {
155
+ if (sourceDirectory !== null) {
165
156
  const sourceDirectoryOption = sourceDirectory; ///
166
157
 
167
158
  sourceDirectoryPath = pathFromOption(sourceDirectory, sourceDirectoryOption);
168
159
 
169
- if (!sourceDirectoryPath) {
160
+ if (sourceDirectoryPath === null) {
170
161
  console.log(SOURCE_DIRECTORY_PATH_NOT_RELATIVE_TO_CURRENT_DIRECTORY_MESSAGE);
171
162
 
172
163
  abort();
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
- const singleProcessTranspileFilesCallback = require(".//transpileFiles/singleProcess"),
4
- multipleProcessesTranspileFilesCallback = require(".//transpileFiles/mutilpleProcesses");
3
+ const singleProcessTranspileFilesCallback = require(".//transpileFiles/singleProcess"), ///
4
+ multipleProcessesTranspileFilesCallback = require(".//transpileFiles/mutilpleProcesses"); ///
5
5
 
6
6
  const { S, EMPTY_STRING } = require("../constants"),
7
7
  { startCountMetric, endCountMetric, startSecondsMetric, endSecondsMetric } = require("../utilities/metrics");
@@ -11,6 +11,7 @@ function transpileFilesOperation(proceed, abort, context) {
11
11
 
12
12
  if (metrics) {
13
13
  startCountMetric(context);
14
+
14
15
  startSecondsMetric(context);
15
16
  }
16
17
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "watchful-cli",
3
3
  "author": "James Smith",
4
- "version": "1.7.23",
4
+ "version": "1.7.24",
5
5
  "license": "MIT, Anti-996",
6
6
  "homepage": "https://github.com/djalbat/watchful-cli",
7
7
  "description": "Incremental transpilation with bundling.",