watchful-cli 1.7.11 → 1.7.15
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/bin/action/batch.js +14 -14
- package/bin/action/incremental.js +10 -10
- package/bin/action.js +3 -3
- package/bin/{callback → operation}/bundleFiles.js +2 -2
- package/bin/{callback → operation}/createBundleFilesFunction.js +2 -2
- package/bin/{callback → operation}/createTranspileFileFunction.js +2 -2
- package/bin/{callback → operation}/initialise.js +2 -2
- package/bin/{callback → operation}/retrieveFilePaths.js +2 -2
- package/bin/{callback → operation}/transpileFiles/mutilpleProcesses.js +2 -2
- package/bin/{callback → operation}/transpileFiles/singleProcess.js +4 -4
- package/bin/{callback → operation}/transpileFiles.js +4 -4
- package/bin/utilities/callback.js +11 -11
- package/package.json +2 -2
package/bin/action/batch.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const action = require("../action"),
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
initialiseOperation = require("../operation/initialise"),
|
|
5
|
+
bundleFilesOperation = require("../operation/bundleFiles"),
|
|
6
|
+
transpileFilesOperation = require("../operation/transpileFiles"),
|
|
7
|
+
retrieveFilePathsOperation = require("../operation/retrieveFilePaths"),
|
|
8
|
+
createBundleFilesFunctionOperation = require("../operation/createBundleFilesFunction"),
|
|
9
|
+
createTranspileFileFunctionOperation = require("../operation/createTranspileFileFunction");
|
|
10
10
|
|
|
11
11
|
const { BATCH_BUILD_FAILED_MESSAGE } = require("../messages");
|
|
12
12
|
|
|
13
13
|
function batch(options) {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
const operations = [
|
|
15
|
+
initialiseOperation,
|
|
16
|
+
createTranspileFileFunctionOperation,
|
|
17
|
+
createBundleFilesFunctionOperation,
|
|
18
|
+
retrieveFilePathsOperation,
|
|
19
|
+
transpileFilesOperation,
|
|
20
|
+
bundleFilesOperation
|
|
21
21
|
],
|
|
22
22
|
context = {
|
|
23
23
|
options
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
action(
|
|
26
|
+
action(operations, (success) => {
|
|
27
27
|
if (!success) {
|
|
28
28
|
console.log(BATCH_BUILD_FAILED_MESSAGE);
|
|
29
29
|
|
|
@@ -2,25 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
const watch = require("../watch"),
|
|
4
4
|
action = require("../action"),
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
initialiseOperation = require("../operation/initialise"),
|
|
6
|
+
retrieveFilePathsOperation = require("../operation/retrieveFilePaths"),
|
|
7
|
+
createBundleFilesFunctionOperation = require("../operation/createBundleFilesFunction"),
|
|
8
|
+
createTranspileFileFunctionOperation = require("../operation/createTranspileFileFunction");
|
|
9
9
|
|
|
10
10
|
const { INCREMENTAL_BUILD_FAILED_MESSAGE } = require("../messages");
|
|
11
11
|
|
|
12
12
|
function incremental(options) {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
const operations = [
|
|
14
|
+
initialiseOperation,
|
|
15
|
+
createTranspileFileFunctionOperation,
|
|
16
|
+
createBundleFilesFunctionOperation,
|
|
17
|
+
retrieveFilePathsOperation
|
|
18
18
|
],
|
|
19
19
|
context = {
|
|
20
20
|
options
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
action(
|
|
23
|
+
action(operations, (success) => {
|
|
24
24
|
if (!success) {
|
|
25
25
|
console.log(INCREMENTAL_BUILD_FAILED_MESSAGE);
|
|
26
26
|
|
package/bin/action.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const {
|
|
3
|
+
const { executeOperations } = require("./utilities/callback");
|
|
4
4
|
|
|
5
|
-
function action(
|
|
6
|
-
|
|
5
|
+
function action(operations, callback, context) {
|
|
6
|
+
executeOperations(operations, (completed) => {
|
|
7
7
|
const success = completed; ///
|
|
8
8
|
|
|
9
9
|
callback(success);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const bundleFiles = require("../bundleFiles");
|
|
4
4
|
|
|
5
|
-
function
|
|
5
|
+
function bundleFilesOperation(proceed, abort, context) {
|
|
6
6
|
const { entryFilePath } = context;
|
|
7
7
|
|
|
8
8
|
if (!entryFilePath) {
|
|
@@ -16,4 +16,4 @@ function bundleFilesCallback(proceed, abort, context) {
|
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
module.exports =
|
|
19
|
+
module.exports = bundleFilesOperation;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const { createBundleFilesFunction } = require("../utilities/bundle");
|
|
4
4
|
|
|
5
|
-
function
|
|
5
|
+
function createBundleFilesFunctionOperation(proceed, abort, context) {
|
|
6
6
|
const { bundleFilePath } = context;
|
|
7
7
|
|
|
8
8
|
if (bundleFilePath === null) {
|
|
@@ -26,4 +26,4 @@ function createBundleFilesFunctionCallback(proceed, abort, context) {
|
|
|
26
26
|
proceed();
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
module.exports =
|
|
29
|
+
module.exports = createBundleFilesFunctionOperation;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const { createTranspileFileFunction } = require("../utilities/transpile");
|
|
4
4
|
|
|
5
|
-
function
|
|
5
|
+
function createTranspileFileFunctionOperation(proceed, abort, context) {
|
|
6
6
|
const transpileFileFunction = createTranspileFileFunction(context);
|
|
7
7
|
|
|
8
8
|
if (transpileFileFunction === null) {
|
|
@@ -18,4 +18,4 @@ function createTranspileFileFunctionCallback(proceed, abort, context) {
|
|
|
18
18
|
proceed();
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
module.exports =
|
|
21
|
+
module.exports = createTranspileFileFunctionOperation;
|
|
@@ -23,7 +23,7 @@ const { pathFromOption } = require("../utilities/path"),
|
|
|
23
23
|
TEMP_DIRECTORY_PATH_NOT_RELATIVE_TO_CURRENT_DIRECTORY_MESSAGE,
|
|
24
24
|
SOURCE_DIRECTORY_PATH_NOT_RELATIVE_TO_CURRENT_DIRECTORY_MESSAGE } = require("../messages");
|
|
25
25
|
|
|
26
|
-
function
|
|
26
|
+
function initialiseOperation(proceed, abort, context) {
|
|
27
27
|
const { options } = context,
|
|
28
28
|
{ wait = DEFAULT_WAIT,
|
|
29
29
|
node = DEFAULT_NODE,
|
|
@@ -199,4 +199,4 @@ function initialiseCallback(proceed, abort, context) {
|
|
|
199
199
|
proceed();
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
module.exports =
|
|
202
|
+
module.exports = initialiseOperation;
|
|
@@ -6,7 +6,7 @@ const { ADD_EVENT, READY_EVENT } = require("../events"),
|
|
|
6
6
|
{ ENTRY_FILE_NOT_INCLUDED_IN_BUNDLED_FILES_MESSAGE } = require("../messages"),
|
|
7
7
|
{ pathWithoutDirectoryPathFromPathAndDirectoryPath } = require("../utilities/path");
|
|
8
8
|
|
|
9
|
-
function
|
|
9
|
+
function retrieveFilePathsOperation(proceed, abort, context) {
|
|
10
10
|
const { sourceDirectoryPath } = context,
|
|
11
11
|
globPattern = `${sourceDirectoryPath}/**/*.js`,
|
|
12
12
|
filePaths = [],
|
|
@@ -44,4 +44,4 @@ function retrieveFilePathsCallback(proceed, abort, context) {
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
module.exports =
|
|
47
|
+
module.exports = retrieveFilePathsOperation;
|
|
@@ -4,7 +4,7 @@ const TranspileFileWrapper = require("../../wrapper/transpileFile");
|
|
|
4
4
|
|
|
5
5
|
const { updateCountMetric } = require("../../utilities/metrics");
|
|
6
6
|
|
|
7
|
-
function
|
|
7
|
+
function multipleProcessesTranspileFilesOperation(done, context) {
|
|
8
8
|
const { filePaths, processesLength } = context,
|
|
9
9
|
filePathsLength = filePaths.length,
|
|
10
10
|
transpileFileWrappers = [],
|
|
@@ -54,4 +54,4 @@ function multipleProcessesTranspileFilesCallback(done, context) {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
module.exports =
|
|
57
|
+
module.exports = multipleProcessesTranspileFilesOperation;
|
|
@@ -8,15 +8,15 @@ const { updateCountMetric } = require("../../utilities/metrics");
|
|
|
8
8
|
|
|
9
9
|
const { forEach } = asynchronousUtilities;
|
|
10
10
|
|
|
11
|
-
function
|
|
11
|
+
function singleProcessTranspileFilesOperation(done, context) {
|
|
12
12
|
const { filePaths } = context;
|
|
13
13
|
|
|
14
|
-
forEach(filePaths,
|
|
14
|
+
forEach(filePaths, transpileFileOperation, done, context);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
module.exports =
|
|
17
|
+
module.exports = singleProcessTranspileFilesOperation;
|
|
18
18
|
|
|
19
|
-
function
|
|
19
|
+
function transpileFileOperation(filePath, next, done, context) {
|
|
20
20
|
transpileFile(filePath, context, (success) => {
|
|
21
21
|
if (success) {
|
|
22
22
|
updateCountMetric(context);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const singleProcessTranspileFilesCallback = require("
|
|
4
|
-
multipleProcessesTranspileFilesCallback = require("
|
|
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");
|
|
8
8
|
|
|
9
|
-
function
|
|
9
|
+
function transpileFilesOperation(proceed, abort, context) {
|
|
10
10
|
const { metrics, processesLength } = context;
|
|
11
11
|
|
|
12
12
|
if (metrics) {
|
|
@@ -33,4 +33,4 @@ function transpileFilesCallback(proceed, abort, context) {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
module.exports =
|
|
36
|
+
module.exports = transpileFilesOperation;
|
|
@@ -4,18 +4,18 @@ const { asynchronousUtilities } = require("necessary");
|
|
|
4
4
|
|
|
5
5
|
const { whilst } = asynchronousUtilities;
|
|
6
6
|
|
|
7
|
-
function
|
|
7
|
+
function executeOperations(operations, callback, context) {
|
|
8
8
|
const completed = true;
|
|
9
9
|
|
|
10
10
|
Object.assign(context, {
|
|
11
|
-
|
|
11
|
+
operations,
|
|
12
12
|
completed
|
|
13
13
|
});
|
|
14
14
|
|
|
15
|
-
whilst(
|
|
15
|
+
whilst(executeOperation, () => {
|
|
16
16
|
const { completed } = context;
|
|
17
17
|
|
|
18
|
-
delete context.
|
|
18
|
+
delete context.operations;
|
|
19
19
|
|
|
20
20
|
delete context.completed;
|
|
21
21
|
|
|
@@ -24,13 +24,13 @@ function executeCallbacks(callbacks, callback, context) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
module.exports = {
|
|
27
|
-
|
|
27
|
+
executeOperations
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
function
|
|
31
|
-
const {
|
|
32
|
-
|
|
33
|
-
lastIndex =
|
|
30
|
+
function executeOperation(next, done, context, index) {
|
|
31
|
+
const { operations } = context,
|
|
32
|
+
operationsLength = operations.length,
|
|
33
|
+
lastIndex = operationsLength - 1;
|
|
34
34
|
|
|
35
35
|
if (index > lastIndex) {
|
|
36
36
|
done();
|
|
@@ -38,9 +38,9 @@ function executeCallback(next, done, context, index) {
|
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
const
|
|
41
|
+
const operation = operations[index];
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
operation(proceed, abort, context);
|
|
44
44
|
|
|
45
45
|
function proceed() {
|
|
46
46
|
next();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "watchful-cli",
|
|
3
3
|
"author": "James Smith",
|
|
4
|
-
"version": "1.7.
|
|
4
|
+
"version": "1.7.15",
|
|
5
5
|
"license": "MIT, Anti-996",
|
|
6
6
|
"homepage": "https://github.com/djalbat/watchful-cli",
|
|
7
7
|
"description": "Incremental transpilation with bundling.",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"argumentative": "^2.0.14",
|
|
17
17
|
"chokidar": "^3.3.1",
|
|
18
|
-
"necessary": "^
|
|
18
|
+
"necessary": "^10.0.4"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {},
|
|
21
21
|
"scripts": {}
|