crabygen 0.0.0 → 0.1.0-alpha.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/README.md +1 -1
- package/bin.js +5 -0
- package/dist/index.cjs +133 -0
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +108 -0
- package/package.json +30 -2
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
#
|
|
1
|
+
# crabygen
|
package/bin.js
ADDED
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
let __craby_cli_bindings = require("@craby/cli-bindings");
|
|
25
|
+
__craby_cli_bindings = __toESM(__craby_cli_bindings);
|
|
26
|
+
let __commander_js_extra_typings = require("@commander-js/extra-typings");
|
|
27
|
+
__commander_js_extra_typings = __toESM(__commander_js_extra_typings);
|
|
28
|
+
|
|
29
|
+
//#region package.json
|
|
30
|
+
var version = "0.1.0-alpha.3";
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/utils/command.ts
|
|
34
|
+
const VERBOSE_OPTION = new __commander_js_extra_typings.Option("-v, --verbose", "Print all logs");
|
|
35
|
+
function withVerbose(command$6) {
|
|
36
|
+
return command$6.addOption(VERBOSE_OPTION);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/utils/resolve-project-root.ts
|
|
41
|
+
function resolveProjectRoot() {
|
|
42
|
+
return process.cwd();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/commands/build.ts
|
|
47
|
+
const command = withVerbose(new __commander_js_extra_typings.Command().name("build").action(async () => {
|
|
48
|
+
(0, __craby_cli_bindings.getBindings)().codegen({ projectRoot: resolveProjectRoot() });
|
|
49
|
+
}));
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/commands/clean.ts
|
|
53
|
+
const command$1 = withVerbose(new __commander_js_extra_typings.Command().name("clean").action(async () => {
|
|
54
|
+
(0, __craby_cli_bindings.getBindings)().codegen({ projectRoot: resolveProjectRoot() });
|
|
55
|
+
}));
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/commands/codegen.ts
|
|
59
|
+
async function runCodegen() {
|
|
60
|
+
(0, __craby_cli_bindings.getBindings)().codegen({ projectRoot: resolveProjectRoot() });
|
|
61
|
+
}
|
|
62
|
+
const command$2 = withVerbose(new __commander_js_extra_typings.Command().name("codegen").action(runCodegen));
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/commands/doctor.ts
|
|
66
|
+
const command$3 = withVerbose(new __commander_js_extra_typings.Command().name("doctor").action(async () => {
|
|
67
|
+
(0, __craby_cli_bindings.getBindings)().codegen({ projectRoot: resolveProjectRoot() });
|
|
68
|
+
}));
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/commands/init.ts
|
|
72
|
+
const command$4 = withVerbose(new __commander_js_extra_typings.Command().name("init").argument("<packageName>", "The name of the package").action(async (packageName) => {
|
|
73
|
+
(0, __craby_cli_bindings.getBindings)().init({
|
|
74
|
+
cwd: process.cwd(),
|
|
75
|
+
pkgName: packageName
|
|
76
|
+
});
|
|
77
|
+
}));
|
|
78
|
+
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/commands/show.ts
|
|
81
|
+
const command$5 = withVerbose(new __commander_js_extra_typings.Command().name("show").action(async () => {
|
|
82
|
+
(0, __craby_cli_bindings.getBindings)().codegen({ projectRoot: resolveProjectRoot() });
|
|
83
|
+
}));
|
|
84
|
+
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/cli.ts
|
|
87
|
+
function run$1() {
|
|
88
|
+
const cli = __commander_js_extra_typings.program.name("crabygen").version(version);
|
|
89
|
+
cli.action(runCodegen);
|
|
90
|
+
cli.addCommand(command$2);
|
|
91
|
+
cli.addCommand(command$4);
|
|
92
|
+
cli.addCommand(command);
|
|
93
|
+
cli.addCommand(command$5);
|
|
94
|
+
cli.addCommand(command$3);
|
|
95
|
+
cli.addCommand(command$1);
|
|
96
|
+
cli.parse();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/logger.ts
|
|
101
|
+
let logger = null;
|
|
102
|
+
function getLogger() {
|
|
103
|
+
if (logger) return logger;
|
|
104
|
+
const bindings = (0, __craby_cli_bindings.getBindings)();
|
|
105
|
+
logger = {
|
|
106
|
+
trace: bindings.trace,
|
|
107
|
+
debug: bindings.debug,
|
|
108
|
+
info: bindings.info,
|
|
109
|
+
warn: bindings.warn,
|
|
110
|
+
error: bindings.error
|
|
111
|
+
};
|
|
112
|
+
return logger;
|
|
113
|
+
}
|
|
114
|
+
const loggerProxy = new Proxy({}, { get(_, prop) {
|
|
115
|
+
return (message) => getLogger()[prop](message);
|
|
116
|
+
} });
|
|
117
|
+
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/index.ts
|
|
120
|
+
async function run() {
|
|
121
|
+
const { setup } = (0, __craby_cli_bindings.getBindings)();
|
|
122
|
+
const verbose = Boolean(process.argv.find((arg) => arg === "-v" || arg === "--verbose"));
|
|
123
|
+
try {
|
|
124
|
+
setup(verbose ? "debug" : process.env.RUST_LOG);
|
|
125
|
+
run$1();
|
|
126
|
+
} catch (error) {
|
|
127
|
+
loggerProxy.error(error instanceof Error ? error.message : "unknown error");
|
|
128
|
+
process.exit(1);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
//#endregion
|
|
133
|
+
exports.run = run;
|
package/dist/index.d.cts
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { getBindings } from "@craby/cli-bindings";
|
|
2
|
+
import { Command, Option, program } from "@commander-js/extra-typings";
|
|
3
|
+
|
|
4
|
+
//#region package.json
|
|
5
|
+
var version = "0.1.0-alpha.3";
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/utils/command.ts
|
|
9
|
+
const VERBOSE_OPTION = new Option("-v, --verbose", "Print all logs");
|
|
10
|
+
function withVerbose(command$6) {
|
|
11
|
+
return command$6.addOption(VERBOSE_OPTION);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/utils/resolve-project-root.ts
|
|
16
|
+
function resolveProjectRoot() {
|
|
17
|
+
return process.cwd();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/commands/build.ts
|
|
22
|
+
const command = withVerbose(new Command().name("build").action(async () => {
|
|
23
|
+
getBindings().codegen({ projectRoot: resolveProjectRoot() });
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/commands/clean.ts
|
|
28
|
+
const command$1 = withVerbose(new Command().name("clean").action(async () => {
|
|
29
|
+
getBindings().codegen({ projectRoot: resolveProjectRoot() });
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/commands/codegen.ts
|
|
34
|
+
async function runCodegen() {
|
|
35
|
+
getBindings().codegen({ projectRoot: resolveProjectRoot() });
|
|
36
|
+
}
|
|
37
|
+
const command$2 = withVerbose(new Command().name("codegen").action(runCodegen));
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/commands/doctor.ts
|
|
41
|
+
const command$3 = withVerbose(new Command().name("doctor").action(async () => {
|
|
42
|
+
getBindings().codegen({ projectRoot: resolveProjectRoot() });
|
|
43
|
+
}));
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/commands/init.ts
|
|
47
|
+
const command$4 = withVerbose(new Command().name("init").argument("<packageName>", "The name of the package").action(async (packageName) => {
|
|
48
|
+
getBindings().init({
|
|
49
|
+
cwd: process.cwd(),
|
|
50
|
+
pkgName: packageName
|
|
51
|
+
});
|
|
52
|
+
}));
|
|
53
|
+
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/commands/show.ts
|
|
56
|
+
const command$5 = withVerbose(new Command().name("show").action(async () => {
|
|
57
|
+
getBindings().codegen({ projectRoot: resolveProjectRoot() });
|
|
58
|
+
}));
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/cli.ts
|
|
62
|
+
function run$1() {
|
|
63
|
+
const cli = program.name("crabygen").version(version);
|
|
64
|
+
cli.action(runCodegen);
|
|
65
|
+
cli.addCommand(command$2);
|
|
66
|
+
cli.addCommand(command$4);
|
|
67
|
+
cli.addCommand(command);
|
|
68
|
+
cli.addCommand(command$5);
|
|
69
|
+
cli.addCommand(command$3);
|
|
70
|
+
cli.addCommand(command$1);
|
|
71
|
+
cli.parse();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/logger.ts
|
|
76
|
+
let logger = null;
|
|
77
|
+
function getLogger() {
|
|
78
|
+
if (logger) return logger;
|
|
79
|
+
const bindings = getBindings();
|
|
80
|
+
logger = {
|
|
81
|
+
trace: bindings.trace,
|
|
82
|
+
debug: bindings.debug,
|
|
83
|
+
info: bindings.info,
|
|
84
|
+
warn: bindings.warn,
|
|
85
|
+
error: bindings.error
|
|
86
|
+
};
|
|
87
|
+
return logger;
|
|
88
|
+
}
|
|
89
|
+
const loggerProxy = new Proxy({}, { get(_, prop) {
|
|
90
|
+
return (message) => getLogger()[prop](message);
|
|
91
|
+
} });
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/index.ts
|
|
95
|
+
async function run() {
|
|
96
|
+
const { setup } = getBindings();
|
|
97
|
+
const verbose = Boolean(process.argv.find((arg) => arg === "-v" || arg === "--verbose"));
|
|
98
|
+
try {
|
|
99
|
+
setup(verbose ? "debug" : process.env.RUST_LOG);
|
|
100
|
+
run$1();
|
|
101
|
+
} catch (error) {
|
|
102
|
+
loggerProxy.error(error instanceof Error ? error.message : "unknown error");
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
//#endregion
|
|
108
|
+
export { run };
|
package/package.json
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "crabygen",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.1.0-alpha.3",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"bin": "./bin.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsdown",
|
|
8
|
+
"prepack": "yarn build",
|
|
9
|
+
"typecheck": "tsc --noEmit"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"bin.js"
|
|
14
|
+
],
|
|
15
|
+
"author": "leegeunhyeok <dev.ghlee@gmail.com> (https://github.com/leegeunhyeok)",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/leegeunhyeok/craby/issues"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "https://github.com/leegeunhyeok/craby#readme",
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@commander-js/extra-typings": "^14.0.0",
|
|
23
|
+
"@craby/cli-bindings": "0.1.0-alpha.3",
|
|
24
|
+
"commander": "^14.0.1",
|
|
25
|
+
"es-toolkit": "^1.39.10"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/node": "^22",
|
|
29
|
+
"tsdown": "^0.15.5",
|
|
30
|
+
"typescript": "^5.9.2"
|
|
31
|
+
},
|
|
4
32
|
"packageManager": "yarn@4.9.2"
|
|
5
|
-
}
|
|
33
|
+
}
|