@akanjs/cli 0.0.138 → 0.0.140
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/cjs/index.js +795 -463
- package/cjs/src/templates/module/__model__.constant.js +10 -1
- package/cjs/src/templates/module/__model__.dictionary.js +5 -0
- package/esm/index.js +795 -463
- package/esm/src/templates/module/__model__.constant.js +10 -1
- package/esm/src/templates/module/__model__.dictionary.js +5 -0
- package/package.json +1 -1
- package/src/application/application.command.d.ts +2 -2
- package/src/application/application.runner.d.ts +6 -3
- package/src/application/application.script.d.ts +3 -2
- package/src/cloud/cloud.command.d.ts +5 -5
- package/src/cloud/cloud.script.d.ts +5 -5
- package/src/library/library.command.d.ts +3 -4
- package/src/library/library.script.d.ts +0 -1
- package/src/module/module.command.d.ts +4 -6
- package/src/module/module.prompt.d.ts +7 -48
- package/src/module/module.request.d.ts +59 -0
- package/src/module/module.runner.d.ts +7 -1
- package/src/module/module.script.d.ts +7 -6
- package/src/package/package.command.d.ts +1 -1
- package/src/package/package.script.d.ts +1 -1
- package/src/workspace/workspace.command.d.ts +1 -1
package/esm/index.js
CHANGED
|
@@ -434,11 +434,11 @@ var Logger = class _Logger {
|
|
|
434
434
|
console.log(`${processMsg} ${timestampMsg} ${logLevelMsg} ${contextMsg} ${contentMsg} ${timeDiffMsg}
|
|
435
435
|
`);
|
|
436
436
|
}
|
|
437
|
-
static rawLog(msg, method) {
|
|
437
|
+
static rawLog(msg = "", method) {
|
|
438
438
|
this.raw(`${msg}
|
|
439
439
|
`, method);
|
|
440
440
|
}
|
|
441
|
-
static raw(msg, method) {
|
|
441
|
+
static raw(msg = "", method) {
|
|
442
442
|
if (typeof window === "undefined" && method !== "console" && global.process)
|
|
443
443
|
global.process.stdout.write(msg);
|
|
444
444
|
else
|
|
@@ -903,28 +903,50 @@ var TypeScriptDependencyScanner = class {
|
|
|
903
903
|
|
|
904
904
|
// pkgs/@akanjs/devkit/src/spinner.ts
|
|
905
905
|
import ora2 from "ora";
|
|
906
|
-
var Spinner = class {
|
|
906
|
+
var Spinner = class _Spinner {
|
|
907
|
+
static padding = 12;
|
|
907
908
|
spinner;
|
|
908
909
|
stopWatch;
|
|
909
910
|
startAt;
|
|
911
|
+
prefix;
|
|
910
912
|
message;
|
|
911
|
-
|
|
913
|
+
enableSpin;
|
|
914
|
+
constructor(message, { prefix = "", indent = 0, enableSpin = true } = {}) {
|
|
915
|
+
_Spinner.padding = Math.max(_Spinner.padding, prefix.length);
|
|
916
|
+
this.prefix = prefix;
|
|
912
917
|
this.message = message;
|
|
913
918
|
this.spinner = ora2(message);
|
|
914
|
-
this.spinner.prefixText = prefix;
|
|
919
|
+
this.spinner.prefixText = prefix.padStart(_Spinner.padding, " ");
|
|
915
920
|
this.spinner.indent = indent;
|
|
921
|
+
this.enableSpin = enableSpin;
|
|
916
922
|
}
|
|
917
923
|
start() {
|
|
918
924
|
this.startAt = /* @__PURE__ */ new Date();
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
925
|
+
if (this.enableSpin) {
|
|
926
|
+
this.spinner.start();
|
|
927
|
+
this.stopWatch = setInterval(() => {
|
|
928
|
+
this.spinner.prefixText = this.prefix.padStart(_Spinner.padding, " ");
|
|
929
|
+
this.spinner.text = `${this.message} (${this.#getElapsedTimeStr()})`;
|
|
930
|
+
}, 1e3);
|
|
931
|
+
} else
|
|
932
|
+
this.spinner.info();
|
|
923
933
|
return this;
|
|
924
934
|
}
|
|
925
935
|
succeed(message) {
|
|
926
|
-
clearInterval(this.stopWatch);
|
|
927
936
|
this.spinner.succeed(`${message} (${this.#getElapsedTimeStr()})`);
|
|
937
|
+
this.#reset();
|
|
938
|
+
}
|
|
939
|
+
fail(message) {
|
|
940
|
+
this.spinner.fail(`${message} (${this.#getElapsedTimeStr()})`);
|
|
941
|
+
this.#reset();
|
|
942
|
+
}
|
|
943
|
+
isSpinning() {
|
|
944
|
+
return this.spinner.isSpinning;
|
|
945
|
+
}
|
|
946
|
+
#reset() {
|
|
947
|
+
if (this.stopWatch)
|
|
948
|
+
clearInterval(this.stopWatch);
|
|
949
|
+
this.stopWatch = null;
|
|
928
950
|
}
|
|
929
951
|
#getElapsedTimeStr() {
|
|
930
952
|
const ms = (/* @__PURE__ */ new Date()).getTime() - this.startAt.getTime();
|
|
@@ -948,7 +970,11 @@ var execEmoji = {
|
|
|
948
970
|
default: "\u2708\uFE0F"
|
|
949
971
|
// for sys executor
|
|
950
972
|
};
|
|
951
|
-
var Executor = class {
|
|
973
|
+
var Executor = class _Executor {
|
|
974
|
+
static verbose = false;
|
|
975
|
+
static setVerbose(verbose) {
|
|
976
|
+
_Executor.verbose = verbose;
|
|
977
|
+
}
|
|
952
978
|
name;
|
|
953
979
|
logger;
|
|
954
980
|
cwdPath;
|
|
@@ -960,13 +986,20 @@ var Executor = class {
|
|
|
960
986
|
if (!fs6.existsSync(cwdPath))
|
|
961
987
|
fs6.mkdirSync(cwdPath, { recursive: true });
|
|
962
988
|
}
|
|
989
|
+
#stdout(data) {
|
|
990
|
+
if (_Executor.verbose)
|
|
991
|
+
Logger.raw(chalk.dim(data.toString()));
|
|
992
|
+
}
|
|
993
|
+
#stderr(data) {
|
|
994
|
+
Logger.raw(chalk.red(data.toString()));
|
|
995
|
+
}
|
|
963
996
|
exec(command, options = {}) {
|
|
964
997
|
const proc = exec(command, { cwd: this.cwdPath, ...options });
|
|
965
998
|
proc.stdout?.on("data", (data) => {
|
|
966
|
-
|
|
999
|
+
this.#stdout(data);
|
|
967
1000
|
});
|
|
968
1001
|
proc.stderr?.on("data", (data) => {
|
|
969
|
-
|
|
1002
|
+
this.#stdout(data);
|
|
970
1003
|
});
|
|
971
1004
|
return new Promise((resolve, reject) => {
|
|
972
1005
|
proc.on("exit", (code, signal) => {
|
|
@@ -978,12 +1011,16 @@ var Executor = class {
|
|
|
978
1011
|
});
|
|
979
1012
|
}
|
|
980
1013
|
spawn(command, args = [], options = {}) {
|
|
981
|
-
const proc = spawn(command, args, {
|
|
1014
|
+
const proc = spawn(command, args, {
|
|
1015
|
+
cwd: this.cwdPath,
|
|
1016
|
+
stdio: "inherit",
|
|
1017
|
+
...options
|
|
1018
|
+
});
|
|
982
1019
|
proc.stdout?.on("data", (data) => {
|
|
983
|
-
|
|
1020
|
+
this.#stdout(data);
|
|
984
1021
|
});
|
|
985
1022
|
proc.stderr?.on("data", (data) => {
|
|
986
|
-
|
|
1023
|
+
this.#stderr(data);
|
|
987
1024
|
});
|
|
988
1025
|
return new Promise((resolve, reject) => {
|
|
989
1026
|
proc.on("exit", (code, signal) => {
|
|
@@ -1001,10 +1038,10 @@ var Executor = class {
|
|
|
1001
1038
|
...options
|
|
1002
1039
|
});
|
|
1003
1040
|
proc.stdout?.on("data", (data) => {
|
|
1004
|
-
|
|
1041
|
+
this.#stdout(data);
|
|
1005
1042
|
});
|
|
1006
1043
|
proc.stderr?.on("data", (data) => {
|
|
1007
|
-
|
|
1044
|
+
this.#stderr(data);
|
|
1008
1045
|
});
|
|
1009
1046
|
return new Promise((resolve, reject) => {
|
|
1010
1047
|
proc.on("exit", (code, signal) => {
|
|
@@ -1029,6 +1066,20 @@ var Executor = class {
|
|
|
1029
1066
|
const readPath = this.#getPath(filePath);
|
|
1030
1067
|
return fs6.existsSync(readPath);
|
|
1031
1068
|
}
|
|
1069
|
+
remove(filePath) {
|
|
1070
|
+
const readPath = this.#getPath(filePath);
|
|
1071
|
+
if (fs6.existsSync(readPath))
|
|
1072
|
+
fs6.unlinkSync(readPath);
|
|
1073
|
+
this.logger.verbose(`Remove file ${readPath}`);
|
|
1074
|
+
return this;
|
|
1075
|
+
}
|
|
1076
|
+
removeDir(dirPath) {
|
|
1077
|
+
const readPath = this.#getPath(dirPath);
|
|
1078
|
+
if (fs6.existsSync(readPath))
|
|
1079
|
+
fs6.rmSync(readPath, { recursive: true });
|
|
1080
|
+
this.logger.verbose(`Remove directory ${readPath}`);
|
|
1081
|
+
return this;
|
|
1082
|
+
}
|
|
1032
1083
|
writeFile(filePath, content, { overwrite = true } = {}) {
|
|
1033
1084
|
const writePath = this.#getPath(filePath);
|
|
1034
1085
|
const dir = path4.dirname(writePath);
|
|
@@ -1079,8 +1130,8 @@ var Executor = class {
|
|
|
1079
1130
|
this.logger.verbose(msg);
|
|
1080
1131
|
return this;
|
|
1081
1132
|
}
|
|
1082
|
-
spinning(msg, { prefix = `${this.emoji}${this.name}
|
|
1083
|
-
return new Spinner(msg, { prefix, indent }).start();
|
|
1133
|
+
spinning(msg, { prefix = `${this.emoji}${this.name}`, indent = 0, enableSpin = !_Executor.verbose } = {}) {
|
|
1134
|
+
return new Spinner(msg, { prefix, indent, enableSpin }).start();
|
|
1084
1135
|
}
|
|
1085
1136
|
getTsConfig(pathname = "tsconfig.json") {
|
|
1086
1137
|
const tsconfig = this.readJson(pathname);
|
|
@@ -1249,23 +1300,41 @@ var WorkspaceExecutor = class _WorkspaceExecutor extends Executor {
|
|
|
1249
1300
|
}
|
|
1250
1301
|
setTsPaths(type, name) {
|
|
1251
1302
|
const rootTsConfig = this.readJson("tsconfig.json");
|
|
1252
|
-
if (type === "lib")
|
|
1303
|
+
if (type === "lib" || type === "pkg")
|
|
1253
1304
|
rootTsConfig.compilerOptions.paths[`@${name}`] = [`${type}s/${name}/index.ts`];
|
|
1254
1305
|
rootTsConfig.compilerOptions.paths[`@${name}/*`] = [`${type}s/${name}/*`];
|
|
1306
|
+
if (rootTsConfig.references) {
|
|
1307
|
+
if (!rootTsConfig.references.some((ref) => ref.path === `./${type}s/${name}/tsconfig.json`))
|
|
1308
|
+
rootTsConfig.references.push({ path: `./${type}s/${name}/tsconfig.json` });
|
|
1309
|
+
}
|
|
1310
|
+
this.writeJson("tsconfig.json", rootTsConfig);
|
|
1311
|
+
return this;
|
|
1312
|
+
}
|
|
1313
|
+
unsetTsPaths(type, name) {
|
|
1314
|
+
const rootTsConfig = this.readJson("tsconfig.json");
|
|
1315
|
+
const filteredKeys = Object.keys(rootTsConfig.compilerOptions.paths).filter((key) => !key.startsWith(`@${name}`));
|
|
1316
|
+
rootTsConfig.compilerOptions.paths = Object.fromEntries(
|
|
1317
|
+
filteredKeys.map((key) => [key, rootTsConfig.compilerOptions.paths[key]])
|
|
1318
|
+
);
|
|
1319
|
+
if (rootTsConfig.references) {
|
|
1320
|
+
rootTsConfig.references = rootTsConfig.references.filter(
|
|
1321
|
+
(ref) => !ref.path.startsWith(`./${type}s/${name}`)
|
|
1322
|
+
);
|
|
1323
|
+
}
|
|
1255
1324
|
this.writeJson("tsconfig.json", rootTsConfig);
|
|
1256
1325
|
return this;
|
|
1257
1326
|
}
|
|
1258
1327
|
async getDirInModule(basePath2, name) {
|
|
1259
|
-
const AVOID_DIRS = ["__lib", "__scalar", `_${name}`];
|
|
1328
|
+
const AVOID_DIRS = ["__lib", "__scalar", `_`, `_${name}`];
|
|
1260
1329
|
const getDirs = async (dirname, maxDepth = 3, results = [], prefix = "") => {
|
|
1261
1330
|
const dirs = await fsPromise.readdir(dirname);
|
|
1262
1331
|
await Promise.all(
|
|
1263
1332
|
dirs.map(async (dir) => {
|
|
1264
|
-
if (AVOID_DIRS.includes(dir))
|
|
1333
|
+
if (dir.includes("_") || AVOID_DIRS.includes(dir))
|
|
1265
1334
|
return;
|
|
1266
1335
|
const dirPath = path4.join(dirname, dir);
|
|
1267
1336
|
if (fs6.lstatSync(dirPath).isDirectory()) {
|
|
1268
|
-
results.push(`${
|
|
1337
|
+
results.push(`${prefix}${dir}`);
|
|
1269
1338
|
if (maxDepth > 0)
|
|
1270
1339
|
await getDirs(dirPath, maxDepth - 1, results, `${prefix}${dir}/`);
|
|
1271
1340
|
}
|
|
@@ -1312,6 +1381,22 @@ var WorkspaceExecutor = class _WorkspaceExecutor extends Executor {
|
|
|
1312
1381
|
];
|
|
1313
1382
|
return scalarConstantExampleFiles;
|
|
1314
1383
|
}
|
|
1384
|
+
async getConstantFiles() {
|
|
1385
|
+
const [appNames, libNames] = await this.getSyss();
|
|
1386
|
+
const moduleConstantExampleFiles = [
|
|
1387
|
+
...(await Promise.all(appNames.map((appName) => AppExecutor.from(this, appName).getConstantFiles()))).flat(),
|
|
1388
|
+
...(await Promise.all(libNames.map((libName) => LibExecutor.from(this, libName).getConstantFiles()))).flat()
|
|
1389
|
+
];
|
|
1390
|
+
return moduleConstantExampleFiles;
|
|
1391
|
+
}
|
|
1392
|
+
async getDictionaryFiles() {
|
|
1393
|
+
const [appNames, libNames] = await this.getSyss();
|
|
1394
|
+
const moduleDictionaryExampleFiles = [
|
|
1395
|
+
...(await Promise.all(appNames.map((appName) => AppExecutor.from(this, appName).getDictionaryFiles()))).flat(),
|
|
1396
|
+
...(await Promise.all(libNames.map((libName) => LibExecutor.from(this, libName).getDictionaryFiles()))).flat()
|
|
1397
|
+
];
|
|
1398
|
+
return moduleDictionaryExampleFiles;
|
|
1399
|
+
}
|
|
1315
1400
|
async getViewFiles() {
|
|
1316
1401
|
const [appNames, libNames] = await this.getSyss();
|
|
1317
1402
|
const viewExampleFiles = [
|
|
@@ -1541,9 +1626,15 @@ var SysExecutor = class extends Executor {
|
|
|
1541
1626
|
}
|
|
1542
1627
|
async getScalarDictionaryFiles() {
|
|
1543
1628
|
const scalarModules = await this.getScalarModules();
|
|
1544
|
-
return scalarModules.map(
|
|
1545
|
-
|
|
1546
|
-
|
|
1629
|
+
return scalarModules.map((scalarModule) => this.getLocalFile(`lib/${scalarModule}/${scalarModule}.dictionary.ts`));
|
|
1630
|
+
}
|
|
1631
|
+
async getConstantFiles() {
|
|
1632
|
+
const modules = await this.getModules();
|
|
1633
|
+
return modules.map((module) => this.getLocalFile(`lib/${module}/${module}.constant.ts`));
|
|
1634
|
+
}
|
|
1635
|
+
async getDictionaryFiles() {
|
|
1636
|
+
const modules = await this.getModules();
|
|
1637
|
+
return modules.map((module) => this.getLocalFile(`lib/${module}/${module}.dictionary.ts`));
|
|
1547
1638
|
}
|
|
1548
1639
|
setTsPaths() {
|
|
1549
1640
|
this.workspace.setTsPaths(this.type, this.name);
|
|
@@ -1562,6 +1653,9 @@ var AppExecutor = class _AppExecutor extends SysExecutor {
|
|
|
1562
1653
|
return new _AppExecutor({ workspace: executor, name });
|
|
1563
1654
|
return new _AppExecutor({ workspace: executor.workspace, name });
|
|
1564
1655
|
}
|
|
1656
|
+
getEnv() {
|
|
1657
|
+
return this.workspace.getBaseDevEnv().env;
|
|
1658
|
+
}
|
|
1565
1659
|
async getConfig(command) {
|
|
1566
1660
|
return await getAppConfig(this.cwdPath, {
|
|
1567
1661
|
...this.workspace.getBaseDevEnv(),
|
|
@@ -1981,6 +2075,7 @@ var getArg = (type) => function(name, argsOption = {}) {
|
|
|
1981
2075
|
setArgMetasOnPrototype(prototype, key, argMetas);
|
|
1982
2076
|
};
|
|
1983
2077
|
};
|
|
2078
|
+
var Argument = getArg("Argument");
|
|
1984
2079
|
var Option = getArg("Option");
|
|
1985
2080
|
var createArgMetaDecorator = (type) => {
|
|
1986
2081
|
return function(option = {}) {
|
|
@@ -2057,6 +2152,16 @@ var handleOption = (programCommand, argMeta) => {
|
|
|
2057
2152
|
);
|
|
2058
2153
|
return programCommand;
|
|
2059
2154
|
};
|
|
2155
|
+
var handleArgument = (programCommand, argMeta) => {
|
|
2156
|
+
const kebabName = camelToKebabCase(argMeta.name);
|
|
2157
|
+
if ((argMeta.argsOption.type ?? "string") !== "string")
|
|
2158
|
+
throw new Error(`Argument type must be string: ${argMeta.name}`);
|
|
2159
|
+
programCommand.argument(
|
|
2160
|
+
`[${kebabName}]`,
|
|
2161
|
+
`${argMeta.argsOption.desc}${argMeta.argsOption.example ? ` (example: ${argMeta.argsOption.example})` : ""}`
|
|
2162
|
+
);
|
|
2163
|
+
return programCommand;
|
|
2164
|
+
};
|
|
2060
2165
|
var convertOptionValue = (value, type) => {
|
|
2061
2166
|
if (type === "string")
|
|
2062
2167
|
return value;
|
|
@@ -2093,7 +2198,21 @@ var getOptionValue = async (argMeta, opt) => {
|
|
|
2093
2198
|
return convertOptionValue(await input({ message }), type ?? "string");
|
|
2094
2199
|
}
|
|
2095
2200
|
};
|
|
2096
|
-
var getArgumentValue = async (argMeta, value
|
|
2201
|
+
var getArgumentValue = async (argMeta, value) => {
|
|
2202
|
+
const {
|
|
2203
|
+
name,
|
|
2204
|
+
argsOption: { default: defaultValue, type, desc, nullable, example, ask }
|
|
2205
|
+
} = argMeta;
|
|
2206
|
+
if (value !== void 0)
|
|
2207
|
+
return value;
|
|
2208
|
+
else if (defaultValue !== void 0)
|
|
2209
|
+
return defaultValue;
|
|
2210
|
+
else if (nullable)
|
|
2211
|
+
return null;
|
|
2212
|
+
const message = ask ? `${ask}: ` : desc ? `${desc}: ` : `Enter the ${name} value${example ? ` (example: ${example})` : ""}: `;
|
|
2213
|
+
return await input({ message });
|
|
2214
|
+
};
|
|
2215
|
+
var getInternalArgumentValue = async (argMeta, value, workspace) => {
|
|
2097
2216
|
if (argMeta.type === "Workspace")
|
|
2098
2217
|
return workspace;
|
|
2099
2218
|
const sysType = argMeta.type.toLowerCase();
|
|
@@ -2158,6 +2277,7 @@ var getArgumentValue = async (argMeta, value, workspace) => {
|
|
|
2158
2277
|
var runCommands = async (...commands) => {
|
|
2159
2278
|
process.on("unhandledRejection", (error) => {
|
|
2160
2279
|
console.error(chalk2.red("[fatal]"), error);
|
|
2280
|
+
process.exit(1);
|
|
2161
2281
|
});
|
|
2162
2282
|
const hasPackageJson = fs9.existsSync(`${__dirname}/../package.json`);
|
|
2163
2283
|
const version = hasPackageJson ? JSON.parse(fs9.readFileSync(`${__dirname}/../package.json`, "utf8")).version : "0.0.1";
|
|
@@ -2178,6 +2298,8 @@ var runCommands = async (...commands) => {
|
|
|
2178
2298
|
for (const argMeta of allArgMetas) {
|
|
2179
2299
|
if (argMeta.type === "Option")
|
|
2180
2300
|
programCommand = handleOption(programCommand, argMeta);
|
|
2301
|
+
else if (argMeta.type === "Argument")
|
|
2302
|
+
programCommand = handleArgument(programCommand, argMeta);
|
|
2181
2303
|
else if (argMeta.type === "Workspace")
|
|
2182
2304
|
continue;
|
|
2183
2305
|
const sysType = argMeta.type.toLowerCase();
|
|
@@ -2186,7 +2308,9 @@ var runCommands = async (...commands) => {
|
|
|
2186
2308
|
`${sysType} in this workspace ${sysType}s/<${sysType}Name>`
|
|
2187
2309
|
);
|
|
2188
2310
|
}
|
|
2311
|
+
programCommand = programCommand.option(`-v, --verbose [boolean]`, `verbose output`);
|
|
2189
2312
|
programCommand.action(async (...args) => {
|
|
2313
|
+
Logger.rawLog();
|
|
2190
2314
|
const cmdArgs = args.slice(0, args.length - 2);
|
|
2191
2315
|
const opt = args[args.length - 2];
|
|
2192
2316
|
const commandArgs = [];
|
|
@@ -2194,14 +2318,23 @@ var runCommands = async (...commands) => {
|
|
|
2194
2318
|
for (const argMeta of allArgMetas) {
|
|
2195
2319
|
if (argMeta.type === "Option")
|
|
2196
2320
|
commandArgs[argMeta.idx] = await getOptionValue(argMeta, opt);
|
|
2321
|
+
else if (argMeta.type === "Argument")
|
|
2322
|
+
commandArgs[argMeta.idx] = await getArgumentValue(argMeta, cmdArgs[argMeta.idx]);
|
|
2197
2323
|
else
|
|
2198
|
-
commandArgs[argMeta.idx] = await
|
|
2324
|
+
commandArgs[argMeta.idx] = await getInternalArgumentValue(
|
|
2325
|
+
argMeta,
|
|
2326
|
+
cmdArgs[argMeta.idx],
|
|
2327
|
+
workspace
|
|
2328
|
+
);
|
|
2199
2329
|
if (commandArgs[argMeta.idx] instanceof AppExecutor)
|
|
2200
2330
|
process.env.NEXT_PUBLIC_APP_NAME = commandArgs[argMeta.idx].name;
|
|
2331
|
+
if (opt.verbose)
|
|
2332
|
+
Executor.setVerbose(true);
|
|
2201
2333
|
}
|
|
2202
2334
|
const cmd = new command();
|
|
2203
2335
|
try {
|
|
2204
2336
|
await cmd[targetMeta.key](...commandArgs);
|
|
2337
|
+
Logger.rawLog();
|
|
2205
2338
|
} catch (e) {
|
|
2206
2339
|
const errMsg = e instanceof Error ? e.message : typeof e === "string" ? e : JSON.stringify(e);
|
|
2207
2340
|
Logger.error(`Command Error: ${chalk2.red(errMsg)}`);
|
|
@@ -2220,7 +2353,6 @@ import { input as input2, select as select3 } from "@inquirer/prompts";
|
|
|
2220
2353
|
import { AIMessage, HumanMessage } from "@langchain/core/messages";
|
|
2221
2354
|
import { ChatOpenAI as ChatOpenAI2 } from "@langchain/openai";
|
|
2222
2355
|
import chalk3 from "chalk";
|
|
2223
|
-
import ora3 from "ora";
|
|
2224
2356
|
var MAX_ASK_TRY = 300;
|
|
2225
2357
|
var supportedLlmModels = ["deepseek-chat", "deepseek-reasoner"];
|
|
2226
2358
|
var AiSession = class _AiSession {
|
|
@@ -2228,8 +2360,11 @@ var AiSession = class _AiSession {
|
|
|
2228
2360
|
static async init({ temperature = 0.7, useExisting = true } = {}) {
|
|
2229
2361
|
if (useExisting) {
|
|
2230
2362
|
const llmConfig2 = this.getLlmConfig();
|
|
2231
|
-
if (llmConfig2)
|
|
2232
|
-
|
|
2363
|
+
if (llmConfig2) {
|
|
2364
|
+
this.#setChatModel(llmConfig2.model, llmConfig2.apiKey);
|
|
2365
|
+
Logger.rawLog(chalk3.dim(`\u{1F916}akan editor uses existing LLM config (${llmConfig2.model})`));
|
|
2366
|
+
return this;
|
|
2367
|
+
}
|
|
2233
2368
|
}
|
|
2234
2369
|
const llmConfig = await this.#requestLlmConfig();
|
|
2235
2370
|
const { model, apiKey } = llmConfig;
|
|
@@ -2261,6 +2396,7 @@ var AiSession = class _AiSession {
|
|
|
2261
2396
|
return { model, apiKey };
|
|
2262
2397
|
}
|
|
2263
2398
|
static async #validateApiKey(modelName, apiKey) {
|
|
2399
|
+
const spinner = new Spinner("Validating LLM API key...", { prefix: `\u{1F916}akan-editor` }).start();
|
|
2264
2400
|
const chat = new ChatOpenAI2({
|
|
2265
2401
|
modelName,
|
|
2266
2402
|
temperature: 0,
|
|
@@ -2268,9 +2404,10 @@ var AiSession = class _AiSession {
|
|
|
2268
2404
|
});
|
|
2269
2405
|
try {
|
|
2270
2406
|
await chat.invoke("Hi, and just say 'ok'");
|
|
2407
|
+
spinner.succeed("LLM API key is valid");
|
|
2271
2408
|
return true;
|
|
2272
2409
|
} catch (error) {
|
|
2273
|
-
|
|
2410
|
+
spinner.fail(
|
|
2274
2411
|
chalk3.red(
|
|
2275
2412
|
`LLM API key is invalid. Please check your API key and try again. You can set it again by running "akan set-llm" or reset by running "akan reset-llm"`
|
|
2276
2413
|
)
|
|
@@ -2291,14 +2428,16 @@ var AiSession = class _AiSession {
|
|
|
2291
2428
|
await _AiSession.init();
|
|
2292
2429
|
if (!_AiSession.#chat)
|
|
2293
2430
|
throw new Error("Failed to initialize the AI session");
|
|
2294
|
-
const loader =
|
|
2431
|
+
const loader = new Spinner(`${_AiSession.#chat.model} is thinking...`, {
|
|
2432
|
+
prefix: `\u{1F916}akan-editor`
|
|
2433
|
+
}).start();
|
|
2295
2434
|
try {
|
|
2296
2435
|
const humanMessage = new HumanMessage(question);
|
|
2297
2436
|
this.messageHistory.push(humanMessage);
|
|
2298
2437
|
const stream = await _AiSession.#chat.stream(this.messageHistory);
|
|
2299
2438
|
let fullResponse = "", tokenIdx = 0;
|
|
2300
2439
|
for await (const chunk of stream) {
|
|
2301
|
-
if (loader.isSpinning)
|
|
2440
|
+
if (loader.isSpinning() && chunk.content.length)
|
|
2302
2441
|
loader.succeed(`${_AiSession.#chat.model} responded`);
|
|
2303
2442
|
const content = chunk.content;
|
|
2304
2443
|
if (typeof content === "string") {
|
|
@@ -2428,22 +2567,14 @@ var LibraryRunner = class {
|
|
|
2428
2567
|
await workspace.exec(`mkdir -p libs/${libName}`);
|
|
2429
2568
|
const lib = LibExecutor.from(workspace, libName);
|
|
2430
2569
|
await lib.applyTemplate({ basePath: ".", template: "libRoot", dict: { libName, LibName: capitalize(libName) } });
|
|
2431
|
-
|
|
2432
|
-
rootTsConfig.compilerOptions.paths[`@${libName}`] = [`libs/${libName}/index.ts`];
|
|
2433
|
-
rootTsConfig.compilerOptions.paths[`@${libName}/*`] = [`libs/${libName}/*`];
|
|
2434
|
-
if (rootTsConfig.references) {
|
|
2435
|
-
if (!rootTsConfig.references.some((ref) => ref.path === `./libs/${libName}/tsconfig.json`))
|
|
2436
|
-
rootTsConfig.references.push({ path: `./libs/${libName}/tsconfig.json` });
|
|
2437
|
-
}
|
|
2438
|
-
workspace.writeJson("tsconfig.json", rootTsConfig);
|
|
2570
|
+
workspace.setTsPaths("lib", libName);
|
|
2439
2571
|
return lib;
|
|
2440
2572
|
}
|
|
2441
2573
|
async removeLibrary(lib) {
|
|
2442
2574
|
await lib.workspace.exec(`rm -rf libs/${lib.name}`);
|
|
2443
|
-
lib.
|
|
2575
|
+
lib.workspace.unsetTsPaths("lib", lib.name);
|
|
2444
2576
|
}
|
|
2445
2577
|
async installLibrary(workspace, libName) {
|
|
2446
|
-
workspace.log(`Installing ${libName} library as git subtree...`);
|
|
2447
2578
|
await workspace.exec(`git subtree add --prefix=libs/${libName} git@github.com:akan-team/${libName}.git main`);
|
|
2448
2579
|
await workspace.cp(`libs/${libName}/env/env.server.example.ts`, `libs/${libName}/env/env.server.testing.ts`);
|
|
2449
2580
|
workspace.setTsPaths("lib", libName);
|
|
@@ -2480,13 +2611,11 @@ var LibraryRunner = class {
|
|
|
2480
2611
|
await lib.workspace.exec(
|
|
2481
2612
|
`git subtree push --prefix=libs/${lib.name} git@github.com:akan-team/${lib.name}.git ${branch}`
|
|
2482
2613
|
);
|
|
2483
|
-
lib.logger.log(`${lib.name} library pushed to ${branch} branch`);
|
|
2484
2614
|
}
|
|
2485
2615
|
async pullLibrary(lib, branch) {
|
|
2486
2616
|
await lib.workspace.exec(
|
|
2487
2617
|
`git subtree pull --prefix=libs/${lib.name} git@github.com:akan-team/${lib.name}.git ${branch}`
|
|
2488
2618
|
);
|
|
2489
|
-
lib.logger.log(`${lib.name} library pulled from ${branch} branch`);
|
|
2490
2619
|
}
|
|
2491
2620
|
#getEnv(lib, env = {}) {
|
|
2492
2621
|
const rootEnv = dotenv2.parse(lib.workspace.readFile(".env"));
|
|
@@ -2518,38 +2647,49 @@ var LibraryRunner = class {
|
|
|
2518
2647
|
// pkgs/@akanjs/cli/src/library/library.script.ts
|
|
2519
2648
|
var LibraryScript = class {
|
|
2520
2649
|
#runner = new LibraryRunner();
|
|
2521
|
-
async
|
|
2650
|
+
async syncLibrary(lib) {
|
|
2651
|
+
const syncSpinner = lib.spinning("Syncing library...");
|
|
2522
2652
|
const akanConfig = await lib.getConfig();
|
|
2523
2653
|
const scanResult = await lib.scan({ akanConfig });
|
|
2524
|
-
|
|
2525
|
-
lib.logger.rawLog(JSON.stringify(scanResult, null, 2));
|
|
2654
|
+
syncSpinner.succeed(`Library ${lib.name} (libs/${lib.name}) is synced`);
|
|
2526
2655
|
return scanResult;
|
|
2527
2656
|
}
|
|
2528
|
-
async syncLibrary(lib) {
|
|
2529
|
-
const akanConfig = await lib.getConfig();
|
|
2530
|
-
return await lib.scan({ akanConfig });
|
|
2531
|
-
}
|
|
2532
2657
|
async createLibrary(libName, workspace) {
|
|
2658
|
+
const spinner = workspace.spinning(`Creating ${libName} library`);
|
|
2533
2659
|
const lib = await this.#runner.createLibrary(libName, workspace);
|
|
2660
|
+
spinner.succeed(`${libName} library (libs/${libName}) is created`);
|
|
2534
2661
|
await this.syncLibrary(lib);
|
|
2535
2662
|
}
|
|
2536
2663
|
async removeLibrary(lib) {
|
|
2664
|
+
const spinner = lib.spinning("Removing library...");
|
|
2537
2665
|
await this.#runner.removeLibrary(lib);
|
|
2666
|
+
spinner.succeed(`Library ${lib.name} (libs/${lib.name}) is removed`);
|
|
2538
2667
|
}
|
|
2539
2668
|
async installLibrary(workspace, libName) {
|
|
2669
|
+
const installSpinner = workspace.spinning(`Installing ${libName} library`);
|
|
2540
2670
|
const lib = await this.#runner.installLibrary(workspace, libName);
|
|
2541
|
-
|
|
2671
|
+
installSpinner.succeed(`${libName} library (libs/${libName}) is installed`);
|
|
2672
|
+
const mergeSpinner = lib.spinning("Merging library dependencies...");
|
|
2542
2673
|
await this.#runner.mergeLibraryDependencies(lib);
|
|
2674
|
+
mergeSpinner.succeed(`${libName} library (libs/${libName}) dependencies merged to root package.json`);
|
|
2543
2675
|
}
|
|
2544
2676
|
async pushLibrary(lib, branch) {
|
|
2677
|
+
const pushSpinner = lib.spinning("Pushing library...");
|
|
2545
2678
|
await this.#runner.pushLibrary(lib, branch);
|
|
2679
|
+
pushSpinner.succeed(`Library ${lib.name} (libs/${lib.name}) pushed to ${branch} branch`);
|
|
2546
2680
|
}
|
|
2547
2681
|
async pullLibrary(lib, branch) {
|
|
2682
|
+
const pullSpinner = lib.spinning("Pulling library...");
|
|
2548
2683
|
await this.#runner.pullLibrary(lib, branch);
|
|
2684
|
+
pullSpinner.succeed(`Library ${lib.name} (libs/${lib.name}) pulled from ${branch} branch`);
|
|
2685
|
+
const mergeSpinner = lib.spinning("Merging library dependencies...");
|
|
2549
2686
|
await this.#runner.mergeLibraryDependencies(lib);
|
|
2687
|
+
mergeSpinner.succeed(`Library ${lib.name} (libs/${lib.name}) dependencies merged to root package.json`);
|
|
2550
2688
|
}
|
|
2551
2689
|
async testLibrary(lib) {
|
|
2690
|
+
const spinner = lib.spinning("Testing library...");
|
|
2552
2691
|
await this.#runner.testLibrary(lib);
|
|
2692
|
+
spinner.succeed(`Library ${lib.name} (libs/${lib.name}) test is successful`);
|
|
2553
2693
|
}
|
|
2554
2694
|
};
|
|
2555
2695
|
|
|
@@ -2566,7 +2706,7 @@ import fs11 from "fs";
|
|
|
2566
2706
|
import fsPromise2 from "fs/promises";
|
|
2567
2707
|
import yaml2 from "js-yaml";
|
|
2568
2708
|
import openBrowser from "open";
|
|
2569
|
-
import
|
|
2709
|
+
import ora3 from "ora";
|
|
2570
2710
|
import path5 from "path";
|
|
2571
2711
|
import * as vite from "vite";
|
|
2572
2712
|
import commonjs from "vite-plugin-commonjs";
|
|
@@ -3850,87 +3990,6 @@ Core ESLint Extensions
|
|
|
3850
3990
|
This configuration creates a robust linting setup that enforces Next.js App Router best practices, maintains clean code
|
|
3851
3991
|
organization, and ensures proper server/client code separation.
|
|
3852
3992
|
`;
|
|
3853
|
-
var componentDefaultDescription = ({
|
|
3854
|
-
modelName,
|
|
3855
|
-
ModelName,
|
|
3856
|
-
exampleFiles,
|
|
3857
|
-
constant,
|
|
3858
|
-
properties
|
|
3859
|
-
}) => `
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
1. Akan.js \uD504\uB808\uC784\uC6CC\uD06C\uC5D0 \uB300\uD55C \uAC1C\uC694
|
|
3863
|
-
${frameworkAbstract}
|
|
3864
|
-
|
|
3865
|
-
2. Akan.js\uD504\uB808\uC784\uC6CC\uD06C \uB370\uC774\uD130 \uAE30\uBC18 \uBAA8\uB4C8\uC5D0 \uB300\uD55C \uC124\uBA85
|
|
3866
|
-
${moduleDesription}
|
|
3867
|
-
|
|
3868
|
-
3. Akan.js eslint \uC124\uC815\uC5D0 \uB300\uD55C \uC124\uBA85
|
|
3869
|
-
${eslintDescription}
|
|
3870
|
-
|
|
3871
|
-
4. util/ui \uB0B4 ui\uD0B7\uC5D0 \uB300\uD55C \uC124\uBA85
|
|
3872
|
-
${utilUiDescription}
|
|
3873
|
-
|
|
3874
|
-
5. shared/ui \uB0B4 ui\uD0B7\uC5D0 \uB300\uD55C \uC124\uBA85
|
|
3875
|
-
${shardUiDescription}
|
|
3876
|
-
|
|
3877
|
-
6. ${ModelName}.constant.ts \uD30C\uC77C\uC5D0 \uB300\uD55C \uC815\uBCF4
|
|
3878
|
-
${constant}
|
|
3879
|
-
|
|
3880
|
-
7. ${modelName}\uC5D0\uC11C \uC885\uC18D\uB418\uB294 \uB2E4\uB978 \uBAA8\uB378\uB4E4\uC758 \uD0C0\uC785 \uC815\uC758
|
|
3881
|
-
${properties.map(
|
|
3882
|
-
(property) => `
|
|
3883
|
-
\`\`\`
|
|
3884
|
-
${property.key}.constant.ts
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
${property.source}
|
|
3888
|
-
\`\`\`
|
|
3889
|
-
`
|
|
3890
|
-
).join("\n\n")}
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
8. \uC608\uC2DC \uD30C\uC77C\uB4E4
|
|
3894
|
-
${exampleFiles.map(
|
|
3895
|
-
(example) => `
|
|
3896
|
-
Example filename: ${example.filepath}
|
|
3897
|
-
\`\`\`
|
|
3898
|
-
${example.content}
|
|
3899
|
-
\`\`\`
|
|
3900
|
-
`
|
|
3901
|
-
).join("\n\n")}
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
\uC5ED\uD560\uBD80\uC5EC
|
|
3909
|
-
- Akan.js \uC0AC\uB0B4 \uD504\uB808\uC784\uC6CC\uD06C \uAE30\uBC18 Typescript \uC2DC\uB2C8\uC5B4 \uD504\uB860\uD2B8\uC5D4\uB4DC \uAC1C\uBC1C\uC790.
|
|
3910
|
-
|
|
3911
|
-
\uCF54\uB529 \uADDC\uCE59
|
|
3912
|
-
- \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
3913
|
-
- \uC544\uC774\uCF58: react-icons \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
3914
|
-
- CSS: tailwind, DaisyUI(btn, input, badge \uAC19\uC740 \uAE30\uBCF8 \uC694\uC18C\uB9CC \uC0AC\uC6A9 \uAC00\uB2A5, card/hero \uAC19\uC740 \uBCF5\uC7A1\uD55C \uCEF4\uD3EC\uB10C\uD2B8 \uC0AC\uC6A9 X) \uC0AC\uC6A9
|
|
3915
|
-
- Ui Component: @util/ui \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
3916
|
-
- \uC870\uAC74\uBD80 \uD074\uB798\uC2A4: clsx \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
3917
|
-
\uCF54\uB4DC \uC2A4\uD0C0\uC77C
|
|
3918
|
-
- \uC0C9\uC0C1: \uD558\uB4DC\uCF54\uB529(bg-red) \uB300\uC2E0 \uD14C\uB9C8 \uC0C9\uC0C1(bg-primary) \uC0AC\uC6A9
|
|
3919
|
-
- \uC870\uAC74\uBD80 \uB80C\uB354\uB9C1: field && <div>... \uB300\uC2E0 field ? <div>... : null \uC0AC\uC6A9
|
|
3920
|
-
- \uBAA8\uB378 \uC811\uADFC: \uAD6C\uC870\uBD84\uD574\uD560\uB2F9 \uB300\uC2E0 ${modelName}.field \uD615\uC2DD\uC73C\uB85C \uC811\uADFC
|
|
3921
|
-
- \uD0C0\uC785 \uC548\uC804: ${modelName}.constant.ts\uC758 \uC2A4\uD0A4\uB9C8 \uCC38\uC870\uD558\uC5EC \uC5D0\uB7EC \uBC29\uC9C0
|
|
3922
|
-
\uD544\uB4DC \uC811\uADFC \uC804: \uC2A4\uD0A4\uB9C8\uC758 \uC2E4\uC81C \uD544\uB4DC \uB9AC\uC2A4\uD2B8 \uC791\uC131 \uBC0F \uAC80\uD1A0 \uD544\uC218
|
|
3923
|
-
|
|
3924
|
-
\uC5C4\uACA9\uD55C \uC8FC\uC758\uC0AC\uD56D
|
|
3925
|
-
- UI \uD0B7\uC740 \uBB38\uC11C\uC5D0 \uBA85\uC2DC\uB41C \uCEF4\uD3EC\uB10C\uD2B8\uB9CC \uC0AC\uC6A9
|
|
3926
|
-
- \uCEF4\uD3EC\uB10C\uD2B8 \uC0AC\uC6A9 \uC804 \uBB38\uC11C \uD655\uC778 \uBC0F props \uC815\uD655\uD788 \uAC80\uC99D
|
|
3927
|
-
- \uBA85\uC2DC\uB41C \uB8F0 \uC678 \uC784\uC758 \uCD94\uC0C1\uD654 \uAE08\uC9C0
|
|
3928
|
-
- dayjs \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB294 @akanjs/base\uC5D0\uC11C \uB798\uD551\uD558\uC5EC \uC81C\uACF5\uD558\uACE0 \uC788\uC74C.
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
`;
|
|
3934
3993
|
var scalarConstantDescription = `
|
|
3935
3994
|
Purpose and Structure
|
|
3936
3995
|
|
|
@@ -4268,159 +4327,56 @@ The \`@Field.Prop()\` decorator is commonly used in different model types:
|
|
|
4268
4327
|
- Reference options enable building relationships between different models
|
|
4269
4328
|
- Aggregation options support analytics use cases
|
|
4270
4329
|
`;
|
|
4271
|
-
var
|
|
4272
|
-
sysName,
|
|
4330
|
+
var componentDefaultDescription = ({
|
|
4273
4331
|
modelName,
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4332
|
+
ModelName,
|
|
4333
|
+
exampleFiles,
|
|
4334
|
+
constant,
|
|
4335
|
+
properties
|
|
4278
4336
|
}) => `
|
|
4279
|
-
|
|
4280
|
-
\uB2E4\uC74C\uC758 \uBC30\uACBD \uC815\uBCF4\uB97C \uBC14\uD0D5\uC73C\uB85C ${modelName}.constant.ts \uD30C\uC77C\uC744 \uC791\uC131\uD574\uC918.
|
|
4337
|
+
|
|
4281
4338
|
|
|
4282
4339
|
1. Akan.js \uD504\uB808\uC784\uC6CC\uD06C\uC5D0 \uB300\uD55C \uAC1C\uC694
|
|
4283
4340
|
${frameworkAbstract}
|
|
4284
4341
|
|
|
4285
|
-
2.
|
|
4286
|
-
${
|
|
4287
|
-
|
|
4288
|
-
3. <model>.constant.ts \uD30C\uC77C\uC758 Enum \uC791\uC131\uBC95
|
|
4289
|
-
${howToSetEnumInModelConstant}
|
|
4290
|
-
|
|
4291
|
-
4. <model>.constant.ts \uD30C\uC77C\uC758 Field \uC791\uC131\uBC95
|
|
4292
|
-
${howToSetFieldInModelConstant}
|
|
4342
|
+
2. Akan.js\uD504\uB808\uC784\uC6CC\uD06C \uB370\uC774\uD130 \uAE30\uBC18 \uBAA8\uB4C8\uC5D0 \uB300\uD55C \uC124\uBA85
|
|
4343
|
+
${moduleDesription}
|
|
4293
4344
|
|
|
4294
|
-
|
|
4295
|
-
${
|
|
4296
|
-
(constant) => `
|
|
4297
|
-
Example file: ${constant.filepath}
|
|
4298
|
-
\`\`\`
|
|
4299
|
-
${constant.content}
|
|
4300
|
-
\`\`\`
|
|
4301
|
-
`
|
|
4302
|
-
).join("\n")}
|
|
4345
|
+
3. Akan.js eslint \uC124\uC815\uC5D0 \uB300\uD55C \uC124\uBA85
|
|
4346
|
+
${eslintDescription}
|
|
4303
4347
|
|
|
4348
|
+
4. util/ui \uB0B4 ui\uD0B7\uC5D0 \uB300\uD55C \uC124\uBA85
|
|
4349
|
+
${utilUiDescription}
|
|
4304
4350
|
|
|
4305
|
-
|
|
4351
|
+
5. shared/ui \uB0B4 ui\uD0B7\uC5D0 \uB300\uD55C \uC124\uBA85
|
|
4352
|
+
${shardUiDescription}
|
|
4306
4353
|
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
Model description: ${modelDesc}
|
|
4310
|
-
Model schema design: ${modelSchemaDesign}
|
|
4354
|
+
6. ${ModelName}.constant.ts \uD30C\uC77C\uC5D0 \uB300\uD55C \uC815\uBCF4
|
|
4355
|
+
${constant}
|
|
4311
4356
|
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
\`\`\`
|
|
4316
|
-
`;
|
|
4317
|
-
var requestTemplate = ({
|
|
4318
|
-
sysName,
|
|
4319
|
-
modelName,
|
|
4320
|
-
ModelName,
|
|
4321
|
-
boilerplate,
|
|
4322
|
-
constant,
|
|
4323
|
-
properties,
|
|
4324
|
-
exampleFiles
|
|
4325
|
-
}) => `
|
|
4326
|
-
${componentDefaultDescription({
|
|
4327
|
-
sysName,
|
|
4328
|
-
modelName,
|
|
4329
|
-
ModelName,
|
|
4330
|
-
exampleFiles,
|
|
4331
|
-
constant,
|
|
4332
|
-
properties
|
|
4333
|
-
})}
|
|
4334
|
-
\uC694\uCCAD\uC0AC\uD56D
|
|
4335
|
-
- \uC544\uB798 \uC81C\uACF5\uD560 \uAE30\uBCF8 \uD15C\uD50C\uB9BF \uCF54\uB4DC\uC5D0 \uCD94\uAC00\uB85C \uCEF4\uD3EC\uB10C\uD2B8 \uAC1C\uBC1C
|
|
4336
|
-
- ${ModelName}.Template.tsx \uCF54\uB4DC \uC791\uC131
|
|
4337
|
-
- \uCEF4\uD3EC\uB10C\uD2B8 \uC774\uB984\uC740 \uBAA8\uB378 \uC774\uB984\uC740 \uC2A4\uD0A4\uB9C8\uC5D0 \uAE30\uBC18\uD55C \uAE30\uB2A5\uC5D0 \uCD08\uC810\uC744 \uB450\uACE0 \uC791\uC131
|
|
4338
|
-
- \uC544\uB798 \uC81C\uACF5\uD560 \uBCF4\uC77C\uB7EC\uD50C\uB808\uC774\uD2B8\uC5D0 \uC788\uB294 General \uCEF4\uD3EC\uB10C\uD2B8 1\uAC1C\uB97C \uC81C\uC678\uD55C \uB514\uC790\uC778 \uCEF4\uD3EC\uB10C\uD2B8 4\uAC1C \uAC1C\uBC1C
|
|
4339
|
-
- \uCD94\uC0C1\uD654 \uD574\uC57C\uD558\uB294 \uACBD\uC6B0\uAC00 \uC788\uC744 \uACBD\uC6B0\uC5D4 \uBB38\uC11C\uB97C \uB2E4\uC2DC \uCC38\uACE0\uD558\uACE0 \uC124\uBA85\uB41C \uB0B4\uC5D0\uC11C \uD574\uACB0\uD574\uC57C\uD568.
|
|
4340
|
-
- \uBCF4\uC77C\uB7EC\uD50C\uB808\uC774\uD2B8\uC5D0 \uB9DE\uAC8C \uC815\uB9AC\uD574\uC11C \uC81C\uACF5
|
|
4341
|
-
-
|
|
4342
|
-
|
|
4343
|
-
Application name: ${sysName}
|
|
4344
|
-
Model name: ${modelName}
|
|
4345
|
-
Target filename: ${ModelName}.Template.tsx
|
|
4357
|
+
7. ${modelName}\uC5D0\uC11C \uC885\uC18D\uB418\uB294 \uB2E4\uB978 \uBAA8\uB378\uB4E4\uC758 \uD0C0\uC785 \uC815\uC758
|
|
4358
|
+
${properties.map(
|
|
4359
|
+
(property) => `
|
|
4346
4360
|
\`\`\`
|
|
4361
|
+
${property.key}.constant.ts
|
|
4347
4362
|
|
|
4348
|
-
\`\`\`
|
|
4349
4363
|
|
|
4350
|
-
|
|
4351
|
-
`;
|
|
4352
|
-
var requestView = ({
|
|
4353
|
-
sysName,
|
|
4354
|
-
modelName,
|
|
4355
|
-
ModelName,
|
|
4356
|
-
boilerplate,
|
|
4357
|
-
constant,
|
|
4358
|
-
properties,
|
|
4359
|
-
exampleFiles
|
|
4360
|
-
}) => `
|
|
4361
|
-
${componentDefaultDescription({
|
|
4362
|
-
sysName,
|
|
4363
|
-
modelName,
|
|
4364
|
-
ModelName,
|
|
4365
|
-
exampleFiles,
|
|
4366
|
-
constant,
|
|
4367
|
-
properties
|
|
4368
|
-
})}
|
|
4369
|
-
\uC694\uCCAD\uC0AC\uD56D
|
|
4370
|
-
- \uC544\uB798 \uC81C\uACF5\uD560 \uAE30\uBCF8 \uD15C\uD50C\uB9BF \uCF54\uB4DC\uC5D0 \uCD94\uAC00\uB85C \uCEF4\uD3EC\uB10C\uD2B8 \uAC1C\uBC1C
|
|
4371
|
-
- ${ModelName}.View.tsx \uCF54\uB4DC \uC791\uC131
|
|
4372
|
-
- \uCEF4\uD3EC\uB10C\uD2B8 \uC774\uB984\uC5D0 ${ModelName}\uC740 \uC0DD\uB7B5\uD558\uBA70, \uB514\uC790\uC778 \uC911\uC810\uC758 \uC774\uB984\uC73C\uB85C \uC791\uC131
|
|
4373
|
-
- \uC544\uB798 \uC81C\uACF5\uD560 \uBCF4\uC77C\uB7EC\uD50C\uB808\uC774\uD2B8\uC5D0 \uC788\uB294 General \uCEF4\uD3EC\uB10C\uD2B8 1\uAC1C\uB97C \uC81C\uC678\uD55C \uB514\uC790\uC778 \uCEF4\uD3EC\uB10C\uD2B8 4\uAC1C \uAC1C\uBC1C
|
|
4374
|
-
- \uCD94\uC0C1\uD654 \uD574\uC57C\uD558\uB294 \uACBD\uC6B0\uAC00 \uC788\uC744 \uACBD\uC6B0\uC5D4 \uBB38\uC11C\uB97C \uB2E4\uC2DC \uCC38\uACE0\uD558\uACE0 \uC124\uBA85\uB41C \uB0B4\uC5D0\uC11C \uD574\uACB0\uD574\uC57C\uD568.
|
|
4375
|
-
- \uBCF4\uC77C\uB7EC\uD50C\uB808\uC774\uD2B8\uC5D0 \uB9DE\uAC8C \uC815\uB9AC\uD574\uC11C \uC81C\uACF5
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
Application name: ${sysName}
|
|
4379
|
-
Model name: ${modelName}
|
|
4380
|
-
|
|
4381
|
-
Target filename: ${ModelName}.View.tsx
|
|
4382
|
-
\`\`\`
|
|
4383
|
-
${boilerplate}
|
|
4364
|
+
${property.source}
|
|
4384
4365
|
\`\`\`
|
|
4366
|
+
`
|
|
4367
|
+
).join("\n\n")}
|
|
4385
4368
|
|
|
4386
|
-
|
|
4387
|
-
`;
|
|
4388
|
-
var requestUnit = ({
|
|
4389
|
-
sysName,
|
|
4390
|
-
modelName,
|
|
4391
|
-
ModelName,
|
|
4392
|
-
constant,
|
|
4393
|
-
properties,
|
|
4394
|
-
boilerplate,
|
|
4395
|
-
exampleFiles
|
|
4396
|
-
}) => `
|
|
4397
|
-
${componentDefaultDescription({
|
|
4398
|
-
sysName,
|
|
4399
|
-
modelName,
|
|
4400
|
-
ModelName,
|
|
4401
|
-
exampleFiles,
|
|
4402
|
-
constant,
|
|
4403
|
-
properties
|
|
4404
|
-
})}
|
|
4405
|
-
|
|
4406
|
-
\uC694\uCCAD\uC0AC\uD56D
|
|
4407
|
-
- \uC544\uB798 \uC81C\uACF5\uD560 \uAE30\uBCF8 \uD15C\uD50C\uB9BF \uCF54\uB4DC\uC5D0 \uCD94\uAC00\uB85C \uCEF4\uD3EC\uB10C\uD2B8 \uAC1C\uBC1C
|
|
4408
|
-
- ${ModelName}.Unit.tsx \uCF54\uB4DC \uC791\uC131
|
|
4409
|
-
- \uCEF4\uD3EC\uB10C\uD2B8 \uC774\uB984\uC5D0 ${ModelName}\uC740 \uC0DD\uB7B5\uD558\uBA70, \uB514\uC790\uC778 \uC911\uC810\uC758 \uC774\uB984\uC73C\uB85C \uC791\uC131
|
|
4410
|
-
- \uC608\uC2DC\uD30C\uC77C \uCEF4\uD3EC\uB10C\uD2B8\uC758 \uAE30\uBC18\uD558\uC5EC \uC77C\uBC18\uC801\uC73C\uB85C \uC0AC\uC6A9 \uAC00\uB2A5\uD55C \uCEF4\uD3EC\uB10C\uD2B8 1\uAC1C\uC640 \uB514\uC790\uC778\uC801 \uC694\uC18C\uAC00 \uD3EC\uD568\uB41C \uCEF4\uD3EC\uB10C\uD2B8 3\uAC1C \uAC1C\uBC1C
|
|
4411
|
-
- \uCD94\uC0C1\uD654 \uD574\uC57C\uD558\uB294 \uACBD\uC6B0\uAC00 \uC788\uC744 \uACBD\uC6B0\uC5D4 \uBB38\uC11C\uB97C \uB2E4\uC2DC \uCC38\uACE0\uD558\uACE0 \uC124\uBA85\uB41C \uB0B4\uC5D0\uC11C \uD574\uACB0\uD574\uC57C\uD568.
|
|
4412
|
-
- \uBCF4\uC77C\uB7EC\uD50C\uB808\uC774\uD2B8\uC5D0 \uB9DE\uAC8C \uC815\uB9AC\uD574\uC11C \uC81C\uACF5
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
Application name: ${sysName}
|
|
4416
|
-
Model name: ${modelName}
|
|
4417
4369
|
|
|
4418
|
-
|
|
4370
|
+
8. \uC608\uC2DC \uD30C\uC77C\uB4E4
|
|
4371
|
+
${exampleFiles.map(
|
|
4372
|
+
(example) => `
|
|
4373
|
+
Example filename: ${example.filepath}
|
|
4419
4374
|
\`\`\`
|
|
4420
|
-
${
|
|
4375
|
+
${example.content}
|
|
4421
4376
|
\`\`\`
|
|
4377
|
+
`
|
|
4378
|
+
).join("\n\n")}
|
|
4422
4379
|
|
|
4423
|
-
|
|
4424
4380
|
`;
|
|
4425
4381
|
|
|
4426
4382
|
// pkgs/@akanjs/cli/src/application/application.prompt.ts
|
|
@@ -4474,7 +4430,7 @@ var ApplicationRunner = class {
|
|
|
4474
4430
|
}
|
|
4475
4431
|
async removeApplication(app) {
|
|
4476
4432
|
await app.workspace.exec(`rm -rf apps/${app.name}`);
|
|
4477
|
-
app.
|
|
4433
|
+
app.workspace.unsetTsPaths("app", app.name);
|
|
4478
4434
|
}
|
|
4479
4435
|
async getConfig(app) {
|
|
4480
4436
|
return await getAppConfig(app.cwdPath, {
|
|
@@ -4537,7 +4493,7 @@ var ApplicationRunner = class {
|
|
|
4537
4493
|
app.dist.writeJson("backend/package.json", appPackageJson);
|
|
4538
4494
|
app.dist.writeFile(path5.join(app.dist.cwdPath, "backend", "Dockerfile"), akanConfig.backend.dockerfile);
|
|
4539
4495
|
}
|
|
4540
|
-
async startBackend(app, { open: open2 = false } = {}) {
|
|
4496
|
+
async startBackend(app, { open: open2 = false, onStart } = {}) {
|
|
4541
4497
|
const { env } = await this.#prepareCommand(app, "start", "backend");
|
|
4542
4498
|
const ctx = await esbuild2.context({
|
|
4543
4499
|
write: true,
|
|
@@ -4551,14 +4507,15 @@ var ApplicationRunner = class {
|
|
|
4551
4507
|
});
|
|
4552
4508
|
await ctx.watch();
|
|
4553
4509
|
await sleep(100);
|
|
4510
|
+
onStart?.();
|
|
4554
4511
|
if (open2)
|
|
4555
4512
|
setTimeout(() => openBrowser("http://localhost:8080/backend/graphql"), 3e3);
|
|
4556
|
-
await app.dist.spawn("node", ["--watch", "backend/main.js"], { env });
|
|
4513
|
+
await app.dist.spawn("node", ["--watch", "backend/main.js"], { env, stdio: "inherit" });
|
|
4557
4514
|
}
|
|
4558
4515
|
async buildFrontend(app) {
|
|
4559
4516
|
const { env } = await this.#prepareCommand(app, "build", "frontend");
|
|
4560
4517
|
const akanConfig = await app.getConfig("build");
|
|
4561
|
-
await app.spawn("npx", ["next", "build", "--no-lint"], { env
|
|
4518
|
+
await app.spawn("npx", ["next", "build", "--no-lint"], { env });
|
|
4562
4519
|
const buildResult = await esbuild2.build({
|
|
4563
4520
|
entryPoints: [`${app.cwdPath}/next.config.ts`],
|
|
4564
4521
|
outdir: `${app.dist.cwdPath}/frontend`,
|
|
@@ -4588,10 +4545,11 @@ var ApplicationRunner = class {
|
|
|
4588
4545
|
]);
|
|
4589
4546
|
app.dist.writeFile("frontend/Dockerfile", akanConfig.frontend.dockerfile);
|
|
4590
4547
|
}
|
|
4591
|
-
async startFrontend(app, { open: open2 = false, turbo = true } = {}) {
|
|
4548
|
+
async startFrontend(app, { open: open2 = false, turbo = true, onStart } = {}) {
|
|
4592
4549
|
const { env } = await this.#prepareCommand(app, "start", "frontend");
|
|
4593
4550
|
if (open2)
|
|
4594
4551
|
setTimeout(() => openBrowser("http://localhost:4200"), 3e3);
|
|
4552
|
+
onStart?.();
|
|
4595
4553
|
await app.spawn("npx", ["next", "dev", "-p", "4200", ...turbo ? ["--turbo"] : []], { env });
|
|
4596
4554
|
}
|
|
4597
4555
|
async #getViteConfig(app, command) {
|
|
@@ -4674,10 +4632,11 @@ var ApplicationRunner = class {
|
|
|
4674
4632
|
const config = await this.#getViteConfig(app, "build");
|
|
4675
4633
|
await vite.build(config);
|
|
4676
4634
|
}
|
|
4677
|
-
async startCsr(app, { open: open2 = false } = {}) {
|
|
4635
|
+
async startCsr(app, { open: open2 = false, onStart } = {}) {
|
|
4678
4636
|
const config = await this.#getViteConfig(app, "start");
|
|
4679
4637
|
const server = await vite.createServer(config);
|
|
4680
4638
|
await server.listen(4201);
|
|
4639
|
+
onStart?.();
|
|
4681
4640
|
app.log(`CSR server is running on http://localhost:4201`);
|
|
4682
4641
|
if (open2)
|
|
4683
4642
|
setTimeout(() => openBrowser("http://localhost:4201"), 3e3);
|
|
@@ -4744,13 +4703,10 @@ var ApplicationRunner = class {
|
|
|
4744
4703
|
dict: { repoName: workspace.repoName },
|
|
4745
4704
|
overwrite: false
|
|
4746
4705
|
});
|
|
4747
|
-
await workspace.spawn(`docker`, ["compose", "up", "-d"], {
|
|
4748
|
-
cwd: `${workspace.workspaceRoot}/local`,
|
|
4749
|
-
stdio: "ignore"
|
|
4750
|
-
});
|
|
4706
|
+
await workspace.spawn(`docker`, ["compose", "up", "-d"], { cwd: `${workspace.workspaceRoot}/local` });
|
|
4751
4707
|
}
|
|
4752
4708
|
async dbdown(workspace) {
|
|
4753
|
-
await workspace.spawn(`docker`, ["compose", "down"], { cwd: `${workspace.workspaceRoot}/local
|
|
4709
|
+
await workspace.spawn(`docker`, ["compose", "down"], { cwd: `${workspace.workspaceRoot}/local` });
|
|
4754
4710
|
}
|
|
4755
4711
|
async configureApp(app) {
|
|
4756
4712
|
const capacitorApp = new CapacitorApp(app);
|
|
@@ -4910,7 +4866,7 @@ var ApplicationRunner = class {
|
|
|
4910
4866
|
const chatModel = new ChatOpenAI3({ modelName: "gpt-4o", openAIApiKey });
|
|
4911
4867
|
const projectName = await input3({ message: "please enter project name." });
|
|
4912
4868
|
const projectDesc = await input3({ message: "please enter project description. (40 ~ 60 characters)" });
|
|
4913
|
-
const spinner =
|
|
4869
|
+
const spinner = ora3("Gerating project files...");
|
|
4914
4870
|
const mainPrompt = PromptTemplate2.fromTemplate(requestApplication());
|
|
4915
4871
|
const chain = RunnableSequence2.from([mainPrompt, chatModel, new StringOutputParser()]);
|
|
4916
4872
|
const resultOne = await chain.invoke({ projectName, projectDesc });
|
|
@@ -4949,20 +4905,22 @@ var ApplicationScript = class {
|
|
|
4949
4905
|
#runner = new ApplicationRunner();
|
|
4950
4906
|
libraryScript = new LibraryScript();
|
|
4951
4907
|
async createApplication(appName, workspace, { start = false } = {}) {
|
|
4908
|
+
const spinner = workspace.spinning("Creating application...");
|
|
4952
4909
|
const app = await this.#runner.createApplication(appName, workspace);
|
|
4910
|
+
spinner.succeed(`Application created in apps/${app.name}`);
|
|
4953
4911
|
await this.syncApplication(app);
|
|
4954
4912
|
if (start)
|
|
4955
4913
|
await this.start(app, { open: true });
|
|
4956
4914
|
}
|
|
4957
4915
|
async removeApplication(app) {
|
|
4916
|
+
const spinner = app.spinning("Removing application...");
|
|
4958
4917
|
await this.#runner.removeApplication(app);
|
|
4918
|
+
spinner.succeed(`Application ${app.name} (apps/${app.name}) removed`);
|
|
4959
4919
|
}
|
|
4960
|
-
async syncApplication(app
|
|
4920
|
+
async syncApplication(app) {
|
|
4961
4921
|
const spinner = app.spinning("Scanning application...");
|
|
4962
4922
|
const akanConfig = await this.#runner.getConfig(app);
|
|
4963
4923
|
const scanResult = await this.#runner.scanSync(app, akanConfig);
|
|
4964
|
-
if (verbose)
|
|
4965
|
-
app.logger.rawLog(JSON.stringify(scanResult, null, 2));
|
|
4966
4924
|
spinner.succeed("Application scanned");
|
|
4967
4925
|
return scanResult;
|
|
4968
4926
|
}
|
|
@@ -4981,24 +4939,39 @@ var ApplicationScript = class {
|
|
|
4981
4939
|
await this.syncApplication(app);
|
|
4982
4940
|
const spinner = app.spinning("Building backend...");
|
|
4983
4941
|
await this.#runner.buildBackend(app);
|
|
4984
|
-
spinner.succeed(`
|
|
4942
|
+
spinner.succeed(`Backend built in dist/apps/${app.name}/backend`);
|
|
4985
4943
|
}
|
|
4986
|
-
async startBackend(app, { open: open2 = false, sync = true } = {}) {
|
|
4944
|
+
async startBackend(app, { open: open2 = false, dbup = true, sync = true } = {}) {
|
|
4945
|
+
if (app.getEnv() === "local" && dbup)
|
|
4946
|
+
await this.dbup(app.workspace);
|
|
4987
4947
|
if (sync)
|
|
4988
4948
|
await this.syncApplication(app);
|
|
4989
|
-
|
|
4949
|
+
const spinner = app.spinning("Preparing backend...");
|
|
4950
|
+
await this.#runner.startBackend(app, {
|
|
4951
|
+
open: open2,
|
|
4952
|
+
onStart: () => {
|
|
4953
|
+
spinner.succeed(`Backend prepared, ready to start`);
|
|
4954
|
+
}
|
|
4955
|
+
});
|
|
4990
4956
|
}
|
|
4991
4957
|
async buildFrontend(app, { sync = true } = {}) {
|
|
4992
4958
|
if (sync)
|
|
4993
4959
|
await this.syncApplication(app);
|
|
4994
4960
|
const spinner = app.spinning("Building frontend...");
|
|
4995
4961
|
await this.#runner.buildFrontend(app);
|
|
4996
|
-
spinner.succeed(`
|
|
4962
|
+
spinner.succeed(`Frontend built in dist/apps/${app.name}/frontend`);
|
|
4997
4963
|
}
|
|
4998
4964
|
async startFrontend(app, { open: open2 = false, turbo = false, sync = true } = {}) {
|
|
4999
4965
|
if (sync)
|
|
5000
4966
|
await this.syncApplication(app);
|
|
5001
|
-
|
|
4967
|
+
const spinner = app.spinning("Preparing frontend...");
|
|
4968
|
+
await this.#runner.startFrontend(app, {
|
|
4969
|
+
open: open2,
|
|
4970
|
+
turbo,
|
|
4971
|
+
onStart: () => {
|
|
4972
|
+
spinner.succeed(`Frontend prepared, ready to start`);
|
|
4973
|
+
}
|
|
4974
|
+
});
|
|
5002
4975
|
}
|
|
5003
4976
|
async buildCsr(app, { sync = true } = {}) {
|
|
5004
4977
|
if (sync)
|
|
@@ -5010,7 +4983,13 @@ var ApplicationScript = class {
|
|
|
5010
4983
|
async startCsr(app, { open: open2 = false, sync = true } = {}) {
|
|
5011
4984
|
if (sync)
|
|
5012
4985
|
await this.syncApplication(app);
|
|
5013
|
-
|
|
4986
|
+
const spinner = app.spinning("Preparing CSR...");
|
|
4987
|
+
await this.#runner.startCsr(app, {
|
|
4988
|
+
open: open2,
|
|
4989
|
+
onStart: () => {
|
|
4990
|
+
spinner.succeed(`CSR prepared, ready to start`);
|
|
4991
|
+
}
|
|
4992
|
+
});
|
|
5014
4993
|
}
|
|
5015
4994
|
async buildIos(app, { sync = true } = {}) {
|
|
5016
4995
|
if (sync)
|
|
@@ -5049,13 +5028,17 @@ var ApplicationScript = class {
|
|
|
5049
5028
|
await this.#runner.releaseAndroid(app);
|
|
5050
5029
|
}
|
|
5051
5030
|
async dumpDatabase(app, environment) {
|
|
5031
|
+
await this.dbdown(app.workspace);
|
|
5032
|
+
const spinner = app.spinning("Dumping database...");
|
|
5052
5033
|
await this.#runner.dumpDatabase(app, environment);
|
|
5034
|
+
spinner.succeed(`Database dumped to dump/${app.name}-${environment}`);
|
|
5053
5035
|
}
|
|
5054
5036
|
async restoreDatabase(app, source, target) {
|
|
5037
|
+
const spinner = app.spinning("Restoring database...");
|
|
5055
5038
|
await this.#runner.restoreDatabase(app, source, target);
|
|
5039
|
+
spinner.succeed(`Database restored from dump/${app.name}-${source} to ${app.name}-${target}`);
|
|
5056
5040
|
}
|
|
5057
5041
|
async pullDatabase(app, environment, dump) {
|
|
5058
|
-
await this.dbdown(app.workspace);
|
|
5059
5042
|
const hasDump = app.workspace.exists(`dump/${app.name}-${environment}`);
|
|
5060
5043
|
if (dump || !hasDump)
|
|
5061
5044
|
await this.dumpDatabase(app, environment);
|
|
@@ -5071,14 +5054,12 @@ var ApplicationScript = class {
|
|
|
5071
5054
|
async dbup(workspace) {
|
|
5072
5055
|
const spinner = workspace.spinning("Starting local database...");
|
|
5073
5056
|
await this.#runner.dbup(workspace);
|
|
5074
|
-
spinner.succeed(
|
|
5075
|
-
"Local database(/local/docker-compose.yaml) is up, you can start your application and connect to the database"
|
|
5076
|
-
);
|
|
5057
|
+
spinner.succeed("Local database (/local/docker-compose.yaml) is up");
|
|
5077
5058
|
}
|
|
5078
5059
|
async dbdown(workspace) {
|
|
5079
5060
|
const spinner = workspace.spinning("Stopping local database...");
|
|
5080
5061
|
await this.#runner.dbdown(workspace);
|
|
5081
|
-
spinner.succeed("Local database(/local/docker-compose.yaml) is down");
|
|
5062
|
+
spinner.succeed("Local database (/local/docker-compose.yaml) is down");
|
|
5082
5063
|
}
|
|
5083
5064
|
async testSys(sys2) {
|
|
5084
5065
|
if (sys2.type === "app")
|
|
@@ -5087,21 +5068,23 @@ var ApplicationScript = class {
|
|
|
5087
5068
|
await this.libraryScript.testLibrary(sys2);
|
|
5088
5069
|
}
|
|
5089
5070
|
async testApplication(app) {
|
|
5071
|
+
const spinner = app.spinning("Testing application...");
|
|
5090
5072
|
await this.#runner.testApplication(app);
|
|
5073
|
+
spinner.succeed(`Application ${app.name} (apps/${app.name}) test is successful`);
|
|
5091
5074
|
}
|
|
5092
5075
|
};
|
|
5093
5076
|
|
|
5094
5077
|
// pkgs/@akanjs/cli/src/application/application.command.ts
|
|
5095
5078
|
var ApplicationCommand = class {
|
|
5096
5079
|
applicationScript = new ApplicationScript();
|
|
5097
|
-
async createApplication(
|
|
5098
|
-
await this.applicationScript.createApplication(
|
|
5080
|
+
async createApplication(appName, start, workspace) {
|
|
5081
|
+
await this.applicationScript.createApplication(appName.toLowerCase().replace(/ /g, "-"), workspace, { start });
|
|
5099
5082
|
}
|
|
5100
5083
|
async removeApplication(app) {
|
|
5101
5084
|
await this.applicationScript.removeApplication(app);
|
|
5102
5085
|
}
|
|
5103
|
-
async syncApplication(app
|
|
5104
|
-
await this.applicationScript.syncApplication(app
|
|
5086
|
+
async syncApplication(app) {
|
|
5087
|
+
await this.applicationScript.syncApplication(app);
|
|
5105
5088
|
}
|
|
5106
5089
|
async build(app) {
|
|
5107
5090
|
await this.applicationScript.build(app);
|
|
@@ -5172,7 +5155,7 @@ var ApplicationCommand = class {
|
|
|
5172
5155
|
};
|
|
5173
5156
|
__decorateClass([
|
|
5174
5157
|
Target.Public(),
|
|
5175
|
-
__decorateParam(0,
|
|
5158
|
+
__decorateParam(0, Argument("appName", { desc: "name of application" })),
|
|
5176
5159
|
__decorateParam(1, Option("start", { type: "boolean", desc: "start application", default: false })),
|
|
5177
5160
|
__decorateParam(2, Workspace())
|
|
5178
5161
|
], ApplicationCommand.prototype, "createApplication", 1);
|
|
@@ -5182,8 +5165,7 @@ __decorateClass([
|
|
|
5182
5165
|
], ApplicationCommand.prototype, "removeApplication", 1);
|
|
5183
5166
|
__decorateClass([
|
|
5184
5167
|
Target.Public(),
|
|
5185
|
-
__decorateParam(0, App())
|
|
5186
|
-
__decorateParam(1, Option("verbose", { type: "boolean", desc: "verbose", default: false }))
|
|
5168
|
+
__decorateParam(0, App())
|
|
5187
5169
|
], ApplicationCommand.prototype, "syncApplication", 1);
|
|
5188
5170
|
__decorateClass([
|
|
5189
5171
|
Target.Public({ short: true }),
|
|
@@ -5322,10 +5304,11 @@ var PackageRunner = class {
|
|
|
5322
5304
|
template: "pkgRoot",
|
|
5323
5305
|
dict: { pkgName, PkgName: capitalize(pkgName) }
|
|
5324
5306
|
});
|
|
5307
|
+
workspace.setTsPaths("pkg", pkgName);
|
|
5325
5308
|
}
|
|
5326
5309
|
async removePackage(pkg) {
|
|
5327
5310
|
await pkg.workspace.exec(`rm -rf pkgs/${pkg.name}`);
|
|
5328
|
-
pkg.
|
|
5311
|
+
pkg.workspace.unsetTsPaths("pkg", pkg.name);
|
|
5329
5312
|
}
|
|
5330
5313
|
async scanSync(pkg) {
|
|
5331
5314
|
const scanResult = await pkg.scan();
|
|
@@ -5352,17 +5335,25 @@ var PackageScript = class {
|
|
|
5352
5335
|
await this.#runner.version(workspace);
|
|
5353
5336
|
}
|
|
5354
5337
|
async createPackage(workspace, pkgName) {
|
|
5338
|
+
const spinner = workspace.spinning(`Creating package in pkgs/${pkgName}...`);
|
|
5355
5339
|
await this.#runner.createPackage(workspace, pkgName);
|
|
5340
|
+
spinner.succeed(`Package in pkgs/${pkgName} is created`);
|
|
5356
5341
|
}
|
|
5357
5342
|
async removePackage(pkg) {
|
|
5343
|
+
const spinner = pkg.spinning(`Removing package in pkgs/${pkg.name}...`);
|
|
5358
5344
|
await this.#runner.removePackage(pkg);
|
|
5345
|
+
spinner.succeed("Package removed");
|
|
5359
5346
|
}
|
|
5360
|
-
async
|
|
5347
|
+
async syncPackage(pkg) {
|
|
5348
|
+
const spinner = pkg.spinning("Scanning package...");
|
|
5361
5349
|
const scanResult = await this.#runner.scanSync(pkg);
|
|
5362
|
-
|
|
5350
|
+
spinner.succeed("Package scanned");
|
|
5351
|
+
return scanResult;
|
|
5363
5352
|
}
|
|
5364
5353
|
async buildPackage(pkg) {
|
|
5354
|
+
const spinner = pkg.spinning("Building package...");
|
|
5365
5355
|
await this.#runner.buildPackage(pkg);
|
|
5356
|
+
spinner.succeed("Package built");
|
|
5366
5357
|
}
|
|
5367
5358
|
};
|
|
5368
5359
|
|
|
@@ -5437,11 +5428,10 @@ ${chalk4.green("\u27A4")} Authentication Required`));
|
|
|
5437
5428
|
}
|
|
5438
5429
|
async setLlm() {
|
|
5439
5430
|
await AiSession.init({ useExisting: true });
|
|
5440
|
-
Logger.rawLog(chalk4.green("LLM model set successfully"));
|
|
5441
5431
|
}
|
|
5442
5432
|
resetLlm() {
|
|
5443
5433
|
AiSession.setLlmConfig(null);
|
|
5444
|
-
Logger.rawLog(chalk4.green("LLM model
|
|
5434
|
+
Logger.rawLog(chalk4.green("\u2611\uFE0F LLM model config is cleared. Please run `akan set-llm` to set a new LLM model."));
|
|
5445
5435
|
}
|
|
5446
5436
|
async getAkanPkgs(workspace) {
|
|
5447
5437
|
const pkgs = await workspace.getPkgs();
|
|
@@ -5471,7 +5461,7 @@ ${chalk4.green("\u27A4")} Authentication Required`));
|
|
|
5471
5461
|
message: "Are you sure you want to deploy the libraries?"
|
|
5472
5462
|
});
|
|
5473
5463
|
if (!isDeployConfirmed) {
|
|
5474
|
-
Logger.
|
|
5464
|
+
Logger.error("Deployment cancelled");
|
|
5475
5465
|
return;
|
|
5476
5466
|
}
|
|
5477
5467
|
await Promise.all(
|
|
@@ -5501,7 +5491,6 @@ ${chalk4.green("\u27A4")} Authentication Required`));
|
|
|
5501
5491
|
workspace.spawn("npm", ["update", "-g", "@akanjs/cli", "--latest"]),
|
|
5502
5492
|
workspace.spawn("pnpm", ["install"])
|
|
5503
5493
|
]);
|
|
5504
|
-
Logger.info(`Akan.js is updated to the latest version ${latestPublishedVersionOfBase}`);
|
|
5505
5494
|
}
|
|
5506
5495
|
};
|
|
5507
5496
|
|
|
@@ -5509,19 +5498,19 @@ ${chalk4.green("\u27A4")} Authentication Required`));
|
|
|
5509
5498
|
var CloudScript = class {
|
|
5510
5499
|
#runner = new CloudRunner();
|
|
5511
5500
|
#packageScript = new PackageScript();
|
|
5512
|
-
async login() {
|
|
5501
|
+
async login(workspace) {
|
|
5513
5502
|
await this.#runner.login();
|
|
5514
5503
|
}
|
|
5515
|
-
logout() {
|
|
5504
|
+
logout(workspace) {
|
|
5516
5505
|
this.#runner.logout();
|
|
5517
5506
|
}
|
|
5518
|
-
async setLlm() {
|
|
5507
|
+
async setLlm(workspace) {
|
|
5519
5508
|
await this.#runner.setLlm();
|
|
5520
5509
|
}
|
|
5521
|
-
resetLlm() {
|
|
5510
|
+
resetLlm(workspace) {
|
|
5522
5511
|
this.#runner.resetLlm();
|
|
5523
5512
|
}
|
|
5524
|
-
async ask(question) {
|
|
5513
|
+
async ask(question, workspace) {
|
|
5525
5514
|
await AiSession.init();
|
|
5526
5515
|
const session = new AiSession();
|
|
5527
5516
|
await session.ask(question);
|
|
@@ -5534,27 +5523,31 @@ var CloudScript = class {
|
|
|
5534
5523
|
await this.#runner.deployAkan(workspace, akanPkgs);
|
|
5535
5524
|
}
|
|
5536
5525
|
async update(workspace) {
|
|
5526
|
+
const spinner = workspace.spinning("Updating Akan.js packages and CLI...");
|
|
5537
5527
|
await this.#runner.update(workspace);
|
|
5528
|
+
spinner.succeed("Akan.js packages and CLI updated, global version is below");
|
|
5529
|
+
Logger.raw("> Akan version: ");
|
|
5530
|
+
await workspace.spawn("akan", ["--version"], { stdio: "inherit" });
|
|
5538
5531
|
}
|
|
5539
5532
|
};
|
|
5540
5533
|
|
|
5541
5534
|
// pkgs/@akanjs/cli/src/cloud/cloud.command.ts
|
|
5542
5535
|
var CloudCommand = class {
|
|
5543
5536
|
cloudScript = new CloudScript();
|
|
5544
|
-
async login() {
|
|
5545
|
-
await this.cloudScript.login();
|
|
5537
|
+
async login(workspace) {
|
|
5538
|
+
await this.cloudScript.login(workspace);
|
|
5546
5539
|
}
|
|
5547
|
-
logout() {
|
|
5548
|
-
this.cloudScript.logout();
|
|
5540
|
+
logout(workspace) {
|
|
5541
|
+
this.cloudScript.logout(workspace);
|
|
5549
5542
|
}
|
|
5550
|
-
async setLlm() {
|
|
5551
|
-
await this.cloudScript.setLlm();
|
|
5543
|
+
async setLlm(workspace) {
|
|
5544
|
+
await this.cloudScript.setLlm(workspace);
|
|
5552
5545
|
}
|
|
5553
|
-
resetLlm() {
|
|
5554
|
-
this.cloudScript.resetLlm();
|
|
5546
|
+
resetLlm(workspace) {
|
|
5547
|
+
this.cloudScript.resetLlm(workspace);
|
|
5555
5548
|
}
|
|
5556
|
-
async ask(question) {
|
|
5557
|
-
await this.cloudScript.ask(question);
|
|
5549
|
+
async ask(question, workspace) {
|
|
5550
|
+
await this.cloudScript.ask(question, workspace);
|
|
5558
5551
|
}
|
|
5559
5552
|
async deployAkan(workspace) {
|
|
5560
5553
|
await this.cloudScript.deployAkan(workspace);
|
|
@@ -5564,20 +5557,25 @@ var CloudCommand = class {
|
|
|
5564
5557
|
}
|
|
5565
5558
|
};
|
|
5566
5559
|
__decorateClass([
|
|
5567
|
-
Target.Public()
|
|
5560
|
+
Target.Public(),
|
|
5561
|
+
__decorateParam(0, Workspace())
|
|
5568
5562
|
], CloudCommand.prototype, "login", 1);
|
|
5569
5563
|
__decorateClass([
|
|
5570
|
-
Target.Public()
|
|
5564
|
+
Target.Public(),
|
|
5565
|
+
__decorateParam(0, Workspace())
|
|
5571
5566
|
], CloudCommand.prototype, "logout", 1);
|
|
5572
5567
|
__decorateClass([
|
|
5573
|
-
Target.Public()
|
|
5568
|
+
Target.Public(),
|
|
5569
|
+
__decorateParam(0, Workspace())
|
|
5574
5570
|
], CloudCommand.prototype, "setLlm", 1);
|
|
5575
5571
|
__decorateClass([
|
|
5576
|
-
Target.Public()
|
|
5572
|
+
Target.Public(),
|
|
5573
|
+
__decorateParam(0, Workspace())
|
|
5577
5574
|
], CloudCommand.prototype, "resetLlm", 1);
|
|
5578
5575
|
__decorateClass([
|
|
5579
5576
|
Target.Public(),
|
|
5580
|
-
__decorateParam(0, Option("question", { ask: "question to ask" }))
|
|
5577
|
+
__decorateParam(0, Option("question", { ask: "question to ask" })),
|
|
5578
|
+
__decorateParam(1, Workspace())
|
|
5581
5579
|
], CloudCommand.prototype, "ask", 1);
|
|
5582
5580
|
__decorateClass([
|
|
5583
5581
|
Target.Public({ devOnly: true }),
|
|
@@ -5594,19 +5592,17 @@ CloudCommand = __decorateClass([
|
|
|
5594
5592
|
// pkgs/@akanjs/cli/src/library/library.command.ts
|
|
5595
5593
|
var LibraryCommand = class {
|
|
5596
5594
|
libraryScript = new LibraryScript();
|
|
5597
|
-
async createLibrary(
|
|
5598
|
-
await this.libraryScript.createLibrary(
|
|
5595
|
+
async createLibrary(libName, workspace) {
|
|
5596
|
+
await this.libraryScript.createLibrary(libName.toLowerCase().replace(/ /g, "-"), workspace);
|
|
5599
5597
|
}
|
|
5600
5598
|
async removeLibrary(lib) {
|
|
5601
5599
|
await this.libraryScript.removeLibrary(lib);
|
|
5602
5600
|
}
|
|
5603
|
-
async
|
|
5604
|
-
await this.libraryScript.
|
|
5605
|
-
}
|
|
5606
|
-
async buildLibrary(lib) {
|
|
5601
|
+
async syncLibrary(lib) {
|
|
5602
|
+
await this.libraryScript.syncLibrary(lib);
|
|
5607
5603
|
}
|
|
5608
|
-
async installLibrary(
|
|
5609
|
-
await this.libraryScript.installLibrary(workspace,
|
|
5604
|
+
async installLibrary(libName, workspace) {
|
|
5605
|
+
await this.libraryScript.installLibrary(workspace, libName);
|
|
5610
5606
|
}
|
|
5611
5607
|
async pushLibrary(lib, branch) {
|
|
5612
5608
|
await this.libraryScript.pushLibrary(lib, branch);
|
|
@@ -5617,7 +5613,7 @@ var LibraryCommand = class {
|
|
|
5617
5613
|
};
|
|
5618
5614
|
__decorateClass([
|
|
5619
5615
|
Target.Public(),
|
|
5620
|
-
__decorateParam(0,
|
|
5616
|
+
__decorateParam(0, Argument("libName", { desc: "name of library" })),
|
|
5621
5617
|
__decorateParam(1, Workspace())
|
|
5622
5618
|
], LibraryCommand.prototype, "createLibrary", 1);
|
|
5623
5619
|
__decorateClass([
|
|
@@ -5627,14 +5623,10 @@ __decorateClass([
|
|
|
5627
5623
|
__decorateClass([
|
|
5628
5624
|
Target.Public(),
|
|
5629
5625
|
__decorateParam(0, Lib())
|
|
5630
|
-
], LibraryCommand.prototype, "
|
|
5626
|
+
], LibraryCommand.prototype, "syncLibrary", 1);
|
|
5631
5627
|
__decorateClass([
|
|
5632
5628
|
Target.Public(),
|
|
5633
|
-
__decorateParam(0,
|
|
5634
|
-
], LibraryCommand.prototype, "buildLibrary", 1);
|
|
5635
|
-
__decorateClass([
|
|
5636
|
-
Target.Public(),
|
|
5637
|
-
__decorateParam(0, Option("name", { desc: "name of library" })),
|
|
5629
|
+
__decorateParam(0, Argument("libName", { desc: "name of library", nullable: true })),
|
|
5638
5630
|
__decorateParam(1, Workspace())
|
|
5639
5631
|
], LibraryCommand.prototype, "installLibrary", 1);
|
|
5640
5632
|
__decorateClass([
|
|
@@ -5651,15 +5643,325 @@ LibraryCommand = __decorateClass([
|
|
|
5651
5643
|
Commands()
|
|
5652
5644
|
], LibraryCommand);
|
|
5653
5645
|
|
|
5654
|
-
// pkgs/@akanjs/cli/src/module/module.
|
|
5646
|
+
// pkgs/@akanjs/cli/src/module/module.command.ts
|
|
5655
5647
|
import { select as select4 } from "@inquirer/prompts";
|
|
5648
|
+
|
|
5649
|
+
// pkgs/@akanjs/cli/src/module/module.script.ts
|
|
5656
5650
|
import fs12 from "fs";
|
|
5657
5651
|
|
|
5652
|
+
// pkgs/@akanjs/cli/src/module/module.request.ts
|
|
5653
|
+
var requestConstant = ({
|
|
5654
|
+
sysName,
|
|
5655
|
+
modelName,
|
|
5656
|
+
modelDesc,
|
|
5657
|
+
modelSchemaDesign,
|
|
5658
|
+
boilerplate,
|
|
5659
|
+
exampleFiles
|
|
5660
|
+
}) => `
|
|
5661
|
+
\uB108\uB294 Akan.js\uB77C\uB294 \uC0AC\uB0B4 \uD504\uB808\uC784\uC6CC\uD06C\uB85C Typescript \uAE30\uBC18 \uD504\uB85C\uADF8\uB7A8\uC744 \uC791\uC131\uD558\uB294 \uC2DC\uB2C8\uC5B4 \uAC1C\uBC1C\uC790\uC57C.
|
|
5662
|
+
\uB2E4\uC74C\uC758 \uBC30\uACBD \uC815\uBCF4\uB97C \uBC14\uD0D5\uC73C\uB85C ${modelName}.constant.ts \uD30C\uC77C\uC744 \uC791\uC131\uD574\uC918.
|
|
5663
|
+
|
|
5664
|
+
1. Akan.js \uD504\uB808\uC784\uC6CC\uD06C\uC5D0 \uB300\uD55C \uAC1C\uC694
|
|
5665
|
+
${frameworkAbstract}
|
|
5666
|
+
|
|
5667
|
+
2. <model>.constant.ts \uD30C\uC77C\uC5D0 \uB300\uD55C \uAC1C\uC694
|
|
5668
|
+
${scalarConstantDescription}
|
|
5669
|
+
|
|
5670
|
+
3. <model>.constant.ts \uD30C\uC77C\uC758 Enum \uC791\uC131\uBC95
|
|
5671
|
+
${howToSetEnumInModelConstant}
|
|
5672
|
+
|
|
5673
|
+
4. <model>.constant.ts \uD30C\uC77C\uC758 Field \uC791\uC131\uBC95
|
|
5674
|
+
${howToSetFieldInModelConstant}
|
|
5675
|
+
|
|
5676
|
+
5. \uD604\uC7AC \uD504\uB85C\uC81D\uD2B8 \uB0B4 \uB2E4\uB978 constant.ts \uD30C\uC77C\uB4E4\uC5D0 \uB300\uD55C \uC608\uC2DC
|
|
5677
|
+
${exampleFiles.map(
|
|
5678
|
+
(constant) => `
|
|
5679
|
+
Example file: ${constant.filepath}
|
|
5680
|
+
\`\`\`
|
|
5681
|
+
${constant.content}
|
|
5682
|
+
\`\`\`
|
|
5683
|
+
`
|
|
5684
|
+
).join("\n")}
|
|
5685
|
+
|
|
5686
|
+
|
|
5687
|
+
\uC704 \uB0B4\uC6A9\uB4E4\uC744 \uBC14\uD0D5\uC73C\uB85C \uD30C\uC2F1\uD558\uAE30 \uC27D\uAC8C \uC544\uB798\uC5D0 \uBCF4\uC77C\uB7EC\uD50C\uB808\uC774\uD2B8\uC5D0 \uB9DE\uAC8C \uC815\uB9AC\uD574\uC11C \uC918
|
|
5688
|
+
|
|
5689
|
+
Application name: ${sysName}
|
|
5690
|
+
Model name: ${modelName}
|
|
5691
|
+
Model description: ${modelDesc}
|
|
5692
|
+
Model schema design: ${modelSchemaDesign}
|
|
5693
|
+
|
|
5694
|
+
Target filename: ${modelName}.constant.ts
|
|
5695
|
+
\`\`\`
|
|
5696
|
+
${boilerplate}
|
|
5697
|
+
\`\`\`
|
|
5698
|
+
`;
|
|
5699
|
+
var requestDictionary = ({
|
|
5700
|
+
sysName,
|
|
5701
|
+
modelName,
|
|
5702
|
+
constant,
|
|
5703
|
+
modelDesc,
|
|
5704
|
+
modelSchemaDesign,
|
|
5705
|
+
boilerplate,
|
|
5706
|
+
exampleFiles
|
|
5707
|
+
}) => `
|
|
5708
|
+
|
|
5709
|
+
|
|
5710
|
+
-${modelName}\uC758 \uC2A4\uD0A4\uB9C8 \uC815\uC758.
|
|
5711
|
+
\`\`\`
|
|
5712
|
+
${constant}
|
|
5713
|
+
\`\`\`
|
|
5714
|
+
|
|
5715
|
+
\uC5ED\uD560\uBD80\uC5EC
|
|
5716
|
+
- Akan.js \uC0AC\uB0B4 \uD504\uB808\uC784\uC6CC\uD06C \uAE30\uBC18 \uC720\uCC3D\uD55C \uBC88\uC5ED\uAC00.
|
|
5717
|
+
|
|
5718
|
+
\uC5C4\uACA9\uD55C \uC8FC\uC758\uC0AC\uD56D
|
|
5719
|
+
- \uBAA8\uB4E0 \uBB38\uC7A5\uC740 \uBB38\uBC95\uC801\uC73C\uB85C \uC62C\uBC14\uB974\uAC8C \uC791\uC131
|
|
5720
|
+
- \uBCF4\uC77C\uB7EC\uD50C\uB808\uC774\uD2B8\uB0B4 signalDictionary \uBD80\uBD84\uC740 \uADF8\uB300\uB85C \uC720\uC9C0
|
|
5721
|
+
|
|
5722
|
+
\uC694\uCCAD\uC0AC\uD56D
|
|
5723
|
+
- \uC544\uB798 \uC81C\uACF5\uD560 \uBCF4\uC77C\uB7EC\uD50C\uB808\uC774\uD2B8\uC5D0 \uB9DE\uCDB0 \uBC88\uC5ED\uBCF8 \uC18C\uC2A4\uCF54\uB4DC \uC81C\uACF5
|
|
5724
|
+
|
|
5725
|
+
|
|
5726
|
+
|
|
5727
|
+
Application name: ${sysName}
|
|
5728
|
+
Model name: ${modelName}
|
|
5729
|
+
Model description: ${modelDesc}
|
|
5730
|
+
Model schema design: ${modelSchemaDesign}
|
|
5731
|
+
|
|
5732
|
+
Target filename: ${modelName}.dictionary.ts
|
|
5733
|
+
\`\`\`
|
|
5734
|
+
${boilerplate}
|
|
5735
|
+
\`\`\`
|
|
5736
|
+
`;
|
|
5737
|
+
var requestScalarConstant = ({
|
|
5738
|
+
sysName,
|
|
5739
|
+
modelName,
|
|
5740
|
+
modelDesc,
|
|
5741
|
+
modelSchemaDesign,
|
|
5742
|
+
boilerplate,
|
|
5743
|
+
exampleFiles
|
|
5744
|
+
}) => `
|
|
5745
|
+
\uB108\uB294 Akan.js\uB77C\uB294 \uC0AC\uB0B4 \uD504\uB808\uC784\uC6CC\uD06C\uB85C Typescript \uAE30\uBC18 \uD504\uB85C\uADF8\uB7A8\uC744 \uC791\uC131\uD558\uB294 \uC2DC\uB2C8\uC5B4 \uAC1C\uBC1C\uC790\uC57C.
|
|
5746
|
+
\uB2E4\uC74C\uC758 \uBC30\uACBD \uC815\uBCF4\uB97C \uBC14\uD0D5\uC73C\uB85C ${modelName}.constant.ts \uD30C\uC77C\uC744 \uC791\uC131\uD574\uC918.
|
|
5747
|
+
|
|
5748
|
+
1. Akan.js \uD504\uB808\uC784\uC6CC\uD06C\uC5D0 \uB300\uD55C \uAC1C\uC694
|
|
5749
|
+
${frameworkAbstract}
|
|
5750
|
+
|
|
5751
|
+
2. <model>.constant.ts \uD30C\uC77C\uC5D0 \uB300\uD55C \uAC1C\uC694
|
|
5752
|
+
${scalarConstantDescription}
|
|
5753
|
+
|
|
5754
|
+
3. <model>.constant.ts \uD30C\uC77C\uC758 Enum \uC791\uC131\uBC95
|
|
5755
|
+
${howToSetEnumInModelConstant}
|
|
5756
|
+
|
|
5757
|
+
4. <model>.constant.ts \uD30C\uC77C\uC758 Field \uC791\uC131\uBC95
|
|
5758
|
+
${howToSetFieldInModelConstant}
|
|
5759
|
+
|
|
5760
|
+
5. \uD604\uC7AC \uD504\uB85C\uC81D\uD2B8 \uB0B4 \uB2E4\uB978 constant.ts \uD30C\uC77C\uB4E4\uC5D0 \uB300\uD55C \uC608\uC2DC
|
|
5761
|
+
${exampleFiles.map(
|
|
5762
|
+
(constant) => `
|
|
5763
|
+
Example file: ${constant.filepath}
|
|
5764
|
+
\`\`\`
|
|
5765
|
+
${constant.content}
|
|
5766
|
+
\`\`\`
|
|
5767
|
+
`
|
|
5768
|
+
).join("\n")}
|
|
5769
|
+
|
|
5770
|
+
|
|
5771
|
+
\uC704 \uB0B4\uC6A9\uB4E4\uC744 \uBC14\uD0D5\uC73C\uB85C \uD30C\uC2F1\uD558\uAE30 \uC27D\uAC8C \uC544\uB798\uC5D0 \uBCF4\uC77C\uB7EC\uD50C\uB808\uC774\uD2B8\uC5D0 \uB9DE\uAC8C \uC815\uB9AC\uD574\uC11C \uC918
|
|
5772
|
+
|
|
5773
|
+
Application name: ${sysName}
|
|
5774
|
+
Model name: ${modelName}
|
|
5775
|
+
Model description: ${modelDesc}
|
|
5776
|
+
Model schema design: ${modelSchemaDesign}
|
|
5777
|
+
|
|
5778
|
+
Target filename: ${modelName}.constant.ts
|
|
5779
|
+
\`\`\`
|
|
5780
|
+
${boilerplate}
|
|
5781
|
+
\`\`\`
|
|
5782
|
+
`;
|
|
5783
|
+
var requestTemplate = ({
|
|
5784
|
+
sysName,
|
|
5785
|
+
modelName,
|
|
5786
|
+
ModelName,
|
|
5787
|
+
boilerplate,
|
|
5788
|
+
constant,
|
|
5789
|
+
properties,
|
|
5790
|
+
exampleFiles
|
|
5791
|
+
}) => `
|
|
5792
|
+
${componentDefaultDescription({
|
|
5793
|
+
sysName,
|
|
5794
|
+
modelName,
|
|
5795
|
+
ModelName: ModelName ?? capitalize(modelName),
|
|
5796
|
+
exampleFiles,
|
|
5797
|
+
constant,
|
|
5798
|
+
properties
|
|
5799
|
+
})}
|
|
5800
|
+
\uC5ED\uD560\uBD80\uC5EC
|
|
5801
|
+
- Akan.js \uC0AC\uB0B4 \uD504\uB808\uC784\uC6CC\uD06C \uAE30\uBC18 Typescript \uC2DC\uB2C8\uC5B4 \uD504\uB860\uD2B8\uC5D4\uB4DC \uAC1C\uBC1C\uC790.
|
|
5802
|
+
|
|
5803
|
+
\uCF54\uB529 \uADDC\uCE59
|
|
5804
|
+
- \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
5805
|
+
- \uC544\uC774\uCF58: react-icons \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
5806
|
+
- CSS: tailwind, DaisyUI(btn, input, badge \uAC19\uC740 \uAE30\uBCF8 \uC694\uC18C\uB9CC \uC0AC\uC6A9 \uAC00\uB2A5, card/hero \uAC19\uC740 \uBCF5\uC7A1\uD55C \uCEF4\uD3EC\uB10C\uD2B8 \uC0AC\uC6A9 X) \uC0AC\uC6A9
|
|
5807
|
+
- Ui Component: @util/ui \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
5808
|
+
- \uC870\uAC74\uBD80 \uD074\uB798\uC2A4: clsx \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
5809
|
+
\uCF54\uB4DC \uC2A4\uD0C0\uC77C
|
|
5810
|
+
- \uC0C9\uC0C1: \uD558\uB4DC\uCF54\uB529(bg-red) \uB300\uC2E0 \uD14C\uB9C8 \uC0C9\uC0C1(bg-primary) \uC0AC\uC6A9
|
|
5811
|
+
- \uC870\uAC74\uBD80 \uB80C\uB354\uB9C1: field && <div>... \uB300\uC2E0 field ? <div>... : null \uC0AC\uC6A9
|
|
5812
|
+
- \uBAA8\uB378 \uC811\uADFC: \uAD6C\uC870\uBD84\uD574\uD560\uB2F9 \uB300\uC2E0 ${modelName}.field \uD615\uC2DD\uC73C\uB85C \uC811\uADFC
|
|
5813
|
+
- \uD0C0\uC785 \uC548\uC804: ${modelName}.constant.ts\uC758 \uC2A4\uD0A4\uB9C8 \uCC38\uC870\uD558\uC5EC \uC5D0\uB7EC \uBC29\uC9C0
|
|
5814
|
+
\uD544\uB4DC \uC811\uADFC \uC804: \uC2A4\uD0A4\uB9C8\uC758 \uC2E4\uC81C \uD544\uB4DC \uB9AC\uC2A4\uD2B8 \uC791\uC131 \uBC0F \uAC80\uD1A0 \uD544\uC218
|
|
5815
|
+
|
|
5816
|
+
\uC5C4\uACA9\uD55C \uC8FC\uC758\uC0AC\uD56D
|
|
5817
|
+
- UI \uD0B7\uC740 \uBB38\uC11C\uC5D0 \uBA85\uC2DC\uB41C \uCEF4\uD3EC\uB10C\uD2B8\uB9CC \uC0AC\uC6A9
|
|
5818
|
+
- \uCEF4\uD3EC\uB10C\uD2B8 \uC0AC\uC6A9 \uC804 \uBB38\uC11C \uD655\uC778 \uBC0F props \uC815\uD655\uD788 \uAC80\uC99D
|
|
5819
|
+
- \uBA85\uC2DC\uB41C \uB8F0 \uC678 \uC784\uC758 \uCD94\uC0C1\uD654 \uAE08\uC9C0
|
|
5820
|
+
- dayjs \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB294 @akanjs/base\uC5D0\uC11C \uB798\uD551\uD558\uC5EC \uC81C\uACF5\uD558\uACE0 \uC788\uC74C.
|
|
5821
|
+
|
|
5822
|
+
\uC694\uCCAD\uC0AC\uD56D
|
|
5823
|
+
- \uC544\uB798 \uC81C\uACF5\uD560 \uAE30\uBCF8 \uD15C\uD50C\uB9BF \uCF54\uB4DC\uC5D0 \uCD94\uAC00\uB85C \uCEF4\uD3EC\uB10C\uD2B8 \uAC1C\uBC1C
|
|
5824
|
+
- ${ModelName}.Template.tsx \uCF54\uB4DC \uC791\uC131
|
|
5825
|
+
- \uCEF4\uD3EC\uB10C\uD2B8 \uC774\uB984\uC740 \uBAA8\uB378 \uC774\uB984\uC740 \uC2A4\uD0A4\uB9C8\uC5D0 \uAE30\uBC18\uD55C \uAE30\uB2A5\uC5D0 \uCD08\uC810\uC744 \uB450\uACE0 \uC791\uC131
|
|
5826
|
+
- \uC544\uB798 \uC81C\uACF5\uD560 \uBCF4\uC77C\uB7EC\uD50C\uB808\uC774\uD2B8\uC5D0 \uC788\uB294 General \uCEF4\uD3EC\uB10C\uD2B8 1\uAC1C\uB97C \uC81C\uC678\uD55C \uB514\uC790\uC778 \uCEF4\uD3EC\uB10C\uD2B8 4\uAC1C \uAC1C\uBC1C
|
|
5827
|
+
- \uCD94\uC0C1\uD654 \uD574\uC57C\uD558\uB294 \uACBD\uC6B0\uAC00 \uC788\uC744 \uACBD\uC6B0\uC5D4 \uBB38\uC11C\uB97C \uB2E4\uC2DC \uCC38\uACE0\uD558\uACE0 \uC124\uBA85\uB41C \uB0B4\uC5D0\uC11C \uD574\uACB0\uD574\uC57C\uD568.
|
|
5828
|
+
- \uBCF4\uC77C\uB7EC\uD50C\uB808\uC774\uD2B8\uC5D0 \uB9DE\uAC8C \uC815\uB9AC\uD574\uC11C \uC81C\uACF5
|
|
5829
|
+
-
|
|
5830
|
+
|
|
5831
|
+
Application name: ${sysName}
|
|
5832
|
+
Model name: ${modelName}
|
|
5833
|
+
Target filename: ${ModelName}.Template.tsx
|
|
5834
|
+
\`\`\`
|
|
5835
|
+
${boilerplate}
|
|
5836
|
+
\`\`\`
|
|
5837
|
+
|
|
5838
|
+
|
|
5839
|
+
`;
|
|
5840
|
+
var requestView = ({
|
|
5841
|
+
sysName,
|
|
5842
|
+
modelName,
|
|
5843
|
+
ModelName,
|
|
5844
|
+
boilerplate,
|
|
5845
|
+
constant,
|
|
5846
|
+
properties,
|
|
5847
|
+
exampleFiles
|
|
5848
|
+
}) => `
|
|
5849
|
+
${componentDefaultDescription({
|
|
5850
|
+
sysName,
|
|
5851
|
+
modelName,
|
|
5852
|
+
ModelName: ModelName ?? capitalize(modelName),
|
|
5853
|
+
exampleFiles,
|
|
5854
|
+
constant,
|
|
5855
|
+
properties
|
|
5856
|
+
})}
|
|
5857
|
+
|
|
5858
|
+
\uC5ED\uD560\uBD80\uC5EC
|
|
5859
|
+
- Akan.js \uC0AC\uB0B4 \uD504\uB808\uC784\uC6CC\uD06C \uAE30\uBC18 Typescript \uC2DC\uB2C8\uC5B4 \uD504\uB860\uD2B8\uC5D4\uB4DC \uAC1C\uBC1C\uC790.
|
|
5860
|
+
|
|
5861
|
+
\uCF54\uB529 \uADDC\uCE59
|
|
5862
|
+
- \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
5863
|
+
- \uC544\uC774\uCF58: react-icons \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
5864
|
+
- CSS: tailwind, DaisyUI(btn, input, badge \uAC19\uC740 \uAE30\uBCF8 \uC694\uC18C\uB9CC \uC0AC\uC6A9 \uAC00\uB2A5, card/hero \uAC19\uC740 \uBCF5\uC7A1\uD55C \uCEF4\uD3EC\uB10C\uD2B8 \uC0AC\uC6A9 X) \uC0AC\uC6A9
|
|
5865
|
+
- Ui Component: @util/ui \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
5866
|
+
- \uC870\uAC74\uBD80 \uD074\uB798\uC2A4: clsx \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
5867
|
+
\uCF54\uB4DC \uC2A4\uD0C0\uC77C
|
|
5868
|
+
- \uC0C9\uC0C1: \uD558\uB4DC\uCF54\uB529(bg-red) \uB300\uC2E0 \uD14C\uB9C8 \uC0C9\uC0C1(bg-primary) \uC0AC\uC6A9
|
|
5869
|
+
- \uC870\uAC74\uBD80 \uB80C\uB354\uB9C1: field && <div>... \uB300\uC2E0 field ? <div>... : null \uC0AC\uC6A9
|
|
5870
|
+
- \uBAA8\uB378 \uC811\uADFC: \uAD6C\uC870\uBD84\uD574\uD560\uB2F9 \uB300\uC2E0 ${modelName}.field \uD615\uC2DD\uC73C\uB85C \uC811\uADFC
|
|
5871
|
+
- \uD0C0\uC785 \uC548\uC804: ${modelName}.constant.ts\uC758 \uC2A4\uD0A4\uB9C8 \uCC38\uC870\uD558\uC5EC \uC5D0\uB7EC \uBC29\uC9C0
|
|
5872
|
+
\uD544\uB4DC \uC811\uADFC \uC804: \uC2A4\uD0A4\uB9C8\uC758 \uC2E4\uC81C \uD544\uB4DC \uB9AC\uC2A4\uD2B8 \uC791\uC131 \uBC0F \uAC80\uD1A0 \uD544\uC218
|
|
5873
|
+
|
|
5874
|
+
\uC5C4\uACA9\uD55C \uC8FC\uC758\uC0AC\uD56D
|
|
5875
|
+
- UI \uD0B7\uC740 \uBB38\uC11C\uC5D0 \uBA85\uC2DC\uB41C \uCEF4\uD3EC\uB10C\uD2B8\uB9CC \uC0AC\uC6A9
|
|
5876
|
+
- \uCEF4\uD3EC\uB10C\uD2B8 \uC0AC\uC6A9 \uC804 \uBB38\uC11C \uD655\uC778 \uBC0F props \uC815\uD655\uD788 \uAC80\uC99D
|
|
5877
|
+
- \uBA85\uC2DC\uB41C \uB8F0 \uC678 \uC784\uC758 \uCD94\uC0C1\uD654 \uAE08\uC9C0
|
|
5878
|
+
- dayjs \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB294 @akanjs/base\uC5D0\uC11C \uB798\uD551\uD558\uC5EC \uC81C\uACF5\uD558\uACE0 \uC788\uC74C.
|
|
5879
|
+
|
|
5880
|
+
\uC694\uCCAD\uC0AC\uD56D
|
|
5881
|
+
- \uC544\uB798 \uC81C\uACF5\uD560 \uAE30\uBCF8 \uD15C\uD50C\uB9BF \uCF54\uB4DC\uC5D0 \uCD94\uAC00\uB85C \uCEF4\uD3EC\uB10C\uD2B8 \uAC1C\uBC1C
|
|
5882
|
+
- ${ModelName}.View.tsx \uCF54\uB4DC \uC791\uC131
|
|
5883
|
+
- \uCEF4\uD3EC\uB10C\uD2B8 \uC774\uB984\uC5D0 ${ModelName}\uC740 \uC0DD\uB7B5\uD558\uBA70, \uB514\uC790\uC778 \uC911\uC810\uC758 \uC774\uB984\uC73C\uB85C \uC791\uC131
|
|
5884
|
+
- \uC544\uB798 \uC81C\uACF5\uD560 \uBCF4\uC77C\uB7EC\uD50C\uB808\uC774\uD2B8\uC5D0 \uC788\uB294 General \uCEF4\uD3EC\uB10C\uD2B8 1\uAC1C\uB97C \uC81C\uC678\uD55C \uB514\uC790\uC778 \uCEF4\uD3EC\uB10C\uD2B8 4\uAC1C \uAC1C\uBC1C
|
|
5885
|
+
- \uCD94\uC0C1\uD654 \uD574\uC57C\uD558\uB294 \uACBD\uC6B0\uAC00 \uC788\uC744 \uACBD\uC6B0\uC5D4 \uBB38\uC11C\uB97C \uB2E4\uC2DC \uCC38\uACE0\uD558\uACE0 \uC124\uBA85\uB41C \uB0B4\uC5D0\uC11C \uD574\uACB0\uD574\uC57C\uD568.
|
|
5886
|
+
- \uBCF4\uC77C\uB7EC\uD50C\uB808\uC774\uD2B8\uC5D0 \uB9DE\uAC8C \uC815\uB9AC\uD574\uC11C \uC81C\uACF5
|
|
5887
|
+
|
|
5888
|
+
|
|
5889
|
+
Application name: ${sysName}
|
|
5890
|
+
Model name: ${modelName}
|
|
5891
|
+
|
|
5892
|
+
Target filename: ${ModelName}.View.tsx
|
|
5893
|
+
\`\`\`
|
|
5894
|
+
${boilerplate}
|
|
5895
|
+
\`\`\`
|
|
5896
|
+
|
|
5897
|
+
|
|
5898
|
+
`;
|
|
5899
|
+
var requestUnit = ({
|
|
5900
|
+
sysName,
|
|
5901
|
+
modelName,
|
|
5902
|
+
ModelName,
|
|
5903
|
+
constant,
|
|
5904
|
+
properties,
|
|
5905
|
+
boilerplate,
|
|
5906
|
+
exampleFiles
|
|
5907
|
+
}) => `
|
|
5908
|
+
${componentDefaultDescription({
|
|
5909
|
+
sysName,
|
|
5910
|
+
modelName,
|
|
5911
|
+
ModelName: ModelName ?? capitalize(modelName),
|
|
5912
|
+
exampleFiles,
|
|
5913
|
+
constant,
|
|
5914
|
+
properties
|
|
5915
|
+
})}
|
|
5916
|
+
|
|
5917
|
+
\uC5ED\uD560\uBD80\uC5EC
|
|
5918
|
+
- Akan.js \uC0AC\uB0B4 \uD504\uB808\uC784\uC6CC\uD06C \uAE30\uBC18 Typescript \uC2DC\uB2C8\uC5B4 \uD504\uB860\uD2B8\uC5D4\uB4DC \uAC1C\uBC1C\uC790.
|
|
5919
|
+
|
|
5920
|
+
\uCF54\uB529 \uADDC\uCE59
|
|
5921
|
+
- \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
5922
|
+
- \uC544\uC774\uCF58: react-icons \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
5923
|
+
- CSS: tailwind, DaisyUI(btn, input, badge \uAC19\uC740 \uAE30\uBCF8 \uC694\uC18C\uB9CC \uC0AC\uC6A9 \uAC00\uB2A5, card/hero \uAC19\uC740 \uBCF5\uC7A1\uD55C \uCEF4\uD3EC\uB10C\uD2B8 \uC0AC\uC6A9 X) \uC0AC\uC6A9
|
|
5924
|
+
- Ui Component: @util/ui \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
5925
|
+
- \uC870\uAC74\uBD80 \uD074\uB798\uC2A4: clsx \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
5926
|
+
\uCF54\uB4DC \uC2A4\uD0C0\uC77C
|
|
5927
|
+
- \uC0C9\uC0C1: \uD558\uB4DC\uCF54\uB529(bg-red) \uB300\uC2E0 \uD14C\uB9C8 \uC0C9\uC0C1(bg-primary) \uC0AC\uC6A9
|
|
5928
|
+
- \uC870\uAC74\uBD80 \uB80C\uB354\uB9C1: field && <div>... \uB300\uC2E0 field ? <div>... : null \uC0AC\uC6A9
|
|
5929
|
+
- \uBAA8\uB378 \uC811\uADFC: \uAD6C\uC870\uBD84\uD574\uD560\uB2F9 \uB300\uC2E0 ${modelName}.field \uD615\uC2DD\uC73C\uB85C \uC811\uADFC
|
|
5930
|
+
- \uD0C0\uC785 \uC548\uC804: ${modelName}.constant.ts\uC758 \uC2A4\uD0A4\uB9C8 \uCC38\uC870\uD558\uC5EC \uC5D0\uB7EC \uBC29\uC9C0
|
|
5931
|
+
\uD544\uB4DC \uC811\uADFC \uC804: \uC2A4\uD0A4\uB9C8\uC758 \uC2E4\uC81C \uD544\uB4DC \uB9AC\uC2A4\uD2B8 \uC791\uC131 \uBC0F \uAC80\uD1A0 \uD544\uC218
|
|
5932
|
+
|
|
5933
|
+
\uC5C4\uACA9\uD55C \uC8FC\uC758\uC0AC\uD56D
|
|
5934
|
+
- UI \uD0B7\uC740 \uBB38\uC11C\uC5D0 \uBA85\uC2DC\uB41C \uCEF4\uD3EC\uB10C\uD2B8\uB9CC \uC0AC\uC6A9
|
|
5935
|
+
- \uCEF4\uD3EC\uB10C\uD2B8 \uC0AC\uC6A9 \uC804 \uBB38\uC11C \uD655\uC778 \uBC0F props \uC815\uD655\uD788 \uAC80\uC99D
|
|
5936
|
+
- \uBA85\uC2DC\uB41C \uB8F0 \uC678 \uC784\uC758 \uCD94\uC0C1\uD654 \uAE08\uC9C0
|
|
5937
|
+
- dayjs \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB294 @akanjs/base\uC5D0\uC11C \uB798\uD551\uD558\uC5EC \uC81C\uACF5\uD558\uACE0 \uC788\uC74C.
|
|
5938
|
+
|
|
5939
|
+
\uC694\uCCAD\uC0AC\uD56D
|
|
5940
|
+
- \uC544\uB798 \uC81C\uACF5\uD560 \uAE30\uBCF8 \uD15C\uD50C\uB9BF \uCF54\uB4DC\uC5D0 \uCD94\uAC00\uB85C \uCEF4\uD3EC\uB10C\uD2B8 \uAC1C\uBC1C
|
|
5941
|
+
- ${ModelName}.Unit.tsx \uCF54\uB4DC \uC791\uC131
|
|
5942
|
+
- \uCEF4\uD3EC\uB10C\uD2B8 \uC774\uB984\uC5D0 ${ModelName}\uC740 \uC0DD\uB7B5\uD558\uBA70, \uB514\uC790\uC778 \uC911\uC810\uC758 \uC774\uB984\uC73C\uB85C \uC791\uC131
|
|
5943
|
+
- \uC608\uC2DC\uD30C\uC77C \uCEF4\uD3EC\uB10C\uD2B8\uC758 \uAE30\uBC18\uD558\uC5EC \uC77C\uBC18\uC801\uC73C\uB85C \uC0AC\uC6A9 \uAC00\uB2A5\uD55C \uCEF4\uD3EC\uB10C\uD2B8 1\uAC1C\uC640 \uB514\uC790\uC778\uC801 \uC694\uC18C\uAC00 \uD3EC\uD568\uB41C \uCEF4\uD3EC\uB10C\uD2B8 3\uAC1C \uAC1C\uBC1C
|
|
5944
|
+
- \uCD94\uC0C1\uD654 \uD574\uC57C\uD558\uB294 \uACBD\uC6B0\uAC00 \uC788\uC744 \uACBD\uC6B0\uC5D4 \uBB38\uC11C\uB97C \uB2E4\uC2DC \uCC38\uACE0\uD558\uACE0 \uC124\uBA85\uB41C \uB0B4\uC5D0\uC11C \uD574\uACB0\uD574\uC57C\uD568.
|
|
5945
|
+
- \uBCF4\uC77C\uB7EC\uD50C\uB808\uC774\uD2B8\uC5D0 \uB9DE\uAC8C \uC815\uB9AC\uD574\uC11C \uC81C\uACF5
|
|
5946
|
+
|
|
5947
|
+
|
|
5948
|
+
Application name: ${sysName}
|
|
5949
|
+
Model name: ${modelName}
|
|
5950
|
+
|
|
5951
|
+
Target filename: ${ModelName}.Unit.tsx
|
|
5952
|
+
\`\`\`
|
|
5953
|
+
${boilerplate}
|
|
5954
|
+
\`\`\`
|
|
5955
|
+
|
|
5956
|
+
|
|
5957
|
+
`;
|
|
5958
|
+
|
|
5658
5959
|
// pkgs/@akanjs/cli/src/module/module.runner.ts
|
|
5659
5960
|
var ModuleRunner = class {
|
|
5660
5961
|
async createModule(workspace, sysType, sysName, moduleName, description) {
|
|
5661
5962
|
}
|
|
5662
|
-
|
|
5963
|
+
removeModule(sys2, name) {
|
|
5964
|
+
sys2.removeDir(`${sys2.cwdPath}/lib/${name}`);
|
|
5663
5965
|
}
|
|
5664
5966
|
async createScalarTemplate(sys2, name) {
|
|
5665
5967
|
const akanConfig = await sys2.getConfig();
|
|
@@ -5687,11 +5989,25 @@ var ModuleRunner = class {
|
|
|
5687
5989
|
}
|
|
5688
5990
|
};
|
|
5689
5991
|
}
|
|
5992
|
+
async createDictionaryTemplate(sys2, name) {
|
|
5993
|
+
const akanConfig = await sys2.getConfig();
|
|
5994
|
+
const scanResult = await sys2.scan({ akanConfig });
|
|
5995
|
+
await sys2.applyTemplate({
|
|
5996
|
+
basePath: `./lib/${name}`,
|
|
5997
|
+
template: "dictionary",
|
|
5998
|
+
scanResult,
|
|
5999
|
+
dict: { model: name, Model: capitalize(name), sysName: sys2.name, SysName: capitalize(sys2.name) }
|
|
6000
|
+
});
|
|
6001
|
+
await sys2.scan({ akanConfig });
|
|
6002
|
+
return {
|
|
6003
|
+
dictionary: { filename: `${name}.dictionary.ts`, content: sys2.readFile(`lib/${name}/${name}.dictionary.ts`) }
|
|
6004
|
+
};
|
|
6005
|
+
}
|
|
5690
6006
|
async createComponentTemplate(sys2, name, type) {
|
|
5691
6007
|
const akanConfig = await sys2.getConfig();
|
|
5692
6008
|
const scanResult = await sys2.scan({ akanConfig });
|
|
5693
6009
|
await sys2.applyTemplate({
|
|
5694
|
-
basePath: `./lib/${name}
|
|
6010
|
+
basePath: `./lib/${name}`,
|
|
5695
6011
|
template: `module/__Model__.${capitalize(type)}.ts`,
|
|
5696
6012
|
scanResult,
|
|
5697
6013
|
dict: { model: name, Model: capitalize(name), appName: sys2.name }
|
|
@@ -5700,7 +6016,7 @@ var ModuleRunner = class {
|
|
|
5700
6016
|
return {
|
|
5701
6017
|
component: {
|
|
5702
6018
|
filename: `${name}.${capitalize(type)}.tsx`,
|
|
5703
|
-
content: sys2.readFile(`lib/${name}
|
|
6019
|
+
content: sys2.readFile(`lib/${name}/${capitalize(name)}.${capitalize(type)}.tsx`)
|
|
5704
6020
|
}
|
|
5705
6021
|
// constant: {
|
|
5706
6022
|
// filename: `${name}.constant.ts`,
|
|
@@ -5779,31 +6095,62 @@ var ModuleRunner = class {
|
|
|
5779
6095
|
// pkgs/@akanjs/cli/src/module/module.script.ts
|
|
5780
6096
|
var ModuleScript = class {
|
|
5781
6097
|
#runner = new ModuleRunner();
|
|
5782
|
-
|
|
6098
|
+
//! .command arg에 병합 필요.
|
|
6099
|
+
async createModuleTemplate(sys2, name, description) {
|
|
5783
6100
|
await this.#runner.createModuleTemplate(sys2, name);
|
|
6101
|
+
}
|
|
6102
|
+
async createModule(sys2, name, description, schemaDescription) {
|
|
6103
|
+
await AiSession.init();
|
|
6104
|
+
const session = new AiSession();
|
|
6105
|
+
const [appNames, libNames] = await sys2.workspace.getSyss();
|
|
6106
|
+
const moduleConstantExampleFiles = await sys2.workspace.getConstantFiles();
|
|
6107
|
+
const moduleDictionaryExampleFiles = await sys2.workspace.getDictionaryFiles();
|
|
6108
|
+
const { constant, dictionary } = await this.#runner.createModuleTemplate(sys2, name);
|
|
6109
|
+
sys2.log(`Module ${name} created in ${sys2.type}s/${sys2.name}/lib/${name}`);
|
|
6110
|
+
const constantContent = await session.editTypescript(
|
|
6111
|
+
requestConstant({
|
|
6112
|
+
sysName: sys2.name,
|
|
6113
|
+
modelName: name,
|
|
6114
|
+
modelDesc: description ?? "",
|
|
6115
|
+
modelSchemaDesign: schemaDescription ?? "",
|
|
6116
|
+
boilerplate: constant.content,
|
|
6117
|
+
exampleFiles: randomPicks(moduleConstantExampleFiles, Math.min(10, moduleConstantExampleFiles.length))
|
|
6118
|
+
})
|
|
6119
|
+
);
|
|
6120
|
+
sys2.writeFile(`lib/${name}/${name}.constant.ts`, constantContent);
|
|
6121
|
+
const dictionaryContent = await session.editTypescript(
|
|
6122
|
+
requestDictionary({
|
|
6123
|
+
sysName: sys2.name,
|
|
6124
|
+
modelName: name,
|
|
6125
|
+
constant: constantContent,
|
|
6126
|
+
modelDesc: description ?? "",
|
|
6127
|
+
modelSchemaDesign: schemaDescription ?? "",
|
|
6128
|
+
boilerplate: dictionary.content,
|
|
6129
|
+
exampleFiles: randomPicks(moduleConstantExampleFiles, Math.min(10, moduleConstantExampleFiles.length))
|
|
6130
|
+
})
|
|
6131
|
+
);
|
|
6132
|
+
sys2.writeFile(`lib/${name}/${name}.dictionary.ts`, dictionaryContent);
|
|
6133
|
+
await this.createView(sys2, name);
|
|
6134
|
+
await this.createUnit(sys2, name);
|
|
6135
|
+
await this.createTemplate(sys2, name);
|
|
5784
6136
|
sys2.log(`Module ${name} created in ${sys2.type}s/${sys2.name}/lib/${name}`);
|
|
5785
6137
|
}
|
|
5786
|
-
async
|
|
6138
|
+
async createModule_(sys2, name, description, schemaDescription) {
|
|
6139
|
+
await AiSession.init();
|
|
6140
|
+
const session = new AiSession();
|
|
5787
6141
|
const [appNames, libNames] = await sys2.workspace.getSyss();
|
|
5788
|
-
const
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
path: `${appName}/${databaseModule}/${databaseModule}.constant.ts`,
|
|
5796
|
-
content: app.readFile(`lib/${databaseModule}/${databaseModule}.constant.ts`)
|
|
5797
|
-
}))
|
|
5798
|
-
);
|
|
5799
|
-
})
|
|
5800
|
-
)).flat()
|
|
5801
|
-
];
|
|
6142
|
+
const moduleConstantExampleFiles = await sys2.workspace.getConstantFiles();
|
|
6143
|
+
const moduleDictionaryExampleFiles = await sys2.workspace.getDictionaryFiles();
|
|
6144
|
+
sys2.log(`Module ${name} created in ${sys2.type}s/${sys2.name}/lib/${name}`);
|
|
6145
|
+
await this.createView(sys2, name);
|
|
6146
|
+
await this.createUnit(sys2, name);
|
|
6147
|
+
await this.createTemplate(sys2, name);
|
|
6148
|
+
sys2.log(`Module ${name} created in ${sys2.type}s/${sys2.name}/lib/${name}`);
|
|
5802
6149
|
}
|
|
5803
|
-
|
|
6150
|
+
removeModule(sys2, name) {
|
|
6151
|
+
this.#runner.removeModule(sys2, name);
|
|
5804
6152
|
}
|
|
5805
6153
|
async createScalar(sys2, name, description, schemaDescription) {
|
|
5806
|
-
await AiSession.init();
|
|
5807
6154
|
await AiSession.init();
|
|
5808
6155
|
const scalarConstantExampleFiles = await sys2.workspace.getScalarConstantFiles();
|
|
5809
6156
|
const { constant, dictionary } = await this.#runner.createScalarTemplate(sys2, name);
|
|
@@ -5815,7 +6162,7 @@ var ModuleScript = class {
|
|
|
5815
6162
|
modelDesc: description,
|
|
5816
6163
|
modelSchemaDesign: schemaDescription,
|
|
5817
6164
|
boilerplate: constant.content,
|
|
5818
|
-
|
|
6165
|
+
exampleFiles: randomPicks(scalarConstantExampleFiles, Math.min(10, scalarConstantExampleFiles.length))
|
|
5819
6166
|
})
|
|
5820
6167
|
);
|
|
5821
6168
|
sys2.writeFile(`lib/__scalar/${name}/${name}.constant.ts`, content);
|
|
@@ -5824,21 +6171,8 @@ var ModuleScript = class {
|
|
|
5824
6171
|
}
|
|
5825
6172
|
async createTest(workspace, name) {
|
|
5826
6173
|
}
|
|
5827
|
-
async createTemplate(sys2) {
|
|
6174
|
+
async createTemplate(sys2, name) {
|
|
5828
6175
|
await AiSession.init();
|
|
5829
|
-
const libs = await sys2.getModules();
|
|
5830
|
-
const lib = await select4({
|
|
5831
|
-
message: "Select the lib",
|
|
5832
|
-
choices: libs
|
|
5833
|
-
}).catch((e) => {
|
|
5834
|
-
Logger.error("canceled");
|
|
5835
|
-
return null;
|
|
5836
|
-
});
|
|
5837
|
-
if (!lib)
|
|
5838
|
-
return;
|
|
5839
|
-
const name = lib.split("/").pop();
|
|
5840
|
-
if (!name)
|
|
5841
|
-
return;
|
|
5842
6176
|
const { component: template } = await this.#runner.createComponentTemplate(sys2, name, "template");
|
|
5843
6177
|
const templateExampleFiles = (await sys2.getTemplatesSourceCode()).filter(
|
|
5844
6178
|
(f) => !f.filepath.includes(`${name}.Template.tsx`)
|
|
@@ -5857,25 +6191,10 @@ var ModuleScript = class {
|
|
|
5857
6191
|
exampleFiles: randomPicks(templateExampleFiles, Math.min(20, templateExampleFiles.length))
|
|
5858
6192
|
});
|
|
5859
6193
|
const content = await session.editTypescript(promptRst);
|
|
5860
|
-
|
|
5861
|
-
fs12.writeFileSync(`${sys2.cwdPath}/resultTemplate.txt`, content);
|
|
5862
|
-
sys2.writeFile(`lib/${name}__/${Name}.Template.tsx`, content);
|
|
6194
|
+
sys2.writeFile(`lib/${name}/${Name}.Template.tsx`, content);
|
|
5863
6195
|
}
|
|
5864
|
-
async createUnit(sys2) {
|
|
6196
|
+
async createUnit(sys2, name) {
|
|
5865
6197
|
await AiSession.init();
|
|
5866
|
-
const libs = await sys2.getModules();
|
|
5867
|
-
const lib = await select4({
|
|
5868
|
-
message: "Select the lib",
|
|
5869
|
-
choices: libs
|
|
5870
|
-
}).catch((e) => {
|
|
5871
|
-
Logger.error("canceled");
|
|
5872
|
-
return null;
|
|
5873
|
-
});
|
|
5874
|
-
if (!lib)
|
|
5875
|
-
return;
|
|
5876
|
-
const name = lib.split("/").pop();
|
|
5877
|
-
if (!name)
|
|
5878
|
-
return;
|
|
5879
6198
|
const { component: unit } = await this.#runner.createComponentTemplate(sys2, name, "unit");
|
|
5880
6199
|
const Name = capitalize(name);
|
|
5881
6200
|
const unitExampleFiles = (await sys2.getUnitsSourceCode()).filter((f) => !f.filepath.includes(`${name}.Unit.tsx`));
|
|
@@ -5892,25 +6211,10 @@ var ModuleScript = class {
|
|
|
5892
6211
|
boilerplate: unit.content
|
|
5893
6212
|
});
|
|
5894
6213
|
const content = await session.editTypescript(promptRst);
|
|
5895
|
-
|
|
5896
|
-
fs12.writeFileSync(`${sys2.cwdPath}/resultUnit.txt`, content);
|
|
5897
|
-
sys2.writeFile(`lib/${name}__/${Name}.Unit.tsx`, content);
|
|
6214
|
+
sys2.writeFile(`lib/${name}/${Name}.Unit.tsx`, content);
|
|
5898
6215
|
}
|
|
5899
|
-
async createView(sys2) {
|
|
6216
|
+
async createView(sys2, name) {
|
|
5900
6217
|
await AiSession.init();
|
|
5901
|
-
const libs = await sys2.getModules();
|
|
5902
|
-
const lib = await select4({
|
|
5903
|
-
message: "Select the lib",
|
|
5904
|
-
choices: libs
|
|
5905
|
-
}).catch((e) => {
|
|
5906
|
-
Logger.error("canceled");
|
|
5907
|
-
return null;
|
|
5908
|
-
});
|
|
5909
|
-
if (!lib)
|
|
5910
|
-
return;
|
|
5911
|
-
const name = lib.split("/").pop();
|
|
5912
|
-
if (!name)
|
|
5913
|
-
return;
|
|
5914
6218
|
const { component: view } = await this.#runner.createComponentTemplate(sys2, name, "view");
|
|
5915
6219
|
const viewExampleFiles = (await sys2.getViewsSourceCode()).filter((f) => !f.filepath.includes(`${name}.View.tsx`));
|
|
5916
6220
|
const Name = capitalize(name);
|
|
@@ -5927,73 +6231,82 @@ var ModuleScript = class {
|
|
|
5927
6231
|
exampleFiles: randomPicks(viewExampleFiles, Math.min(20, viewExampleFiles.length))
|
|
5928
6232
|
});
|
|
5929
6233
|
const content = await session.editTypescript(promptRst);
|
|
5930
|
-
|
|
5931
|
-
fs12.writeFileSync(`${sys2.cwdPath}/result.txt`, content);
|
|
5932
|
-
sys2.writeFile(`lib/${name}__/${Name}.View.tsx`, content);
|
|
6234
|
+
sys2.writeFile(`lib/${name}/${Name}.View.tsx`, content);
|
|
5933
6235
|
}
|
|
5934
6236
|
};
|
|
5935
6237
|
|
|
5936
6238
|
// pkgs/@akanjs/cli/src/module/module.command.ts
|
|
5937
6239
|
var ModuleCommand = class {
|
|
5938
6240
|
moduleScript = new ModuleScript();
|
|
5939
|
-
async
|
|
5940
|
-
await
|
|
5941
|
-
|
|
5942
|
-
|
|
5943
|
-
|
|
5944
|
-
|
|
6241
|
+
async selectLib(sys2) {
|
|
6242
|
+
const libs = await sys2.getModules();
|
|
6243
|
+
const lib = await select4({
|
|
6244
|
+
message: "Select the lib",
|
|
6245
|
+
choices: libs.map((l) => `${sys2.name}/${l}`)
|
|
6246
|
+
}).catch((e) => {
|
|
6247
|
+
Logger.error("canceled");
|
|
6248
|
+
return null;
|
|
6249
|
+
});
|
|
6250
|
+
return lib?.split("/").pop();
|
|
5945
6251
|
}
|
|
5946
|
-
async
|
|
5947
|
-
|
|
6252
|
+
async createModule(sys2, moduleName, description, schemaDescription, ai, workspace) {
|
|
6253
|
+
const name = lowerlize(moduleName.replace(/ /g, ""));
|
|
6254
|
+
if (ai) {
|
|
6255
|
+
await this.moduleScript.createModule(sys2, name, description, schemaDescription);
|
|
6256
|
+
} else {
|
|
6257
|
+
await this.moduleScript.createModuleTemplate(sys2, name);
|
|
6258
|
+
}
|
|
5948
6259
|
}
|
|
5949
|
-
async
|
|
6260
|
+
async removeModule(sys2, workspace) {
|
|
6261
|
+
const name = await this.selectLib(sys2);
|
|
6262
|
+
if (!name)
|
|
6263
|
+
return;
|
|
6264
|
+
this.moduleScript.removeModule(sys2, name);
|
|
5950
6265
|
}
|
|
5951
|
-
async
|
|
6266
|
+
async createScalar(sys2, scalarName, description, schemaDescription, workspace) {
|
|
6267
|
+
await this.moduleScript.createScalar(sys2, lowerlize(scalarName.replace(/ /g, "")), description, schemaDescription);
|
|
5952
6268
|
}
|
|
5953
6269
|
async createView(sys2, workspace) {
|
|
5954
|
-
await this.
|
|
6270
|
+
const name = await this.selectLib(sys2);
|
|
6271
|
+
if (!name)
|
|
6272
|
+
return;
|
|
6273
|
+
await this.moduleScript.createView(sys2, name);
|
|
5955
6274
|
}
|
|
5956
6275
|
async createUnit(sys2, workspace) {
|
|
5957
|
-
await this.
|
|
6276
|
+
const name = await this.selectLib(sys2);
|
|
6277
|
+
if (!name)
|
|
6278
|
+
return;
|
|
6279
|
+
await this.moduleScript.createUnit(sys2, name);
|
|
5958
6280
|
}
|
|
5959
6281
|
async createTemplate(sys2, workspace) {
|
|
5960
|
-
await this.
|
|
6282
|
+
const name = await this.selectLib(sys2);
|
|
6283
|
+
if (!name)
|
|
6284
|
+
return;
|
|
6285
|
+
await this.moduleScript.createTemplate(sys2, name);
|
|
5961
6286
|
}
|
|
5962
6287
|
};
|
|
5963
6288
|
__decorateClass([
|
|
5964
6289
|
Target.Public(),
|
|
5965
6290
|
__decorateParam(0, Sys()),
|
|
5966
|
-
__decorateParam(1,
|
|
5967
|
-
__decorateParam(2,
|
|
6291
|
+
__decorateParam(1, Argument("moduleName", { desc: "name of module" })),
|
|
6292
|
+
__decorateParam(2, Option("description", { desc: "description of module" })),
|
|
6293
|
+
__decorateParam(3, Option("schemaDescription", { desc: "schema description of module" })),
|
|
6294
|
+
__decorateParam(4, Option("ai", { type: "boolean", default: false, desc: "use ai to create module" })),
|
|
6295
|
+
__decorateParam(5, Workspace())
|
|
5968
6296
|
], ModuleCommand.prototype, "createModule", 1);
|
|
5969
6297
|
__decorateClass([
|
|
5970
6298
|
Target.Public(),
|
|
5971
|
-
__decorateParam(0,
|
|
6299
|
+
__decorateParam(0, Sys()),
|
|
5972
6300
|
__decorateParam(1, Workspace())
|
|
5973
6301
|
], ModuleCommand.prototype, "removeModule", 1);
|
|
5974
|
-
__decorateClass([
|
|
5975
|
-
Target.Public(),
|
|
5976
|
-
__decorateParam(0, Option("name", { desc: "name of module" })),
|
|
5977
|
-
__decorateParam(1, Workspace())
|
|
5978
|
-
], ModuleCommand.prototype, "scanModule", 1);
|
|
5979
6302
|
__decorateClass([
|
|
5980
6303
|
Target.Public(),
|
|
5981
6304
|
__decorateParam(0, Sys()),
|
|
5982
|
-
__decorateParam(1,
|
|
6305
|
+
__decorateParam(1, Argument("scalarName", { desc: "name of scalar module" })),
|
|
5983
6306
|
__decorateParam(2, Option("description", { desc: "description of scalar module" })),
|
|
5984
6307
|
__decorateParam(3, Option("schemaDescription", { desc: "schema description of scalar module" })),
|
|
5985
6308
|
__decorateParam(4, Workspace())
|
|
5986
6309
|
], ModuleCommand.prototype, "createScalar", 1);
|
|
5987
|
-
__decorateClass([
|
|
5988
|
-
Target.Public(),
|
|
5989
|
-
__decorateParam(0, Option("name", { desc: "name of service module" })),
|
|
5990
|
-
__decorateParam(1, Workspace())
|
|
5991
|
-
], ModuleCommand.prototype, "createService", 1);
|
|
5992
|
-
__decorateClass([
|
|
5993
|
-
Target.Public(),
|
|
5994
|
-
__decorateParam(0, Option("name", { desc: "name of test module" })),
|
|
5995
|
-
__decorateParam(1, Workspace())
|
|
5996
|
-
], ModuleCommand.prototype, "createTest", 1);
|
|
5997
6310
|
__decorateClass([
|
|
5998
6311
|
Target.Public(),
|
|
5999
6312
|
__decorateParam(0, Sys()),
|
|
@@ -6025,8 +6338,8 @@ var PackageCommand = class {
|
|
|
6025
6338
|
async removePackage(pkg) {
|
|
6026
6339
|
await this.packageScript.removePackage(pkg);
|
|
6027
6340
|
}
|
|
6028
|
-
async
|
|
6029
|
-
await this.packageScript.
|
|
6341
|
+
async syncPackage(pkg) {
|
|
6342
|
+
await this.packageScript.syncPackage(pkg);
|
|
6030
6343
|
}
|
|
6031
6344
|
async buildPackage(pkg) {
|
|
6032
6345
|
await this.packageScript.buildPackage(pkg);
|
|
@@ -6048,7 +6361,7 @@ __decorateClass([
|
|
|
6048
6361
|
__decorateClass([
|
|
6049
6362
|
Target.Public(),
|
|
6050
6363
|
__decorateParam(0, Pkg())
|
|
6051
|
-
], PackageCommand.prototype, "
|
|
6364
|
+
], PackageCommand.prototype, "syncPackage", 1);
|
|
6052
6365
|
__decorateClass([
|
|
6053
6366
|
Target.Public(),
|
|
6054
6367
|
__decorateParam(0, Pkg())
|
|
@@ -6096,6 +6409,7 @@ var WorkspaceRunner = class {
|
|
|
6096
6409
|
const cwdPath = process.cwd();
|
|
6097
6410
|
const workspaceRoot = path6.join(cwdPath, dirname, repoName);
|
|
6098
6411
|
const workspace = new WorkspaceExecutor({ workspaceRoot, repoName });
|
|
6412
|
+
const templateSpinner = workspace.spinning(`Creating workspace template files in ${dirname}/${repoName}...`);
|
|
6099
6413
|
await workspace.applyTemplate({
|
|
6100
6414
|
basePath: ".",
|
|
6101
6415
|
template: "workspaceRoot",
|
|
@@ -6107,6 +6421,7 @@ var WorkspaceRunner = class {
|
|
|
6107
6421
|
serveDomain: "localhost"
|
|
6108
6422
|
}
|
|
6109
6423
|
});
|
|
6424
|
+
templateSpinner.succeed(`Workspace files created in ${dirname}/${repoName}`);
|
|
6110
6425
|
const rootPackageJson = workspace.readJson("package.json");
|
|
6111
6426
|
const dependencies = [
|
|
6112
6427
|
"@akanjs/base",
|
|
@@ -6139,10 +6454,12 @@ var WorkspaceRunner = class {
|
|
|
6139
6454
|
}
|
|
6140
6455
|
};
|
|
6141
6456
|
workspace.writeFile("package.json", packageJson);
|
|
6142
|
-
workspace.
|
|
6457
|
+
const installSpinner = workspace.spinning("Installing dependencies with pnpm...");
|
|
6143
6458
|
await workspace.spawn("pnpm", ["install", "--reporter=silent"]);
|
|
6144
|
-
|
|
6459
|
+
installSpinner.succeed("Dependencies installed with pnpm");
|
|
6460
|
+
const gitSpinner = workspace.spinning("Initializing git repository and commit...");
|
|
6145
6461
|
await workspace.commit("Initial commit", { init: true });
|
|
6462
|
+
gitSpinner.succeed("Git repository initialized and committed");
|
|
6146
6463
|
return workspace;
|
|
6147
6464
|
}
|
|
6148
6465
|
async generateMongo(workspace) {
|
|
@@ -6198,19 +6515,30 @@ var WorkspaceScript = class {
|
|
|
6198
6515
|
await this.libraryScript.installLibrary(workspace, "util");
|
|
6199
6516
|
await this.libraryScript.installLibrary(workspace, "shared");
|
|
6200
6517
|
await this.applicationScript.createApplication(appName, workspace);
|
|
6201
|
-
|
|
6202
|
-
|
|
6518
|
+
Logger.rawLog(`
|
|
6519
|
+
\u{1F389} Welcome aboard! Workspace created in ${dirname}/${repoName}`);
|
|
6520
|
+
Logger.rawLog(`\u{1F680} Run \`cd ${repoName} && akan start ${appName}\` to start the development server.`);
|
|
6521
|
+
Logger.rawLog(`
|
|
6522
|
+
\u{1F44B} Happy coding!`);
|
|
6203
6523
|
}
|
|
6204
6524
|
async generateMongo(workspace) {
|
|
6525
|
+
const spinner = workspace.spinning("Generating Mongo connections...");
|
|
6205
6526
|
await this.#runner.generateMongo(workspace);
|
|
6206
|
-
|
|
6527
|
+
spinner.succeed(`Mongo connections generated in infra/master/mongo-connections.json`);
|
|
6207
6528
|
}
|
|
6208
6529
|
async lint(exec2, workspace, { fix = true } = {}) {
|
|
6209
6530
|
if (exec2 instanceof AppExecutor)
|
|
6210
6531
|
await this.applicationScript.syncApplication(exec2);
|
|
6211
6532
|
else if (exec2 instanceof LibExecutor)
|
|
6212
6533
|
await this.libraryScript.syncLibrary(exec2);
|
|
6213
|
-
|
|
6534
|
+
const spinner = workspace.spinning(`Linting${fix ? " with fix" : ""}...`);
|
|
6535
|
+
try {
|
|
6536
|
+
await this.#runner.lint(exec2, workspace, { fix });
|
|
6537
|
+
spinner.succeed("Lint completed with no errors");
|
|
6538
|
+
} catch (error) {
|
|
6539
|
+
spinner.fail("Lint failed with errors");
|
|
6540
|
+
throw error;
|
|
6541
|
+
}
|
|
6214
6542
|
}
|
|
6215
6543
|
async lintAll(workspace, { fix = true } = {}) {
|
|
6216
6544
|
const [appNames, libNames, pkgNames] = await workspace.getExecs();
|
|
@@ -6229,8 +6557,12 @@ var WorkspaceScript = class {
|
|
|
6229
6557
|
// pkgs/@akanjs/cli/src/workspace/workspace.command.ts
|
|
6230
6558
|
var WorkspaceCommand = class {
|
|
6231
6559
|
workspaceScript = new WorkspaceScript();
|
|
6232
|
-
async createWorkspace(
|
|
6233
|
-
await this.workspaceScript.createWorkspace(
|
|
6560
|
+
async createWorkspace(workspaceName, app, dir) {
|
|
6561
|
+
await this.workspaceScript.createWorkspace(
|
|
6562
|
+
workspaceName.toLowerCase().replace(/ /g, "-"),
|
|
6563
|
+
app.toLowerCase().replace(/ /g, "-"),
|
|
6564
|
+
dir
|
|
6565
|
+
);
|
|
6234
6566
|
}
|
|
6235
6567
|
async generateMongo(workspace) {
|
|
6236
6568
|
await this.workspaceScript.generateMongo(workspace);
|
|
@@ -6244,7 +6576,7 @@ var WorkspaceCommand = class {
|
|
|
6244
6576
|
};
|
|
6245
6577
|
__decorateClass([
|
|
6246
6578
|
Target.Public(),
|
|
6247
|
-
__decorateParam(0,
|
|
6579
|
+
__decorateParam(0, Argument("workspaceName", { desc: "what is the name of your organization?" })),
|
|
6248
6580
|
__decorateParam(1, Option("app", { desc: "describe your first application to create " })),
|
|
6249
6581
|
__decorateParam(2, Option("dir", { desc: "directory of workspace", default: process.env.USE_AKANJS_PKGS === "true" ? "local" : "." }))
|
|
6250
6582
|
], WorkspaceCommand.prototype, "createWorkspace", 1);
|