cam-fe-code-generator 0.0.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/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +38 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/package.json +32 -0
- package/src/cli.ts +42 -0
- package/src/index.ts +4 -0
- package/tsconfig.json +20 -0
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const program = new commander_1.Command();
|
|
8
|
+
program
|
|
9
|
+
.name('cam')
|
|
10
|
+
.description('CAM frontend code generator CLI')
|
|
11
|
+
.version('0.0.1');
|
|
12
|
+
program
|
|
13
|
+
.command('init')
|
|
14
|
+
.description('Initialize a new configuration file')
|
|
15
|
+
.action(() => {
|
|
16
|
+
const configContent = {
|
|
17
|
+
services: {},
|
|
18
|
+
params: {
|
|
19
|
+
param1: "",
|
|
20
|
+
param2: ""
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const targetPath = path.join(process.cwd(), 'cam.config.json');
|
|
24
|
+
if (fs.existsSync(targetPath)) {
|
|
25
|
+
console.warn('cam.config.json already exists in the current directory.');
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
fs.writeFileSync(targetPath, JSON.stringify(configContent, null, 2));
|
|
30
|
+
console.log('Successfully created cam.config.json');
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
console.error('Failed to create cam.config.json:', error);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
program.parse(process.argv);
|
|
38
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;AAEA,yCAAoC;AACpC,yBAAyB;AACzB,6BAA6B;AAE7B,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,KAAK,CAAC;KACX,WAAW,CAAC,iCAAiC,CAAC;KAC9C,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,qCAAqC,CAAC;KAClD,MAAM,CAAC,GAAG,EAAE;IACX,MAAM,aAAa,GAAG;QACpB,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,EAAE;SACX;KACF,CAAC;IAEF,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,iBAAiB,CAAC,CAAC;IAE/D,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC9B,OAAO,CAAC,IAAI,CAAC,0DAA0D,CAAC,CAAC;QACzE,OAAO;IACT,CAAC;IAED,IAAI,CAAC;QACH,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACrE,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;IACtD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;QAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,wBAAgB,KAAK,SAEpB"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AACA,sBAEC;AAHD,eAAe;AACf,SAAgB,KAAK;IACnB,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAA;AAClC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cam-fe-code-generator",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"bin": {
|
|
7
|
+
"cam": "dist/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
11
|
+
"build": "tsc"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"codegen",
|
|
15
|
+
"cam",
|
|
16
|
+
"typescript",
|
|
17
|
+
"api management"
|
|
18
|
+
],
|
|
19
|
+
"author": "Charlie. BU",
|
|
20
|
+
"license": "ISC",
|
|
21
|
+
"description": "",
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/node": "^25.0.3",
|
|
24
|
+
"typescript": "^5.9.3"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"commander": "^14.0.2"
|
|
28
|
+
},
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
}
|
|
32
|
+
}
|
package/src/cli.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { Command } from 'commander';
|
|
4
|
+
import * as fs from 'fs';
|
|
5
|
+
import * as path from 'path';
|
|
6
|
+
|
|
7
|
+
const program = new Command();
|
|
8
|
+
|
|
9
|
+
program
|
|
10
|
+
.name('cam')
|
|
11
|
+
.description('CAM frontend code generator CLI')
|
|
12
|
+
.version('0.0.1');
|
|
13
|
+
|
|
14
|
+
program
|
|
15
|
+
.command('init')
|
|
16
|
+
.description('Initialize a new configuration file')
|
|
17
|
+
.action(() => {
|
|
18
|
+
const configContent = {
|
|
19
|
+
services: {},
|
|
20
|
+
params: {
|
|
21
|
+
param1: "",
|
|
22
|
+
param2: ""
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const targetPath = path.join(process.cwd(), 'cam.config.json');
|
|
27
|
+
|
|
28
|
+
if (fs.existsSync(targetPath)) {
|
|
29
|
+
console.warn('cam.config.json already exists in the current directory.');
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
fs.writeFileSync(targetPath, JSON.stringify(configContent, null, 2));
|
|
35
|
+
console.log('Successfully created cam.config.json');
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.error('Failed to create cam.config.json:', error);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
program.parse(process.argv);
|
package/src/index.ts
ADDED
package/tsconfig.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"rootDir": "./src",
|
|
4
|
+
"outDir": "./dist",
|
|
5
|
+
"module": "CommonJS",
|
|
6
|
+
"target": "ES2019",
|
|
7
|
+
"sourceMap": true,
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"declarationMap": true,
|
|
10
|
+
"noUncheckedIndexedAccess": true,
|
|
11
|
+
"exactOptionalPropertyTypes": true,
|
|
12
|
+
"strict": true,
|
|
13
|
+
"jsx": "react-jsx",
|
|
14
|
+
"verbatimModuleSyntax": false,
|
|
15
|
+
"isolatedModules": true,
|
|
16
|
+
"noUncheckedSideEffectImports": true,
|
|
17
|
+
"moduleDetection": "force",
|
|
18
|
+
"skipLibCheck": true,
|
|
19
|
+
}
|
|
20
|
+
}
|