opticore-cli 1.0.1 → 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 +66 -0
- package/dist/bin.d.cts +1 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +7 -0
- package/dist/chunk-6DKVP6WN.js +42 -0
- package/dist/index.cjs +50 -83
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +5 -85
- package/package.json +11 -3
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,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,88 +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
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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)(
|
|
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;
|
|
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);
|
|
107
70
|
}
|
|
108
|
-
|
|
109
|
-
|
|
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
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,86 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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(
|
|
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.
|
|
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/
|
|
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/
|
|
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",
|