@joystick.js/cli-canary 0.0.0-canary.88 → 0.0.0-canary.89
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/dist/cli.js +7 -0
- package/dist/functions/index.js +21 -0
- package/dist/functions/test/index.js +7 -26
- package/dist/lib/dev/index.js +3 -0
- package/package.json +1 -1
- package/src/cli.js +9 -0
- package/src/functions/index.js +21 -0
- package/src/functions/test/index.js +7 -32
- package/src/lib/dev/index.js +6 -6
package/dist/cli.js
CHANGED
|
@@ -53,6 +53,13 @@ if (functionsCalled.includes("start")) {
|
|
|
53
53
|
functions.start.function(args, options);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
+
if (functionsCalled.includes("test")) {
|
|
57
|
+
const args = getArgs(functions.test.args);
|
|
58
|
+
const options = getOptions(functions.test.options);
|
|
59
|
+
if (functions.test.function && typeof functions.test.function === "function") {
|
|
60
|
+
functions.test.function(args, options);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
56
63
|
if (functionsCalled.includes("update")) {
|
|
57
64
|
const args = getArgs(functions.update.args);
|
|
58
65
|
const options = getOptions(functions.update.options);
|
package/dist/functions/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import logout from "./logout/index.js";
|
|
|
4
4
|
import start from "./start/index.js";
|
|
5
5
|
import update from "./update/index.js";
|
|
6
6
|
import use from "./use/index.js";
|
|
7
|
+
import test from "./test/index.js";
|
|
7
8
|
const [_node, _bin, ...rawArgs] = process.argv;
|
|
8
9
|
var functions_default = {
|
|
9
10
|
build: {
|
|
@@ -216,6 +217,26 @@ var functions_default = {
|
|
|
216
217
|
},
|
|
217
218
|
function: start
|
|
218
219
|
},
|
|
220
|
+
test: {
|
|
221
|
+
set: !!rawArgs.includes("test"),
|
|
222
|
+
description: "Start an existing Joystick app and run its tests.",
|
|
223
|
+
args: {
|
|
224
|
+
w: {
|
|
225
|
+
set: !!rawArgs.includes("w") && !!rawArgs[rawArgs.indexOf("w") + 1],
|
|
226
|
+
parent: "w",
|
|
227
|
+
value: !!rawArgs.includes("w") && rawArgs[rawArgs.indexOf("w") + 1],
|
|
228
|
+
description: "Run joystick test in watch mode."
|
|
229
|
+
},
|
|
230
|
+
watch: {
|
|
231
|
+
set: !!rawArgs.includes("watch") && !!rawArgs[rawArgs.indexOf("watch") + 1],
|
|
232
|
+
parent: "watch",
|
|
233
|
+
value: !!rawArgs.includes("watch") && rawArgs[rawArgs.indexOf("watch") + 1],
|
|
234
|
+
description: "Run joystick test in watch mode."
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
options: {},
|
|
238
|
+
function: test()
|
|
239
|
+
},
|
|
219
240
|
update: {
|
|
220
241
|
set: !!rawArgs.includes("update"),
|
|
221
242
|
description: "Update all Joystick packages to their latest version.",
|
|
@@ -1,30 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import dev from "../../lib/dev/index.js";
|
|
2
|
+
var test_default = async (args = {}, options = {}) => {
|
|
3
|
+
await dev({
|
|
4
|
+
environment: "test",
|
|
5
|
+
process,
|
|
6
|
+
port: 1977
|
|
7
|
+
});
|
|
6
8
|
};
|
|
7
|
-
const validateOptions = (options) => {
|
|
8
|
-
try {
|
|
9
|
-
if (!options)
|
|
10
|
-
throw new Error("options object is required.");
|
|
11
|
-
if (!options.someOption)
|
|
12
|
-
throw new Error("options.someOption is required.");
|
|
13
|
-
} catch (exception) {
|
|
14
|
-
throw new Error(`[test.validateOptions] ${exception.message}`);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
const test = (options, { resolve, reject }) => {
|
|
18
|
-
try {
|
|
19
|
-
validateOptions(options);
|
|
20
|
-
resolve();
|
|
21
|
-
} catch (exception) {
|
|
22
|
-
reject(`[test] ${exception.message}`);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
var test_default = (options) => new Promise((resolve, reject) => {
|
|
26
|
-
test(options, { resolve, reject });
|
|
27
|
-
});
|
|
28
9
|
export {
|
|
29
10
|
test_default as default
|
|
30
11
|
};
|
package/dist/lib/dev/index.js
CHANGED
|
@@ -437,6 +437,9 @@ const dev = async (options, { resolve, reject }) => {
|
|
|
437
437
|
nodeMajorVersion,
|
|
438
438
|
__dirname
|
|
439
439
|
);
|
|
440
|
+
if (options?.environment === "test") {
|
|
441
|
+
process.loader.text("Running tests...");
|
|
442
|
+
}
|
|
440
443
|
resolve();
|
|
441
444
|
} catch (exception) {
|
|
442
445
|
console.warn(exception);
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -69,6 +69,15 @@ if (functionsCalled.includes('start')) {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
if (functionsCalled.includes('test')) {
|
|
73
|
+
const args = getArgs(functions.test.args);
|
|
74
|
+
const options = getOptions(functions.test.options);
|
|
75
|
+
|
|
76
|
+
if (functions.test.function && typeof functions.test.function === 'function') {
|
|
77
|
+
functions.test.function(args, options);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
72
81
|
if (functionsCalled.includes('update')) {
|
|
73
82
|
const args = getArgs(functions.update.args);
|
|
74
83
|
const options = getOptions(functions.update.options);
|
package/src/functions/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import logout from './logout/index.js';
|
|
|
5
5
|
import start from './start/index.js';
|
|
6
6
|
import update from './update/index.js';
|
|
7
7
|
import use from "./use/index.js";
|
|
8
|
+
import test from "./test/index.js";
|
|
8
9
|
|
|
9
10
|
const [_node, _bin, ...rawArgs] = process.argv;
|
|
10
11
|
|
|
@@ -219,6 +220,26 @@ export default {
|
|
|
219
220
|
},
|
|
220
221
|
function: start,
|
|
221
222
|
},
|
|
223
|
+
test: {
|
|
224
|
+
set: !!rawArgs.includes('test'),
|
|
225
|
+
description: 'Start an existing Joystick app and run its tests.',
|
|
226
|
+
args: {
|
|
227
|
+
w: {
|
|
228
|
+
set: !!rawArgs.includes('w') && !!rawArgs[rawArgs.indexOf('w') + 1],
|
|
229
|
+
parent: 'w',
|
|
230
|
+
value: !!rawArgs.includes('w') && rawArgs[rawArgs.indexOf('w') + 1],
|
|
231
|
+
description: 'Run joystick test in watch mode.',
|
|
232
|
+
},
|
|
233
|
+
watch: {
|
|
234
|
+
set: !!rawArgs.includes('watch') && !!rawArgs[rawArgs.indexOf('watch') + 1],
|
|
235
|
+
parent: 'watch',
|
|
236
|
+
value: !!rawArgs.includes('watch') && rawArgs[rawArgs.indexOf('watch') + 1],
|
|
237
|
+
description: 'Run joystick test in watch mode.',
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
options: {},
|
|
241
|
+
function: test(),
|
|
242
|
+
},
|
|
222
243
|
update: {
|
|
223
244
|
set: !!rawArgs.includes('update'),
|
|
224
245
|
description: 'Update all Joystick packages to their latest version.',
|
|
@@ -1,34 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import dev from "../../lib/dev/index.js";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const validateOptions = (options) => {
|
|
12
|
-
try {
|
|
13
|
-
if (!options) throw new Error('options object is required.');
|
|
14
|
-
if (!options.someOption) throw new Error('options.someOption is required.');
|
|
15
|
-
} catch (exception) {
|
|
16
|
-
throw new Error(`[test.validateOptions] ${exception.message}`);
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const test = (options, { resolve, reject }) => {
|
|
21
|
-
try {
|
|
22
|
-
validateOptions(options);
|
|
23
|
-
// Call action methods in sequence here.
|
|
24
|
-
resolve();
|
|
25
|
-
} catch (exception) {
|
|
26
|
-
reject(`[test] ${exception.message}`);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export default (options) =>
|
|
31
|
-
new Promise((resolve, reject) => {
|
|
32
|
-
test(options, { resolve, reject });
|
|
3
|
+
export default async (args = {}, options = {}) => {
|
|
4
|
+
await dev({
|
|
5
|
+
environment: 'test',
|
|
6
|
+
process,
|
|
7
|
+
port: 1977,
|
|
33
8
|
});
|
|
34
|
-
|
|
9
|
+
};
|
package/src/lib/dev/index.js
CHANGED
|
@@ -267,7 +267,6 @@ const getWatchChangeContext = (event = '', path = '') => {
|
|
|
267
267
|
try {
|
|
268
268
|
const isHTMLUpdate = path === "index.html";
|
|
269
269
|
const isUIPath = path?.includes("ui/") || path === 'index.css' || isHTMLUpdate;
|
|
270
|
-
// TODO: Flimsy. May want to wait until HMR and server are up to do the builds/watching.
|
|
271
270
|
const isUIUpdate = (process.hmrProcess && process.hmrProcess.hasConnections && isUIPath) || false;
|
|
272
271
|
const isSettingsUpdate = path?.match(SETTINGS_FILE_NAME_REGEX)?.length > 0;
|
|
273
272
|
const isDirectory = fs.statSync(path).isDirectory();
|
|
@@ -525,10 +524,11 @@ const dev = async (options, { resolve, reject }) => {
|
|
|
525
524
|
__dirname
|
|
526
525
|
);
|
|
527
526
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
//
|
|
527
|
+
|
|
528
|
+
if (options?.environment === 'test') {
|
|
529
|
+
process.loader.text('Running tests...');
|
|
530
|
+
// await runTests(options);
|
|
531
|
+
}
|
|
532
532
|
|
|
533
533
|
/*
|
|
534
534
|
TODO:
|
|
@@ -540,7 +540,7 @@ const dev = async (options, { resolve, reject }) => {
|
|
|
540
540
|
- [x] Start databases relative to options.environment (development|test) from settings.<environment>.json.
|
|
541
541
|
- [x] Run the initial build
|
|
542
542
|
- [x] Start the file watcher
|
|
543
|
-
- [
|
|
543
|
+
- [x] Start the app as normal from the build directory.
|
|
544
544
|
- [ ] If environment === 'test', run the tests.
|
|
545
545
|
- [ ] If environment === 'test', after tests, run process.exit(0).
|
|
546
546
|
*/
|