opticore-cli 1.0.1 → 1.0.3

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,106 @@
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
+ var OPTICORE_CLI_VERSION = "1.0.2";
34
+ function printCommandList(program) {
35
+ const title = import_chalk.default.bold.hex("#FF6B35");
36
+ const name = import_chalk.default.bold.cyan;
37
+ const alias = import_chalk.default.dim;
38
+ const desc = import_chalk.default.dim;
39
+ const flag = import_chalk.default.green;
40
+ console.log(`
41
+ ${title("Available Commands")}
42
+ `);
43
+ const walk = (cmd, path, depth) => {
44
+ for (const sub of cmd.commands) {
45
+ const fullPath = `${path} ${sub.name()}`;
46
+ const indent = " ".repeat(depth);
47
+ const aliases = sub.aliases();
48
+ const aliasText = aliases.length ? alias(` (${aliases.join(", ")})`) : "";
49
+ console.log(` ${indent}${name(fullPath)}${aliasText}`);
50
+ if (sub.description()) {
51
+ console.log(` ${indent} ${desc(sub.description())}`);
52
+ }
53
+ for (const opt of sub.options) {
54
+ console.log(` ${indent} ${flag(opt.flags.padEnd(22))}${desc(opt.description)}`);
55
+ }
56
+ walk(sub, fullPath, depth + 1);
57
+ }
58
+ };
59
+ walk(program, "opticore", 0);
60
+ console.log();
61
+ }
62
+ function printBanner() {
63
+ import_cfonts.default.say("OpticoreJs", {
64
+ font: "block",
65
+ align: "left",
66
+ colors: ["yellow", "#FF6B35"],
67
+ background: "transparent",
68
+ letterSpacing: 1,
69
+ lineHeight: 1,
70
+ space: true,
71
+ maxLength: "0"
72
+ });
73
+ const orange = import_chalk.default.bold.hex("#FF6B35");
74
+ const dim = import_chalk.default.bold.yellow;
75
+ console.log(` ${orange("OPTICOREJS C L I")}`);
76
+ console.log(` ${dim("Validator \xB7 ORM Orchestrator \xB7 Feature Generator")}
77
+ `);
78
+ console.log(` ${import_chalk.default.bold.dim("Documentation")} ${import_chalk.default.underline.cyan("https://github.com/guyzoum77/opticore-cli#readme")}
79
+ `);
80
+ }
81
+ function runOpticoreCli() {
82
+ (0, import_cli.forceOpticoreColors)();
83
+ printBanner();
84
+ const program = new import_commander.Command();
85
+ program.name("opticore").description(import_chalk.default.dim("Opticore CLI")).version(
86
+ OPTICORE_CLI_VERSION,
87
+ "-v, --version",
88
+ "Output the current version"
89
+ ).option("-l, --list", "List every command available across installed Opticore packages").configureHelp(import_cli.helpConfig);
90
+ (0, import_cli.registerValidatorCommand)(program);
91
+ (0, import_cli2.registerOrmCommand)(program);
92
+ (0, import_cli3.registerFeatureCommand)(program);
93
+ const args = process.argv.slice(2);
94
+ if (!args.length) {
95
+ program.outputHelp();
96
+ process.exit(0);
97
+ }
98
+ if (args.includes("-l") || args.includes("--list")) {
99
+ printCommandList(program);
100
+ process.exit(0);
101
+ }
102
+ program.parse(process.argv);
103
+ }
104
+
105
+ // src/bin.ts
106
+ 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-53EMHB2D.js";
5
+
6
+ // src/bin.ts
7
+ runOpticoreCli();
@@ -0,0 +1,83 @@
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
+ var OPTICORE_CLI_VERSION = "1.0.2";
9
+ function printCommandList(program) {
10
+ const title = chalk.bold.hex("#FF6B35");
11
+ const name = chalk.bold.cyan;
12
+ const alias = chalk.dim;
13
+ const desc = chalk.dim;
14
+ const flag = chalk.green;
15
+ console.log(`
16
+ ${title("Available Commands")}
17
+ `);
18
+ const walk = (cmd, path, depth) => {
19
+ for (const sub of cmd.commands) {
20
+ const fullPath = `${path} ${sub.name()}`;
21
+ const indent = " ".repeat(depth);
22
+ const aliases = sub.aliases();
23
+ const aliasText = aliases.length ? alias(` (${aliases.join(", ")})`) : "";
24
+ console.log(` ${indent}${name(fullPath)}${aliasText}`);
25
+ if (sub.description()) {
26
+ console.log(` ${indent} ${desc(sub.description())}`);
27
+ }
28
+ for (const opt of sub.options) {
29
+ console.log(` ${indent} ${flag(opt.flags.padEnd(22))}${desc(opt.description)}`);
30
+ }
31
+ walk(sub, fullPath, depth + 1);
32
+ }
33
+ };
34
+ walk(program, "opticore", 0);
35
+ console.log();
36
+ }
37
+ function printBanner() {
38
+ cfonts.say("OpticoreJs", {
39
+ font: "block",
40
+ align: "left",
41
+ colors: ["yellow", "#FF6B35"],
42
+ background: "transparent",
43
+ letterSpacing: 1,
44
+ lineHeight: 1,
45
+ space: true,
46
+ maxLength: "0"
47
+ });
48
+ const orange = chalk.bold.hex("#FF6B35");
49
+ const dim = chalk.bold.yellow;
50
+ console.log(` ${orange("OPTICOREJS C L I")}`);
51
+ console.log(` ${dim("Validator \xB7 ORM Orchestrator \xB7 Feature Generator")}
52
+ `);
53
+ console.log(` ${chalk.bold.dim("Documentation")} ${chalk.underline.cyan("https://github.com/guyzoum77/opticore-cli#readme")}
54
+ `);
55
+ }
56
+ function runOpticoreCli() {
57
+ forceOpticoreColors();
58
+ printBanner();
59
+ const program = new Command();
60
+ program.name("opticore").description(chalk.dim("Opticore CLI")).version(
61
+ OPTICORE_CLI_VERSION,
62
+ "-v, --version",
63
+ "Output the current version"
64
+ ).option("-l, --list", "List every command available across installed Opticore packages").configureHelp(helpConfig);
65
+ registerValidatorCommand(program);
66
+ registerOrmCommand(program);
67
+ registerFeatureCommand(program);
68
+ const args = process.argv.slice(2);
69
+ if (!args.length) {
70
+ program.outputHelp();
71
+ process.exit(0);
72
+ }
73
+ if (args.includes("-l") || args.includes("--list")) {
74
+ printCommandList(program);
75
+ process.exit(0);
76
+ }
77
+ program.parse(process.argv);
78
+ }
79
+
80
+ export {
81
+ OPTICORE_CLI_VERSION,
82
+ runOpticoreCli
83
+ };
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,88 +25,94 @@ 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);
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ OPTICORE_CLI_VERSION: () => OPTICORE_CLI_VERSION,
34
+ runOpticoreCli: () => runOpticoreCli
35
+ });
36
+ module.exports = __toCommonJS(index_exports);
37
+ var import_commander = require("commander");
38
+ var import_chalk = __toESM(require("chalk"), 1);
39
+ var import_cfonts = __toESM(require("cfonts"), 1);
40
+ var import_cli = require("opticore-validator/cli");
41
+ var import_cli2 = require("opticore-orm-orchestrator/cli");
42
+ var import_cli3 = require("opticore-feature-component/cli");
43
+ var OPTICORE_CLI_VERSION = "1.0.2";
44
+ function printCommandList(program) {
45
+ const title = import_chalk.default.bold.hex("#FF6B35");
46
+ const name = import_chalk.default.bold.cyan;
47
+ const alias = import_chalk.default.dim;
48
+ const desc = import_chalk.default.dim;
49
+ const flag = import_chalk.default.green;
50
+ console.log(`
51
+ ${title("Available Commands")}
52
+ `);
53
+ const walk = (cmd, path, depth) => {
54
+ for (const sub of cmd.commands) {
55
+ const fullPath = `${path} ${sub.name()}`;
56
+ const indent = " ".repeat(depth);
57
+ const aliases = sub.aliases();
58
+ const aliasText = aliases.length ? alias(` (${aliases.join(", ")})`) : "";
59
+ console.log(` ${indent}${name(fullPath)}${aliasText}`);
60
+ if (sub.description()) {
61
+ console.log(` ${indent} ${desc(sub.description())}`);
44
62
  }
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);
63
+ for (const opt of sub.options) {
64
+ console.log(` ${indent} ${flag(opt.flags.padEnd(22))}${desc(opt.description)}`);
52
65
  }
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 = () => {
66
+ walk(sub, fullPath, depth + 1);
67
+ }
68
+ };
69
+ walk(program, "opticore", 0);
70
+ console.log();
71
+ }
72
+ function printBanner() {
73
+ import_cfonts.default.say("OpticoreJs", {
74
+ font: "block",
75
+ align: "left",
76
+ colors: ["yellow", "#FF6B35"],
77
+ background: "transparent",
78
+ letterSpacing: 1,
79
+ lineHeight: 1,
80
+ space: true,
81
+ maxLength: "0"
82
+ });
83
+ const orange = import_chalk.default.bold.hex("#FF6B35");
84
+ const dim = import_chalk.default.bold.yellow;
85
+ console.log(` ${orange("OPTICOREJS C L I")}`);
86
+ console.log(` ${dim("Validator \xB7 ORM Orchestrator \xB7 Feature Generator")}
87
+ `);
88
+ console.log(` ${import_chalk.default.bold.dim("Documentation")} ${import_chalk.default.underline.cyan("https://github.com/guyzoum77/opticore-cli#readme")}
89
+ `);
90
+ }
91
+ function runOpticoreCli() {
92
+ (0, import_cli.forceOpticoreColors)();
93
+ printBanner();
94
+ const program = new import_commander.Command();
95
+ program.name("opticore").description(import_chalk.default.dim("Opticore CLI")).version(
96
+ OPTICORE_CLI_VERSION,
97
+ "-v, --version",
98
+ "Output the current version"
99
+ ).option("-l, --list", "List every command available across installed Opticore packages").configureHelp(import_cli.helpConfig);
100
+ (0, import_cli.registerValidatorCommand)(program);
101
+ (0, import_cli2.registerOrmCommand)(program);
102
+ (0, import_cli3.registerFeatureCommand)(program);
68
103
  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)(
79
- "npx",
80
- ["--yes", "--package=opticore-installer", "opticore-new-project", projectName],
81
- { stdio: "inherit" }
82
- );
83
- if (result.error) {
84
- console.error("\u274C Error during installation :", result.error.message);
85
- }
86
- break;
87
- case "generate":
88
- case "g":
89
- const type = args[1];
90
- const name = args[2];
91
- if (!type || !name) {
92
- console.error("\u274C Usage : opticore generate <type> <name>");
93
- process.exit(1);
94
- }
95
- generate(type, name);
96
- break;
97
- case "help":
98
- default:
99
- console.log(`
100
- OptiCore CLI
101
- Available commands :
102
- opticore new <projectName> Create a new project
103
- opticore generate <type> <name> Generate an artifact (service, component, etc.)
104
- opticore help Get help for a specific command with OptiCoreJs help COMMAND.
105
- `);
106
- break;
104
+ if (!args.length) {
105
+ program.outputHelp();
106
+ process.exit(0);
107
107
  }
108
- };
109
- main();
108
+ if (args.includes("-l") || args.includes("--list")) {
109
+ printCommandList(program);
110
+ process.exit(0);
111
+ }
112
+ program.parse(process.argv);
113
+ }
114
+ // Annotate the CommonJS export names for ESM import in node:
115
+ 0 && (module.exports = {
116
+ OPTICORE_CLI_VERSION,
117
+ runOpticoreCli
118
+ });
package/dist/index.d.cts CHANGED
@@ -1 +1,4 @@
1
- #!/usr/bin/env node
1
+ declare const OPTICORE_CLI_VERSION = "1.0.2";
2
+ declare function runOpticoreCli(): void;
3
+
4
+ export { OPTICORE_CLI_VERSION, runOpticoreCli };
package/dist/index.d.ts CHANGED
@@ -1 +1,4 @@
1
- #!/usr/bin/env node
1
+ declare const OPTICORE_CLI_VERSION = "1.0.2";
2
+ declare function runOpticoreCli(): void;
3
+
4
+ export { OPTICORE_CLI_VERSION, runOpticoreCli };
package/dist/index.js CHANGED
@@ -1,86 +1,8 @@
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
+ OPTICORE_CLI_VERSION,
3
+ runOpticoreCli
4
+ } from "./chunk-53EMHB2D.js";
5
+ export {
6
+ OPTICORE_CLI_VERSION,
7
+ runOpticoreCli
41
8
  };
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(
56
- "npx",
57
- ["--yes", "--package=opticore-installer", "opticore-new-project", projectName],
58
- { stdio: "inherit" }
59
- );
60
- if (result.error) {
61
- console.error("\u274C Error during installation :", result.error.message);
62
- }
63
- break;
64
- case "generate":
65
- case "g":
66
- const type = args[1];
67
- const name = args[2];
68
- if (!type || !name) {
69
- console.error("\u274C Usage : opticore generate <type> <name>");
70
- process.exit(1);
71
- }
72
- generate(type, name);
73
- break;
74
- case "help":
75
- default:
76
- console.log(`
77
- OptiCore CLI
78
- Available commands :
79
- opticore new <projectName> Create a new project
80
- opticore generate <type> <name> Generate an artifact (service, component, etc.)
81
- opticore help Get help for a specific command with OptiCoreJs help COMMAND.
82
- `);
83
- break;
84
- }
85
- };
86
- main();
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "opticore-cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
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",