slicejs-cli 3.1.0 → 3.2.0
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 +375 -375
- package/client.js +579 -555
- package/commands/Print.js +167 -167
- package/commands/Validations.js +103 -103
- package/commands/build/build.js +40 -40
- package/commands/buildProduction/buildProduction.js +579 -579
- package/commands/bundle/bundle.js +235 -235
- package/commands/createComponent/VisualComponentTemplate.js +55 -55
- package/commands/createComponent/createComponent.js +126 -126
- package/commands/deleteComponent/deleteComponent.js +77 -77
- package/commands/doctor/doctor.js +369 -369
- package/commands/getComponent/getComponent.js +747 -747
- package/commands/init/init.js +261 -261
- package/commands/listComponents/listComponents.js +175 -175
- package/commands/startServer/startServer.js +264 -264
- package/commands/startServer/watchServer.js +79 -79
- package/commands/types/types.js +538 -0
- package/commands/utils/LocalCliDelegation.js +53 -53
- package/commands/utils/PathHelper.js +68 -68
- package/commands/utils/VersionChecker.js +167 -167
- package/commands/utils/bundling/BundleGenerator.js +2292 -2292
- package/commands/utils/bundling/DependencyAnalyzer.js +933 -933
- package/commands/utils/updateManager.js +453 -453
- package/docs/superpowers/specs/2026-05-10-pwa-generate-design.md +182 -0
- package/package.json +46 -46
- package/post.js +25 -25
- package/refactor.md +271 -271
- package/tests/bundle-generator.test.js +708 -708
- package/tests/bundle-v2-register-output.test.js +470 -470
- package/tests/client-launcher-contract.test.js +211 -211
- package/tests/client-update-flow-contract.test.js +272 -272
- package/tests/dependency-analyzer.test.js +24 -24
- package/tests/local-cli-delegation.test.js +79 -79
- package/tests/types-generator.test.js +356 -0
- package/tests/update-manager-notifications.test.js +88 -88
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
import { test } from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
import Print from '../commands/Print.js';
|
|
4
|
-
import { UpdateManager } from '../commands/utils/updateManager.js';
|
|
5
|
-
|
|
6
|
-
test('notifyAvailableUpdates shows advisory output and never invokes interactive update flow', async () => {
|
|
7
|
-
const manager = new UpdateManager();
|
|
8
|
-
const calls = {
|
|
9
|
-
display: 0,
|
|
10
|
-
prompted: 0,
|
|
11
|
-
info: [],
|
|
12
|
-
error: []
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
manager.checkForUpdates = async () => ({
|
|
16
|
-
hasUpdates: true,
|
|
17
|
-
updates: [
|
|
18
|
-
{
|
|
19
|
-
name: 'slicejs-web-framework',
|
|
20
|
-
displayName: 'Slice.js Framework',
|
|
21
|
-
current: '2.4.3',
|
|
22
|
-
latest: '2.5.0',
|
|
23
|
-
type: 'framework'
|
|
24
|
-
}
|
|
25
|
-
],
|
|
26
|
-
allCurrent: false
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
manager.displayUpdates = () => {
|
|
30
|
-
calls.display += 1;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
manager.checkAndPromptUpdates = async () => {
|
|
34
|
-
calls.prompted += 1;
|
|
35
|
-
return true;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const originalInfo = Print.info;
|
|
39
|
-
const originalError = Print.error;
|
|
40
|
-
|
|
41
|
-
Print.info = (message) => calls.info.push(message);
|
|
42
|
-
Print.error = (message) => calls.error.push(message);
|
|
43
|
-
|
|
44
|
-
try {
|
|
45
|
-
const result = await manager.notifyAvailableUpdates();
|
|
46
|
-
|
|
47
|
-
assert.equal(result, true);
|
|
48
|
-
assert.equal(calls.display, 1);
|
|
49
|
-
assert.equal(calls.prompted, 0);
|
|
50
|
-
assert.equal(calls.error.length, 0);
|
|
51
|
-
assert.equal(calls.info.length, 1);
|
|
52
|
-
assert.match(calls.info[0], /slice update/);
|
|
53
|
-
} finally {
|
|
54
|
-
Print.info = originalInfo;
|
|
55
|
-
Print.error = originalError;
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
test('notifyAvailableUpdates returns false and prints nothing when no updates are available', async () => {
|
|
60
|
-
const manager = new UpdateManager();
|
|
61
|
-
const calls = {
|
|
62
|
-
display: 0,
|
|
63
|
-
info: []
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
manager.checkForUpdates = async () => ({
|
|
67
|
-
hasUpdates: false,
|
|
68
|
-
updates: [],
|
|
69
|
-
allCurrent: true
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
manager.displayUpdates = () => {
|
|
73
|
-
calls.display += 1;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const originalInfo = Print.info;
|
|
77
|
-
Print.info = (message) => calls.info.push(message);
|
|
78
|
-
|
|
79
|
-
try {
|
|
80
|
-
const result = await manager.notifyAvailableUpdates();
|
|
81
|
-
|
|
82
|
-
assert.equal(result, false);
|
|
83
|
-
assert.equal(calls.display, 0);
|
|
84
|
-
assert.equal(calls.info.length, 0);
|
|
85
|
-
} finally {
|
|
86
|
-
Print.info = originalInfo;
|
|
87
|
-
}
|
|
88
|
-
});
|
|
1
|
+
import { test } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import Print from '../commands/Print.js';
|
|
4
|
+
import { UpdateManager } from '../commands/utils/updateManager.js';
|
|
5
|
+
|
|
6
|
+
test('notifyAvailableUpdates shows advisory output and never invokes interactive update flow', async () => {
|
|
7
|
+
const manager = new UpdateManager();
|
|
8
|
+
const calls = {
|
|
9
|
+
display: 0,
|
|
10
|
+
prompted: 0,
|
|
11
|
+
info: [],
|
|
12
|
+
error: []
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
manager.checkForUpdates = async () => ({
|
|
16
|
+
hasUpdates: true,
|
|
17
|
+
updates: [
|
|
18
|
+
{
|
|
19
|
+
name: 'slicejs-web-framework',
|
|
20
|
+
displayName: 'Slice.js Framework',
|
|
21
|
+
current: '2.4.3',
|
|
22
|
+
latest: '2.5.0',
|
|
23
|
+
type: 'framework'
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
allCurrent: false
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
manager.displayUpdates = () => {
|
|
30
|
+
calls.display += 1;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
manager.checkAndPromptUpdates = async () => {
|
|
34
|
+
calls.prompted += 1;
|
|
35
|
+
return true;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const originalInfo = Print.info;
|
|
39
|
+
const originalError = Print.error;
|
|
40
|
+
|
|
41
|
+
Print.info = (message) => calls.info.push(message);
|
|
42
|
+
Print.error = (message) => calls.error.push(message);
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
const result = await manager.notifyAvailableUpdates();
|
|
46
|
+
|
|
47
|
+
assert.equal(result, true);
|
|
48
|
+
assert.equal(calls.display, 1);
|
|
49
|
+
assert.equal(calls.prompted, 0);
|
|
50
|
+
assert.equal(calls.error.length, 0);
|
|
51
|
+
assert.equal(calls.info.length, 1);
|
|
52
|
+
assert.match(calls.info[0], /slice update/);
|
|
53
|
+
} finally {
|
|
54
|
+
Print.info = originalInfo;
|
|
55
|
+
Print.error = originalError;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test('notifyAvailableUpdates returns false and prints nothing when no updates are available', async () => {
|
|
60
|
+
const manager = new UpdateManager();
|
|
61
|
+
const calls = {
|
|
62
|
+
display: 0,
|
|
63
|
+
info: []
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
manager.checkForUpdates = async () => ({
|
|
67
|
+
hasUpdates: false,
|
|
68
|
+
updates: [],
|
|
69
|
+
allCurrent: true
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
manager.displayUpdates = () => {
|
|
73
|
+
calls.display += 1;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const originalInfo = Print.info;
|
|
77
|
+
Print.info = (message) => calls.info.push(message);
|
|
78
|
+
|
|
79
|
+
try {
|
|
80
|
+
const result = await manager.notifyAvailableUpdates();
|
|
81
|
+
|
|
82
|
+
assert.equal(result, false);
|
|
83
|
+
assert.equal(calls.display, 0);
|
|
84
|
+
assert.equal(calls.info.length, 0);
|
|
85
|
+
} finally {
|
|
86
|
+
Print.info = originalInfo;
|
|
87
|
+
}
|
|
88
|
+
});
|