watchful-cli 1.7.51 → 1.7.52
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.
- package/README.md +3 -3
- package/bin/action/help.js +3 -3
- package/bin/configure.js +20 -0
- package/bin/main.js +19 -18
- package/bin/messages.js +4 -0
- package/package.json +1 -1
- package/watchful.js +2 -1
package/README.md
CHANGED
|
@@ -56,14 +56,14 @@ If you would like to contribute or would simply like to have a look at the code,
|
|
|
56
56
|
Watchful has the following commands and options:
|
|
57
57
|
|
|
58
58
|
```
|
|
59
|
-
watchful [<command>] [<
|
|
59
|
+
watchful [<options>] [<command>] [<argument>]
|
|
60
60
|
|
|
61
61
|
Commands:
|
|
62
62
|
|
|
63
63
|
help Show this help
|
|
64
|
-
|
|
65
|
-
version Show theh version
|
|
66
64
|
|
|
65
|
+
version Show the version
|
|
66
|
+
|
|
67
67
|
batch Batch build
|
|
68
68
|
|
|
69
69
|
[incremental] Watch and build incrementally
|
package/bin/action/help.js
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
function helpAction() {
|
|
4
4
|
console.log(`Usage:
|
|
5
5
|
|
|
6
|
-
watchful [<command>] [<
|
|
6
|
+
watchful [<options>] [<command>] [<argument>]
|
|
7
7
|
|
|
8
8
|
Commands:
|
|
9
9
|
|
|
10
|
-
version Show theh version
|
|
11
|
-
|
|
12
10
|
help Show this help
|
|
11
|
+
|
|
12
|
+
version Show the version
|
|
13
13
|
|
|
14
14
|
batch Batch build
|
|
15
15
|
|
package/bin/configure.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { DEFAULT_HELP, DEFAULT_VERSION } = require("./defaults"),
|
|
4
|
+
{ HELP_COMMAND, VERSION_COMMAND } = require("./commands");
|
|
5
|
+
|
|
6
|
+
function configure(command, argument, options, main) {
|
|
7
|
+
const { help = DEFAULT_HELP, version = DEFAULT_VERSION } = options;
|
|
8
|
+
|
|
9
|
+
if (false) {
|
|
10
|
+
///
|
|
11
|
+
} else if (help) {
|
|
12
|
+
command = HELP_COMMAND;
|
|
13
|
+
} else if (version) {
|
|
14
|
+
command = VERSION_COMMAND;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
main(command, argument, options);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = configure;
|
package/bin/main.js
CHANGED
|
@@ -5,14 +5,13 @@ const helpAction = require("./action/help"),
|
|
|
5
5
|
versionAction = require("./action/version"),
|
|
6
6
|
incrementalAction = require("./action/incremental");
|
|
7
7
|
|
|
8
|
-
const {
|
|
9
|
-
{
|
|
10
|
-
|
|
8
|
+
const { NO_COMMAND_GIVEN_MESSAGE, COMMAND_NOT_RECOGNISED_MESSAGE } = require("./messages"),
|
|
9
|
+
{ HELP_COMMAND, BATCH_COMMAND, VERSION_COMMAND, INCREMENTAL_COMMAND } = require("./commands"),
|
|
10
|
+
{ DEFAULT_WAIT,
|
|
11
11
|
DEFAULT_NODE,
|
|
12
12
|
DEFAULT_DEBUG,
|
|
13
13
|
DEFAULT_RELEASE,
|
|
14
14
|
DEFAULT_BUNDLER,
|
|
15
|
-
DEFAULT_VERSION,
|
|
16
15
|
DEFAULT_QUIETLY,
|
|
17
16
|
DEFAULT_METRICS,
|
|
18
17
|
DEFAULT_ENTRY_FILE,
|
|
@@ -24,14 +23,11 @@ const { HELP_COMMAND, BATCH_COMMAND, VERSION_COMMAND, INCREMENTAL_COMMAND } = re
|
|
|
24
23
|
DEFAULT_SOURCE_DIRECTORY } = require("./defaults");
|
|
25
24
|
|
|
26
25
|
function main(command, argument, options) {
|
|
27
|
-
const
|
|
28
|
-
{ help = DEFAULT_HELP,
|
|
29
|
-
wait = DEFAULT_WAIT,
|
|
26
|
+
const { wait = DEFAULT_WAIT,
|
|
30
27
|
node = DEFAULT_NODE,
|
|
31
28
|
debug = DEFAULT_DEBUG,
|
|
32
29
|
release = DEFAULT_RELEASE,
|
|
33
30
|
bundler = DEFAULT_BUNDLER,
|
|
34
|
-
version = DEFAULT_VERSION,
|
|
35
31
|
quietly = DEFAULT_QUIETLY,
|
|
36
32
|
metrics = DEFAULT_METRICS,
|
|
37
33
|
processes = DEFAULT_PROCESSES,
|
|
@@ -42,17 +38,15 @@ function main(command, argument, options) {
|
|
|
42
38
|
tempDirectory = DEFAULT_TEMP_DIRECTORY,
|
|
43
39
|
sourceDirectory = DEFAULT_SOURCE_DIRECTORY } = options;
|
|
44
40
|
|
|
45
|
-
if (false) {
|
|
46
|
-
///
|
|
47
|
-
} else if (help) {
|
|
48
|
-
command = HELP_COMMAND;
|
|
49
|
-
} else if (version) {
|
|
50
|
-
command = VERSION_COMMAND;
|
|
51
|
-
} else if (commandMissing) {
|
|
52
|
-
command = INCREMENTAL_COMMAND;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
41
|
switch (command) {
|
|
42
|
+
case null: {
|
|
43
|
+
console.log(NO_COMMAND_GIVEN_MESSAGE);
|
|
44
|
+
|
|
45
|
+
process.exit(1);
|
|
46
|
+
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
|
|
56
50
|
case HELP_COMMAND: {
|
|
57
51
|
helpAction();
|
|
58
52
|
|
|
@@ -77,6 +71,13 @@ function main(command, argument, options) {
|
|
|
77
71
|
break;
|
|
78
72
|
}
|
|
79
73
|
|
|
74
|
+
default: {
|
|
75
|
+
console.log(COMMAND_NOT_RECOGNISED_MESSAGE);
|
|
76
|
+
|
|
77
|
+
process.exit(1);
|
|
78
|
+
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
83
|
|
package/bin/messages.js
CHANGED
|
@@ -10,6 +10,8 @@ const SWC_FAILED_MESSAGE = "swc failed:",
|
|
|
10
10
|
BABEL_NOT_INSTALLED_MESSAGE = "The '@babel/core' package is not installed.",
|
|
11
11
|
ESBUILD_NOT_INSTALLED_MESSAGE = "esbuild is not installed.",
|
|
12
12
|
BROWSERIFY_NOT_INSTALLED_MESSAGE = "Browserify is not installed.",
|
|
13
|
+
NO_COMMAND_GIVEN_MESSAGE = "No command has been given.",
|
|
14
|
+
COMMAND_NOT_RECOGNISED_MESSAGE = "The command is not recognised.",
|
|
13
15
|
NO_ENTRY_FILE_SPECIFIED_MESSAGE = "If a temp directory is specified then an entry file must also be given.",
|
|
14
16
|
NO_BUNDLE_FILE_SPECIFIED_MESSAGE = "If a temp directory is specified then a bundle file must also be given.",
|
|
15
17
|
DEBUG_AND_RELEAES_BOTH_SET_MESSAGE = "The debug and release flags cannot both be set at the same time.",
|
|
@@ -36,6 +38,8 @@ module.exports = {
|
|
|
36
38
|
BABEL_NOT_INSTALLED_MESSAGE,
|
|
37
39
|
ESBUILD_NOT_INSTALLED_MESSAGE,
|
|
38
40
|
BROWSERIFY_NOT_INSTALLED_MESSAGE,
|
|
41
|
+
NO_COMMAND_GIVEN_MESSAGE,
|
|
42
|
+
COMMAND_NOT_RECOGNISED_MESSAGE,
|
|
39
43
|
NO_ENTRY_FILE_SPECIFIED_MESSAGE,
|
|
40
44
|
NO_BUNDLE_FILE_SPECIFIED_MESSAGE,
|
|
41
45
|
DEBUG_AND_RELEAES_BOTH_SET_MESSAGE,
|
package/package.json
CHANGED
package/watchful.js
CHANGED
|
@@ -4,6 +4,7 @@ const { parseArgv } = require("argumentative"),
|
|
|
4
4
|
{ arrayUtilities } = require("necessary");
|
|
5
5
|
|
|
6
6
|
const main = require("./bin/main"),
|
|
7
|
+
configure = require("./bin/configure"),
|
|
7
8
|
abbreviations = require("./bin/abbreviations");
|
|
8
9
|
|
|
9
10
|
const { first, second } = arrayUtilities;
|
|
@@ -14,4 +15,4 @@ const { commands, options } = parseArgv(process.argv, abbreviations),
|
|
|
14
15
|
command = firstCommand || null, ///
|
|
15
16
|
argument = secondCommand || null; ///
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
configure(command, argument, options, main);
|