opticore-cli 1.0.0 → 1.0.2

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/bin.cjs ADDED
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
+ // If the importer is in node compatibility mode or this is not an ESM
19
+ // file that has been converted to a CommonJS file using a Babel-
20
+ // compatible transform (i.e. "__esModule" has not been set), then set
21
+ // "default" to the CommonJS "module.exports" for node compatibility.
22
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
+ mod
24
+ ));
25
+
26
+ // src/index.ts
27
+ var import_commander = require("commander");
28
+ var import_chalk = __toESM(require("chalk"), 1);
29
+ var import_cfonts = __toESM(require("cfonts"), 1);
30
+ var import_cli = require("opticore-validator/cli");
31
+ var import_cli2 = require("opticore-orm-orchestrator/cli");
32
+ var import_cli3 = require("opticore-feature-component/cli");
33
+ function printBanner() {
34
+ import_cfonts.default.say("OpticoreJs", {
35
+ font: "block",
36
+ align: "left",
37
+ colors: ["yellow", "#FF6B35"],
38
+ background: "transparent",
39
+ letterSpacing: 1,
40
+ lineHeight: 1,
41
+ space: true,
42
+ maxLength: "0"
43
+ });
44
+ const orange = import_chalk.default.bold.hex("#FF6B35");
45
+ const dim = import_chalk.default.bold.yellow;
46
+ console.log(` ${orange("O P T I C O R E")}`);
47
+ console.log(` ${dim("Project CLI \u2014 validator, ORM, features")}
48
+ `);
49
+ }
50
+ function runOpticoreCli() {
51
+ (0, import_cli.forceOpticoreColors)();
52
+ printBanner();
53
+ const program = new import_commander.Command();
54
+ program.name("opticore").description(import_chalk.default.dim("Opticore CLI")).configureHelp(import_cli.helpConfig);
55
+ (0, import_cli.registerValidatorCommand)(program);
56
+ (0, import_cli2.registerOrmCommand)(program);
57
+ (0, import_cli3.registerFeatureCommand)(program);
58
+ if (!process.argv.slice(2).length) {
59
+ program.outputHelp();
60
+ process.exit(0);
61
+ }
62
+ program.parse(process.argv);
63
+ }
64
+
65
+ // src/bin.ts
66
+ runOpticoreCli();
package/dist/bin.d.cts ADDED
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
package/dist/bin.d.ts ADDED
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
package/dist/bin.js ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ runOpticoreCli
4
+ } from "./chunk-6DKVP6WN.js";
5
+
6
+ // src/bin.ts
7
+ runOpticoreCli();
@@ -0,0 +1,42 @@
1
+ // src/index.ts
2
+ import { Command } from "commander";
3
+ import chalk from "chalk";
4
+ import cfonts from "cfonts";
5
+ import { registerValidatorCommand, forceOpticoreColors, helpConfig } from "opticore-validator/cli";
6
+ import { registerOrmCommand } from "opticore-orm-orchestrator/cli";
7
+ import { registerFeatureCommand } from "opticore-feature-component/cli";
8
+ function printBanner() {
9
+ cfonts.say("OpticoreJs", {
10
+ font: "block",
11
+ align: "left",
12
+ colors: ["yellow", "#FF6B35"],
13
+ background: "transparent",
14
+ letterSpacing: 1,
15
+ lineHeight: 1,
16
+ space: true,
17
+ maxLength: "0"
18
+ });
19
+ const orange = chalk.bold.hex("#FF6B35");
20
+ const dim = chalk.bold.yellow;
21
+ console.log(` ${orange("O P T I C O R E")}`);
22
+ console.log(` ${dim("Project CLI \u2014 validator, ORM, features")}
23
+ `);
24
+ }
25
+ function runOpticoreCli() {
26
+ forceOpticoreColors();
27
+ printBanner();
28
+ const program = new Command();
29
+ program.name("opticore").description(chalk.dim("Opticore CLI")).configureHelp(helpConfig);
30
+ registerValidatorCommand(program);
31
+ registerOrmCommand(program);
32
+ registerFeatureCommand(program);
33
+ if (!process.argv.slice(2).length) {
34
+ program.outputHelp();
35
+ process.exit(0);
36
+ }
37
+ program.parse(process.argv);
38
+ }
39
+
40
+ export {
41
+ runOpticoreCli
42
+ };
package/dist/index.cjs CHANGED
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env node
2
1
  "use strict";
3
2
  var __create = Object.create;
4
3
  var __defProp = Object.defineProperty;
@@ -6,6 +5,10 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
6
  var __getProtoOf = Object.getPrototypeOf;
8
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
9
12
  var __copyProps = (to, from, except, desc) => {
10
13
  if (from && typeof from === "object" || typeof from === "function") {
11
14
  for (let key of __getOwnPropNames(from))
@@ -22,87 +25,52 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
25
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
26
  mod
24
27
  ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
29
 
26
30
  // src/index.ts
27
- var import_child_process2 = require("child_process");
28
-
29
- // src/commands/generate.command.ts
30
- var path = __toESM(require("path"), 1);
31
- var fs = __toESM(require("fs"), 1);
32
- var import_child_process = require("child_process");
33
- var generate = (type, name) => {
34
- const basePath = process.cwd();
35
- let targetDir = "";
36
- let content = "";
37
- switch (type) {
38
- case "service":
39
- break;
40
- case "component":
41
- if (!name) {
42
- console.error("\u274C Please specify the component name");
43
- process.exit(1);
44
- }
45
- console.log(`Component generation ${name}...`);
46
- const result = (0, import_child_process.spawnSync)("npx", ["create-clean-component", name], {
47
- stdio: "inherit",
48
- shell: true
49
- });
50
- if (result.error) {
51
- console.error("\u274C Error generating component :", result.error.message);
52
- }
53
- break;
54
- default:
55
- console.error("\u274C Unsupported type!");
56
- return;
57
- }
58
- if (!fs.existsSync(targetDir)) {
59
- fs.mkdirSync(targetDir, { recursive: true });
60
- }
61
- const filePath = path.join(targetDir, `${name}.${type}.ts`);
62
- fs.writeFileSync(filePath, content);
63
- console.log(`\u2705 ${type} ${name} created in ${filePath}`);
64
- };
65
-
66
- // src/index.ts
67
- var main = () => {
68
- const args = process.argv.slice(2);
69
- const program = args[0];
70
- switch (program) {
71
- case "new":
72
- const projectName = args[1];
73
- if (!projectName) {
74
- console.error("\u274C The project name must get a name");
75
- process.exit(1);
76
- }
77
- console.log(`Project creation ${projectName}...`);
78
- const result = (0, import_child_process2.spawnSync)("npx", ["opticore-new-project", projectName], {
79
- stdio: "inherit",
80
- shell: true
81
- });
82
- if (result.error) {
83
- console.error("\u274C Error during installation :", result.error.message);
84
- }
85
- break;
86
- case "generate":
87
- case "g":
88
- const type = args[1];
89
- const name = args[2];
90
- if (!type || !name) {
91
- console.error("\u274C Usage : opticore generate <type> <name>");
92
- process.exit(1);
93
- }
94
- generate(type, name);
95
- break;
96
- case "help":
97
- default:
98
- console.log(`
99
- OptiCore CLI
100
- Available commands :
101
- opticore new <projectName> Create a new project
102
- opticore generate <type> <name> Generate an artifact (service, component, etc.)
103
- opticore help Get help for a specific command with OptiCoreJs help COMMAND.
104
- `);
105
- break;
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ runOpticoreCli: () => runOpticoreCli
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+ var import_commander = require("commander");
37
+ var import_chalk = __toESM(require("chalk"), 1);
38
+ var import_cfonts = __toESM(require("cfonts"), 1);
39
+ var import_cli = require("opticore-validator/cli");
40
+ var import_cli2 = require("opticore-orm-orchestrator/cli");
41
+ var import_cli3 = require("opticore-feature-component/cli");
42
+ function printBanner() {
43
+ import_cfonts.default.say("OpticoreJs", {
44
+ font: "block",
45
+ align: "left",
46
+ colors: ["yellow", "#FF6B35"],
47
+ background: "transparent",
48
+ letterSpacing: 1,
49
+ lineHeight: 1,
50
+ space: true,
51
+ maxLength: "0"
52
+ });
53
+ const orange = import_chalk.default.bold.hex("#FF6B35");
54
+ const dim = import_chalk.default.bold.yellow;
55
+ console.log(` ${orange("O P T I C O R E")}`);
56
+ console.log(` ${dim("Project CLI \u2014 validator, ORM, features")}
57
+ `);
58
+ }
59
+ function runOpticoreCli() {
60
+ (0, import_cli.forceOpticoreColors)();
61
+ printBanner();
62
+ const program = new import_commander.Command();
63
+ program.name("opticore").description(import_chalk.default.dim("Opticore CLI")).configureHelp(import_cli.helpConfig);
64
+ (0, import_cli.registerValidatorCommand)(program);
65
+ (0, import_cli2.registerOrmCommand)(program);
66
+ (0, import_cli3.registerFeatureCommand)(program);
67
+ if (!process.argv.slice(2).length) {
68
+ program.outputHelp();
69
+ process.exit(0);
106
70
  }
107
- };
108
- main();
71
+ program.parse(process.argv);
72
+ }
73
+ // Annotate the CommonJS export names for ESM import in node:
74
+ 0 && (module.exports = {
75
+ runOpticoreCli
76
+ });
package/dist/index.d.cts CHANGED
@@ -1 +1,3 @@
1
- #!/usr/bin/env node
1
+ declare function runOpticoreCli(): void;
2
+
3
+ export { runOpticoreCli };
package/dist/index.d.ts CHANGED
@@ -1 +1,3 @@
1
- #!/usr/bin/env node
1
+ declare function runOpticoreCli(): void;
2
+
3
+ export { runOpticoreCli };
package/dist/index.js CHANGED
@@ -1,85 +1,6 @@
1
- #!/usr/bin/env node
2
-
3
- // src/index.ts
4
- import { spawnSync as spawnSync2 } from "child_process";
5
-
6
- // src/commands/generate.command.ts
7
- import * as path from "path";
8
- import * as fs from "fs";
9
- import { spawnSync } from "child_process";
10
- var generate = (type, name) => {
11
- const basePath = process.cwd();
12
- let targetDir = "";
13
- let content = "";
14
- switch (type) {
15
- case "service":
16
- break;
17
- case "component":
18
- if (!name) {
19
- console.error("\u274C Please specify the component name");
20
- process.exit(1);
21
- }
22
- console.log(`Component generation ${name}...`);
23
- const result = spawnSync("npx", ["create-clean-component", name], {
24
- stdio: "inherit",
25
- shell: true
26
- });
27
- if (result.error) {
28
- console.error("\u274C Error generating component :", result.error.message);
29
- }
30
- break;
31
- default:
32
- console.error("\u274C Unsupported type!");
33
- return;
34
- }
35
- if (!fs.existsSync(targetDir)) {
36
- fs.mkdirSync(targetDir, { recursive: true });
37
- }
38
- const filePath = path.join(targetDir, `${name}.${type}.ts`);
39
- fs.writeFileSync(filePath, content);
40
- console.log(`\u2705 ${type} ${name} created in ${filePath}`);
1
+ import {
2
+ runOpticoreCli
3
+ } from "./chunk-6DKVP6WN.js";
4
+ export {
5
+ runOpticoreCli
41
6
  };
42
-
43
- // src/index.ts
44
- var main = () => {
45
- const args = process.argv.slice(2);
46
- const program = args[0];
47
- switch (program) {
48
- case "new":
49
- const projectName = args[1];
50
- if (!projectName) {
51
- console.error("\u274C The project name must get a name");
52
- process.exit(1);
53
- }
54
- console.log(`Project creation ${projectName}...`);
55
- const result = spawnSync2("npx", ["opticore-new-project", projectName], {
56
- stdio: "inherit",
57
- shell: true
58
- });
59
- if (result.error) {
60
- console.error("\u274C Error during installation :", result.error.message);
61
- }
62
- break;
63
- case "generate":
64
- case "g":
65
- const type = args[1];
66
- const name = args[2];
67
- if (!type || !name) {
68
- console.error("\u274C Usage : opticore generate <type> <name>");
69
- process.exit(1);
70
- }
71
- generate(type, name);
72
- break;
73
- case "help":
74
- default:
75
- console.log(`
76
- OptiCore CLI
77
- Available commands :
78
- opticore new <projectName> Create a new project
79
- opticore generate <type> <name> Generate an artifact (service, component, etc.)
80
- opticore help Get help for a specific command with OptiCoreJs help COMMAND.
81
- `);
82
- break;
83
- }
84
- };
85
- main();
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "opticore-cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "bin": {
8
- "opticore": "./dist/index.js"
8
+ "opticore": "./dist/bin.js"
9
9
  },
10
10
  "type": "module",
11
11
  "files": [
@@ -13,7 +13,7 @@
13
13
  ],
14
14
  "scripts": {
15
15
  "test": "echo \"Error: no test specified\" && exit 1",
16
- "dev": "ts-node src/index.ts",
16
+ "dev": "ts-node src/bin.ts",
17
17
  "build": "tsup",
18
18
  "prepublishOnly": "npm run build"
19
19
  },
@@ -33,6 +33,14 @@
33
33
  },
34
34
  "homepage": "https://github.com/guyzoum77/opticore-cli#readme",
35
35
  "description": "",
36
+ "dependencies": {
37
+ "cfonts": "^3.3.1",
38
+ "chalk": "^5.6.2",
39
+ "commander": "^14.0.3",
40
+ "opticore-feature-component": "^1.1.0",
41
+ "opticore-orm-orchestrator": "^1.1.0",
42
+ "opticore-validator": "^1.0.6"
43
+ },
36
44
  "devDependencies": {
37
45
  "ts-node": "^10.9.2",
38
46
  "tsup": "^8.5.0",