slicejs-cli 3.3.0 ā 3.4.1
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/AGENTS.md +247 -0
- package/LICENSE +21 -21
- package/client.js +663 -626
- package/commands/Print.js +163 -167
- package/commands/Validations.js +92 -103
- package/commands/build/build.js +40 -40
- package/commands/buildProduction/buildProduction.js +576 -579
- package/commands/bundle/bundle.js +234 -235
- package/commands/createComponent/VisualComponentTemplate.js +55 -55
- package/commands/createComponent/createComponent.js +124 -126
- package/commands/deleteComponent/deleteComponent.js +77 -77
- package/commands/doctor/doctor.js +366 -369
- package/commands/getComponent/getComponent.js +684 -747
- package/commands/init/init.js +269 -261
- package/commands/listComponents/listComponents.js +172 -175
- package/commands/startServer/startServer.js +261 -264
- package/commands/startServer/watchServer.js +79 -79
- package/commands/types/types.js +69 -27
- package/commands/utils/LocalCliDelegation.js +53 -53
- package/commands/utils/PathHelper.js +75 -68
- package/commands/utils/VersionChecker.js +167 -167
- package/commands/utils/bundling/BundleGenerator.js +2292 -2292
- package/commands/utils/bundling/DependencyAnalyzer.js +925 -933
- package/commands/utils/loadConfig.js +31 -0
- package/commands/utils/updateManager.js +452 -453
- package/docs/superpowers/specs/2026-05-10-pwa-generate-design.md +105 -105
- package/package.json +58 -46
- package/post.js +66 -65
- package/tests/bundle-generator.test.js +691 -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/component-registry-parse.test.js +34 -0
- package/tests/dependency-analyzer.test.js +24 -24
- package/tests/fixtures/components.js +8 -0
- package/tests/fixtures/sliceConfig.json +74 -0
- package/tests/getcomponent.test.js +407 -0
- package/tests/helpers/setup.js +97 -0
- package/tests/init-command-contract.test.js +46 -0
- package/tests/local-cli-delegation.test.js +81 -79
- package/tests/path-helper.test.js +206 -0
- package/tests/types-breakage.test.js +491 -0
- package/tests/types-generator-errors.test.js +361 -0
- package/tests/types-generator.test.js +172 -184
- package/tests/update-manager-notifications.test.js +88 -88
- package/.github/workflows/docs-render-cicd.yml +0 -65
|
@@ -1,167 +1,167 @@
|
|
|
1
|
-
// commands/utils/VersionChecker.js
|
|
2
|
-
|
|
3
|
-
import fs from "fs-extra";
|
|
4
|
-
import path from "path";
|
|
5
|
-
import { fileURLToPath } from "url";
|
|
6
|
-
import Print from "../Print.js";
|
|
7
|
-
import { getProjectRoot } from "../utils/PathHelper.js";
|
|
8
|
-
|
|
9
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
|
-
|
|
11
|
-
class VersionChecker {
|
|
12
|
-
constructor() {
|
|
13
|
-
this.currentCliVersion = null;
|
|
14
|
-
this.currentFrameworkVersion = null;
|
|
15
|
-
this.latestCliVersion = null;
|
|
16
|
-
this.latestFrameworkVersion = null;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async getCurrentVersions() {
|
|
20
|
-
try {
|
|
21
|
-
// Get CLI version
|
|
22
|
-
const cliPackagePath = path.join(__dirname, '../../package.json');
|
|
23
|
-
const cliPackage = await fs.readJson(cliPackagePath);
|
|
24
|
-
this.currentCliVersion = cliPackage.version;
|
|
25
|
-
|
|
26
|
-
// Get Framework version from project node_modules
|
|
27
|
-
const projectRoot = getProjectRoot(import.meta.url);
|
|
28
|
-
const frameworkPackagePath =
|
|
29
|
-
if (await fs.pathExists(frameworkPackagePath)) {
|
|
30
|
-
const frameworkPackage = await fs.readJson(frameworkPackagePath);
|
|
31
|
-
this.currentFrameworkVersion = frameworkPackage.version;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Get Project's CLI version
|
|
35
|
-
const projectPackagePath =
|
|
36
|
-
if (await fs.pathExists(projectPackagePath)) {
|
|
37
|
-
const projectPackage = await fs.readJson(projectPackagePath);
|
|
38
|
-
if (projectPackage.dependencies && projectPackage.dependencies['slicejs-cli']) {
|
|
39
|
-
// This could be different from the currently running CLI version
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return {
|
|
44
|
-
cli: this.currentCliVersion,
|
|
45
|
-
framework: this.currentFrameworkVersion
|
|
46
|
-
};
|
|
47
|
-
} catch (error) {
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
async getLatestVersions() {
|
|
53
|
-
try {
|
|
54
|
-
// Check CLI version
|
|
55
|
-
const cliResponse = await fetch('https://registry.npmjs.org/slicejs-cli/latest', {
|
|
56
|
-
headers: { 'Accept': 'application/json' }
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
if (cliResponse.ok) {
|
|
60
|
-
const cliData = await cliResponse.json();
|
|
61
|
-
this.latestCliVersion = cliData.version;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Check Framework version
|
|
65
|
-
const frameworkResponse = await fetch('https://registry.npmjs.org/slicejs-web-framework/latest', {
|
|
66
|
-
headers: { 'Accept': 'application/json' }
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
if (frameworkResponse.ok) {
|
|
70
|
-
const frameworkData = await frameworkResponse.json();
|
|
71
|
-
this.latestFrameworkVersion = frameworkData.version;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return {
|
|
75
|
-
cli: this.latestCliVersion,
|
|
76
|
-
framework: this.latestFrameworkVersion
|
|
77
|
-
};
|
|
78
|
-
} catch (error) {
|
|
79
|
-
// Silent fail - don't interrupt commands for version check failures
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
compareVersions(current, latest) {
|
|
85
|
-
if (!current || !latest) return null;
|
|
86
|
-
|
|
87
|
-
const currentParts = current.split('.').map(Number);
|
|
88
|
-
const latestParts = latest.split('.').map(Number);
|
|
89
|
-
|
|
90
|
-
for (let i = 0; i < Math.max(currentParts.length, latestParts.length); i++) {
|
|
91
|
-
const currentPart = currentParts[i] || 0;
|
|
92
|
-
const latestPart = latestParts[i] || 0;
|
|
93
|
-
|
|
94
|
-
if (latestPart > currentPart) return 'outdated';
|
|
95
|
-
if (currentPart > latestPart) return 'newer';
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return 'current';
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
async checkForUpdates(silent = false) {
|
|
102
|
-
try {
|
|
103
|
-
const current = await this.getCurrentVersions();
|
|
104
|
-
if (!current) return;
|
|
105
|
-
|
|
106
|
-
const latest = await this.getLatestVersions();
|
|
107
|
-
if (!latest) return;
|
|
108
|
-
|
|
109
|
-
const cliStatus = this.compareVersions(current.cli, latest.cli);
|
|
110
|
-
const frameworkStatus = this.compareVersions(current.framework, latest.framework);
|
|
111
|
-
|
|
112
|
-
if (!silent && (cliStatus === 'outdated' || frameworkStatus === 'outdated')) {
|
|
113
|
-
console.log(''); // Line break
|
|
114
|
-
Print.warning('š¦ Available Updates:');
|
|
115
|
-
|
|
116
|
-
if (cliStatus === 'outdated') {
|
|
117
|
-
console.log(` š§ CLI: ${current.cli} ā ${latest.cli}`);
|
|
118
|
-
console.log(` npm update slicejs-cli`);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (frameworkStatus === 'outdated') {
|
|
122
|
-
console.log(` ā” Framework: ${current.framework} ā ${latest.framework}`);
|
|
123
|
-
console.log(` npm update slicejs-web-framework`);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
console.log(' š Changelog: https://github.com/VKneider/slice.js/releases');
|
|
127
|
-
console.log(''); // Line break
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return {
|
|
131
|
-
cli: { current: current.cli, latest: latest.cli, status: cliStatus },
|
|
132
|
-
framework: { current: current.framework, latest: latest.framework, status: frameworkStatus }
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
} catch (error) {
|
|
136
|
-
// Silent fail - don't interrupt commands
|
|
137
|
-
return null;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
async showVersionInfo() {
|
|
142
|
-
const current = await this.getCurrentVersions();
|
|
143
|
-
const latest = await this.getLatestVersions();
|
|
144
|
-
|
|
145
|
-
console.log('\nš Version Information:');
|
|
146
|
-
console.log('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā');
|
|
147
|
-
|
|
148
|
-
if (current?.cli) {
|
|
149
|
-
const cliStatus = this.compareVersions(current.cli, latest?.cli);
|
|
150
|
-
const statusIcon = cliStatus === 'current' ? 'ā
' : cliStatus === 'outdated' ? 'š' : 'š';
|
|
151
|
-
console.log(`${statusIcon} CLI: v${current.cli}${latest?.cli && latest.cli !== current.cli ? ` (latest: v${latest.cli})` : ''}`);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
if (current?.framework) {
|
|
155
|
-
const frameworkStatus = this.compareVersions(current.framework, latest?.framework);
|
|
156
|
-
const statusIcon = frameworkStatus === 'current' ? 'ā
' : frameworkStatus === 'outdated' ? 'š' : 'š';
|
|
157
|
-
console.log(`${statusIcon} Framework: v${current.framework}${latest?.framework && latest.framework !== current.framework ? ` (latest: v${latest.framework})` : ''}`);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
console.log('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā\n');
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// Singleton instance
|
|
165
|
-
const versionChecker = new VersionChecker();
|
|
166
|
-
|
|
167
|
-
export default versionChecker;
|
|
1
|
+
// commands/utils/VersionChecker.js
|
|
2
|
+
|
|
3
|
+
import fs from "fs-extra";
|
|
4
|
+
import path from "path";
|
|
5
|
+
import { fileURLToPath } from "url";
|
|
6
|
+
import Print from "../Print.js";
|
|
7
|
+
import { getProjectRoot, getPath } from "../utils/PathHelper.js";
|
|
8
|
+
|
|
9
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
|
|
11
|
+
class VersionChecker {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.currentCliVersion = null;
|
|
14
|
+
this.currentFrameworkVersion = null;
|
|
15
|
+
this.latestCliVersion = null;
|
|
16
|
+
this.latestFrameworkVersion = null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async getCurrentVersions() {
|
|
20
|
+
try {
|
|
21
|
+
// Get CLI version
|
|
22
|
+
const cliPackagePath = path.join(__dirname, '../../package.json');
|
|
23
|
+
const cliPackage = await fs.readJson(cliPackagePath);
|
|
24
|
+
this.currentCliVersion = cliPackage.version;
|
|
25
|
+
|
|
26
|
+
// Get Framework version from project node_modules
|
|
27
|
+
const projectRoot = getProjectRoot(import.meta.url);
|
|
28
|
+
const frameworkPackagePath = getPath(import.meta.url, 'node_modules', 'slicejs-web-framework', 'package.json');
|
|
29
|
+
if (await fs.pathExists(frameworkPackagePath)) {
|
|
30
|
+
const frameworkPackage = await fs.readJson(frameworkPackagePath);
|
|
31
|
+
this.currentFrameworkVersion = frameworkPackage.version;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Get Project's CLI version
|
|
35
|
+
const projectPackagePath = getPath(import.meta.url, 'package.json');
|
|
36
|
+
if (await fs.pathExists(projectPackagePath)) {
|
|
37
|
+
const projectPackage = await fs.readJson(projectPackagePath);
|
|
38
|
+
if (projectPackage.dependencies && projectPackage.dependencies['slicejs-cli']) {
|
|
39
|
+
// This could be different from the currently running CLI version
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
cli: this.currentCliVersion,
|
|
45
|
+
framework: this.currentFrameworkVersion
|
|
46
|
+
};
|
|
47
|
+
} catch (error) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async getLatestVersions() {
|
|
53
|
+
try {
|
|
54
|
+
// Check CLI version
|
|
55
|
+
const cliResponse = await fetch('https://registry.npmjs.org/slicejs-cli/latest', {
|
|
56
|
+
headers: { 'Accept': 'application/json' }
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
if (cliResponse.ok) {
|
|
60
|
+
const cliData = await cliResponse.json();
|
|
61
|
+
this.latestCliVersion = cliData.version;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Check Framework version
|
|
65
|
+
const frameworkResponse = await fetch('https://registry.npmjs.org/slicejs-web-framework/latest', {
|
|
66
|
+
headers: { 'Accept': 'application/json' }
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
if (frameworkResponse.ok) {
|
|
70
|
+
const frameworkData = await frameworkResponse.json();
|
|
71
|
+
this.latestFrameworkVersion = frameworkData.version;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
cli: this.latestCliVersion,
|
|
76
|
+
framework: this.latestFrameworkVersion
|
|
77
|
+
};
|
|
78
|
+
} catch (error) {
|
|
79
|
+
// Silent fail - don't interrupt commands for version check failures
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
compareVersions(current, latest) {
|
|
85
|
+
if (!current || !latest) return null;
|
|
86
|
+
|
|
87
|
+
const currentParts = current.split('.').map(Number);
|
|
88
|
+
const latestParts = latest.split('.').map(Number);
|
|
89
|
+
|
|
90
|
+
for (let i = 0; i < Math.max(currentParts.length, latestParts.length); i++) {
|
|
91
|
+
const currentPart = currentParts[i] || 0;
|
|
92
|
+
const latestPart = latestParts[i] || 0;
|
|
93
|
+
|
|
94
|
+
if (latestPart > currentPart) return 'outdated';
|
|
95
|
+
if (currentPart > latestPart) return 'newer';
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return 'current';
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async checkForUpdates(silent = false) {
|
|
102
|
+
try {
|
|
103
|
+
const current = await this.getCurrentVersions();
|
|
104
|
+
if (!current) return;
|
|
105
|
+
|
|
106
|
+
const latest = await this.getLatestVersions();
|
|
107
|
+
if (!latest) return;
|
|
108
|
+
|
|
109
|
+
const cliStatus = this.compareVersions(current.cli, latest.cli);
|
|
110
|
+
const frameworkStatus = this.compareVersions(current.framework, latest.framework);
|
|
111
|
+
|
|
112
|
+
if (!silent && (cliStatus === 'outdated' || frameworkStatus === 'outdated')) {
|
|
113
|
+
console.log(''); // Line break
|
|
114
|
+
Print.warning('š¦ Available Updates:');
|
|
115
|
+
|
|
116
|
+
if (cliStatus === 'outdated') {
|
|
117
|
+
console.log(` š§ CLI: ${current.cli} ā ${latest.cli}`);
|
|
118
|
+
console.log(` npm update slicejs-cli`);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (frameworkStatus === 'outdated') {
|
|
122
|
+
console.log(` ā” Framework: ${current.framework} ā ${latest.framework}`);
|
|
123
|
+
console.log(` npm update slicejs-web-framework`);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
console.log(' š Changelog: https://github.com/VKneider/slice.js/releases');
|
|
127
|
+
console.log(''); // Line break
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return {
|
|
131
|
+
cli: { current: current.cli, latest: latest.cli, status: cliStatus },
|
|
132
|
+
framework: { current: current.framework, latest: latest.framework, status: frameworkStatus }
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
} catch (error) {
|
|
136
|
+
// Silent fail - don't interrupt commands
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async showVersionInfo() {
|
|
142
|
+
const current = await this.getCurrentVersions();
|
|
143
|
+
const latest = await this.getLatestVersions();
|
|
144
|
+
|
|
145
|
+
console.log('\nš Version Information:');
|
|
146
|
+
console.log('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā');
|
|
147
|
+
|
|
148
|
+
if (current?.cli) {
|
|
149
|
+
const cliStatus = this.compareVersions(current.cli, latest?.cli);
|
|
150
|
+
const statusIcon = cliStatus === 'current' ? 'ā
' : cliStatus === 'outdated' ? 'š' : 'š';
|
|
151
|
+
console.log(`${statusIcon} CLI: v${current.cli}${latest?.cli && latest.cli !== current.cli ? ` (latest: v${latest.cli})` : ''}`);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (current?.framework) {
|
|
155
|
+
const frameworkStatus = this.compareVersions(current.framework, latest?.framework);
|
|
156
|
+
const statusIcon = frameworkStatus === 'current' ? 'ā
' : frameworkStatus === 'outdated' ? 'š' : 'š';
|
|
157
|
+
console.log(`${statusIcon} Framework: v${current.framework}${latest?.framework && latest.framework !== current.framework ? ` (latest: v${latest.framework})` : ''}`);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
console.log('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā\n');
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Singleton instance
|
|
165
|
+
const versionChecker = new VersionChecker();
|
|
166
|
+
|
|
167
|
+
export default versionChecker;
|