slicejs-cli 3.2.0 → 3.4.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.
Files changed (40) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
  2. package/.github/ISSUE_TEMPLATE/feature_request.md +25 -0
  3. package/.github/pull_request_template.md +22 -0
  4. package/CODE_OF_CONDUCT.md +126 -0
  5. package/ECOSYSTEM.md +9 -0
  6. package/LICENSE +21 -0
  7. package/README.md +171 -375
  8. package/client.js +664 -563
  9. package/commands/Print.js +167 -167
  10. package/commands/Validations.js +103 -103
  11. package/commands/build/build.js +40 -40
  12. package/commands/buildProduction/buildProduction.js +579 -579
  13. package/commands/bundle/bundle.js +235 -235
  14. package/commands/createComponent/VisualComponentTemplate.js +55 -55
  15. package/commands/createComponent/createComponent.js +126 -126
  16. package/commands/deleteComponent/deleteComponent.js +77 -77
  17. package/commands/doctor/doctor.js +369 -369
  18. package/commands/getComponent/getComponent.js +747 -747
  19. package/commands/init/init.js +265 -261
  20. package/commands/listComponents/listComponents.js +175 -175
  21. package/commands/startServer/startServer.js +264 -264
  22. package/commands/startServer/watchServer.js +79 -79
  23. package/commands/types/types.js +16 -9
  24. package/commands/utils/LocalCliDelegation.js +53 -53
  25. package/commands/utils/PathHelper.js +68 -68
  26. package/commands/utils/VersionChecker.js +167 -167
  27. package/commands/utils/bundling/BundleGenerator.js +2292 -2292
  28. package/commands/utils/bundling/DependencyAnalyzer.js +933 -933
  29. package/commands/utils/updateManager.js +453 -453
  30. package/package.json +46 -46
  31. package/post.js +66 -25
  32. package/tests/bundle-generator.test.js +708 -708
  33. package/tests/bundle-v2-register-output.test.js +470 -470
  34. package/tests/client-launcher-contract.test.js +211 -211
  35. package/tests/client-update-flow-contract.test.js +272 -272
  36. package/tests/dependency-analyzer.test.js +24 -24
  37. package/tests/local-cli-delegation.test.js +79 -79
  38. package/tests/postinstall-command.test.js +72 -0
  39. package/tests/update-manager-notifications.test.js +88 -88
  40. package/refactor.md +0 -271
package/package.json CHANGED
@@ -1,46 +1,46 @@
1
- {
2
- "name": "slicejs-cli",
3
- "version": "3.2.0",
4
- "description": "Command client for developing web applications with Slice.js framework",
5
- "main": "client.js",
6
- "bin": {
7
- "slice": "./client.js"
8
- },
9
- "repository": {
10
- "type": "git",
11
- "url": "https://github.com/vkneider/slicejs-cli.git"
12
- },
13
- "scripts": {
14
- "test": "node --test",
15
- "postinstall": "node post.js"
16
- },
17
- "keywords": [
18
- "framework",
19
- "web",
20
- "client",
21
- "cli",
22
- "slice",
23
- "slicejs",
24
- "component",
25
- "development server"
26
- ],
27
- "author": "vkneider",
28
- "type": "module",
29
- "preferGlobal": false,
30
- "license": "ISC",
31
- "dependencies": {
32
- "@babel/parser": "^7.28.5",
33
- "@babel/traverse": "^7.28.5",
34
- "chalk": "^5.6.2",
35
- "chokidar": "^3.6.0",
36
- "clean-css": "^5.3.3",
37
- "cli-table3": "^0.6.5",
38
- "commander": "^12.0.0",
39
- "fs-extra": "^11.2.0",
40
- "html-minifier-terser": "^7.2.0",
41
- "inquirer": "^12.4.2",
42
- "ora": "^8.2.0",
43
- "slicejs-web-framework": "latest",
44
- "terser": "^5.43.1"
45
- }
46
- }
1
+ {
2
+ "name": "slicejs-cli",
3
+ "version": "3.4.0",
4
+ "description": "Command client for developing web applications with Slice.js framework",
5
+ "main": "client.js",
6
+ "bin": {
7
+ "slice": "./client.js"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/vkneider/slicejs-cli.git"
12
+ },
13
+ "scripts": {
14
+ "test": "node --test",
15
+ "postinstall": "node post.js"
16
+ },
17
+ "keywords": [
18
+ "framework",
19
+ "web",
20
+ "client",
21
+ "cli",
22
+ "slice",
23
+ "slicejs",
24
+ "component",
25
+ "development server"
26
+ ],
27
+ "author": "vkneider",
28
+ "type": "module",
29
+ "preferGlobal": false,
30
+ "license": "ISC",
31
+ "dependencies": {
32
+ "@babel/parser": "^7.28.5",
33
+ "@babel/traverse": "^7.28.5",
34
+ "chalk": "^5.6.2",
35
+ "chokidar": "^3.6.0",
36
+ "clean-css": "^5.3.3",
37
+ "cli-table3": "^0.6.5",
38
+ "commander": "^12.0.0",
39
+ "fs-extra": "^11.2.0",
40
+ "html-minifier-terser": "^7.2.0",
41
+ "inquirer": "^12.4.2",
42
+ "ora": "^8.2.0",
43
+ "slicejs-web-framework": "latest",
44
+ "terser": "^5.43.1"
45
+ }
46
+ }
package/post.js CHANGED
@@ -1,25 +1,66 @@
1
- import fs from 'fs';
2
- import { fileURLToPath } from 'url';
3
- import path from 'path';
4
- import Print from './commands/Print.js';
5
-
6
- const __filename = fileURLToPath(import.meta.url);
7
- const __dirname = path.dirname(__filename);
8
-
9
- const isGlobal = process.env.npm_config_global === 'true';
10
- const initCwd = process.env.INIT_CWD ? path.resolve(process.env.INIT_CWD) : null;
11
- const targetRoot = initCwd || path.resolve(__dirname, '../../');
12
- const projectPackageJsonPath = path.join(targetRoot, 'package.json');
13
-
14
- if (isGlobal) {
15
- console.log('⚠️ Global installation of slicejs-cli detected.');
16
- console.log(' We strongly recommend using a local installation to avoid version mismatches.');
17
- console.log(' Uninstall global: npm uninstall -g slicejs-cli');
18
- process.exit(0);
19
- }
20
-
21
- console.log('✅ slicejs-cli installed successfully.');
22
- console.log(' Add the CLI to your package.json scripts:');
23
- console.log(' "dev": "slice dev"');
24
- console.log(' Then run: npm run dev');
25
- process.exit(0);
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { fileURLToPath } from 'url';
4
+ import { getProjectRoot } from './commands/utils/PathHelper.js';
5
+
6
+ const __filename = fileURLToPath(import.meta.url);
7
+
8
+ const isGlobal = process.env.npm_config_global === 'true';
9
+
10
+ if (isGlobal) {
11
+ console.log('⚠️ Global installation of slicejs-cli detected.');
12
+ console.log(' We strongly recommend using a local installation to avoid version mismatches.');
13
+ console.log(' Uninstall global: npm uninstall -g slicejs-cli');
14
+ process.exit(0);
15
+ }
16
+
17
+ const projectRoot = getProjectRoot(import.meta.url);
18
+ const pkgPath = path.join(projectRoot, 'package.json');
19
+
20
+ const sliceScripts = {
21
+ 'slice:dev': 'slice dev',
22
+ 'slice:start': 'slice start',
23
+ 'slice:create': 'slice component create',
24
+ 'slice:list': 'slice component list',
25
+ 'slice:delete': 'slice component delete',
26
+ 'slice:init': 'slice init',
27
+ 'slice:get': 'slice get',
28
+ 'slice:browse': 'slice browse',
29
+ 'slice:sync': 'slice sync',
30
+ 'slice:version': 'slice version',
31
+ 'slice:update': 'slice update',
32
+ 'slice:types': 'slice types generate',
33
+ };
34
+
35
+ try {
36
+ let pkg = {};
37
+ if (fs.existsSync(pkgPath)) {
38
+ pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
39
+ } else {
40
+ pkg = {
41
+ name: path.basename(projectRoot),
42
+ version: '1.0.0',
43
+ description: 'Slice.js project',
44
+ scripts: {}
45
+ };
46
+ }
47
+
48
+ pkg.scripts = pkg.scripts || {};
49
+ let addedCount = 0;
50
+ for (const [script, command] of Object.entries(sliceScripts)) {
51
+ if (!pkg.scripts[script]) {
52
+ pkg.scripts[script] = command;
53
+ addedCount++;
54
+ }
55
+ }
56
+
57
+ fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2), 'utf-8');
58
+ console.log(`✅ slicejs-cli installed successfully. Added ${addedCount} npm scripts to package.json.`);
59
+ console.log(' Run: npm run slice:dev');
60
+ } catch (err) {
61
+ console.log('✅ slicejs-cli installed successfully.');
62
+ console.log(' Could not auto-configure scripts:', err.message);
63
+ console.log(' Run: npx slice dev');
64
+ }
65
+
66
+ process.exit(0);