@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/cjs/index.js
CHANGED
|
@@ -447,11 +447,11 @@ var Logger = class _Logger {
|
|
|
447
447
|
console.log(`${processMsg} ${timestampMsg} ${logLevelMsg} ${contextMsg} ${contentMsg} ${timeDiffMsg}
|
|
448
448
|
`);
|
|
449
449
|
}
|
|
450
|
-
static rawLog(msg, method) {
|
|
450
|
+
static rawLog(msg = "", method) {
|
|
451
451
|
this.raw(`${msg}
|
|
452
452
|
`, method);
|
|
453
453
|
}
|
|
454
|
-
static raw(msg, method) {
|
|
454
|
+
static raw(msg = "", method) {
|
|
455
455
|
if (typeof window === "undefined" && method !== "console" && global.process)
|
|
456
456
|
global.process.stdout.write(msg);
|
|
457
457
|
else
|
|
@@ -916,28 +916,50 @@ var TypeScriptDependencyScanner = class {
|
|
|
916
916
|
|
|
917
917
|
// pkgs/@akanjs/devkit/src/spinner.ts
|
|
918
918
|
var import_ora2 = __toESM(require("ora"));
|
|
919
|
-
var Spinner = class {
|
|
919
|
+
var Spinner = class _Spinner {
|
|
920
|
+
static padding = 12;
|
|
920
921
|
spinner;
|
|
921
922
|
stopWatch;
|
|
922
923
|
startAt;
|
|
924
|
+
prefix;
|
|
923
925
|
message;
|
|
924
|
-
|
|
926
|
+
enableSpin;
|
|
927
|
+
constructor(message, { prefix = "", indent = 0, enableSpin = true } = {}) {
|
|
928
|
+
_Spinner.padding = Math.max(_Spinner.padding, prefix.length);
|
|
929
|
+
this.prefix = prefix;
|
|
925
930
|
this.message = message;
|
|
926
931
|
this.spinner = (0, import_ora2.default)(message);
|
|
927
|
-
this.spinner.prefixText = prefix;
|
|
932
|
+
this.spinner.prefixText = prefix.padStart(_Spinner.padding, " ");
|
|
928
933
|
this.spinner.indent = indent;
|
|
934
|
+
this.enableSpin = enableSpin;
|
|
929
935
|
}
|
|
930
936
|
start() {
|
|
931
937
|
this.startAt = /* @__PURE__ */ new Date();
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
938
|
+
if (this.enableSpin) {
|
|
939
|
+
this.spinner.start();
|
|
940
|
+
this.stopWatch = setInterval(() => {
|
|
941
|
+
this.spinner.prefixText = this.prefix.padStart(_Spinner.padding, " ");
|
|
942
|
+
this.spinner.text = `${this.message} (${this.#getElapsedTimeStr()})`;
|
|
943
|
+
}, 1e3);
|
|
944
|
+
} else
|
|
945
|
+
this.spinner.info();
|
|
936
946
|
return this;
|
|
937
947
|
}
|
|
938
948
|
succeed(message) {
|
|
939
|
-
clearInterval(this.stopWatch);
|
|
940
949
|
this.spinner.succeed(`${message} (${this.#getElapsedTimeStr()})`);
|
|
950
|
+
this.#reset();
|
|
951
|
+
}
|
|
952
|
+
fail(message) {
|
|
953
|
+
this.spinner.fail(`${message} (${this.#getElapsedTimeStr()})`);
|
|
954
|
+
this.#reset();
|
|
955
|
+
}
|
|
956
|
+
isSpinning() {
|
|
957
|
+
return this.spinner.isSpinning;
|
|
958
|
+
}
|
|
959
|
+
#reset() {
|
|
960
|
+
if (this.stopWatch)
|
|
961
|
+
clearInterval(this.stopWatch);
|
|
962
|
+
this.stopWatch = null;
|
|
941
963
|
}
|
|
942
964
|
#getElapsedTimeStr() {
|
|
943
965
|
const ms = (/* @__PURE__ */ new Date()).getTime() - this.startAt.getTime();
|
|
@@ -961,7 +983,11 @@ var execEmoji = {
|
|
|
961
983
|
default: "\u2708\uFE0F"
|
|
962
984
|
// for sys executor
|
|
963
985
|
};
|
|
964
|
-
var Executor = class {
|
|
986
|
+
var Executor = class _Executor {
|
|
987
|
+
static verbose = false;
|
|
988
|
+
static setVerbose(verbose) {
|
|
989
|
+
_Executor.verbose = verbose;
|
|
990
|
+
}
|
|
965
991
|
name;
|
|
966
992
|
logger;
|
|
967
993
|
cwdPath;
|
|
@@ -973,13 +999,20 @@ var Executor = class {
|
|
|
973
999
|
if (!import_fs4.default.existsSync(cwdPath))
|
|
974
1000
|
import_fs4.default.mkdirSync(cwdPath, { recursive: true });
|
|
975
1001
|
}
|
|
1002
|
+
#stdout(data) {
|
|
1003
|
+
if (_Executor.verbose)
|
|
1004
|
+
Logger.raw(import_chalk.default.dim(data.toString()));
|
|
1005
|
+
}
|
|
1006
|
+
#stderr(data) {
|
|
1007
|
+
Logger.raw(import_chalk.default.red(data.toString()));
|
|
1008
|
+
}
|
|
976
1009
|
exec(command, options = {}) {
|
|
977
1010
|
const proc = (0, import_child_process.exec)(command, { cwd: this.cwdPath, ...options });
|
|
978
1011
|
proc.stdout?.on("data", (data) => {
|
|
979
|
-
|
|
1012
|
+
this.#stdout(data);
|
|
980
1013
|
});
|
|
981
1014
|
proc.stderr?.on("data", (data) => {
|
|
982
|
-
|
|
1015
|
+
this.#stdout(data);
|
|
983
1016
|
});
|
|
984
1017
|
return new Promise((resolve, reject) => {
|
|
985
1018
|
proc.on("exit", (code, signal) => {
|
|
@@ -991,12 +1024,16 @@ var Executor = class {
|
|
|
991
1024
|
});
|
|
992
1025
|
}
|
|
993
1026
|
spawn(command, args = [], options = {}) {
|
|
994
|
-
const proc = (0, import_child_process.spawn)(command, args, {
|
|
1027
|
+
const proc = (0, import_child_process.spawn)(command, args, {
|
|
1028
|
+
cwd: this.cwdPath,
|
|
1029
|
+
stdio: "inherit",
|
|
1030
|
+
...options
|
|
1031
|
+
});
|
|
995
1032
|
proc.stdout?.on("data", (data) => {
|
|
996
|
-
|
|
1033
|
+
this.#stdout(data);
|
|
997
1034
|
});
|
|
998
1035
|
proc.stderr?.on("data", (data) => {
|
|
999
|
-
|
|
1036
|
+
this.#stderr(data);
|
|
1000
1037
|
});
|
|
1001
1038
|
return new Promise((resolve, reject) => {
|
|
1002
1039
|
proc.on("exit", (code, signal) => {
|
|
@@ -1014,10 +1051,10 @@ var Executor = class {
|
|
|
1014
1051
|
...options
|
|
1015
1052
|
});
|
|
1016
1053
|
proc.stdout?.on("data", (data) => {
|
|
1017
|
-
|
|
1054
|
+
this.#stdout(data);
|
|
1018
1055
|
});
|
|
1019
1056
|
proc.stderr?.on("data", (data) => {
|
|
1020
|
-
|
|
1057
|
+
this.#stderr(data);
|
|
1021
1058
|
});
|
|
1022
1059
|
return new Promise((resolve, reject) => {
|
|
1023
1060
|
proc.on("exit", (code, signal) => {
|
|
@@ -1042,6 +1079,20 @@ var Executor = class {
|
|
|
1042
1079
|
const readPath = this.#getPath(filePath);
|
|
1043
1080
|
return import_fs4.default.existsSync(readPath);
|
|
1044
1081
|
}
|
|
1082
|
+
remove(filePath) {
|
|
1083
|
+
const readPath = this.#getPath(filePath);
|
|
1084
|
+
if (import_fs4.default.existsSync(readPath))
|
|
1085
|
+
import_fs4.default.unlinkSync(readPath);
|
|
1086
|
+
this.logger.verbose(`Remove file ${readPath}`);
|
|
1087
|
+
return this;
|
|
1088
|
+
}
|
|
1089
|
+
removeDir(dirPath) {
|
|
1090
|
+
const readPath = this.#getPath(dirPath);
|
|
1091
|
+
if (import_fs4.default.existsSync(readPath))
|
|
1092
|
+
import_fs4.default.rmSync(readPath, { recursive: true });
|
|
1093
|
+
this.logger.verbose(`Remove directory ${readPath}`);
|
|
1094
|
+
return this;
|
|
1095
|
+
}
|
|
1045
1096
|
writeFile(filePath, content, { overwrite = true } = {}) {
|
|
1046
1097
|
const writePath = this.#getPath(filePath);
|
|
1047
1098
|
const dir = import_path3.default.dirname(writePath);
|
|
@@ -1092,8 +1143,8 @@ var Executor = class {
|
|
|
1092
1143
|
this.logger.verbose(msg);
|
|
1093
1144
|
return this;
|
|
1094
1145
|
}
|
|
1095
|
-
spinning(msg, { prefix = `${this.emoji}${this.name}
|
|
1096
|
-
return new Spinner(msg, { prefix, indent }).start();
|
|
1146
|
+
spinning(msg, { prefix = `${this.emoji}${this.name}`, indent = 0, enableSpin = !_Executor.verbose } = {}) {
|
|
1147
|
+
return new Spinner(msg, { prefix, indent, enableSpin }).start();
|
|
1097
1148
|
}
|
|
1098
1149
|
getTsConfig(pathname = "tsconfig.json") {
|
|
1099
1150
|
const tsconfig = this.readJson(pathname);
|
|
@@ -1262,23 +1313,41 @@ var WorkspaceExecutor = class _WorkspaceExecutor extends Executor {
|
|
|
1262
1313
|
}
|
|
1263
1314
|
setTsPaths(type, name) {
|
|
1264
1315
|
const rootTsConfig = this.readJson("tsconfig.json");
|
|
1265
|
-
if (type === "lib")
|
|
1316
|
+
if (type === "lib" || type === "pkg")
|
|
1266
1317
|
rootTsConfig.compilerOptions.paths[`@${name}`] = [`${type}s/${name}/index.ts`];
|
|
1267
1318
|
rootTsConfig.compilerOptions.paths[`@${name}/*`] = [`${type}s/${name}/*`];
|
|
1319
|
+
if (rootTsConfig.references) {
|
|
1320
|
+
if (!rootTsConfig.references.some((ref) => ref.path === `./${type}s/${name}/tsconfig.json`))
|
|
1321
|
+
rootTsConfig.references.push({ path: `./${type}s/${name}/tsconfig.json` });
|
|
1322
|
+
}
|
|
1323
|
+
this.writeJson("tsconfig.json", rootTsConfig);
|
|
1324
|
+
return this;
|
|
1325
|
+
}
|
|
1326
|
+
unsetTsPaths(type, name) {
|
|
1327
|
+
const rootTsConfig = this.readJson("tsconfig.json");
|
|
1328
|
+
const filteredKeys = Object.keys(rootTsConfig.compilerOptions.paths).filter((key) => !key.startsWith(`@${name}`));
|
|
1329
|
+
rootTsConfig.compilerOptions.paths = Object.fromEntries(
|
|
1330
|
+
filteredKeys.map((key) => [key, rootTsConfig.compilerOptions.paths[key]])
|
|
1331
|
+
);
|
|
1332
|
+
if (rootTsConfig.references) {
|
|
1333
|
+
rootTsConfig.references = rootTsConfig.references.filter(
|
|
1334
|
+
(ref) => !ref.path.startsWith(`./${type}s/${name}`)
|
|
1335
|
+
);
|
|
1336
|
+
}
|
|
1268
1337
|
this.writeJson("tsconfig.json", rootTsConfig);
|
|
1269
1338
|
return this;
|
|
1270
1339
|
}
|
|
1271
1340
|
async getDirInModule(basePath2, name) {
|
|
1272
|
-
const AVOID_DIRS = ["__lib", "__scalar", `_${name}`];
|
|
1341
|
+
const AVOID_DIRS = ["__lib", "__scalar", `_`, `_${name}`];
|
|
1273
1342
|
const getDirs = async (dirname, maxDepth = 3, results = [], prefix = "") => {
|
|
1274
1343
|
const dirs = await import_promises.default.readdir(dirname);
|
|
1275
1344
|
await Promise.all(
|
|
1276
1345
|
dirs.map(async (dir) => {
|
|
1277
|
-
if (AVOID_DIRS.includes(dir))
|
|
1346
|
+
if (dir.includes("_") || AVOID_DIRS.includes(dir))
|
|
1278
1347
|
return;
|
|
1279
1348
|
const dirPath = import_path3.default.join(dirname, dir);
|
|
1280
1349
|
if (import_fs4.default.lstatSync(dirPath).isDirectory()) {
|
|
1281
|
-
results.push(`${
|
|
1350
|
+
results.push(`${prefix}${dir}`);
|
|
1282
1351
|
if (maxDepth > 0)
|
|
1283
1352
|
await getDirs(dirPath, maxDepth - 1, results, `${prefix}${dir}/`);
|
|
1284
1353
|
}
|
|
@@ -1325,6 +1394,22 @@ var WorkspaceExecutor = class _WorkspaceExecutor extends Executor {
|
|
|
1325
1394
|
];
|
|
1326
1395
|
return scalarConstantExampleFiles;
|
|
1327
1396
|
}
|
|
1397
|
+
async getConstantFiles() {
|
|
1398
|
+
const [appNames, libNames] = await this.getSyss();
|
|
1399
|
+
const moduleConstantExampleFiles = [
|
|
1400
|
+
...(await Promise.all(appNames.map((appName) => AppExecutor.from(this, appName).getConstantFiles()))).flat(),
|
|
1401
|
+
...(await Promise.all(libNames.map((libName) => LibExecutor.from(this, libName).getConstantFiles()))).flat()
|
|
1402
|
+
];
|
|
1403
|
+
return moduleConstantExampleFiles;
|
|
1404
|
+
}
|
|
1405
|
+
async getDictionaryFiles() {
|
|
1406
|
+
const [appNames, libNames] = await this.getSyss();
|
|
1407
|
+
const moduleDictionaryExampleFiles = [
|
|
1408
|
+
...(await Promise.all(appNames.map((appName) => AppExecutor.from(this, appName).getDictionaryFiles()))).flat(),
|
|
1409
|
+
...(await Promise.all(libNames.map((libName) => LibExecutor.from(this, libName).getDictionaryFiles()))).flat()
|
|
1410
|
+
];
|
|
1411
|
+
return moduleDictionaryExampleFiles;
|
|
1412
|
+
}
|
|
1328
1413
|
async getViewFiles() {
|
|
1329
1414
|
const [appNames, libNames] = await this.getSyss();
|
|
1330
1415
|
const viewExampleFiles = [
|
|
@@ -1554,9 +1639,15 @@ var SysExecutor = class extends Executor {
|
|
|
1554
1639
|
}
|
|
1555
1640
|
async getScalarDictionaryFiles() {
|
|
1556
1641
|
const scalarModules = await this.getScalarModules();
|
|
1557
|
-
return scalarModules.map(
|
|
1558
|
-
|
|
1559
|
-
|
|
1642
|
+
return scalarModules.map((scalarModule) => this.getLocalFile(`lib/${scalarModule}/${scalarModule}.dictionary.ts`));
|
|
1643
|
+
}
|
|
1644
|
+
async getConstantFiles() {
|
|
1645
|
+
const modules = await this.getModules();
|
|
1646
|
+
return modules.map((module2) => this.getLocalFile(`lib/${module2}/${module2}.constant.ts`));
|
|
1647
|
+
}
|
|
1648
|
+
async getDictionaryFiles() {
|
|
1649
|
+
const modules = await this.getModules();
|
|
1650
|
+
return modules.map((module2) => this.getLocalFile(`lib/${module2}/${module2}.dictionary.ts`));
|
|
1560
1651
|
}
|
|
1561
1652
|
setTsPaths() {
|
|
1562
1653
|
this.workspace.setTsPaths(this.type, this.name);
|
|
@@ -1575,6 +1666,9 @@ var AppExecutor = class _AppExecutor extends SysExecutor {
|
|
|
1575
1666
|
return new _AppExecutor({ workspace: executor, name });
|
|
1576
1667
|
return new _AppExecutor({ workspace: executor.workspace, name });
|
|
1577
1668
|
}
|
|
1669
|
+
getEnv() {
|
|
1670
|
+
return this.workspace.getBaseDevEnv().env;
|
|
1671
|
+
}
|
|
1578
1672
|
async getConfig(command) {
|
|
1579
1673
|
return await getAppConfig(this.cwdPath, {
|
|
1580
1674
|
...this.workspace.getBaseDevEnv(),
|
|
@@ -1994,6 +2088,7 @@ var getArg = (type) => function(name, argsOption = {}) {
|
|
|
1994
2088
|
setArgMetasOnPrototype(prototype, key, argMetas);
|
|
1995
2089
|
};
|
|
1996
2090
|
};
|
|
2091
|
+
var Argument = getArg("Argument");
|
|
1997
2092
|
var Option = getArg("Option");
|
|
1998
2093
|
var createArgMetaDecorator = (type) => {
|
|
1999
2094
|
return function(option = {}) {
|
|
@@ -2070,6 +2165,16 @@ var handleOption = (programCommand, argMeta) => {
|
|
|
2070
2165
|
);
|
|
2071
2166
|
return programCommand;
|
|
2072
2167
|
};
|
|
2168
|
+
var handleArgument = (programCommand, argMeta) => {
|
|
2169
|
+
const kebabName = camelToKebabCase(argMeta.name);
|
|
2170
|
+
if ((argMeta.argsOption.type ?? "string") !== "string")
|
|
2171
|
+
throw new Error(`Argument type must be string: ${argMeta.name}`);
|
|
2172
|
+
programCommand.argument(
|
|
2173
|
+
`[${kebabName}]`,
|
|
2174
|
+
`${argMeta.argsOption.desc}${argMeta.argsOption.example ? ` (example: ${argMeta.argsOption.example})` : ""}`
|
|
2175
|
+
);
|
|
2176
|
+
return programCommand;
|
|
2177
|
+
};
|
|
2073
2178
|
var convertOptionValue = (value, type) => {
|
|
2074
2179
|
if (type === "string")
|
|
2075
2180
|
return value;
|
|
@@ -2106,7 +2211,21 @@ var getOptionValue = async (argMeta, opt) => {
|
|
|
2106
2211
|
return convertOptionValue(await (0, import_prompts3.input)({ message }), type ?? "string");
|
|
2107
2212
|
}
|
|
2108
2213
|
};
|
|
2109
|
-
var getArgumentValue = async (argMeta, value
|
|
2214
|
+
var getArgumentValue = async (argMeta, value) => {
|
|
2215
|
+
const {
|
|
2216
|
+
name,
|
|
2217
|
+
argsOption: { default: defaultValue, type, desc, nullable, example, ask }
|
|
2218
|
+
} = argMeta;
|
|
2219
|
+
if (value !== void 0)
|
|
2220
|
+
return value;
|
|
2221
|
+
else if (defaultValue !== void 0)
|
|
2222
|
+
return defaultValue;
|
|
2223
|
+
else if (nullable)
|
|
2224
|
+
return null;
|
|
2225
|
+
const message = ask ? `${ask}: ` : desc ? `${desc}: ` : `Enter the ${name} value${example ? ` (example: ${example})` : ""}: `;
|
|
2226
|
+
return await (0, import_prompts3.input)({ message });
|
|
2227
|
+
};
|
|
2228
|
+
var getInternalArgumentValue = async (argMeta, value, workspace) => {
|
|
2110
2229
|
if (argMeta.type === "Workspace")
|
|
2111
2230
|
return workspace;
|
|
2112
2231
|
const sysType = argMeta.type.toLowerCase();
|
|
@@ -2171,6 +2290,7 @@ var getArgumentValue = async (argMeta, value, workspace) => {
|
|
|
2171
2290
|
var runCommands = async (...commands) => {
|
|
2172
2291
|
process.on("unhandledRejection", (error) => {
|
|
2173
2292
|
console.error(import_chalk2.default.red("[fatal]"), error);
|
|
2293
|
+
process.exit(1);
|
|
2174
2294
|
});
|
|
2175
2295
|
const hasPackageJson = import_fs7.default.existsSync(`${__dirname}/../package.json`);
|
|
2176
2296
|
const version = hasPackageJson ? JSON.parse(import_fs7.default.readFileSync(`${__dirname}/../package.json`, "utf8")).version : "0.0.1";
|
|
@@ -2191,6 +2311,8 @@ var runCommands = async (...commands) => {
|
|
|
2191
2311
|
for (const argMeta of allArgMetas) {
|
|
2192
2312
|
if (argMeta.type === "Option")
|
|
2193
2313
|
programCommand = handleOption(programCommand, argMeta);
|
|
2314
|
+
else if (argMeta.type === "Argument")
|
|
2315
|
+
programCommand = handleArgument(programCommand, argMeta);
|
|
2194
2316
|
else if (argMeta.type === "Workspace")
|
|
2195
2317
|
continue;
|
|
2196
2318
|
const sysType = argMeta.type.toLowerCase();
|
|
@@ -2199,7 +2321,9 @@ var runCommands = async (...commands) => {
|
|
|
2199
2321
|
`${sysType} in this workspace ${sysType}s/<${sysType}Name>`
|
|
2200
2322
|
);
|
|
2201
2323
|
}
|
|
2324
|
+
programCommand = programCommand.option(`-v, --verbose [boolean]`, `verbose output`);
|
|
2202
2325
|
programCommand.action(async (...args) => {
|
|
2326
|
+
Logger.rawLog();
|
|
2203
2327
|
const cmdArgs = args.slice(0, args.length - 2);
|
|
2204
2328
|
const opt = args[args.length - 2];
|
|
2205
2329
|
const commandArgs = [];
|
|
@@ -2207,14 +2331,23 @@ var runCommands = async (...commands) => {
|
|
|
2207
2331
|
for (const argMeta of allArgMetas) {
|
|
2208
2332
|
if (argMeta.type === "Option")
|
|
2209
2333
|
commandArgs[argMeta.idx] = await getOptionValue(argMeta, opt);
|
|
2334
|
+
else if (argMeta.type === "Argument")
|
|
2335
|
+
commandArgs[argMeta.idx] = await getArgumentValue(argMeta, cmdArgs[argMeta.idx]);
|
|
2210
2336
|
else
|
|
2211
|
-
commandArgs[argMeta.idx] = await
|
|
2337
|
+
commandArgs[argMeta.idx] = await getInternalArgumentValue(
|
|
2338
|
+
argMeta,
|
|
2339
|
+
cmdArgs[argMeta.idx],
|
|
2340
|
+
workspace
|
|
2341
|
+
);
|
|
2212
2342
|
if (commandArgs[argMeta.idx] instanceof AppExecutor)
|
|
2213
2343
|
process.env.NEXT_PUBLIC_APP_NAME = commandArgs[argMeta.idx].name;
|
|
2344
|
+
if (opt.verbose)
|
|
2345
|
+
Executor.setVerbose(true);
|
|
2214
2346
|
}
|
|
2215
2347
|
const cmd = new command();
|
|
2216
2348
|
try {
|
|
2217
2349
|
await cmd[targetMeta.key](...commandArgs);
|
|
2350
|
+
Logger.rawLog();
|
|
2218
2351
|
} catch (e) {
|
|
2219
2352
|
const errMsg = e instanceof Error ? e.message : typeof e === "string" ? e : JSON.stringify(e);
|
|
2220
2353
|
Logger.error(`Command Error: ${import_chalk2.default.red(errMsg)}`);
|
|
@@ -2233,7 +2366,6 @@ var import_prompts4 = require("@inquirer/prompts");
|
|
|
2233
2366
|
var import_messages = require("@langchain/core/messages");
|
|
2234
2367
|
var import_openai2 = require("@langchain/openai");
|
|
2235
2368
|
var import_chalk3 = __toESM(require("chalk"));
|
|
2236
|
-
var import_ora3 = __toESM(require("ora"));
|
|
2237
2369
|
var MAX_ASK_TRY = 300;
|
|
2238
2370
|
var supportedLlmModels = ["deepseek-chat", "deepseek-reasoner"];
|
|
2239
2371
|
var AiSession = class _AiSession {
|
|
@@ -2241,8 +2373,11 @@ var AiSession = class _AiSession {
|
|
|
2241
2373
|
static async init({ temperature = 0.7, useExisting = true } = {}) {
|
|
2242
2374
|
if (useExisting) {
|
|
2243
2375
|
const llmConfig2 = this.getLlmConfig();
|
|
2244
|
-
if (llmConfig2)
|
|
2245
|
-
|
|
2376
|
+
if (llmConfig2) {
|
|
2377
|
+
this.#setChatModel(llmConfig2.model, llmConfig2.apiKey);
|
|
2378
|
+
Logger.rawLog(import_chalk3.default.dim(`\u{1F916}akan editor uses existing LLM config (${llmConfig2.model})`));
|
|
2379
|
+
return this;
|
|
2380
|
+
}
|
|
2246
2381
|
}
|
|
2247
2382
|
const llmConfig = await this.#requestLlmConfig();
|
|
2248
2383
|
const { model, apiKey } = llmConfig;
|
|
@@ -2274,6 +2409,7 @@ var AiSession = class _AiSession {
|
|
|
2274
2409
|
return { model, apiKey };
|
|
2275
2410
|
}
|
|
2276
2411
|
static async #validateApiKey(modelName, apiKey) {
|
|
2412
|
+
const spinner = new Spinner("Validating LLM API key...", { prefix: `\u{1F916}akan-editor` }).start();
|
|
2277
2413
|
const chat = new import_openai2.ChatOpenAI({
|
|
2278
2414
|
modelName,
|
|
2279
2415
|
temperature: 0,
|
|
@@ -2281,9 +2417,10 @@ var AiSession = class _AiSession {
|
|
|
2281
2417
|
});
|
|
2282
2418
|
try {
|
|
2283
2419
|
await chat.invoke("Hi, and just say 'ok'");
|
|
2420
|
+
spinner.succeed("LLM API key is valid");
|
|
2284
2421
|
return true;
|
|
2285
2422
|
} catch (error) {
|
|
2286
|
-
|
|
2423
|
+
spinner.fail(
|
|
2287
2424
|
import_chalk3.default.red(
|
|
2288
2425
|
`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"`
|
|
2289
2426
|
)
|
|
@@ -2304,14 +2441,16 @@ var AiSession = class _AiSession {
|
|
|
2304
2441
|
await _AiSession.init();
|
|
2305
2442
|
if (!_AiSession.#chat)
|
|
2306
2443
|
throw new Error("Failed to initialize the AI session");
|
|
2307
|
-
const loader =
|
|
2444
|
+
const loader = new Spinner(`${_AiSession.#chat.model} is thinking...`, {
|
|
2445
|
+
prefix: `\u{1F916}akan-editor`
|
|
2446
|
+
}).start();
|
|
2308
2447
|
try {
|
|
2309
2448
|
const humanMessage = new import_messages.HumanMessage(question);
|
|
2310
2449
|
this.messageHistory.push(humanMessage);
|
|
2311
2450
|
const stream = await _AiSession.#chat.stream(this.messageHistory);
|
|
2312
2451
|
let fullResponse = "", tokenIdx = 0;
|
|
2313
2452
|
for await (const chunk of stream) {
|
|
2314
|
-
if (loader.isSpinning)
|
|
2453
|
+
if (loader.isSpinning() && chunk.content.length)
|
|
2315
2454
|
loader.succeed(`${_AiSession.#chat.model} responded`);
|
|
2316
2455
|
const content = chunk.content;
|
|
2317
2456
|
if (typeof content === "string") {
|
|
@@ -2441,22 +2580,14 @@ var LibraryRunner = class {
|
|
|
2441
2580
|
await workspace.exec(`mkdir -p libs/${libName}`);
|
|
2442
2581
|
const lib = LibExecutor.from(workspace, libName);
|
|
2443
2582
|
await lib.applyTemplate({ basePath: ".", template: "libRoot", dict: { libName, LibName: capitalize(libName) } });
|
|
2444
|
-
|
|
2445
|
-
rootTsConfig.compilerOptions.paths[`@${libName}`] = [`libs/${libName}/index.ts`];
|
|
2446
|
-
rootTsConfig.compilerOptions.paths[`@${libName}/*`] = [`libs/${libName}/*`];
|
|
2447
|
-
if (rootTsConfig.references) {
|
|
2448
|
-
if (!rootTsConfig.references.some((ref) => ref.path === `./libs/${libName}/tsconfig.json`))
|
|
2449
|
-
rootTsConfig.references.push({ path: `./libs/${libName}/tsconfig.json` });
|
|
2450
|
-
}
|
|
2451
|
-
workspace.writeJson("tsconfig.json", rootTsConfig);
|
|
2583
|
+
workspace.setTsPaths("lib", libName);
|
|
2452
2584
|
return lib;
|
|
2453
2585
|
}
|
|
2454
2586
|
async removeLibrary(lib) {
|
|
2455
2587
|
await lib.workspace.exec(`rm -rf libs/${lib.name}`);
|
|
2456
|
-
lib.
|
|
2588
|
+
lib.workspace.unsetTsPaths("lib", lib.name);
|
|
2457
2589
|
}
|
|
2458
2590
|
async installLibrary(workspace, libName) {
|
|
2459
|
-
workspace.log(`Installing ${libName} library as git subtree...`);
|
|
2460
2591
|
await workspace.exec(`git subtree add --prefix=libs/${libName} git@github.com:akan-team/${libName}.git main`);
|
|
2461
2592
|
await workspace.cp(`libs/${libName}/env/env.server.example.ts`, `libs/${libName}/env/env.server.testing.ts`);
|
|
2462
2593
|
workspace.setTsPaths("lib", libName);
|
|
@@ -2493,13 +2624,11 @@ var LibraryRunner = class {
|
|
|
2493
2624
|
await lib.workspace.exec(
|
|
2494
2625
|
`git subtree push --prefix=libs/${lib.name} git@github.com:akan-team/${lib.name}.git ${branch}`
|
|
2495
2626
|
);
|
|
2496
|
-
lib.logger.log(`${lib.name} library pushed to ${branch} branch`);
|
|
2497
2627
|
}
|
|
2498
2628
|
async pullLibrary(lib, branch) {
|
|
2499
2629
|
await lib.workspace.exec(
|
|
2500
2630
|
`git subtree pull --prefix=libs/${lib.name} git@github.com:akan-team/${lib.name}.git ${branch}`
|
|
2501
2631
|
);
|
|
2502
|
-
lib.logger.log(`${lib.name} library pulled from ${branch} branch`);
|
|
2503
2632
|
}
|
|
2504
2633
|
#getEnv(lib, env = {}) {
|
|
2505
2634
|
const rootEnv = import_dotenv2.default.parse(lib.workspace.readFile(".env"));
|
|
@@ -2531,38 +2660,49 @@ var LibraryRunner = class {
|
|
|
2531
2660
|
// pkgs/@akanjs/cli/src/library/library.script.ts
|
|
2532
2661
|
var LibraryScript = class {
|
|
2533
2662
|
#runner = new LibraryRunner();
|
|
2534
|
-
async
|
|
2663
|
+
async syncLibrary(lib) {
|
|
2664
|
+
const syncSpinner = lib.spinning("Syncing library...");
|
|
2535
2665
|
const akanConfig = await lib.getConfig();
|
|
2536
2666
|
const scanResult = await lib.scan({ akanConfig });
|
|
2537
|
-
|
|
2538
|
-
lib.logger.rawLog(JSON.stringify(scanResult, null, 2));
|
|
2667
|
+
syncSpinner.succeed(`Library ${lib.name} (libs/${lib.name}) is synced`);
|
|
2539
2668
|
return scanResult;
|
|
2540
2669
|
}
|
|
2541
|
-
async syncLibrary(lib) {
|
|
2542
|
-
const akanConfig = await lib.getConfig();
|
|
2543
|
-
return await lib.scan({ akanConfig });
|
|
2544
|
-
}
|
|
2545
2670
|
async createLibrary(libName, workspace) {
|
|
2671
|
+
const spinner = workspace.spinning(`Creating ${libName} library`);
|
|
2546
2672
|
const lib = await this.#runner.createLibrary(libName, workspace);
|
|
2673
|
+
spinner.succeed(`${libName} library (libs/${libName}) is created`);
|
|
2547
2674
|
await this.syncLibrary(lib);
|
|
2548
2675
|
}
|
|
2549
2676
|
async removeLibrary(lib) {
|
|
2677
|
+
const spinner = lib.spinning("Removing library...");
|
|
2550
2678
|
await this.#runner.removeLibrary(lib);
|
|
2679
|
+
spinner.succeed(`Library ${lib.name} (libs/${lib.name}) is removed`);
|
|
2551
2680
|
}
|
|
2552
2681
|
async installLibrary(workspace, libName) {
|
|
2682
|
+
const installSpinner = workspace.spinning(`Installing ${libName} library`);
|
|
2553
2683
|
const lib = await this.#runner.installLibrary(workspace, libName);
|
|
2554
|
-
|
|
2684
|
+
installSpinner.succeed(`${libName} library (libs/${libName}) is installed`);
|
|
2685
|
+
const mergeSpinner = lib.spinning("Merging library dependencies...");
|
|
2555
2686
|
await this.#runner.mergeLibraryDependencies(lib);
|
|
2687
|
+
mergeSpinner.succeed(`${libName} library (libs/${libName}) dependencies merged to root package.json`);
|
|
2556
2688
|
}
|
|
2557
2689
|
async pushLibrary(lib, branch) {
|
|
2690
|
+
const pushSpinner = lib.spinning("Pushing library...");
|
|
2558
2691
|
await this.#runner.pushLibrary(lib, branch);
|
|
2692
|
+
pushSpinner.succeed(`Library ${lib.name} (libs/${lib.name}) pushed to ${branch} branch`);
|
|
2559
2693
|
}
|
|
2560
2694
|
async pullLibrary(lib, branch) {
|
|
2695
|
+
const pullSpinner = lib.spinning("Pulling library...");
|
|
2561
2696
|
await this.#runner.pullLibrary(lib, branch);
|
|
2697
|
+
pullSpinner.succeed(`Library ${lib.name} (libs/${lib.name}) pulled from ${branch} branch`);
|
|
2698
|
+
const mergeSpinner = lib.spinning("Merging library dependencies...");
|
|
2562
2699
|
await this.#runner.mergeLibraryDependencies(lib);
|
|
2700
|
+
mergeSpinner.succeed(`Library ${lib.name} (libs/${lib.name}) dependencies merged to root package.json`);
|
|
2563
2701
|
}
|
|
2564
2702
|
async testLibrary(lib) {
|
|
2703
|
+
const spinner = lib.spinning("Testing library...");
|
|
2565
2704
|
await this.#runner.testLibrary(lib);
|
|
2705
|
+
spinner.succeed(`Library ${lib.name} (libs/${lib.name}) test is successful`);
|
|
2566
2706
|
}
|
|
2567
2707
|
};
|
|
2568
2708
|
|
|
@@ -2579,7 +2719,7 @@ var import_fs9 = __toESM(require("fs"));
|
|
|
2579
2719
|
var import_promises2 = __toESM(require("fs/promises"));
|
|
2580
2720
|
var import_js_yaml2 = __toESM(require("js-yaml"));
|
|
2581
2721
|
var import_open = __toESM(require("open"));
|
|
2582
|
-
var
|
|
2722
|
+
var import_ora3 = __toESM(require("ora"));
|
|
2583
2723
|
var import_path4 = __toESM(require("path"));
|
|
2584
2724
|
var vite = __toESM(require("vite"));
|
|
2585
2725
|
var import_vite_plugin_commonjs = __toESM(require("vite-plugin-commonjs"));
|
|
@@ -3863,87 +4003,6 @@ Core ESLint Extensions
|
|
|
3863
4003
|
This configuration creates a robust linting setup that enforces Next.js App Router best practices, maintains clean code
|
|
3864
4004
|
organization, and ensures proper server/client code separation.
|
|
3865
4005
|
`;
|
|
3866
|
-
var componentDefaultDescription = ({
|
|
3867
|
-
modelName,
|
|
3868
|
-
ModelName,
|
|
3869
|
-
exampleFiles,
|
|
3870
|
-
constant,
|
|
3871
|
-
properties
|
|
3872
|
-
}) => `
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
1. Akan.js \uD504\uB808\uC784\uC6CC\uD06C\uC5D0 \uB300\uD55C \uAC1C\uC694
|
|
3876
|
-
${frameworkAbstract}
|
|
3877
|
-
|
|
3878
|
-
2. Akan.js\uD504\uB808\uC784\uC6CC\uD06C \uB370\uC774\uD130 \uAE30\uBC18 \uBAA8\uB4C8\uC5D0 \uB300\uD55C \uC124\uBA85
|
|
3879
|
-
${moduleDesription}
|
|
3880
|
-
|
|
3881
|
-
3. Akan.js eslint \uC124\uC815\uC5D0 \uB300\uD55C \uC124\uBA85
|
|
3882
|
-
${eslintDescription}
|
|
3883
|
-
|
|
3884
|
-
4. util/ui \uB0B4 ui\uD0B7\uC5D0 \uB300\uD55C \uC124\uBA85
|
|
3885
|
-
${utilUiDescription}
|
|
3886
|
-
|
|
3887
|
-
5. shared/ui \uB0B4 ui\uD0B7\uC5D0 \uB300\uD55C \uC124\uBA85
|
|
3888
|
-
${shardUiDescription}
|
|
3889
|
-
|
|
3890
|
-
6. ${ModelName}.constant.ts \uD30C\uC77C\uC5D0 \uB300\uD55C \uC815\uBCF4
|
|
3891
|
-
${constant}
|
|
3892
|
-
|
|
3893
|
-
7. ${modelName}\uC5D0\uC11C \uC885\uC18D\uB418\uB294 \uB2E4\uB978 \uBAA8\uB378\uB4E4\uC758 \uD0C0\uC785 \uC815\uC758
|
|
3894
|
-
${properties.map(
|
|
3895
|
-
(property) => `
|
|
3896
|
-
\`\`\`
|
|
3897
|
-
${property.key}.constant.ts
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
${property.source}
|
|
3901
|
-
\`\`\`
|
|
3902
|
-
`
|
|
3903
|
-
).join("\n\n")}
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
8. \uC608\uC2DC \uD30C\uC77C\uB4E4
|
|
3907
|
-
${exampleFiles.map(
|
|
3908
|
-
(example) => `
|
|
3909
|
-
Example filename: ${example.filepath}
|
|
3910
|
-
\`\`\`
|
|
3911
|
-
${example.content}
|
|
3912
|
-
\`\`\`
|
|
3913
|
-
`
|
|
3914
|
-
).join("\n\n")}
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
\uC5ED\uD560\uBD80\uC5EC
|
|
3922
|
-
- Akan.js \uC0AC\uB0B4 \uD504\uB808\uC784\uC6CC\uD06C \uAE30\uBC18 Typescript \uC2DC\uB2C8\uC5B4 \uD504\uB860\uD2B8\uC5D4\uB4DC \uAC1C\uBC1C\uC790.
|
|
3923
|
-
|
|
3924
|
-
\uCF54\uB529 \uADDC\uCE59
|
|
3925
|
-
- \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
3926
|
-
- \uC544\uC774\uCF58: react-icons \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
3927
|
-
- 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
|
|
3928
|
-
- Ui Component: @util/ui \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
3929
|
-
- \uC870\uAC74\uBD80 \uD074\uB798\uC2A4: clsx \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
3930
|
-
\uCF54\uB4DC \uC2A4\uD0C0\uC77C
|
|
3931
|
-
- \uC0C9\uC0C1: \uD558\uB4DC\uCF54\uB529(bg-red) \uB300\uC2E0 \uD14C\uB9C8 \uC0C9\uC0C1(bg-primary) \uC0AC\uC6A9
|
|
3932
|
-
- \uC870\uAC74\uBD80 \uB80C\uB354\uB9C1: field && <div>... \uB300\uC2E0 field ? <div>... : null \uC0AC\uC6A9
|
|
3933
|
-
- \uBAA8\uB378 \uC811\uADFC: \uAD6C\uC870\uBD84\uD574\uD560\uB2F9 \uB300\uC2E0 ${modelName}.field \uD615\uC2DD\uC73C\uB85C \uC811\uADFC
|
|
3934
|
-
- \uD0C0\uC785 \uC548\uC804: ${modelName}.constant.ts\uC758 \uC2A4\uD0A4\uB9C8 \uCC38\uC870\uD558\uC5EC \uC5D0\uB7EC \uBC29\uC9C0
|
|
3935
|
-
\uD544\uB4DC \uC811\uADFC \uC804: \uC2A4\uD0A4\uB9C8\uC758 \uC2E4\uC81C \uD544\uB4DC \uB9AC\uC2A4\uD2B8 \uC791\uC131 \uBC0F \uAC80\uD1A0 \uD544\uC218
|
|
3936
|
-
|
|
3937
|
-
\uC5C4\uACA9\uD55C \uC8FC\uC758\uC0AC\uD56D
|
|
3938
|
-
- UI \uD0B7\uC740 \uBB38\uC11C\uC5D0 \uBA85\uC2DC\uB41C \uCEF4\uD3EC\uB10C\uD2B8\uB9CC \uC0AC\uC6A9
|
|
3939
|
-
- \uCEF4\uD3EC\uB10C\uD2B8 \uC0AC\uC6A9 \uC804 \uBB38\uC11C \uD655\uC778 \uBC0F props \uC815\uD655\uD788 \uAC80\uC99D
|
|
3940
|
-
- \uBA85\uC2DC\uB41C \uB8F0 \uC678 \uC784\uC758 \uCD94\uC0C1\uD654 \uAE08\uC9C0
|
|
3941
|
-
- dayjs \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB294 @akanjs/base\uC5D0\uC11C \uB798\uD551\uD558\uC5EC \uC81C\uACF5\uD558\uACE0 \uC788\uC74C.
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
`;
|
|
3947
4006
|
var scalarConstantDescription = `
|
|
3948
4007
|
Purpose and Structure
|
|
3949
4008
|
|
|
@@ -4281,159 +4340,56 @@ The \`@Field.Prop()\` decorator is commonly used in different model types:
|
|
|
4281
4340
|
- Reference options enable building relationships between different models
|
|
4282
4341
|
- Aggregation options support analytics use cases
|
|
4283
4342
|
`;
|
|
4284
|
-
var
|
|
4285
|
-
sysName,
|
|
4343
|
+
var componentDefaultDescription = ({
|
|
4286
4344
|
modelName,
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4345
|
+
ModelName,
|
|
4346
|
+
exampleFiles,
|
|
4347
|
+
constant,
|
|
4348
|
+
properties
|
|
4291
4349
|
}) => `
|
|
4292
|
-
|
|
4293
|
-
\uB2E4\uC74C\uC758 \uBC30\uACBD \uC815\uBCF4\uB97C \uBC14\uD0D5\uC73C\uB85C ${modelName}.constant.ts \uD30C\uC77C\uC744 \uC791\uC131\uD574\uC918.
|
|
4350
|
+
|
|
4294
4351
|
|
|
4295
4352
|
1. Akan.js \uD504\uB808\uC784\uC6CC\uD06C\uC5D0 \uB300\uD55C \uAC1C\uC694
|
|
4296
4353
|
${frameworkAbstract}
|
|
4297
4354
|
|
|
4298
|
-
2.
|
|
4299
|
-
${
|
|
4300
|
-
|
|
4301
|
-
3. <model>.constant.ts \uD30C\uC77C\uC758 Enum \uC791\uC131\uBC95
|
|
4302
|
-
${howToSetEnumInModelConstant}
|
|
4303
|
-
|
|
4304
|
-
4. <model>.constant.ts \uD30C\uC77C\uC758 Field \uC791\uC131\uBC95
|
|
4305
|
-
${howToSetFieldInModelConstant}
|
|
4355
|
+
2. Akan.js\uD504\uB808\uC784\uC6CC\uD06C \uB370\uC774\uD130 \uAE30\uBC18 \uBAA8\uB4C8\uC5D0 \uB300\uD55C \uC124\uBA85
|
|
4356
|
+
${moduleDesription}
|
|
4306
4357
|
|
|
4307
|
-
|
|
4308
|
-
${
|
|
4309
|
-
(constant) => `
|
|
4310
|
-
Example file: ${constant.filepath}
|
|
4311
|
-
\`\`\`
|
|
4312
|
-
${constant.content}
|
|
4313
|
-
\`\`\`
|
|
4314
|
-
`
|
|
4315
|
-
).join("\n")}
|
|
4358
|
+
3. Akan.js eslint \uC124\uC815\uC5D0 \uB300\uD55C \uC124\uBA85
|
|
4359
|
+
${eslintDescription}
|
|
4316
4360
|
|
|
4361
|
+
4. util/ui \uB0B4 ui\uD0B7\uC5D0 \uB300\uD55C \uC124\uBA85
|
|
4362
|
+
${utilUiDescription}
|
|
4317
4363
|
|
|
4318
|
-
|
|
4364
|
+
5. shared/ui \uB0B4 ui\uD0B7\uC5D0 \uB300\uD55C \uC124\uBA85
|
|
4365
|
+
${shardUiDescription}
|
|
4319
4366
|
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
Model description: ${modelDesc}
|
|
4323
|
-
Model schema design: ${modelSchemaDesign}
|
|
4367
|
+
6. ${ModelName}.constant.ts \uD30C\uC77C\uC5D0 \uB300\uD55C \uC815\uBCF4
|
|
4368
|
+
${constant}
|
|
4324
4369
|
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
\`\`\`
|
|
4329
|
-
`;
|
|
4330
|
-
var requestTemplate = ({
|
|
4331
|
-
sysName,
|
|
4332
|
-
modelName,
|
|
4333
|
-
ModelName,
|
|
4334
|
-
boilerplate,
|
|
4335
|
-
constant,
|
|
4336
|
-
properties,
|
|
4337
|
-
exampleFiles
|
|
4338
|
-
}) => `
|
|
4339
|
-
${componentDefaultDescription({
|
|
4340
|
-
sysName,
|
|
4341
|
-
modelName,
|
|
4342
|
-
ModelName,
|
|
4343
|
-
exampleFiles,
|
|
4344
|
-
constant,
|
|
4345
|
-
properties
|
|
4346
|
-
})}
|
|
4347
|
-
\uC694\uCCAD\uC0AC\uD56D
|
|
4348
|
-
- \uC544\uB798 \uC81C\uACF5\uD560 \uAE30\uBCF8 \uD15C\uD50C\uB9BF \uCF54\uB4DC\uC5D0 \uCD94\uAC00\uB85C \uCEF4\uD3EC\uB10C\uD2B8 \uAC1C\uBC1C
|
|
4349
|
-
- ${ModelName}.Template.tsx \uCF54\uB4DC \uC791\uC131
|
|
4350
|
-
- \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
|
|
4351
|
-
- \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
|
|
4352
|
-
- \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.
|
|
4353
|
-
- \uBCF4\uC77C\uB7EC\uD50C\uB808\uC774\uD2B8\uC5D0 \uB9DE\uAC8C \uC815\uB9AC\uD574\uC11C \uC81C\uACF5
|
|
4354
|
-
-
|
|
4355
|
-
|
|
4356
|
-
Application name: ${sysName}
|
|
4357
|
-
Model name: ${modelName}
|
|
4358
|
-
Target filename: ${ModelName}.Template.tsx
|
|
4370
|
+
7. ${modelName}\uC5D0\uC11C \uC885\uC18D\uB418\uB294 \uB2E4\uB978 \uBAA8\uB378\uB4E4\uC758 \uD0C0\uC785 \uC815\uC758
|
|
4371
|
+
${properties.map(
|
|
4372
|
+
(property) => `
|
|
4359
4373
|
\`\`\`
|
|
4374
|
+
${property.key}.constant.ts
|
|
4360
4375
|
|
|
4361
|
-
\`\`\`
|
|
4362
4376
|
|
|
4363
|
-
|
|
4364
|
-
`;
|
|
4365
|
-
var requestView = ({
|
|
4366
|
-
sysName,
|
|
4367
|
-
modelName,
|
|
4368
|
-
ModelName,
|
|
4369
|
-
boilerplate,
|
|
4370
|
-
constant,
|
|
4371
|
-
properties,
|
|
4372
|
-
exampleFiles
|
|
4373
|
-
}) => `
|
|
4374
|
-
${componentDefaultDescription({
|
|
4375
|
-
sysName,
|
|
4376
|
-
modelName,
|
|
4377
|
-
ModelName,
|
|
4378
|
-
exampleFiles,
|
|
4379
|
-
constant,
|
|
4380
|
-
properties
|
|
4381
|
-
})}
|
|
4382
|
-
\uC694\uCCAD\uC0AC\uD56D
|
|
4383
|
-
- \uC544\uB798 \uC81C\uACF5\uD560 \uAE30\uBCF8 \uD15C\uD50C\uB9BF \uCF54\uB4DC\uC5D0 \uCD94\uAC00\uB85C \uCEF4\uD3EC\uB10C\uD2B8 \uAC1C\uBC1C
|
|
4384
|
-
- ${ModelName}.View.tsx \uCF54\uB4DC \uC791\uC131
|
|
4385
|
-
- \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
|
|
4386
|
-
- \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
|
|
4387
|
-
- \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.
|
|
4388
|
-
- \uBCF4\uC77C\uB7EC\uD50C\uB808\uC774\uD2B8\uC5D0 \uB9DE\uAC8C \uC815\uB9AC\uD574\uC11C \uC81C\uACF5
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
Application name: ${sysName}
|
|
4392
|
-
Model name: ${modelName}
|
|
4393
|
-
|
|
4394
|
-
Target filename: ${ModelName}.View.tsx
|
|
4395
|
-
\`\`\`
|
|
4396
|
-
${boilerplate}
|
|
4377
|
+
${property.source}
|
|
4397
4378
|
\`\`\`
|
|
4379
|
+
`
|
|
4380
|
+
).join("\n\n")}
|
|
4398
4381
|
|
|
4399
|
-
|
|
4400
|
-
`;
|
|
4401
|
-
var requestUnit = ({
|
|
4402
|
-
sysName,
|
|
4403
|
-
modelName,
|
|
4404
|
-
ModelName,
|
|
4405
|
-
constant,
|
|
4406
|
-
properties,
|
|
4407
|
-
boilerplate,
|
|
4408
|
-
exampleFiles
|
|
4409
|
-
}) => `
|
|
4410
|
-
${componentDefaultDescription({
|
|
4411
|
-
sysName,
|
|
4412
|
-
modelName,
|
|
4413
|
-
ModelName,
|
|
4414
|
-
exampleFiles,
|
|
4415
|
-
constant,
|
|
4416
|
-
properties
|
|
4417
|
-
})}
|
|
4418
|
-
|
|
4419
|
-
\uC694\uCCAD\uC0AC\uD56D
|
|
4420
|
-
- \uC544\uB798 \uC81C\uACF5\uD560 \uAE30\uBCF8 \uD15C\uD50C\uB9BF \uCF54\uB4DC\uC5D0 \uCD94\uAC00\uB85C \uCEF4\uD3EC\uB10C\uD2B8 \uAC1C\uBC1C
|
|
4421
|
-
- ${ModelName}.Unit.tsx \uCF54\uB4DC \uC791\uC131
|
|
4422
|
-
- \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
|
|
4423
|
-
- \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
|
|
4424
|
-
- \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.
|
|
4425
|
-
- \uBCF4\uC77C\uB7EC\uD50C\uB808\uC774\uD2B8\uC5D0 \uB9DE\uAC8C \uC815\uB9AC\uD574\uC11C \uC81C\uACF5
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
Application name: ${sysName}
|
|
4429
|
-
Model name: ${modelName}
|
|
4430
4382
|
|
|
4431
|
-
|
|
4383
|
+
8. \uC608\uC2DC \uD30C\uC77C\uB4E4
|
|
4384
|
+
${exampleFiles.map(
|
|
4385
|
+
(example) => `
|
|
4386
|
+
Example filename: ${example.filepath}
|
|
4432
4387
|
\`\`\`
|
|
4433
|
-
${
|
|
4388
|
+
${example.content}
|
|
4434
4389
|
\`\`\`
|
|
4390
|
+
`
|
|
4391
|
+
).join("\n\n")}
|
|
4435
4392
|
|
|
4436
|
-
|
|
4437
4393
|
`;
|
|
4438
4394
|
|
|
4439
4395
|
// pkgs/@akanjs/cli/src/application/application.prompt.ts
|
|
@@ -4487,7 +4443,7 @@ var ApplicationRunner = class {
|
|
|
4487
4443
|
}
|
|
4488
4444
|
async removeApplication(app) {
|
|
4489
4445
|
await app.workspace.exec(`rm -rf apps/${app.name}`);
|
|
4490
|
-
app.
|
|
4446
|
+
app.workspace.unsetTsPaths("app", app.name);
|
|
4491
4447
|
}
|
|
4492
4448
|
async getConfig(app) {
|
|
4493
4449
|
return await getAppConfig(app.cwdPath, {
|
|
@@ -4550,7 +4506,7 @@ var ApplicationRunner = class {
|
|
|
4550
4506
|
app.dist.writeJson("backend/package.json", appPackageJson);
|
|
4551
4507
|
app.dist.writeFile(import_path4.default.join(app.dist.cwdPath, "backend", "Dockerfile"), akanConfig.backend.dockerfile);
|
|
4552
4508
|
}
|
|
4553
|
-
async startBackend(app, { open: open2 = false } = {}) {
|
|
4509
|
+
async startBackend(app, { open: open2 = false, onStart } = {}) {
|
|
4554
4510
|
const { env } = await this.#prepareCommand(app, "start", "backend");
|
|
4555
4511
|
const ctx = await esbuild2.context({
|
|
4556
4512
|
write: true,
|
|
@@ -4564,14 +4520,15 @@ var ApplicationRunner = class {
|
|
|
4564
4520
|
});
|
|
4565
4521
|
await ctx.watch();
|
|
4566
4522
|
await sleep(100);
|
|
4523
|
+
onStart?.();
|
|
4567
4524
|
if (open2)
|
|
4568
4525
|
setTimeout(() => (0, import_open.default)("http://localhost:8080/backend/graphql"), 3e3);
|
|
4569
|
-
await app.dist.spawn("node", ["--watch", "backend/main.js"], { env });
|
|
4526
|
+
await app.dist.spawn("node", ["--watch", "backend/main.js"], { env, stdio: "inherit" });
|
|
4570
4527
|
}
|
|
4571
4528
|
async buildFrontend(app) {
|
|
4572
4529
|
const { env } = await this.#prepareCommand(app, "build", "frontend");
|
|
4573
4530
|
const akanConfig = await app.getConfig("build");
|
|
4574
|
-
await app.spawn("npx", ["next", "build", "--no-lint"], { env
|
|
4531
|
+
await app.spawn("npx", ["next", "build", "--no-lint"], { env });
|
|
4575
4532
|
const buildResult = await esbuild2.build({
|
|
4576
4533
|
entryPoints: [`${app.cwdPath}/next.config.ts`],
|
|
4577
4534
|
outdir: `${app.dist.cwdPath}/frontend`,
|
|
@@ -4601,10 +4558,11 @@ var ApplicationRunner = class {
|
|
|
4601
4558
|
]);
|
|
4602
4559
|
app.dist.writeFile("frontend/Dockerfile", akanConfig.frontend.dockerfile);
|
|
4603
4560
|
}
|
|
4604
|
-
async startFrontend(app, { open: open2 = false, turbo = true } = {}) {
|
|
4561
|
+
async startFrontend(app, { open: open2 = false, turbo = true, onStart } = {}) {
|
|
4605
4562
|
const { env } = await this.#prepareCommand(app, "start", "frontend");
|
|
4606
4563
|
if (open2)
|
|
4607
4564
|
setTimeout(() => (0, import_open.default)("http://localhost:4200"), 3e3);
|
|
4565
|
+
onStart?.();
|
|
4608
4566
|
await app.spawn("npx", ["next", "dev", "-p", "4200", ...turbo ? ["--turbo"] : []], { env });
|
|
4609
4567
|
}
|
|
4610
4568
|
async #getViteConfig(app, command) {
|
|
@@ -4687,10 +4645,11 @@ var ApplicationRunner = class {
|
|
|
4687
4645
|
const config = await this.#getViteConfig(app, "build");
|
|
4688
4646
|
await vite.build(config);
|
|
4689
4647
|
}
|
|
4690
|
-
async startCsr(app, { open: open2 = false } = {}) {
|
|
4648
|
+
async startCsr(app, { open: open2 = false, onStart } = {}) {
|
|
4691
4649
|
const config = await this.#getViteConfig(app, "start");
|
|
4692
4650
|
const server = await vite.createServer(config);
|
|
4693
4651
|
await server.listen(4201);
|
|
4652
|
+
onStart?.();
|
|
4694
4653
|
app.log(`CSR server is running on http://localhost:4201`);
|
|
4695
4654
|
if (open2)
|
|
4696
4655
|
setTimeout(() => (0, import_open.default)("http://localhost:4201"), 3e3);
|
|
@@ -4757,13 +4716,10 @@ var ApplicationRunner = class {
|
|
|
4757
4716
|
dict: { repoName: workspace.repoName },
|
|
4758
4717
|
overwrite: false
|
|
4759
4718
|
});
|
|
4760
|
-
await workspace.spawn(`docker`, ["compose", "up", "-d"], {
|
|
4761
|
-
cwd: `${workspace.workspaceRoot}/local`,
|
|
4762
|
-
stdio: "ignore"
|
|
4763
|
-
});
|
|
4719
|
+
await workspace.spawn(`docker`, ["compose", "up", "-d"], { cwd: `${workspace.workspaceRoot}/local` });
|
|
4764
4720
|
}
|
|
4765
4721
|
async dbdown(workspace) {
|
|
4766
|
-
await workspace.spawn(`docker`, ["compose", "down"], { cwd: `${workspace.workspaceRoot}/local
|
|
4722
|
+
await workspace.spawn(`docker`, ["compose", "down"], { cwd: `${workspace.workspaceRoot}/local` });
|
|
4767
4723
|
}
|
|
4768
4724
|
async configureApp(app) {
|
|
4769
4725
|
const capacitorApp = new CapacitorApp(app);
|
|
@@ -4923,7 +4879,7 @@ var ApplicationRunner = class {
|
|
|
4923
4879
|
const chatModel = new import_openai3.ChatOpenAI({ modelName: "gpt-4o", openAIApiKey });
|
|
4924
4880
|
const projectName = await (0, import_prompts5.input)({ message: "please enter project name." });
|
|
4925
4881
|
const projectDesc = await (0, import_prompts5.input)({ message: "please enter project description. (40 ~ 60 characters)" });
|
|
4926
|
-
const spinner = (0,
|
|
4882
|
+
const spinner = (0, import_ora3.default)("Gerating project files...");
|
|
4927
4883
|
const mainPrompt = import_prompts6.PromptTemplate.fromTemplate(requestApplication());
|
|
4928
4884
|
const chain = import_runnables2.RunnableSequence.from([mainPrompt, chatModel, new import_output_parsers.StringOutputParser()]);
|
|
4929
4885
|
const resultOne = await chain.invoke({ projectName, projectDesc });
|
|
@@ -4962,20 +4918,22 @@ var ApplicationScript = class {
|
|
|
4962
4918
|
#runner = new ApplicationRunner();
|
|
4963
4919
|
libraryScript = new LibraryScript();
|
|
4964
4920
|
async createApplication(appName, workspace, { start = false } = {}) {
|
|
4921
|
+
const spinner = workspace.spinning("Creating application...");
|
|
4965
4922
|
const app = await this.#runner.createApplication(appName, workspace);
|
|
4923
|
+
spinner.succeed(`Application created in apps/${app.name}`);
|
|
4966
4924
|
await this.syncApplication(app);
|
|
4967
4925
|
if (start)
|
|
4968
4926
|
await this.start(app, { open: true });
|
|
4969
4927
|
}
|
|
4970
4928
|
async removeApplication(app) {
|
|
4929
|
+
const spinner = app.spinning("Removing application...");
|
|
4971
4930
|
await this.#runner.removeApplication(app);
|
|
4931
|
+
spinner.succeed(`Application ${app.name} (apps/${app.name}) removed`);
|
|
4972
4932
|
}
|
|
4973
|
-
async syncApplication(app
|
|
4933
|
+
async syncApplication(app) {
|
|
4974
4934
|
const spinner = app.spinning("Scanning application...");
|
|
4975
4935
|
const akanConfig = await this.#runner.getConfig(app);
|
|
4976
4936
|
const scanResult = await this.#runner.scanSync(app, akanConfig);
|
|
4977
|
-
if (verbose)
|
|
4978
|
-
app.logger.rawLog(JSON.stringify(scanResult, null, 2));
|
|
4979
4937
|
spinner.succeed("Application scanned");
|
|
4980
4938
|
return scanResult;
|
|
4981
4939
|
}
|
|
@@ -4994,24 +4952,39 @@ var ApplicationScript = class {
|
|
|
4994
4952
|
await this.syncApplication(app);
|
|
4995
4953
|
const spinner = app.spinning("Building backend...");
|
|
4996
4954
|
await this.#runner.buildBackend(app);
|
|
4997
|
-
spinner.succeed(`
|
|
4955
|
+
spinner.succeed(`Backend built in dist/apps/${app.name}/backend`);
|
|
4998
4956
|
}
|
|
4999
|
-
async startBackend(app, { open: open2 = false, sync = true } = {}) {
|
|
4957
|
+
async startBackend(app, { open: open2 = false, dbup = true, sync = true } = {}) {
|
|
4958
|
+
if (app.getEnv() === "local" && dbup)
|
|
4959
|
+
await this.dbup(app.workspace);
|
|
5000
4960
|
if (sync)
|
|
5001
4961
|
await this.syncApplication(app);
|
|
5002
|
-
|
|
4962
|
+
const spinner = app.spinning("Preparing backend...");
|
|
4963
|
+
await this.#runner.startBackend(app, {
|
|
4964
|
+
open: open2,
|
|
4965
|
+
onStart: () => {
|
|
4966
|
+
spinner.succeed(`Backend prepared, ready to start`);
|
|
4967
|
+
}
|
|
4968
|
+
});
|
|
5003
4969
|
}
|
|
5004
4970
|
async buildFrontend(app, { sync = true } = {}) {
|
|
5005
4971
|
if (sync)
|
|
5006
4972
|
await this.syncApplication(app);
|
|
5007
4973
|
const spinner = app.spinning("Building frontend...");
|
|
5008
4974
|
await this.#runner.buildFrontend(app);
|
|
5009
|
-
spinner.succeed(`
|
|
4975
|
+
spinner.succeed(`Frontend built in dist/apps/${app.name}/frontend`);
|
|
5010
4976
|
}
|
|
5011
4977
|
async startFrontend(app, { open: open2 = false, turbo = false, sync = true } = {}) {
|
|
5012
4978
|
if (sync)
|
|
5013
4979
|
await this.syncApplication(app);
|
|
5014
|
-
|
|
4980
|
+
const spinner = app.spinning("Preparing frontend...");
|
|
4981
|
+
await this.#runner.startFrontend(app, {
|
|
4982
|
+
open: open2,
|
|
4983
|
+
turbo,
|
|
4984
|
+
onStart: () => {
|
|
4985
|
+
spinner.succeed(`Frontend prepared, ready to start`);
|
|
4986
|
+
}
|
|
4987
|
+
});
|
|
5015
4988
|
}
|
|
5016
4989
|
async buildCsr(app, { sync = true } = {}) {
|
|
5017
4990
|
if (sync)
|
|
@@ -5023,7 +4996,13 @@ var ApplicationScript = class {
|
|
|
5023
4996
|
async startCsr(app, { open: open2 = false, sync = true } = {}) {
|
|
5024
4997
|
if (sync)
|
|
5025
4998
|
await this.syncApplication(app);
|
|
5026
|
-
|
|
4999
|
+
const spinner = app.spinning("Preparing CSR...");
|
|
5000
|
+
await this.#runner.startCsr(app, {
|
|
5001
|
+
open: open2,
|
|
5002
|
+
onStart: () => {
|
|
5003
|
+
spinner.succeed(`CSR prepared, ready to start`);
|
|
5004
|
+
}
|
|
5005
|
+
});
|
|
5027
5006
|
}
|
|
5028
5007
|
async buildIos(app, { sync = true } = {}) {
|
|
5029
5008
|
if (sync)
|
|
@@ -5062,13 +5041,17 @@ var ApplicationScript = class {
|
|
|
5062
5041
|
await this.#runner.releaseAndroid(app);
|
|
5063
5042
|
}
|
|
5064
5043
|
async dumpDatabase(app, environment) {
|
|
5044
|
+
await this.dbdown(app.workspace);
|
|
5045
|
+
const spinner = app.spinning("Dumping database...");
|
|
5065
5046
|
await this.#runner.dumpDatabase(app, environment);
|
|
5047
|
+
spinner.succeed(`Database dumped to dump/${app.name}-${environment}`);
|
|
5066
5048
|
}
|
|
5067
5049
|
async restoreDatabase(app, source, target) {
|
|
5050
|
+
const spinner = app.spinning("Restoring database...");
|
|
5068
5051
|
await this.#runner.restoreDatabase(app, source, target);
|
|
5052
|
+
spinner.succeed(`Database restored from dump/${app.name}-${source} to ${app.name}-${target}`);
|
|
5069
5053
|
}
|
|
5070
5054
|
async pullDatabase(app, environment, dump) {
|
|
5071
|
-
await this.dbdown(app.workspace);
|
|
5072
5055
|
const hasDump = app.workspace.exists(`dump/${app.name}-${environment}`);
|
|
5073
5056
|
if (dump || !hasDump)
|
|
5074
5057
|
await this.dumpDatabase(app, environment);
|
|
@@ -5084,14 +5067,12 @@ var ApplicationScript = class {
|
|
|
5084
5067
|
async dbup(workspace) {
|
|
5085
5068
|
const spinner = workspace.spinning("Starting local database...");
|
|
5086
5069
|
await this.#runner.dbup(workspace);
|
|
5087
|
-
spinner.succeed(
|
|
5088
|
-
"Local database(/local/docker-compose.yaml) is up, you can start your application and connect to the database"
|
|
5089
|
-
);
|
|
5070
|
+
spinner.succeed("Local database (/local/docker-compose.yaml) is up");
|
|
5090
5071
|
}
|
|
5091
5072
|
async dbdown(workspace) {
|
|
5092
5073
|
const spinner = workspace.spinning("Stopping local database...");
|
|
5093
5074
|
await this.#runner.dbdown(workspace);
|
|
5094
|
-
spinner.succeed("Local database(/local/docker-compose.yaml) is down");
|
|
5075
|
+
spinner.succeed("Local database (/local/docker-compose.yaml) is down");
|
|
5095
5076
|
}
|
|
5096
5077
|
async testSys(sys2) {
|
|
5097
5078
|
if (sys2.type === "app")
|
|
@@ -5100,21 +5081,23 @@ var ApplicationScript = class {
|
|
|
5100
5081
|
await this.libraryScript.testLibrary(sys2);
|
|
5101
5082
|
}
|
|
5102
5083
|
async testApplication(app) {
|
|
5084
|
+
const spinner = app.spinning("Testing application...");
|
|
5103
5085
|
await this.#runner.testApplication(app);
|
|
5086
|
+
spinner.succeed(`Application ${app.name} (apps/${app.name}) test is successful`);
|
|
5104
5087
|
}
|
|
5105
5088
|
};
|
|
5106
5089
|
|
|
5107
5090
|
// pkgs/@akanjs/cli/src/application/application.command.ts
|
|
5108
5091
|
var ApplicationCommand = class {
|
|
5109
5092
|
applicationScript = new ApplicationScript();
|
|
5110
|
-
async createApplication(
|
|
5111
|
-
await this.applicationScript.createApplication(
|
|
5093
|
+
async createApplication(appName, start, workspace) {
|
|
5094
|
+
await this.applicationScript.createApplication(appName.toLowerCase().replace(/ /g, "-"), workspace, { start });
|
|
5112
5095
|
}
|
|
5113
5096
|
async removeApplication(app) {
|
|
5114
5097
|
await this.applicationScript.removeApplication(app);
|
|
5115
5098
|
}
|
|
5116
|
-
async syncApplication(app
|
|
5117
|
-
await this.applicationScript.syncApplication(app
|
|
5099
|
+
async syncApplication(app) {
|
|
5100
|
+
await this.applicationScript.syncApplication(app);
|
|
5118
5101
|
}
|
|
5119
5102
|
async build(app) {
|
|
5120
5103
|
await this.applicationScript.build(app);
|
|
@@ -5185,7 +5168,7 @@ var ApplicationCommand = class {
|
|
|
5185
5168
|
};
|
|
5186
5169
|
__decorateClass([
|
|
5187
5170
|
Target.Public(),
|
|
5188
|
-
__decorateParam(0,
|
|
5171
|
+
__decorateParam(0, Argument("appName", { desc: "name of application" })),
|
|
5189
5172
|
__decorateParam(1, Option("start", { type: "boolean", desc: "start application", default: false })),
|
|
5190
5173
|
__decorateParam(2, Workspace())
|
|
5191
5174
|
], ApplicationCommand.prototype, "createApplication", 1);
|
|
@@ -5195,8 +5178,7 @@ __decorateClass([
|
|
|
5195
5178
|
], ApplicationCommand.prototype, "removeApplication", 1);
|
|
5196
5179
|
__decorateClass([
|
|
5197
5180
|
Target.Public(),
|
|
5198
|
-
__decorateParam(0, App())
|
|
5199
|
-
__decorateParam(1, Option("verbose", { type: "boolean", desc: "verbose", default: false }))
|
|
5181
|
+
__decorateParam(0, App())
|
|
5200
5182
|
], ApplicationCommand.prototype, "syncApplication", 1);
|
|
5201
5183
|
__decorateClass([
|
|
5202
5184
|
Target.Public({ short: true }),
|
|
@@ -5335,10 +5317,11 @@ var PackageRunner = class {
|
|
|
5335
5317
|
template: "pkgRoot",
|
|
5336
5318
|
dict: { pkgName, PkgName: capitalize(pkgName) }
|
|
5337
5319
|
});
|
|
5320
|
+
workspace.setTsPaths("pkg", pkgName);
|
|
5338
5321
|
}
|
|
5339
5322
|
async removePackage(pkg) {
|
|
5340
5323
|
await pkg.workspace.exec(`rm -rf pkgs/${pkg.name}`);
|
|
5341
|
-
pkg.
|
|
5324
|
+
pkg.workspace.unsetTsPaths("pkg", pkg.name);
|
|
5342
5325
|
}
|
|
5343
5326
|
async scanSync(pkg) {
|
|
5344
5327
|
const scanResult = await pkg.scan();
|
|
@@ -5365,17 +5348,25 @@ var PackageScript = class {
|
|
|
5365
5348
|
await this.#runner.version(workspace);
|
|
5366
5349
|
}
|
|
5367
5350
|
async createPackage(workspace, pkgName) {
|
|
5351
|
+
const spinner = workspace.spinning(`Creating package in pkgs/${pkgName}...`);
|
|
5368
5352
|
await this.#runner.createPackage(workspace, pkgName);
|
|
5353
|
+
spinner.succeed(`Package in pkgs/${pkgName} is created`);
|
|
5369
5354
|
}
|
|
5370
5355
|
async removePackage(pkg) {
|
|
5356
|
+
const spinner = pkg.spinning(`Removing package in pkgs/${pkg.name}...`);
|
|
5371
5357
|
await this.#runner.removePackage(pkg);
|
|
5358
|
+
spinner.succeed("Package removed");
|
|
5372
5359
|
}
|
|
5373
|
-
async
|
|
5360
|
+
async syncPackage(pkg) {
|
|
5361
|
+
const spinner = pkg.spinning("Scanning package...");
|
|
5374
5362
|
const scanResult = await this.#runner.scanSync(pkg);
|
|
5375
|
-
|
|
5363
|
+
spinner.succeed("Package scanned");
|
|
5364
|
+
return scanResult;
|
|
5376
5365
|
}
|
|
5377
5366
|
async buildPackage(pkg) {
|
|
5367
|
+
const spinner = pkg.spinning("Building package...");
|
|
5378
5368
|
await this.#runner.buildPackage(pkg);
|
|
5369
|
+
spinner.succeed("Package built");
|
|
5379
5370
|
}
|
|
5380
5371
|
};
|
|
5381
5372
|
|
|
@@ -5450,11 +5441,10 @@ ${import_chalk4.default.green("\u27A4")} Authentication Required`));
|
|
|
5450
5441
|
}
|
|
5451
5442
|
async setLlm() {
|
|
5452
5443
|
await AiSession.init({ useExisting: true });
|
|
5453
|
-
Logger.rawLog(import_chalk4.default.green("LLM model set successfully"));
|
|
5454
5444
|
}
|
|
5455
5445
|
resetLlm() {
|
|
5456
5446
|
AiSession.setLlmConfig(null);
|
|
5457
|
-
Logger.rawLog(import_chalk4.default.green("LLM model
|
|
5447
|
+
Logger.rawLog(import_chalk4.default.green("\u2611\uFE0F LLM model config is cleared. Please run `akan set-llm` to set a new LLM model."));
|
|
5458
5448
|
}
|
|
5459
5449
|
async getAkanPkgs(workspace) {
|
|
5460
5450
|
const pkgs = await workspace.getPkgs();
|
|
@@ -5484,7 +5474,7 @@ ${import_chalk4.default.green("\u27A4")} Authentication Required`));
|
|
|
5484
5474
|
message: "Are you sure you want to deploy the libraries?"
|
|
5485
5475
|
});
|
|
5486
5476
|
if (!isDeployConfirmed) {
|
|
5487
|
-
Logger.
|
|
5477
|
+
Logger.error("Deployment cancelled");
|
|
5488
5478
|
return;
|
|
5489
5479
|
}
|
|
5490
5480
|
await Promise.all(
|
|
@@ -5514,7 +5504,6 @@ ${import_chalk4.default.green("\u27A4")} Authentication Required`));
|
|
|
5514
5504
|
workspace.spawn("npm", ["update", "-g", "@akanjs/cli", "--latest"]),
|
|
5515
5505
|
workspace.spawn("pnpm", ["install"])
|
|
5516
5506
|
]);
|
|
5517
|
-
Logger.info(`Akan.js is updated to the latest version ${latestPublishedVersionOfBase}`);
|
|
5518
5507
|
}
|
|
5519
5508
|
};
|
|
5520
5509
|
|
|
@@ -5522,19 +5511,19 @@ ${import_chalk4.default.green("\u27A4")} Authentication Required`));
|
|
|
5522
5511
|
var CloudScript = class {
|
|
5523
5512
|
#runner = new CloudRunner();
|
|
5524
5513
|
#packageScript = new PackageScript();
|
|
5525
|
-
async login() {
|
|
5514
|
+
async login(workspace) {
|
|
5526
5515
|
await this.#runner.login();
|
|
5527
5516
|
}
|
|
5528
|
-
logout() {
|
|
5517
|
+
logout(workspace) {
|
|
5529
5518
|
this.#runner.logout();
|
|
5530
5519
|
}
|
|
5531
|
-
async setLlm() {
|
|
5520
|
+
async setLlm(workspace) {
|
|
5532
5521
|
await this.#runner.setLlm();
|
|
5533
5522
|
}
|
|
5534
|
-
resetLlm() {
|
|
5523
|
+
resetLlm(workspace) {
|
|
5535
5524
|
this.#runner.resetLlm();
|
|
5536
5525
|
}
|
|
5537
|
-
async ask(question) {
|
|
5526
|
+
async ask(question, workspace) {
|
|
5538
5527
|
await AiSession.init();
|
|
5539
5528
|
const session = new AiSession();
|
|
5540
5529
|
await session.ask(question);
|
|
@@ -5547,27 +5536,31 @@ var CloudScript = class {
|
|
|
5547
5536
|
await this.#runner.deployAkan(workspace, akanPkgs);
|
|
5548
5537
|
}
|
|
5549
5538
|
async update(workspace) {
|
|
5539
|
+
const spinner = workspace.spinning("Updating Akan.js packages and CLI...");
|
|
5550
5540
|
await this.#runner.update(workspace);
|
|
5541
|
+
spinner.succeed("Akan.js packages and CLI updated, global version is below");
|
|
5542
|
+
Logger.raw("> Akan version: ");
|
|
5543
|
+
await workspace.spawn("akan", ["--version"], { stdio: "inherit" });
|
|
5551
5544
|
}
|
|
5552
5545
|
};
|
|
5553
5546
|
|
|
5554
5547
|
// pkgs/@akanjs/cli/src/cloud/cloud.command.ts
|
|
5555
5548
|
var CloudCommand = class {
|
|
5556
5549
|
cloudScript = new CloudScript();
|
|
5557
|
-
async login() {
|
|
5558
|
-
await this.cloudScript.login();
|
|
5550
|
+
async login(workspace) {
|
|
5551
|
+
await this.cloudScript.login(workspace);
|
|
5559
5552
|
}
|
|
5560
|
-
logout() {
|
|
5561
|
-
this.cloudScript.logout();
|
|
5553
|
+
logout(workspace) {
|
|
5554
|
+
this.cloudScript.logout(workspace);
|
|
5562
5555
|
}
|
|
5563
|
-
async setLlm() {
|
|
5564
|
-
await this.cloudScript.setLlm();
|
|
5556
|
+
async setLlm(workspace) {
|
|
5557
|
+
await this.cloudScript.setLlm(workspace);
|
|
5565
5558
|
}
|
|
5566
|
-
resetLlm() {
|
|
5567
|
-
this.cloudScript.resetLlm();
|
|
5559
|
+
resetLlm(workspace) {
|
|
5560
|
+
this.cloudScript.resetLlm(workspace);
|
|
5568
5561
|
}
|
|
5569
|
-
async ask(question) {
|
|
5570
|
-
await this.cloudScript.ask(question);
|
|
5562
|
+
async ask(question, workspace) {
|
|
5563
|
+
await this.cloudScript.ask(question, workspace);
|
|
5571
5564
|
}
|
|
5572
5565
|
async deployAkan(workspace) {
|
|
5573
5566
|
await this.cloudScript.deployAkan(workspace);
|
|
@@ -5577,20 +5570,25 @@ var CloudCommand = class {
|
|
|
5577
5570
|
}
|
|
5578
5571
|
};
|
|
5579
5572
|
__decorateClass([
|
|
5580
|
-
Target.Public()
|
|
5573
|
+
Target.Public(),
|
|
5574
|
+
__decorateParam(0, Workspace())
|
|
5581
5575
|
], CloudCommand.prototype, "login", 1);
|
|
5582
5576
|
__decorateClass([
|
|
5583
|
-
Target.Public()
|
|
5577
|
+
Target.Public(),
|
|
5578
|
+
__decorateParam(0, Workspace())
|
|
5584
5579
|
], CloudCommand.prototype, "logout", 1);
|
|
5585
5580
|
__decorateClass([
|
|
5586
|
-
Target.Public()
|
|
5581
|
+
Target.Public(),
|
|
5582
|
+
__decorateParam(0, Workspace())
|
|
5587
5583
|
], CloudCommand.prototype, "setLlm", 1);
|
|
5588
5584
|
__decorateClass([
|
|
5589
|
-
Target.Public()
|
|
5585
|
+
Target.Public(),
|
|
5586
|
+
__decorateParam(0, Workspace())
|
|
5590
5587
|
], CloudCommand.prototype, "resetLlm", 1);
|
|
5591
5588
|
__decorateClass([
|
|
5592
5589
|
Target.Public(),
|
|
5593
|
-
__decorateParam(0, Option("question", { ask: "question to ask" }))
|
|
5590
|
+
__decorateParam(0, Option("question", { ask: "question to ask" })),
|
|
5591
|
+
__decorateParam(1, Workspace())
|
|
5594
5592
|
], CloudCommand.prototype, "ask", 1);
|
|
5595
5593
|
__decorateClass([
|
|
5596
5594
|
Target.Public({ devOnly: true }),
|
|
@@ -5607,19 +5605,17 @@ CloudCommand = __decorateClass([
|
|
|
5607
5605
|
// pkgs/@akanjs/cli/src/library/library.command.ts
|
|
5608
5606
|
var LibraryCommand = class {
|
|
5609
5607
|
libraryScript = new LibraryScript();
|
|
5610
|
-
async createLibrary(
|
|
5611
|
-
await this.libraryScript.createLibrary(
|
|
5608
|
+
async createLibrary(libName, workspace) {
|
|
5609
|
+
await this.libraryScript.createLibrary(libName.toLowerCase().replace(/ /g, "-"), workspace);
|
|
5612
5610
|
}
|
|
5613
5611
|
async removeLibrary(lib) {
|
|
5614
5612
|
await this.libraryScript.removeLibrary(lib);
|
|
5615
5613
|
}
|
|
5616
|
-
async
|
|
5617
|
-
await this.libraryScript.
|
|
5618
|
-
}
|
|
5619
|
-
async buildLibrary(lib) {
|
|
5614
|
+
async syncLibrary(lib) {
|
|
5615
|
+
await this.libraryScript.syncLibrary(lib);
|
|
5620
5616
|
}
|
|
5621
|
-
async installLibrary(
|
|
5622
|
-
await this.libraryScript.installLibrary(workspace,
|
|
5617
|
+
async installLibrary(libName, workspace) {
|
|
5618
|
+
await this.libraryScript.installLibrary(workspace, libName);
|
|
5623
5619
|
}
|
|
5624
5620
|
async pushLibrary(lib, branch) {
|
|
5625
5621
|
await this.libraryScript.pushLibrary(lib, branch);
|
|
@@ -5630,7 +5626,7 @@ var LibraryCommand = class {
|
|
|
5630
5626
|
};
|
|
5631
5627
|
__decorateClass([
|
|
5632
5628
|
Target.Public(),
|
|
5633
|
-
__decorateParam(0,
|
|
5629
|
+
__decorateParam(0, Argument("libName", { desc: "name of library" })),
|
|
5634
5630
|
__decorateParam(1, Workspace())
|
|
5635
5631
|
], LibraryCommand.prototype, "createLibrary", 1);
|
|
5636
5632
|
__decorateClass([
|
|
@@ -5640,14 +5636,10 @@ __decorateClass([
|
|
|
5640
5636
|
__decorateClass([
|
|
5641
5637
|
Target.Public(),
|
|
5642
5638
|
__decorateParam(0, Lib())
|
|
5643
|
-
], LibraryCommand.prototype, "
|
|
5639
|
+
], LibraryCommand.prototype, "syncLibrary", 1);
|
|
5644
5640
|
__decorateClass([
|
|
5645
5641
|
Target.Public(),
|
|
5646
|
-
__decorateParam(0,
|
|
5647
|
-
], LibraryCommand.prototype, "buildLibrary", 1);
|
|
5648
|
-
__decorateClass([
|
|
5649
|
-
Target.Public(),
|
|
5650
|
-
__decorateParam(0, Option("name", { desc: "name of library" })),
|
|
5642
|
+
__decorateParam(0, Argument("libName", { desc: "name of library", nullable: true })),
|
|
5651
5643
|
__decorateParam(1, Workspace())
|
|
5652
5644
|
], LibraryCommand.prototype, "installLibrary", 1);
|
|
5653
5645
|
__decorateClass([
|
|
@@ -5664,15 +5656,325 @@ LibraryCommand = __decorateClass([
|
|
|
5664
5656
|
Commands()
|
|
5665
5657
|
], LibraryCommand);
|
|
5666
5658
|
|
|
5667
|
-
// pkgs/@akanjs/cli/src/module/module.
|
|
5659
|
+
// pkgs/@akanjs/cli/src/module/module.command.ts
|
|
5668
5660
|
var import_prompts8 = require("@inquirer/prompts");
|
|
5661
|
+
|
|
5662
|
+
// pkgs/@akanjs/cli/src/module/module.script.ts
|
|
5669
5663
|
var import_fs10 = __toESM(require("fs"));
|
|
5670
5664
|
|
|
5665
|
+
// pkgs/@akanjs/cli/src/module/module.request.ts
|
|
5666
|
+
var requestConstant = ({
|
|
5667
|
+
sysName,
|
|
5668
|
+
modelName,
|
|
5669
|
+
modelDesc,
|
|
5670
|
+
modelSchemaDesign,
|
|
5671
|
+
boilerplate,
|
|
5672
|
+
exampleFiles
|
|
5673
|
+
}) => `
|
|
5674
|
+
\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.
|
|
5675
|
+
\uB2E4\uC74C\uC758 \uBC30\uACBD \uC815\uBCF4\uB97C \uBC14\uD0D5\uC73C\uB85C ${modelName}.constant.ts \uD30C\uC77C\uC744 \uC791\uC131\uD574\uC918.
|
|
5676
|
+
|
|
5677
|
+
1. Akan.js \uD504\uB808\uC784\uC6CC\uD06C\uC5D0 \uB300\uD55C \uAC1C\uC694
|
|
5678
|
+
${frameworkAbstract}
|
|
5679
|
+
|
|
5680
|
+
2. <model>.constant.ts \uD30C\uC77C\uC5D0 \uB300\uD55C \uAC1C\uC694
|
|
5681
|
+
${scalarConstantDescription}
|
|
5682
|
+
|
|
5683
|
+
3. <model>.constant.ts \uD30C\uC77C\uC758 Enum \uC791\uC131\uBC95
|
|
5684
|
+
${howToSetEnumInModelConstant}
|
|
5685
|
+
|
|
5686
|
+
4. <model>.constant.ts \uD30C\uC77C\uC758 Field \uC791\uC131\uBC95
|
|
5687
|
+
${howToSetFieldInModelConstant}
|
|
5688
|
+
|
|
5689
|
+
5. \uD604\uC7AC \uD504\uB85C\uC81D\uD2B8 \uB0B4 \uB2E4\uB978 constant.ts \uD30C\uC77C\uB4E4\uC5D0 \uB300\uD55C \uC608\uC2DC
|
|
5690
|
+
${exampleFiles.map(
|
|
5691
|
+
(constant) => `
|
|
5692
|
+
Example file: ${constant.filepath}
|
|
5693
|
+
\`\`\`
|
|
5694
|
+
${constant.content}
|
|
5695
|
+
\`\`\`
|
|
5696
|
+
`
|
|
5697
|
+
).join("\n")}
|
|
5698
|
+
|
|
5699
|
+
|
|
5700
|
+
\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
|
|
5701
|
+
|
|
5702
|
+
Application name: ${sysName}
|
|
5703
|
+
Model name: ${modelName}
|
|
5704
|
+
Model description: ${modelDesc}
|
|
5705
|
+
Model schema design: ${modelSchemaDesign}
|
|
5706
|
+
|
|
5707
|
+
Target filename: ${modelName}.constant.ts
|
|
5708
|
+
\`\`\`
|
|
5709
|
+
${boilerplate}
|
|
5710
|
+
\`\`\`
|
|
5711
|
+
`;
|
|
5712
|
+
var requestDictionary = ({
|
|
5713
|
+
sysName,
|
|
5714
|
+
modelName,
|
|
5715
|
+
constant,
|
|
5716
|
+
modelDesc,
|
|
5717
|
+
modelSchemaDesign,
|
|
5718
|
+
boilerplate,
|
|
5719
|
+
exampleFiles
|
|
5720
|
+
}) => `
|
|
5721
|
+
|
|
5722
|
+
|
|
5723
|
+
-${modelName}\uC758 \uC2A4\uD0A4\uB9C8 \uC815\uC758.
|
|
5724
|
+
\`\`\`
|
|
5725
|
+
${constant}
|
|
5726
|
+
\`\`\`
|
|
5727
|
+
|
|
5728
|
+
\uC5ED\uD560\uBD80\uC5EC
|
|
5729
|
+
- Akan.js \uC0AC\uB0B4 \uD504\uB808\uC784\uC6CC\uD06C \uAE30\uBC18 \uC720\uCC3D\uD55C \uBC88\uC5ED\uAC00.
|
|
5730
|
+
|
|
5731
|
+
\uC5C4\uACA9\uD55C \uC8FC\uC758\uC0AC\uD56D
|
|
5732
|
+
- \uBAA8\uB4E0 \uBB38\uC7A5\uC740 \uBB38\uBC95\uC801\uC73C\uB85C \uC62C\uBC14\uB974\uAC8C \uC791\uC131
|
|
5733
|
+
- \uBCF4\uC77C\uB7EC\uD50C\uB808\uC774\uD2B8\uB0B4 signalDictionary \uBD80\uBD84\uC740 \uADF8\uB300\uB85C \uC720\uC9C0
|
|
5734
|
+
|
|
5735
|
+
\uC694\uCCAD\uC0AC\uD56D
|
|
5736
|
+
- \uC544\uB798 \uC81C\uACF5\uD560 \uBCF4\uC77C\uB7EC\uD50C\uB808\uC774\uD2B8\uC5D0 \uB9DE\uCDB0 \uBC88\uC5ED\uBCF8 \uC18C\uC2A4\uCF54\uB4DC \uC81C\uACF5
|
|
5737
|
+
|
|
5738
|
+
|
|
5739
|
+
|
|
5740
|
+
Application name: ${sysName}
|
|
5741
|
+
Model name: ${modelName}
|
|
5742
|
+
Model description: ${modelDesc}
|
|
5743
|
+
Model schema design: ${modelSchemaDesign}
|
|
5744
|
+
|
|
5745
|
+
Target filename: ${modelName}.dictionary.ts
|
|
5746
|
+
\`\`\`
|
|
5747
|
+
${boilerplate}
|
|
5748
|
+
\`\`\`
|
|
5749
|
+
`;
|
|
5750
|
+
var requestScalarConstant = ({
|
|
5751
|
+
sysName,
|
|
5752
|
+
modelName,
|
|
5753
|
+
modelDesc,
|
|
5754
|
+
modelSchemaDesign,
|
|
5755
|
+
boilerplate,
|
|
5756
|
+
exampleFiles
|
|
5757
|
+
}) => `
|
|
5758
|
+
\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.
|
|
5759
|
+
\uB2E4\uC74C\uC758 \uBC30\uACBD \uC815\uBCF4\uB97C \uBC14\uD0D5\uC73C\uB85C ${modelName}.constant.ts \uD30C\uC77C\uC744 \uC791\uC131\uD574\uC918.
|
|
5760
|
+
|
|
5761
|
+
1. Akan.js \uD504\uB808\uC784\uC6CC\uD06C\uC5D0 \uB300\uD55C \uAC1C\uC694
|
|
5762
|
+
${frameworkAbstract}
|
|
5763
|
+
|
|
5764
|
+
2. <model>.constant.ts \uD30C\uC77C\uC5D0 \uB300\uD55C \uAC1C\uC694
|
|
5765
|
+
${scalarConstantDescription}
|
|
5766
|
+
|
|
5767
|
+
3. <model>.constant.ts \uD30C\uC77C\uC758 Enum \uC791\uC131\uBC95
|
|
5768
|
+
${howToSetEnumInModelConstant}
|
|
5769
|
+
|
|
5770
|
+
4. <model>.constant.ts \uD30C\uC77C\uC758 Field \uC791\uC131\uBC95
|
|
5771
|
+
${howToSetFieldInModelConstant}
|
|
5772
|
+
|
|
5773
|
+
5. \uD604\uC7AC \uD504\uB85C\uC81D\uD2B8 \uB0B4 \uB2E4\uB978 constant.ts \uD30C\uC77C\uB4E4\uC5D0 \uB300\uD55C \uC608\uC2DC
|
|
5774
|
+
${exampleFiles.map(
|
|
5775
|
+
(constant) => `
|
|
5776
|
+
Example file: ${constant.filepath}
|
|
5777
|
+
\`\`\`
|
|
5778
|
+
${constant.content}
|
|
5779
|
+
\`\`\`
|
|
5780
|
+
`
|
|
5781
|
+
).join("\n")}
|
|
5782
|
+
|
|
5783
|
+
|
|
5784
|
+
\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
|
|
5785
|
+
|
|
5786
|
+
Application name: ${sysName}
|
|
5787
|
+
Model name: ${modelName}
|
|
5788
|
+
Model description: ${modelDesc}
|
|
5789
|
+
Model schema design: ${modelSchemaDesign}
|
|
5790
|
+
|
|
5791
|
+
Target filename: ${modelName}.constant.ts
|
|
5792
|
+
\`\`\`
|
|
5793
|
+
${boilerplate}
|
|
5794
|
+
\`\`\`
|
|
5795
|
+
`;
|
|
5796
|
+
var requestTemplate = ({
|
|
5797
|
+
sysName,
|
|
5798
|
+
modelName,
|
|
5799
|
+
ModelName,
|
|
5800
|
+
boilerplate,
|
|
5801
|
+
constant,
|
|
5802
|
+
properties,
|
|
5803
|
+
exampleFiles
|
|
5804
|
+
}) => `
|
|
5805
|
+
${componentDefaultDescription({
|
|
5806
|
+
sysName,
|
|
5807
|
+
modelName,
|
|
5808
|
+
ModelName: ModelName ?? capitalize(modelName),
|
|
5809
|
+
exampleFiles,
|
|
5810
|
+
constant,
|
|
5811
|
+
properties
|
|
5812
|
+
})}
|
|
5813
|
+
\uC5ED\uD560\uBD80\uC5EC
|
|
5814
|
+
- Akan.js \uC0AC\uB0B4 \uD504\uB808\uC784\uC6CC\uD06C \uAE30\uBC18 Typescript \uC2DC\uB2C8\uC5B4 \uD504\uB860\uD2B8\uC5D4\uB4DC \uAC1C\uBC1C\uC790.
|
|
5815
|
+
|
|
5816
|
+
\uCF54\uB529 \uADDC\uCE59
|
|
5817
|
+
- \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
5818
|
+
- \uC544\uC774\uCF58: react-icons \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
5819
|
+
- 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
|
|
5820
|
+
- Ui Component: @util/ui \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
5821
|
+
- \uC870\uAC74\uBD80 \uD074\uB798\uC2A4: clsx \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
5822
|
+
\uCF54\uB4DC \uC2A4\uD0C0\uC77C
|
|
5823
|
+
- \uC0C9\uC0C1: \uD558\uB4DC\uCF54\uB529(bg-red) \uB300\uC2E0 \uD14C\uB9C8 \uC0C9\uC0C1(bg-primary) \uC0AC\uC6A9
|
|
5824
|
+
- \uC870\uAC74\uBD80 \uB80C\uB354\uB9C1: field && <div>... \uB300\uC2E0 field ? <div>... : null \uC0AC\uC6A9
|
|
5825
|
+
- \uBAA8\uB378 \uC811\uADFC: \uAD6C\uC870\uBD84\uD574\uD560\uB2F9 \uB300\uC2E0 ${modelName}.field \uD615\uC2DD\uC73C\uB85C \uC811\uADFC
|
|
5826
|
+
- \uD0C0\uC785 \uC548\uC804: ${modelName}.constant.ts\uC758 \uC2A4\uD0A4\uB9C8 \uCC38\uC870\uD558\uC5EC \uC5D0\uB7EC \uBC29\uC9C0
|
|
5827
|
+
\uD544\uB4DC \uC811\uADFC \uC804: \uC2A4\uD0A4\uB9C8\uC758 \uC2E4\uC81C \uD544\uB4DC \uB9AC\uC2A4\uD2B8 \uC791\uC131 \uBC0F \uAC80\uD1A0 \uD544\uC218
|
|
5828
|
+
|
|
5829
|
+
\uC5C4\uACA9\uD55C \uC8FC\uC758\uC0AC\uD56D
|
|
5830
|
+
- UI \uD0B7\uC740 \uBB38\uC11C\uC5D0 \uBA85\uC2DC\uB41C \uCEF4\uD3EC\uB10C\uD2B8\uB9CC \uC0AC\uC6A9
|
|
5831
|
+
- \uCEF4\uD3EC\uB10C\uD2B8 \uC0AC\uC6A9 \uC804 \uBB38\uC11C \uD655\uC778 \uBC0F props \uC815\uD655\uD788 \uAC80\uC99D
|
|
5832
|
+
- \uBA85\uC2DC\uB41C \uB8F0 \uC678 \uC784\uC758 \uCD94\uC0C1\uD654 \uAE08\uC9C0
|
|
5833
|
+
- dayjs \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB294 @akanjs/base\uC5D0\uC11C \uB798\uD551\uD558\uC5EC \uC81C\uACF5\uD558\uACE0 \uC788\uC74C.
|
|
5834
|
+
|
|
5835
|
+
\uC694\uCCAD\uC0AC\uD56D
|
|
5836
|
+
- \uC544\uB798 \uC81C\uACF5\uD560 \uAE30\uBCF8 \uD15C\uD50C\uB9BF \uCF54\uB4DC\uC5D0 \uCD94\uAC00\uB85C \uCEF4\uD3EC\uB10C\uD2B8 \uAC1C\uBC1C
|
|
5837
|
+
- ${ModelName}.Template.tsx \uCF54\uB4DC \uC791\uC131
|
|
5838
|
+
- \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
|
|
5839
|
+
- \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
|
|
5840
|
+
- \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.
|
|
5841
|
+
- \uBCF4\uC77C\uB7EC\uD50C\uB808\uC774\uD2B8\uC5D0 \uB9DE\uAC8C \uC815\uB9AC\uD574\uC11C \uC81C\uACF5
|
|
5842
|
+
-
|
|
5843
|
+
|
|
5844
|
+
Application name: ${sysName}
|
|
5845
|
+
Model name: ${modelName}
|
|
5846
|
+
Target filename: ${ModelName}.Template.tsx
|
|
5847
|
+
\`\`\`
|
|
5848
|
+
${boilerplate}
|
|
5849
|
+
\`\`\`
|
|
5850
|
+
|
|
5851
|
+
|
|
5852
|
+
`;
|
|
5853
|
+
var requestView = ({
|
|
5854
|
+
sysName,
|
|
5855
|
+
modelName,
|
|
5856
|
+
ModelName,
|
|
5857
|
+
boilerplate,
|
|
5858
|
+
constant,
|
|
5859
|
+
properties,
|
|
5860
|
+
exampleFiles
|
|
5861
|
+
}) => `
|
|
5862
|
+
${componentDefaultDescription({
|
|
5863
|
+
sysName,
|
|
5864
|
+
modelName,
|
|
5865
|
+
ModelName: ModelName ?? capitalize(modelName),
|
|
5866
|
+
exampleFiles,
|
|
5867
|
+
constant,
|
|
5868
|
+
properties
|
|
5869
|
+
})}
|
|
5870
|
+
|
|
5871
|
+
\uC5ED\uD560\uBD80\uC5EC
|
|
5872
|
+
- Akan.js \uC0AC\uB0B4 \uD504\uB808\uC784\uC6CC\uD06C \uAE30\uBC18 Typescript \uC2DC\uB2C8\uC5B4 \uD504\uB860\uD2B8\uC5D4\uB4DC \uAC1C\uBC1C\uC790.
|
|
5873
|
+
|
|
5874
|
+
\uCF54\uB529 \uADDC\uCE59
|
|
5875
|
+
- \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
5876
|
+
- \uC544\uC774\uCF58: react-icons \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
5877
|
+
- 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
|
|
5878
|
+
- Ui Component: @util/ui \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
5879
|
+
- \uC870\uAC74\uBD80 \uD074\uB798\uC2A4: clsx \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
5880
|
+
\uCF54\uB4DC \uC2A4\uD0C0\uC77C
|
|
5881
|
+
- \uC0C9\uC0C1: \uD558\uB4DC\uCF54\uB529(bg-red) \uB300\uC2E0 \uD14C\uB9C8 \uC0C9\uC0C1(bg-primary) \uC0AC\uC6A9
|
|
5882
|
+
- \uC870\uAC74\uBD80 \uB80C\uB354\uB9C1: field && <div>... \uB300\uC2E0 field ? <div>... : null \uC0AC\uC6A9
|
|
5883
|
+
- \uBAA8\uB378 \uC811\uADFC: \uAD6C\uC870\uBD84\uD574\uD560\uB2F9 \uB300\uC2E0 ${modelName}.field \uD615\uC2DD\uC73C\uB85C \uC811\uADFC
|
|
5884
|
+
- \uD0C0\uC785 \uC548\uC804: ${modelName}.constant.ts\uC758 \uC2A4\uD0A4\uB9C8 \uCC38\uC870\uD558\uC5EC \uC5D0\uB7EC \uBC29\uC9C0
|
|
5885
|
+
\uD544\uB4DC \uC811\uADFC \uC804: \uC2A4\uD0A4\uB9C8\uC758 \uC2E4\uC81C \uD544\uB4DC \uB9AC\uC2A4\uD2B8 \uC791\uC131 \uBC0F \uAC80\uD1A0 \uD544\uC218
|
|
5886
|
+
|
|
5887
|
+
\uC5C4\uACA9\uD55C \uC8FC\uC758\uC0AC\uD56D
|
|
5888
|
+
- UI \uD0B7\uC740 \uBB38\uC11C\uC5D0 \uBA85\uC2DC\uB41C \uCEF4\uD3EC\uB10C\uD2B8\uB9CC \uC0AC\uC6A9
|
|
5889
|
+
- \uCEF4\uD3EC\uB10C\uD2B8 \uC0AC\uC6A9 \uC804 \uBB38\uC11C \uD655\uC778 \uBC0F props \uC815\uD655\uD788 \uAC80\uC99D
|
|
5890
|
+
- \uBA85\uC2DC\uB41C \uB8F0 \uC678 \uC784\uC758 \uCD94\uC0C1\uD654 \uAE08\uC9C0
|
|
5891
|
+
- dayjs \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB294 @akanjs/base\uC5D0\uC11C \uB798\uD551\uD558\uC5EC \uC81C\uACF5\uD558\uACE0 \uC788\uC74C.
|
|
5892
|
+
|
|
5893
|
+
\uC694\uCCAD\uC0AC\uD56D
|
|
5894
|
+
- \uC544\uB798 \uC81C\uACF5\uD560 \uAE30\uBCF8 \uD15C\uD50C\uB9BF \uCF54\uB4DC\uC5D0 \uCD94\uAC00\uB85C \uCEF4\uD3EC\uB10C\uD2B8 \uAC1C\uBC1C
|
|
5895
|
+
- ${ModelName}.View.tsx \uCF54\uB4DC \uC791\uC131
|
|
5896
|
+
- \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
|
|
5897
|
+
- \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
|
|
5898
|
+
- \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.
|
|
5899
|
+
- \uBCF4\uC77C\uB7EC\uD50C\uB808\uC774\uD2B8\uC5D0 \uB9DE\uAC8C \uC815\uB9AC\uD574\uC11C \uC81C\uACF5
|
|
5900
|
+
|
|
5901
|
+
|
|
5902
|
+
Application name: ${sysName}
|
|
5903
|
+
Model name: ${modelName}
|
|
5904
|
+
|
|
5905
|
+
Target filename: ${ModelName}.View.tsx
|
|
5906
|
+
\`\`\`
|
|
5907
|
+
${boilerplate}
|
|
5908
|
+
\`\`\`
|
|
5909
|
+
|
|
5910
|
+
|
|
5911
|
+
`;
|
|
5912
|
+
var requestUnit = ({
|
|
5913
|
+
sysName,
|
|
5914
|
+
modelName,
|
|
5915
|
+
ModelName,
|
|
5916
|
+
constant,
|
|
5917
|
+
properties,
|
|
5918
|
+
boilerplate,
|
|
5919
|
+
exampleFiles
|
|
5920
|
+
}) => `
|
|
5921
|
+
${componentDefaultDescription({
|
|
5922
|
+
sysName,
|
|
5923
|
+
modelName,
|
|
5924
|
+
ModelName: ModelName ?? capitalize(modelName),
|
|
5925
|
+
exampleFiles,
|
|
5926
|
+
constant,
|
|
5927
|
+
properties
|
|
5928
|
+
})}
|
|
5929
|
+
|
|
5930
|
+
\uC5ED\uD560\uBD80\uC5EC
|
|
5931
|
+
- Akan.js \uC0AC\uB0B4 \uD504\uB808\uC784\uC6CC\uD06C \uAE30\uBC18 Typescript \uC2DC\uB2C8\uC5B4 \uD504\uB860\uD2B8\uC5D4\uB4DC \uAC1C\uBC1C\uC790.
|
|
5932
|
+
|
|
5933
|
+
\uCF54\uB529 \uADDC\uCE59
|
|
5934
|
+
- \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
5935
|
+
- \uC544\uC774\uCF58: react-icons \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
5936
|
+
- 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
|
|
5937
|
+
- Ui Component: @util/ui \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
5938
|
+
- \uC870\uAC74\uBD80 \uD074\uB798\uC2A4: clsx \uB77C\uC774\uBE0C\uB7EC\uB9AC \uC0AC\uC6A9
|
|
5939
|
+
\uCF54\uB4DC \uC2A4\uD0C0\uC77C
|
|
5940
|
+
- \uC0C9\uC0C1: \uD558\uB4DC\uCF54\uB529(bg-red) \uB300\uC2E0 \uD14C\uB9C8 \uC0C9\uC0C1(bg-primary) \uC0AC\uC6A9
|
|
5941
|
+
- \uC870\uAC74\uBD80 \uB80C\uB354\uB9C1: field && <div>... \uB300\uC2E0 field ? <div>... : null \uC0AC\uC6A9
|
|
5942
|
+
- \uBAA8\uB378 \uC811\uADFC: \uAD6C\uC870\uBD84\uD574\uD560\uB2F9 \uB300\uC2E0 ${modelName}.field \uD615\uC2DD\uC73C\uB85C \uC811\uADFC
|
|
5943
|
+
- \uD0C0\uC785 \uC548\uC804: ${modelName}.constant.ts\uC758 \uC2A4\uD0A4\uB9C8 \uCC38\uC870\uD558\uC5EC \uC5D0\uB7EC \uBC29\uC9C0
|
|
5944
|
+
\uD544\uB4DC \uC811\uADFC \uC804: \uC2A4\uD0A4\uB9C8\uC758 \uC2E4\uC81C \uD544\uB4DC \uB9AC\uC2A4\uD2B8 \uC791\uC131 \uBC0F \uAC80\uD1A0 \uD544\uC218
|
|
5945
|
+
|
|
5946
|
+
\uC5C4\uACA9\uD55C \uC8FC\uC758\uC0AC\uD56D
|
|
5947
|
+
- UI \uD0B7\uC740 \uBB38\uC11C\uC5D0 \uBA85\uC2DC\uB41C \uCEF4\uD3EC\uB10C\uD2B8\uB9CC \uC0AC\uC6A9
|
|
5948
|
+
- \uCEF4\uD3EC\uB10C\uD2B8 \uC0AC\uC6A9 \uC804 \uBB38\uC11C \uD655\uC778 \uBC0F props \uC815\uD655\uD788 \uAC80\uC99D
|
|
5949
|
+
- \uBA85\uC2DC\uB41C \uB8F0 \uC678 \uC784\uC758 \uCD94\uC0C1\uD654 \uAE08\uC9C0
|
|
5950
|
+
- dayjs \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB294 @akanjs/base\uC5D0\uC11C \uB798\uD551\uD558\uC5EC \uC81C\uACF5\uD558\uACE0 \uC788\uC74C.
|
|
5951
|
+
|
|
5952
|
+
\uC694\uCCAD\uC0AC\uD56D
|
|
5953
|
+
- \uC544\uB798 \uC81C\uACF5\uD560 \uAE30\uBCF8 \uD15C\uD50C\uB9BF \uCF54\uB4DC\uC5D0 \uCD94\uAC00\uB85C \uCEF4\uD3EC\uB10C\uD2B8 \uAC1C\uBC1C
|
|
5954
|
+
- ${ModelName}.Unit.tsx \uCF54\uB4DC \uC791\uC131
|
|
5955
|
+
- \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
|
|
5956
|
+
- \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
|
|
5957
|
+
- \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.
|
|
5958
|
+
- \uBCF4\uC77C\uB7EC\uD50C\uB808\uC774\uD2B8\uC5D0 \uB9DE\uAC8C \uC815\uB9AC\uD574\uC11C \uC81C\uACF5
|
|
5959
|
+
|
|
5960
|
+
|
|
5961
|
+
Application name: ${sysName}
|
|
5962
|
+
Model name: ${modelName}
|
|
5963
|
+
|
|
5964
|
+
Target filename: ${ModelName}.Unit.tsx
|
|
5965
|
+
\`\`\`
|
|
5966
|
+
${boilerplate}
|
|
5967
|
+
\`\`\`
|
|
5968
|
+
|
|
5969
|
+
|
|
5970
|
+
`;
|
|
5971
|
+
|
|
5671
5972
|
// pkgs/@akanjs/cli/src/module/module.runner.ts
|
|
5672
5973
|
var ModuleRunner = class {
|
|
5673
5974
|
async createModule(workspace, sysType, sysName, moduleName, description) {
|
|
5674
5975
|
}
|
|
5675
|
-
|
|
5976
|
+
removeModule(sys2, name) {
|
|
5977
|
+
sys2.removeDir(`${sys2.cwdPath}/lib/${name}`);
|
|
5676
5978
|
}
|
|
5677
5979
|
async createScalarTemplate(sys2, name) {
|
|
5678
5980
|
const akanConfig = await sys2.getConfig();
|
|
@@ -5700,11 +6002,25 @@ var ModuleRunner = class {
|
|
|
5700
6002
|
}
|
|
5701
6003
|
};
|
|
5702
6004
|
}
|
|
6005
|
+
async createDictionaryTemplate(sys2, name) {
|
|
6006
|
+
const akanConfig = await sys2.getConfig();
|
|
6007
|
+
const scanResult = await sys2.scan({ akanConfig });
|
|
6008
|
+
await sys2.applyTemplate({
|
|
6009
|
+
basePath: `./lib/${name}`,
|
|
6010
|
+
template: "dictionary",
|
|
6011
|
+
scanResult,
|
|
6012
|
+
dict: { model: name, Model: capitalize(name), sysName: sys2.name, SysName: capitalize(sys2.name) }
|
|
6013
|
+
});
|
|
6014
|
+
await sys2.scan({ akanConfig });
|
|
6015
|
+
return {
|
|
6016
|
+
dictionary: { filename: `${name}.dictionary.ts`, content: sys2.readFile(`lib/${name}/${name}.dictionary.ts`) }
|
|
6017
|
+
};
|
|
6018
|
+
}
|
|
5703
6019
|
async createComponentTemplate(sys2, name, type) {
|
|
5704
6020
|
const akanConfig = await sys2.getConfig();
|
|
5705
6021
|
const scanResult = await sys2.scan({ akanConfig });
|
|
5706
6022
|
await sys2.applyTemplate({
|
|
5707
|
-
basePath: `./lib/${name}
|
|
6023
|
+
basePath: `./lib/${name}`,
|
|
5708
6024
|
template: `module/__Model__.${capitalize(type)}.ts`,
|
|
5709
6025
|
scanResult,
|
|
5710
6026
|
dict: { model: name, Model: capitalize(name), appName: sys2.name }
|
|
@@ -5713,7 +6029,7 @@ var ModuleRunner = class {
|
|
|
5713
6029
|
return {
|
|
5714
6030
|
component: {
|
|
5715
6031
|
filename: `${name}.${capitalize(type)}.tsx`,
|
|
5716
|
-
content: sys2.readFile(`lib/${name}
|
|
6032
|
+
content: sys2.readFile(`lib/${name}/${capitalize(name)}.${capitalize(type)}.tsx`)
|
|
5717
6033
|
}
|
|
5718
6034
|
// constant: {
|
|
5719
6035
|
// filename: `${name}.constant.ts`,
|
|
@@ -5792,31 +6108,62 @@ var ModuleRunner = class {
|
|
|
5792
6108
|
// pkgs/@akanjs/cli/src/module/module.script.ts
|
|
5793
6109
|
var ModuleScript = class {
|
|
5794
6110
|
#runner = new ModuleRunner();
|
|
5795
|
-
|
|
6111
|
+
//! .command arg에 병합 필요.
|
|
6112
|
+
async createModuleTemplate(sys2, name, description) {
|
|
5796
6113
|
await this.#runner.createModuleTemplate(sys2, name);
|
|
6114
|
+
}
|
|
6115
|
+
async createModule(sys2, name, description, schemaDescription) {
|
|
6116
|
+
await AiSession.init();
|
|
6117
|
+
const session = new AiSession();
|
|
6118
|
+
const [appNames, libNames] = await sys2.workspace.getSyss();
|
|
6119
|
+
const moduleConstantExampleFiles = await sys2.workspace.getConstantFiles();
|
|
6120
|
+
const moduleDictionaryExampleFiles = await sys2.workspace.getDictionaryFiles();
|
|
6121
|
+
const { constant, dictionary } = await this.#runner.createModuleTemplate(sys2, name);
|
|
6122
|
+
sys2.log(`Module ${name} created in ${sys2.type}s/${sys2.name}/lib/${name}`);
|
|
6123
|
+
const constantContent = await session.editTypescript(
|
|
6124
|
+
requestConstant({
|
|
6125
|
+
sysName: sys2.name,
|
|
6126
|
+
modelName: name,
|
|
6127
|
+
modelDesc: description ?? "",
|
|
6128
|
+
modelSchemaDesign: schemaDescription ?? "",
|
|
6129
|
+
boilerplate: constant.content,
|
|
6130
|
+
exampleFiles: randomPicks(moduleConstantExampleFiles, Math.min(10, moduleConstantExampleFiles.length))
|
|
6131
|
+
})
|
|
6132
|
+
);
|
|
6133
|
+
sys2.writeFile(`lib/${name}/${name}.constant.ts`, constantContent);
|
|
6134
|
+
const dictionaryContent = await session.editTypescript(
|
|
6135
|
+
requestDictionary({
|
|
6136
|
+
sysName: sys2.name,
|
|
6137
|
+
modelName: name,
|
|
6138
|
+
constant: constantContent,
|
|
6139
|
+
modelDesc: description ?? "",
|
|
6140
|
+
modelSchemaDesign: schemaDescription ?? "",
|
|
6141
|
+
boilerplate: dictionary.content,
|
|
6142
|
+
exampleFiles: randomPicks(moduleConstantExampleFiles, Math.min(10, moduleConstantExampleFiles.length))
|
|
6143
|
+
})
|
|
6144
|
+
);
|
|
6145
|
+
sys2.writeFile(`lib/${name}/${name}.dictionary.ts`, dictionaryContent);
|
|
6146
|
+
await this.createView(sys2, name);
|
|
6147
|
+
await this.createUnit(sys2, name);
|
|
6148
|
+
await this.createTemplate(sys2, name);
|
|
5797
6149
|
sys2.log(`Module ${name} created in ${sys2.type}s/${sys2.name}/lib/${name}`);
|
|
5798
6150
|
}
|
|
5799
|
-
async
|
|
6151
|
+
async createModule_(sys2, name, description, schemaDescription) {
|
|
6152
|
+
await AiSession.init();
|
|
6153
|
+
const session = new AiSession();
|
|
5800
6154
|
const [appNames, libNames] = await sys2.workspace.getSyss();
|
|
5801
|
-
const
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
path: `${appName}/${databaseModule}/${databaseModule}.constant.ts`,
|
|
5809
|
-
content: app.readFile(`lib/${databaseModule}/${databaseModule}.constant.ts`)
|
|
5810
|
-
}))
|
|
5811
|
-
);
|
|
5812
|
-
})
|
|
5813
|
-
)).flat()
|
|
5814
|
-
];
|
|
6155
|
+
const moduleConstantExampleFiles = await sys2.workspace.getConstantFiles();
|
|
6156
|
+
const moduleDictionaryExampleFiles = await sys2.workspace.getDictionaryFiles();
|
|
6157
|
+
sys2.log(`Module ${name} created in ${sys2.type}s/${sys2.name}/lib/${name}`);
|
|
6158
|
+
await this.createView(sys2, name);
|
|
6159
|
+
await this.createUnit(sys2, name);
|
|
6160
|
+
await this.createTemplate(sys2, name);
|
|
6161
|
+
sys2.log(`Module ${name} created in ${sys2.type}s/${sys2.name}/lib/${name}`);
|
|
5815
6162
|
}
|
|
5816
|
-
|
|
6163
|
+
removeModule(sys2, name) {
|
|
6164
|
+
this.#runner.removeModule(sys2, name);
|
|
5817
6165
|
}
|
|
5818
6166
|
async createScalar(sys2, name, description, schemaDescription) {
|
|
5819
|
-
await AiSession.init();
|
|
5820
6167
|
await AiSession.init();
|
|
5821
6168
|
const scalarConstantExampleFiles = await sys2.workspace.getScalarConstantFiles();
|
|
5822
6169
|
const { constant, dictionary } = await this.#runner.createScalarTemplate(sys2, name);
|
|
@@ -5828,7 +6175,7 @@ var ModuleScript = class {
|
|
|
5828
6175
|
modelDesc: description,
|
|
5829
6176
|
modelSchemaDesign: schemaDescription,
|
|
5830
6177
|
boilerplate: constant.content,
|
|
5831
|
-
|
|
6178
|
+
exampleFiles: randomPicks(scalarConstantExampleFiles, Math.min(10, scalarConstantExampleFiles.length))
|
|
5832
6179
|
})
|
|
5833
6180
|
);
|
|
5834
6181
|
sys2.writeFile(`lib/__scalar/${name}/${name}.constant.ts`, content);
|
|
@@ -5837,21 +6184,8 @@ var ModuleScript = class {
|
|
|
5837
6184
|
}
|
|
5838
6185
|
async createTest(workspace, name) {
|
|
5839
6186
|
}
|
|
5840
|
-
async createTemplate(sys2) {
|
|
6187
|
+
async createTemplate(sys2, name) {
|
|
5841
6188
|
await AiSession.init();
|
|
5842
|
-
const libs = await sys2.getModules();
|
|
5843
|
-
const lib = await (0, import_prompts8.select)({
|
|
5844
|
-
message: "Select the lib",
|
|
5845
|
-
choices: libs
|
|
5846
|
-
}).catch((e) => {
|
|
5847
|
-
Logger.error("canceled");
|
|
5848
|
-
return null;
|
|
5849
|
-
});
|
|
5850
|
-
if (!lib)
|
|
5851
|
-
return;
|
|
5852
|
-
const name = lib.split("/").pop();
|
|
5853
|
-
if (!name)
|
|
5854
|
-
return;
|
|
5855
6189
|
const { component: template } = await this.#runner.createComponentTemplate(sys2, name, "template");
|
|
5856
6190
|
const templateExampleFiles = (await sys2.getTemplatesSourceCode()).filter(
|
|
5857
6191
|
(f) => !f.filepath.includes(`${name}.Template.tsx`)
|
|
@@ -5870,25 +6204,10 @@ var ModuleScript = class {
|
|
|
5870
6204
|
exampleFiles: randomPicks(templateExampleFiles, Math.min(20, templateExampleFiles.length))
|
|
5871
6205
|
});
|
|
5872
6206
|
const content = await session.editTypescript(promptRst);
|
|
5873
|
-
|
|
5874
|
-
import_fs10.default.writeFileSync(`${sys2.cwdPath}/resultTemplate.txt`, content);
|
|
5875
|
-
sys2.writeFile(`lib/${name}__/${Name}.Template.tsx`, content);
|
|
6207
|
+
sys2.writeFile(`lib/${name}/${Name}.Template.tsx`, content);
|
|
5876
6208
|
}
|
|
5877
|
-
async createUnit(sys2) {
|
|
6209
|
+
async createUnit(sys2, name) {
|
|
5878
6210
|
await AiSession.init();
|
|
5879
|
-
const libs = await sys2.getModules();
|
|
5880
|
-
const lib = await (0, import_prompts8.select)({
|
|
5881
|
-
message: "Select the lib",
|
|
5882
|
-
choices: libs
|
|
5883
|
-
}).catch((e) => {
|
|
5884
|
-
Logger.error("canceled");
|
|
5885
|
-
return null;
|
|
5886
|
-
});
|
|
5887
|
-
if (!lib)
|
|
5888
|
-
return;
|
|
5889
|
-
const name = lib.split("/").pop();
|
|
5890
|
-
if (!name)
|
|
5891
|
-
return;
|
|
5892
6211
|
const { component: unit } = await this.#runner.createComponentTemplate(sys2, name, "unit");
|
|
5893
6212
|
const Name = capitalize(name);
|
|
5894
6213
|
const unitExampleFiles = (await sys2.getUnitsSourceCode()).filter((f) => !f.filepath.includes(`${name}.Unit.tsx`));
|
|
@@ -5905,25 +6224,10 @@ var ModuleScript = class {
|
|
|
5905
6224
|
boilerplate: unit.content
|
|
5906
6225
|
});
|
|
5907
6226
|
const content = await session.editTypescript(promptRst);
|
|
5908
|
-
|
|
5909
|
-
import_fs10.default.writeFileSync(`${sys2.cwdPath}/resultUnit.txt`, content);
|
|
5910
|
-
sys2.writeFile(`lib/${name}__/${Name}.Unit.tsx`, content);
|
|
6227
|
+
sys2.writeFile(`lib/${name}/${Name}.Unit.tsx`, content);
|
|
5911
6228
|
}
|
|
5912
|
-
async createView(sys2) {
|
|
6229
|
+
async createView(sys2, name) {
|
|
5913
6230
|
await AiSession.init();
|
|
5914
|
-
const libs = await sys2.getModules();
|
|
5915
|
-
const lib = await (0, import_prompts8.select)({
|
|
5916
|
-
message: "Select the lib",
|
|
5917
|
-
choices: libs
|
|
5918
|
-
}).catch((e) => {
|
|
5919
|
-
Logger.error("canceled");
|
|
5920
|
-
return null;
|
|
5921
|
-
});
|
|
5922
|
-
if (!lib)
|
|
5923
|
-
return;
|
|
5924
|
-
const name = lib.split("/").pop();
|
|
5925
|
-
if (!name)
|
|
5926
|
-
return;
|
|
5927
6231
|
const { component: view } = await this.#runner.createComponentTemplate(sys2, name, "view");
|
|
5928
6232
|
const viewExampleFiles = (await sys2.getViewsSourceCode()).filter((f) => !f.filepath.includes(`${name}.View.tsx`));
|
|
5929
6233
|
const Name = capitalize(name);
|
|
@@ -5940,73 +6244,82 @@ var ModuleScript = class {
|
|
|
5940
6244
|
exampleFiles: randomPicks(viewExampleFiles, Math.min(20, viewExampleFiles.length))
|
|
5941
6245
|
});
|
|
5942
6246
|
const content = await session.editTypescript(promptRst);
|
|
5943
|
-
|
|
5944
|
-
import_fs10.default.writeFileSync(`${sys2.cwdPath}/result.txt`, content);
|
|
5945
|
-
sys2.writeFile(`lib/${name}__/${Name}.View.tsx`, content);
|
|
6247
|
+
sys2.writeFile(`lib/${name}/${Name}.View.tsx`, content);
|
|
5946
6248
|
}
|
|
5947
6249
|
};
|
|
5948
6250
|
|
|
5949
6251
|
// pkgs/@akanjs/cli/src/module/module.command.ts
|
|
5950
6252
|
var ModuleCommand = class {
|
|
5951
6253
|
moduleScript = new ModuleScript();
|
|
5952
|
-
async
|
|
5953
|
-
await
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
6254
|
+
async selectLib(sys2) {
|
|
6255
|
+
const libs = await sys2.getModules();
|
|
6256
|
+
const lib = await (0, import_prompts8.select)({
|
|
6257
|
+
message: "Select the lib",
|
|
6258
|
+
choices: libs.map((l) => `${sys2.name}/${l}`)
|
|
6259
|
+
}).catch((e) => {
|
|
6260
|
+
Logger.error("canceled");
|
|
6261
|
+
return null;
|
|
6262
|
+
});
|
|
6263
|
+
return lib?.split("/").pop();
|
|
5958
6264
|
}
|
|
5959
|
-
async
|
|
5960
|
-
|
|
6265
|
+
async createModule(sys2, moduleName, description, schemaDescription, ai, workspace) {
|
|
6266
|
+
const name = lowerlize(moduleName.replace(/ /g, ""));
|
|
6267
|
+
if (ai) {
|
|
6268
|
+
await this.moduleScript.createModule(sys2, name, description, schemaDescription);
|
|
6269
|
+
} else {
|
|
6270
|
+
await this.moduleScript.createModuleTemplate(sys2, name);
|
|
6271
|
+
}
|
|
5961
6272
|
}
|
|
5962
|
-
async
|
|
6273
|
+
async removeModule(sys2, workspace) {
|
|
6274
|
+
const name = await this.selectLib(sys2);
|
|
6275
|
+
if (!name)
|
|
6276
|
+
return;
|
|
6277
|
+
this.moduleScript.removeModule(sys2, name);
|
|
5963
6278
|
}
|
|
5964
|
-
async
|
|
6279
|
+
async createScalar(sys2, scalarName, description, schemaDescription, workspace) {
|
|
6280
|
+
await this.moduleScript.createScalar(sys2, lowerlize(scalarName.replace(/ /g, "")), description, schemaDescription);
|
|
5965
6281
|
}
|
|
5966
6282
|
async createView(sys2, workspace) {
|
|
5967
|
-
await this.
|
|
6283
|
+
const name = await this.selectLib(sys2);
|
|
6284
|
+
if (!name)
|
|
6285
|
+
return;
|
|
6286
|
+
await this.moduleScript.createView(sys2, name);
|
|
5968
6287
|
}
|
|
5969
6288
|
async createUnit(sys2, workspace) {
|
|
5970
|
-
await this.
|
|
6289
|
+
const name = await this.selectLib(sys2);
|
|
6290
|
+
if (!name)
|
|
6291
|
+
return;
|
|
6292
|
+
await this.moduleScript.createUnit(sys2, name);
|
|
5971
6293
|
}
|
|
5972
6294
|
async createTemplate(sys2, workspace) {
|
|
5973
|
-
await this.
|
|
6295
|
+
const name = await this.selectLib(sys2);
|
|
6296
|
+
if (!name)
|
|
6297
|
+
return;
|
|
6298
|
+
await this.moduleScript.createTemplate(sys2, name);
|
|
5974
6299
|
}
|
|
5975
6300
|
};
|
|
5976
6301
|
__decorateClass([
|
|
5977
6302
|
Target.Public(),
|
|
5978
6303
|
__decorateParam(0, Sys()),
|
|
5979
|
-
__decorateParam(1,
|
|
5980
|
-
__decorateParam(2,
|
|
6304
|
+
__decorateParam(1, Argument("moduleName", { desc: "name of module" })),
|
|
6305
|
+
__decorateParam(2, Option("description", { desc: "description of module" })),
|
|
6306
|
+
__decorateParam(3, Option("schemaDescription", { desc: "schema description of module" })),
|
|
6307
|
+
__decorateParam(4, Option("ai", { type: "boolean", default: false, desc: "use ai to create module" })),
|
|
6308
|
+
__decorateParam(5, Workspace())
|
|
5981
6309
|
], ModuleCommand.prototype, "createModule", 1);
|
|
5982
6310
|
__decorateClass([
|
|
5983
6311
|
Target.Public(),
|
|
5984
|
-
__decorateParam(0,
|
|
6312
|
+
__decorateParam(0, Sys()),
|
|
5985
6313
|
__decorateParam(1, Workspace())
|
|
5986
6314
|
], ModuleCommand.prototype, "removeModule", 1);
|
|
5987
|
-
__decorateClass([
|
|
5988
|
-
Target.Public(),
|
|
5989
|
-
__decorateParam(0, Option("name", { desc: "name of module" })),
|
|
5990
|
-
__decorateParam(1, Workspace())
|
|
5991
|
-
], ModuleCommand.prototype, "scanModule", 1);
|
|
5992
6315
|
__decorateClass([
|
|
5993
6316
|
Target.Public(),
|
|
5994
6317
|
__decorateParam(0, Sys()),
|
|
5995
|
-
__decorateParam(1,
|
|
6318
|
+
__decorateParam(1, Argument("scalarName", { desc: "name of scalar module" })),
|
|
5996
6319
|
__decorateParam(2, Option("description", { desc: "description of scalar module" })),
|
|
5997
6320
|
__decorateParam(3, Option("schemaDescription", { desc: "schema description of scalar module" })),
|
|
5998
6321
|
__decorateParam(4, Workspace())
|
|
5999
6322
|
], ModuleCommand.prototype, "createScalar", 1);
|
|
6000
|
-
__decorateClass([
|
|
6001
|
-
Target.Public(),
|
|
6002
|
-
__decorateParam(0, Option("name", { desc: "name of service module" })),
|
|
6003
|
-
__decorateParam(1, Workspace())
|
|
6004
|
-
], ModuleCommand.prototype, "createService", 1);
|
|
6005
|
-
__decorateClass([
|
|
6006
|
-
Target.Public(),
|
|
6007
|
-
__decorateParam(0, Option("name", { desc: "name of test module" })),
|
|
6008
|
-
__decorateParam(1, Workspace())
|
|
6009
|
-
], ModuleCommand.prototype, "createTest", 1);
|
|
6010
6323
|
__decorateClass([
|
|
6011
6324
|
Target.Public(),
|
|
6012
6325
|
__decorateParam(0, Sys()),
|
|
@@ -6038,8 +6351,8 @@ var PackageCommand = class {
|
|
|
6038
6351
|
async removePackage(pkg) {
|
|
6039
6352
|
await this.packageScript.removePackage(pkg);
|
|
6040
6353
|
}
|
|
6041
|
-
async
|
|
6042
|
-
await this.packageScript.
|
|
6354
|
+
async syncPackage(pkg) {
|
|
6355
|
+
await this.packageScript.syncPackage(pkg);
|
|
6043
6356
|
}
|
|
6044
6357
|
async buildPackage(pkg) {
|
|
6045
6358
|
await this.packageScript.buildPackage(pkg);
|
|
@@ -6061,7 +6374,7 @@ __decorateClass([
|
|
|
6061
6374
|
__decorateClass([
|
|
6062
6375
|
Target.Public(),
|
|
6063
6376
|
__decorateParam(0, Pkg())
|
|
6064
|
-
], PackageCommand.prototype, "
|
|
6377
|
+
], PackageCommand.prototype, "syncPackage", 1);
|
|
6065
6378
|
__decorateClass([
|
|
6066
6379
|
Target.Public(),
|
|
6067
6380
|
__decorateParam(0, Pkg())
|
|
@@ -6109,6 +6422,7 @@ var WorkspaceRunner = class {
|
|
|
6109
6422
|
const cwdPath = process.cwd();
|
|
6110
6423
|
const workspaceRoot = import_path5.default.join(cwdPath, dirname, repoName);
|
|
6111
6424
|
const workspace = new WorkspaceExecutor({ workspaceRoot, repoName });
|
|
6425
|
+
const templateSpinner = workspace.spinning(`Creating workspace template files in ${dirname}/${repoName}...`);
|
|
6112
6426
|
await workspace.applyTemplate({
|
|
6113
6427
|
basePath: ".",
|
|
6114
6428
|
template: "workspaceRoot",
|
|
@@ -6120,6 +6434,7 @@ var WorkspaceRunner = class {
|
|
|
6120
6434
|
serveDomain: "localhost"
|
|
6121
6435
|
}
|
|
6122
6436
|
});
|
|
6437
|
+
templateSpinner.succeed(`Workspace files created in ${dirname}/${repoName}`);
|
|
6123
6438
|
const rootPackageJson = workspace.readJson("package.json");
|
|
6124
6439
|
const dependencies = [
|
|
6125
6440
|
"@akanjs/base",
|
|
@@ -6152,10 +6467,12 @@ var WorkspaceRunner = class {
|
|
|
6152
6467
|
}
|
|
6153
6468
|
};
|
|
6154
6469
|
workspace.writeFile("package.json", packageJson);
|
|
6155
|
-
workspace.
|
|
6470
|
+
const installSpinner = workspace.spinning("Installing dependencies with pnpm...");
|
|
6156
6471
|
await workspace.spawn("pnpm", ["install", "--reporter=silent"]);
|
|
6157
|
-
|
|
6472
|
+
installSpinner.succeed("Dependencies installed with pnpm");
|
|
6473
|
+
const gitSpinner = workspace.spinning("Initializing git repository and commit...");
|
|
6158
6474
|
await workspace.commit("Initial commit", { init: true });
|
|
6475
|
+
gitSpinner.succeed("Git repository initialized and committed");
|
|
6159
6476
|
return workspace;
|
|
6160
6477
|
}
|
|
6161
6478
|
async generateMongo(workspace) {
|
|
@@ -6211,19 +6528,30 @@ var WorkspaceScript = class {
|
|
|
6211
6528
|
await this.libraryScript.installLibrary(workspace, "util");
|
|
6212
6529
|
await this.libraryScript.installLibrary(workspace, "shared");
|
|
6213
6530
|
await this.applicationScript.createApplication(appName, workspace);
|
|
6214
|
-
|
|
6215
|
-
|
|
6531
|
+
Logger.rawLog(`
|
|
6532
|
+
\u{1F389} Welcome aboard! Workspace created in ${dirname}/${repoName}`);
|
|
6533
|
+
Logger.rawLog(`\u{1F680} Run \`cd ${repoName} && akan start ${appName}\` to start the development server.`);
|
|
6534
|
+
Logger.rawLog(`
|
|
6535
|
+
\u{1F44B} Happy coding!`);
|
|
6216
6536
|
}
|
|
6217
6537
|
async generateMongo(workspace) {
|
|
6538
|
+
const spinner = workspace.spinning("Generating Mongo connections...");
|
|
6218
6539
|
await this.#runner.generateMongo(workspace);
|
|
6219
|
-
|
|
6540
|
+
spinner.succeed(`Mongo connections generated in infra/master/mongo-connections.json`);
|
|
6220
6541
|
}
|
|
6221
6542
|
async lint(exec2, workspace, { fix = true } = {}) {
|
|
6222
6543
|
if (exec2 instanceof AppExecutor)
|
|
6223
6544
|
await this.applicationScript.syncApplication(exec2);
|
|
6224
6545
|
else if (exec2 instanceof LibExecutor)
|
|
6225
6546
|
await this.libraryScript.syncLibrary(exec2);
|
|
6226
|
-
|
|
6547
|
+
const spinner = workspace.spinning(`Linting${fix ? " with fix" : ""}...`);
|
|
6548
|
+
try {
|
|
6549
|
+
await this.#runner.lint(exec2, workspace, { fix });
|
|
6550
|
+
spinner.succeed("Lint completed with no errors");
|
|
6551
|
+
} catch (error) {
|
|
6552
|
+
spinner.fail("Lint failed with errors");
|
|
6553
|
+
throw error;
|
|
6554
|
+
}
|
|
6227
6555
|
}
|
|
6228
6556
|
async lintAll(workspace, { fix = true } = {}) {
|
|
6229
6557
|
const [appNames, libNames, pkgNames] = await workspace.getExecs();
|
|
@@ -6242,8 +6570,12 @@ var WorkspaceScript = class {
|
|
|
6242
6570
|
// pkgs/@akanjs/cli/src/workspace/workspace.command.ts
|
|
6243
6571
|
var WorkspaceCommand = class {
|
|
6244
6572
|
workspaceScript = new WorkspaceScript();
|
|
6245
|
-
async createWorkspace(
|
|
6246
|
-
await this.workspaceScript.createWorkspace(
|
|
6573
|
+
async createWorkspace(workspaceName, app, dir) {
|
|
6574
|
+
await this.workspaceScript.createWorkspace(
|
|
6575
|
+
workspaceName.toLowerCase().replace(/ /g, "-"),
|
|
6576
|
+
app.toLowerCase().replace(/ /g, "-"),
|
|
6577
|
+
dir
|
|
6578
|
+
);
|
|
6247
6579
|
}
|
|
6248
6580
|
async generateMongo(workspace) {
|
|
6249
6581
|
await this.workspaceScript.generateMongo(workspace);
|
|
@@ -6257,7 +6589,7 @@ var WorkspaceCommand = class {
|
|
|
6257
6589
|
};
|
|
6258
6590
|
__decorateClass([
|
|
6259
6591
|
Target.Public(),
|
|
6260
|
-
__decorateParam(0,
|
|
6592
|
+
__decorateParam(0, Argument("workspaceName", { desc: "what is the name of your organization?" })),
|
|
6261
6593
|
__decorateParam(1, Option("app", { desc: "describe your first application to create " })),
|
|
6262
6594
|
__decorateParam(2, Option("dir", { desc: "directory of workspace", default: process.env.USE_AKANJS_PKGS === "true" ? "local" : "." }))
|
|
6263
6595
|
], WorkspaceCommand.prototype, "createWorkspace", 1);
|