crabygen 0.1.0-alpha.9 → 0.1.0-beta.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/index.cjs +61 -29
- package/dist/index.js +61 -29
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -27,7 +27,7 @@ let __craby_cli_bindings = require("@craby/cli-bindings");
|
|
|
27
27
|
__craby_cli_bindings = __toESM(__craby_cli_bindings);
|
|
28
28
|
|
|
29
29
|
//#region package.json
|
|
30
|
-
var version = "0.1.0-
|
|
30
|
+
var version = "0.1.0-beta.1";
|
|
31
31
|
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region src/utils/bindings.ts
|
|
@@ -42,6 +42,33 @@ function withVerbose(command$6) {
|
|
|
42
42
|
return command$6.addOption(VERBOSE_OPTION);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/logger.ts
|
|
47
|
+
let logger = null;
|
|
48
|
+
function getLogger() {
|
|
49
|
+
if (logger) return logger;
|
|
50
|
+
const bindings = getBindings();
|
|
51
|
+
logger = {
|
|
52
|
+
trace: bindings.trace,
|
|
53
|
+
debug: bindings.debug,
|
|
54
|
+
info: bindings.info,
|
|
55
|
+
warn: bindings.warn,
|
|
56
|
+
error: bindings.error
|
|
57
|
+
};
|
|
58
|
+
return logger;
|
|
59
|
+
}
|
|
60
|
+
const loggerProxy = new Proxy({}, { get(_, prop) {
|
|
61
|
+
return (message) => getLogger()[prop](message);
|
|
62
|
+
} });
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/utils/errors.ts
|
|
66
|
+
function commonErrorHandler(error) {
|
|
67
|
+
if (error instanceof Error) loggerProxy.error(error.message);
|
|
68
|
+
else loggerProxy.error("Unknown error");
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
|
|
45
72
|
//#endregion
|
|
46
73
|
//#region src/utils/resolve-project-root.ts
|
|
47
74
|
function resolveProjectRoot() {
|
|
@@ -51,41 +78,65 @@ function resolveProjectRoot() {
|
|
|
51
78
|
//#endregion
|
|
52
79
|
//#region src/commands/build.ts
|
|
53
80
|
const command = withVerbose(new __commander_js_extra_typings.Command().name("build").action(async () => {
|
|
54
|
-
|
|
81
|
+
try {
|
|
82
|
+
getBindings().build({ projectRoot: resolveProjectRoot() });
|
|
83
|
+
} catch (error) {
|
|
84
|
+
commonErrorHandler(error);
|
|
85
|
+
}
|
|
55
86
|
}));
|
|
56
87
|
|
|
57
88
|
//#endregion
|
|
58
89
|
//#region src/commands/clean.ts
|
|
59
90
|
const command$1 = withVerbose(new __commander_js_extra_typings.Command().name("clean").action(async () => {
|
|
60
|
-
|
|
91
|
+
try {
|
|
92
|
+
getBindings().clean({ projectRoot: resolveProjectRoot() });
|
|
93
|
+
} catch (error) {
|
|
94
|
+
commonErrorHandler(error);
|
|
95
|
+
}
|
|
61
96
|
}));
|
|
62
97
|
|
|
63
98
|
//#endregion
|
|
64
99
|
//#region src/commands/codegen.ts
|
|
65
100
|
async function runCodegen() {
|
|
66
|
-
|
|
101
|
+
try {
|
|
102
|
+
getBindings().codegen({ projectRoot: resolveProjectRoot() });
|
|
103
|
+
} catch (error) {
|
|
104
|
+
commonErrorHandler(error);
|
|
105
|
+
}
|
|
67
106
|
}
|
|
68
107
|
const command$2 = withVerbose(new __commander_js_extra_typings.Command().name("codegen").action(runCodegen));
|
|
69
108
|
|
|
70
109
|
//#endregion
|
|
71
110
|
//#region src/commands/doctor.ts
|
|
72
111
|
const command$3 = withVerbose(new __commander_js_extra_typings.Command().name("doctor").action(async () => {
|
|
73
|
-
|
|
112
|
+
try {
|
|
113
|
+
getBindings().doctor({ projectRoot: resolveProjectRoot() });
|
|
114
|
+
} catch (error) {
|
|
115
|
+
commonErrorHandler(error);
|
|
116
|
+
}
|
|
74
117
|
}));
|
|
75
118
|
|
|
76
119
|
//#endregion
|
|
77
120
|
//#region src/commands/init.ts
|
|
78
121
|
const command$4 = withVerbose(new __commander_js_extra_typings.Command().name("init").argument("<packageName>", "The name of the package").action(async (packageName) => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
122
|
+
try {
|
|
123
|
+
getBindings().init({
|
|
124
|
+
cwd: process.cwd(),
|
|
125
|
+
pkgName: packageName
|
|
126
|
+
});
|
|
127
|
+
} catch (error) {
|
|
128
|
+
commonErrorHandler(error);
|
|
129
|
+
}
|
|
83
130
|
}));
|
|
84
131
|
|
|
85
132
|
//#endregion
|
|
86
133
|
//#region src/commands/show.ts
|
|
87
134
|
const command$5 = withVerbose(new __commander_js_extra_typings.Command().name("show").action(async () => {
|
|
88
|
-
|
|
135
|
+
try {
|
|
136
|
+
getBindings().show({ projectRoot: resolveProjectRoot() });
|
|
137
|
+
} catch (error) {
|
|
138
|
+
commonErrorHandler(error);
|
|
139
|
+
}
|
|
89
140
|
}));
|
|
90
141
|
|
|
91
142
|
//#endregion
|
|
@@ -107,25 +158,6 @@ function run$1(baseCommand) {
|
|
|
107
158
|
cli.parse();
|
|
108
159
|
}
|
|
109
160
|
|
|
110
|
-
//#endregion
|
|
111
|
-
//#region src/logger.ts
|
|
112
|
-
let logger = null;
|
|
113
|
-
function getLogger() {
|
|
114
|
-
if (logger) return logger;
|
|
115
|
-
const bindings = getBindings();
|
|
116
|
-
logger = {
|
|
117
|
-
trace: bindings.trace,
|
|
118
|
-
debug: bindings.debug,
|
|
119
|
-
info: bindings.info,
|
|
120
|
-
warn: bindings.warn,
|
|
121
|
-
error: bindings.error
|
|
122
|
-
};
|
|
123
|
-
return logger;
|
|
124
|
-
}
|
|
125
|
-
const loggerProxy = new Proxy({}, { get(_, prop) {
|
|
126
|
-
return (message) => getLogger()[prop](message);
|
|
127
|
-
} });
|
|
128
|
-
|
|
129
161
|
//#endregion
|
|
130
162
|
//#region src/index.ts
|
|
131
163
|
async function run(baseCommand = "crabygen") {
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Command, Option, program } from "@commander-js/extra-typings";
|
|
|
2
2
|
import * as mod from "@craby/cli-bindings";
|
|
3
3
|
|
|
4
4
|
//#region package.json
|
|
5
|
-
var version = "0.1.0-
|
|
5
|
+
var version = "0.1.0-beta.1";
|
|
6
6
|
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/utils/bindings.ts
|
|
@@ -17,6 +17,33 @@ function withVerbose(command$6) {
|
|
|
17
17
|
return command$6.addOption(VERBOSE_OPTION);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/logger.ts
|
|
22
|
+
let logger = null;
|
|
23
|
+
function getLogger() {
|
|
24
|
+
if (logger) return logger;
|
|
25
|
+
const bindings = getBindings();
|
|
26
|
+
logger = {
|
|
27
|
+
trace: bindings.trace,
|
|
28
|
+
debug: bindings.debug,
|
|
29
|
+
info: bindings.info,
|
|
30
|
+
warn: bindings.warn,
|
|
31
|
+
error: bindings.error
|
|
32
|
+
};
|
|
33
|
+
return logger;
|
|
34
|
+
}
|
|
35
|
+
const loggerProxy = new Proxy({}, { get(_, prop) {
|
|
36
|
+
return (message) => getLogger()[prop](message);
|
|
37
|
+
} });
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/utils/errors.ts
|
|
41
|
+
function commonErrorHandler(error) {
|
|
42
|
+
if (error instanceof Error) loggerProxy.error(error.message);
|
|
43
|
+
else loggerProxy.error("Unknown error");
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
|
|
20
47
|
//#endregion
|
|
21
48
|
//#region src/utils/resolve-project-root.ts
|
|
22
49
|
function resolveProjectRoot() {
|
|
@@ -26,41 +53,65 @@ function resolveProjectRoot() {
|
|
|
26
53
|
//#endregion
|
|
27
54
|
//#region src/commands/build.ts
|
|
28
55
|
const command = withVerbose(new Command().name("build").action(async () => {
|
|
29
|
-
|
|
56
|
+
try {
|
|
57
|
+
getBindings().build({ projectRoot: resolveProjectRoot() });
|
|
58
|
+
} catch (error) {
|
|
59
|
+
commonErrorHandler(error);
|
|
60
|
+
}
|
|
30
61
|
}));
|
|
31
62
|
|
|
32
63
|
//#endregion
|
|
33
64
|
//#region src/commands/clean.ts
|
|
34
65
|
const command$1 = withVerbose(new Command().name("clean").action(async () => {
|
|
35
|
-
|
|
66
|
+
try {
|
|
67
|
+
getBindings().clean({ projectRoot: resolveProjectRoot() });
|
|
68
|
+
} catch (error) {
|
|
69
|
+
commonErrorHandler(error);
|
|
70
|
+
}
|
|
36
71
|
}));
|
|
37
72
|
|
|
38
73
|
//#endregion
|
|
39
74
|
//#region src/commands/codegen.ts
|
|
40
75
|
async function runCodegen() {
|
|
41
|
-
|
|
76
|
+
try {
|
|
77
|
+
getBindings().codegen({ projectRoot: resolveProjectRoot() });
|
|
78
|
+
} catch (error) {
|
|
79
|
+
commonErrorHandler(error);
|
|
80
|
+
}
|
|
42
81
|
}
|
|
43
82
|
const command$2 = withVerbose(new Command().name("codegen").action(runCodegen));
|
|
44
83
|
|
|
45
84
|
//#endregion
|
|
46
85
|
//#region src/commands/doctor.ts
|
|
47
86
|
const command$3 = withVerbose(new Command().name("doctor").action(async () => {
|
|
48
|
-
|
|
87
|
+
try {
|
|
88
|
+
getBindings().doctor({ projectRoot: resolveProjectRoot() });
|
|
89
|
+
} catch (error) {
|
|
90
|
+
commonErrorHandler(error);
|
|
91
|
+
}
|
|
49
92
|
}));
|
|
50
93
|
|
|
51
94
|
//#endregion
|
|
52
95
|
//#region src/commands/init.ts
|
|
53
96
|
const command$4 = withVerbose(new Command().name("init").argument("<packageName>", "The name of the package").action(async (packageName) => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
97
|
+
try {
|
|
98
|
+
getBindings().init({
|
|
99
|
+
cwd: process.cwd(),
|
|
100
|
+
pkgName: packageName
|
|
101
|
+
});
|
|
102
|
+
} catch (error) {
|
|
103
|
+
commonErrorHandler(error);
|
|
104
|
+
}
|
|
58
105
|
}));
|
|
59
106
|
|
|
60
107
|
//#endregion
|
|
61
108
|
//#region src/commands/show.ts
|
|
62
109
|
const command$5 = withVerbose(new Command().name("show").action(async () => {
|
|
63
|
-
|
|
110
|
+
try {
|
|
111
|
+
getBindings().show({ projectRoot: resolveProjectRoot() });
|
|
112
|
+
} catch (error) {
|
|
113
|
+
commonErrorHandler(error);
|
|
114
|
+
}
|
|
64
115
|
}));
|
|
65
116
|
|
|
66
117
|
//#endregion
|
|
@@ -82,25 +133,6 @@ function run$1(baseCommand) {
|
|
|
82
133
|
cli.parse();
|
|
83
134
|
}
|
|
84
135
|
|
|
85
|
-
//#endregion
|
|
86
|
-
//#region src/logger.ts
|
|
87
|
-
let logger = null;
|
|
88
|
-
function getLogger() {
|
|
89
|
-
if (logger) return logger;
|
|
90
|
-
const bindings = getBindings();
|
|
91
|
-
logger = {
|
|
92
|
-
trace: bindings.trace,
|
|
93
|
-
debug: bindings.debug,
|
|
94
|
-
info: bindings.info,
|
|
95
|
-
warn: bindings.warn,
|
|
96
|
-
error: bindings.error
|
|
97
|
-
};
|
|
98
|
-
return logger;
|
|
99
|
-
}
|
|
100
|
-
const loggerProxy = new Proxy({}, { get(_, prop) {
|
|
101
|
-
return (message) => getLogger()[prop](message);
|
|
102
|
-
} });
|
|
103
|
-
|
|
104
136
|
//#endregion
|
|
105
137
|
//#region src/index.ts
|
|
106
138
|
async function run(baseCommand = "crabygen") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "crabygen",
|
|
3
|
-
"version": "0.1.0-
|
|
3
|
+
"version": "0.1.0-beta.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"craby": "./bin-craby.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"homepage": "https://github.com/leegeunhyeok/craby#readme",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@commander-js/extra-typings": "^14.0.0",
|
|
26
|
-
"@craby/cli-bindings": "0.1.0-
|
|
26
|
+
"@craby/cli-bindings": "0.1.0-beta.1",
|
|
27
27
|
"commander": "^14.0.1",
|
|
28
28
|
"es-toolkit": "^1.39.10"
|
|
29
29
|
},
|