@akanjs/cli 0.9.60-canary.0 → 0.9.60-canary.2
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 +109 -62
- package/cjs/src/templates/__scalar/__model__/__model__.dictionary.js +6 -13
- package/cjs/src/templates/app/akan.config.js +2 -4
- package/cjs/src/templates/env/{env.server.type.js → _env.server.type.js} +6 -3
- package/cjs/src/templates/lib/__lib/lib.constant.js +1 -1
- package/cjs/src/templates/lib/__lib/lib.dictionary.js +1 -1
- package/cjs/src/templates/libRoot/akan.config.js +1 -3
- package/cjs/src/templates/module/__model__.dictionary.js +0 -1
- package/esm/index.js +109 -62
- package/esm/src/templates/__scalar/__model__/__model__.dictionary.js +6 -13
- package/esm/src/templates/app/akan.config.js +2 -4
- package/esm/src/templates/env/{env.server.type.js → _env.server.type.js} +6 -3
- package/esm/src/templates/lib/__lib/lib.constant.js +1 -1
- package/esm/src/templates/lib/__lib/lib.dictionary.js +1 -1
- package/esm/src/templates/libRoot/akan.config.js +1 -3
- package/esm/src/templates/module/__model__.dictionary.js +0 -1
- package/package.json +2 -1
- package/src/scalar/scalar.command.d.ts +2 -2
- package/src/scalar/scalar.runner.d.ts +1 -0
- package/src/scalar/scalar.script.d.ts +1 -0
- package/src/templates/app/akan.config.d.ts +1 -3
- package/src/templates/env/{env.server.type.d.ts → _env.server.type.d.ts} +4 -1
- package/src/workspace/workspace.command.d.ts +1 -1
- package/src/workspace/workspace.runner.d.ts +4 -1
- package/src/workspace/workspace.script.d.ts +5 -1
- package/cjs/src/templates/module/__model__.signal.spec.js +0 -27
- package/cjs/src/templates/module/__model__.signal.test.js +0 -27
- package/esm/src/templates/module/__model__.signal.spec.js +0 -7
- package/esm/src/templates/module/__model__.signal.test.js +0 -7
- package/src/templates/module/__model__.signal.spec.d.ts +0 -8
- package/src/templates/module/__model__.signal.test.d.ts +0 -8
package/cjs/index.js
CHANGED
|
@@ -593,7 +593,7 @@ var composePlugins = (...plugins) => {
|
|
|
593
593
|
};
|
|
594
594
|
var commandType = process.env.AKAN_COMMAND_TYPE?.includes("start") ? "start" : process.env.AKAN_COMMAND_TYPE?.includes("build") ? "build" : "deploy";
|
|
595
595
|
var devDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN ?? "akanjs.com";
|
|
596
|
-
var withBase = (appName, config,
|
|
596
|
+
var withBase = (appName, config, optimizeLibs, routes = []) => {
|
|
597
597
|
const withPWA = (0, import_next_pwa.default)({
|
|
598
598
|
dest: "public",
|
|
599
599
|
register: true,
|
|
@@ -617,8 +617,7 @@ var withBase = (appName, config, libs, routes = []) => {
|
|
|
617
617
|
experimental: {
|
|
618
618
|
...config.experimental ?? {},
|
|
619
619
|
optimizePackageImports: [
|
|
620
|
-
...[appName, ...
|
|
621
|
-
"@contract",
|
|
620
|
+
...[appName, ...optimizeLibs].map((lib) => [`@${lib}/ui`, `@${lib}/next`, `@${lib}/common`, `@${lib}/client`]).flat(),
|
|
622
621
|
"@akanjs/next",
|
|
623
622
|
"@akanjs/common",
|
|
624
623
|
"@akanjs/ui"
|
|
@@ -639,7 +638,7 @@ var withBase = (appName, config, libs, routes = []) => {
|
|
|
639
638
|
},
|
|
640
639
|
webpack: (config2) => {
|
|
641
640
|
const watchOptions = config2.watchOptions;
|
|
642
|
-
const ignored = watchOptions?.ignored ? typeof watchOptions.ignored === "string" ? [watchOptions.ignored] : Array.isArray(watchOptions.ignored) ? watchOptions.ignored.filter((
|
|
641
|
+
const ignored = watchOptions?.ignored ? typeof watchOptions.ignored === "string" ? [watchOptions.ignored] : Array.isArray(watchOptions.ignored) ? watchOptions.ignored.filter((ignore2) => typeof ignore2 === "string") : [] : [];
|
|
643
642
|
config2.watchOptions = {
|
|
644
643
|
...config2.watchOptions ?? {},
|
|
645
644
|
...{ ignored: [...ignored, "**/node_modules/**", "**/.git/**", "**/.next/**", "**/dist/**", "**/local/**"] }
|
|
@@ -708,10 +707,9 @@ var archs = ["amd64", "arm64"];
|
|
|
708
707
|
|
|
709
708
|
// pkgs/@akanjs/config/src/akanConfig.ts
|
|
710
709
|
var import_meta = {};
|
|
711
|
-
var makeAppConfig = (config, props) => {
|
|
710
|
+
var makeAppConfig = (config, props, optimizeLibs) => {
|
|
712
711
|
const { name, repoName } = props;
|
|
713
712
|
return {
|
|
714
|
-
libs: config.libs ?? [],
|
|
715
713
|
backend: {
|
|
716
714
|
docker: makeDockerfile("backend", config.backend?.docker ?? {}, props),
|
|
717
715
|
explicitDependencies: config.backend?.explicitDependencies ?? []
|
|
@@ -721,7 +719,7 @@ var makeAppConfig = (config, props) => {
|
|
|
721
719
|
nextConfig: withBase(
|
|
722
720
|
name,
|
|
723
721
|
config.frontend?.nextConfig ? typeof config.frontend.nextConfig === "function" ? config.frontend.nextConfig() : config.frontend.nextConfig : {},
|
|
724
|
-
|
|
722
|
+
optimizeLibs,
|
|
725
723
|
config.frontend?.routes
|
|
726
724
|
),
|
|
727
725
|
routes: config.frontend?.routes,
|
|
@@ -737,7 +735,7 @@ var makeAppConfig = (config, props) => {
|
|
|
737
735
|
}
|
|
738
736
|
};
|
|
739
737
|
};
|
|
740
|
-
var getAppConfig = async (appRoot, props) => {
|
|
738
|
+
var getAppConfig = async (appRoot, props, tsconfig) => {
|
|
741
739
|
const akanConfigPath = import_path.default.join(appRoot, "akan.config.ts");
|
|
742
740
|
if (!import_fs3.default.existsSync(akanConfigPath))
|
|
743
741
|
throw new Error(`application akan.config.ts is not found ${appRoot}`);
|
|
@@ -748,11 +746,13 @@ var getAppConfig = async (appRoot, props) => {
|
|
|
748
746
|
});
|
|
749
747
|
const configImp = (await jiti.import(akanConfigPath)).default;
|
|
750
748
|
const config = typeof configImp === "function" ? configImp(props) : configImp;
|
|
751
|
-
|
|
749
|
+
const optimizeLibs = Object.entries(tsconfig.compilerOptions.paths ?? {}).filter(
|
|
750
|
+
([key, resolves]) => key.startsWith("@") && resolves.at(0)?.startsWith("libs/") && resolves.at(0)?.endsWith("/index.ts")
|
|
751
|
+
).map(([key]) => key.slice(1));
|
|
752
|
+
return makeAppConfig(config, props, optimizeLibs);
|
|
752
753
|
};
|
|
753
754
|
var makeLibConfig = (config, props) => {
|
|
754
755
|
return {
|
|
755
|
-
libs: config.libs ?? [],
|
|
756
756
|
backend: {
|
|
757
757
|
explicitDependencies: config.backend?.explicitDependencies ?? []
|
|
758
758
|
},
|
|
@@ -856,8 +856,8 @@ CMD [${command.map((c) => `"${c}"`).join(",")}]`;
|
|
|
856
856
|
};
|
|
857
857
|
}
|
|
858
858
|
};
|
|
859
|
-
var increaseBuildNum = async (appRoot, props) => {
|
|
860
|
-
const appConfig = await getAppConfig(appRoot, props);
|
|
859
|
+
var increaseBuildNum = async (appRoot, props, tsconfig) => {
|
|
860
|
+
const appConfig = await getAppConfig(appRoot, props, tsconfig);
|
|
861
861
|
const akanConfigPath = import_path.default.join(appRoot, "akan.config.ts");
|
|
862
862
|
const akanConfig = import_fs3.default.readFileSync(akanConfigPath, "utf8");
|
|
863
863
|
const akanConfigContent = akanConfig.replace(
|
|
@@ -866,8 +866,8 @@ var increaseBuildNum = async (appRoot, props) => {
|
|
|
866
866
|
);
|
|
867
867
|
import_fs3.default.writeFileSync(akanConfigPath, akanConfigContent);
|
|
868
868
|
};
|
|
869
|
-
var decreaseBuildNum = async (appRoot, props) => {
|
|
870
|
-
const appConfig = await getAppConfig(appRoot, props);
|
|
869
|
+
var decreaseBuildNum = async (appRoot, props, tsconfig) => {
|
|
870
|
+
const appConfig = await getAppConfig(appRoot, props, tsconfig);
|
|
871
871
|
const akanConfigPath = import_path.default.join(appRoot, "akan.config.ts");
|
|
872
872
|
const akanConfig = import_fs3.default.readFileSync(akanConfigPath, "utf8");
|
|
873
873
|
const akanConfigContent = akanConfig.replace(
|
|
@@ -1097,6 +1097,7 @@ var import_path3 = __toESM(require("path"));
|
|
|
1097
1097
|
|
|
1098
1098
|
// pkgs/@akanjs/devkit/src/dependencyScanner.ts
|
|
1099
1099
|
var fs6 = __toESM(require("fs"));
|
|
1100
|
+
var import_ignore = __toESM(require("ignore"));
|
|
1100
1101
|
var path4 = __toESM(require("path"));
|
|
1101
1102
|
var ts2 = __toESM(require("typescript"));
|
|
1102
1103
|
var TypeScriptDependencyScanner = class {
|
|
@@ -1105,10 +1106,19 @@ var TypeScriptDependencyScanner = class {
|
|
|
1105
1106
|
directory;
|
|
1106
1107
|
tsconfig;
|
|
1107
1108
|
rootPackageJson;
|
|
1108
|
-
|
|
1109
|
+
ig;
|
|
1110
|
+
workspaceRoot;
|
|
1111
|
+
constructor(directory, {
|
|
1112
|
+
workspaceRoot,
|
|
1113
|
+
tsconfig,
|
|
1114
|
+
rootPackageJson,
|
|
1115
|
+
gitignorePatterns = []
|
|
1116
|
+
}) {
|
|
1109
1117
|
this.directory = directory;
|
|
1110
1118
|
this.tsconfig = tsconfig;
|
|
1111
1119
|
this.rootPackageJson = rootPackageJson;
|
|
1120
|
+
this.ig = (0, import_ignore.default)().add(gitignorePatterns);
|
|
1121
|
+
this.workspaceRoot = workspaceRoot;
|
|
1112
1122
|
}
|
|
1113
1123
|
async getMonorepoDependencies(projectName) {
|
|
1114
1124
|
const npmSet = new Set(
|
|
@@ -1170,6 +1180,9 @@ var TypeScriptDependencyScanner = class {
|
|
|
1170
1180
|
const entries = await fs6.promises.readdir(dir, { withFileTypes: true });
|
|
1171
1181
|
for (const entry of entries) {
|
|
1172
1182
|
const fullPath = path4.join(dir, entry.name);
|
|
1183
|
+
const relativePath = path4.relative(this.workspaceRoot, fullPath);
|
|
1184
|
+
if (this.ig.ignores(relativePath))
|
|
1185
|
+
continue;
|
|
1173
1186
|
if (entry.isDirectory()) {
|
|
1174
1187
|
if (!["node_modules", "dist", "build", ".git", ".next", "public", "ios", "android"].includes(entry.name))
|
|
1175
1188
|
await processDirectory(fullPath);
|
|
@@ -1298,7 +1311,13 @@ var ScanInfo = class {
|
|
|
1298
1311
|
const akanConfig = await exec2.getConfig();
|
|
1299
1312
|
const tsconfig = exec2.getTsConfig();
|
|
1300
1313
|
const rootPackageJson = exec2.workspace.getPackageJson();
|
|
1301
|
-
const
|
|
1314
|
+
const gitignorePatterns = exec2.workspace.getGitignorePatterns();
|
|
1315
|
+
const scanner = new TypeScriptDependencyScanner(exec2.cwdPath, {
|
|
1316
|
+
workspaceRoot: exec2.workspace.cwdPath,
|
|
1317
|
+
tsconfig,
|
|
1318
|
+
rootPackageJson,
|
|
1319
|
+
gitignorePatterns
|
|
1320
|
+
});
|
|
1302
1321
|
const { pkgDeps, libDeps, npmDeps } = await scanner.getMonorepoDependencies(exec2.name);
|
|
1303
1322
|
const files = {
|
|
1304
1323
|
constant: { databases: [], scalars: [] },
|
|
@@ -1402,15 +1421,6 @@ var ScanInfo = class {
|
|
|
1402
1421
|
});
|
|
1403
1422
|
})
|
|
1404
1423
|
]);
|
|
1405
|
-
const missingLibDeps = [];
|
|
1406
|
-
libDeps.forEach((libName) => {
|
|
1407
|
-
if (!akanConfig.libs.includes(libName))
|
|
1408
|
-
missingLibDeps.push(libName);
|
|
1409
|
-
});
|
|
1410
|
-
if (missingLibDeps.length)
|
|
1411
|
-
throw new Error(
|
|
1412
|
-
`Missing libs: ${missingLibDeps.join(", ")}, add these dependencies in akan.config.ts as { libs: [...other deps, ${missingLibDeps.join(", ")}] }`
|
|
1413
|
-
);
|
|
1414
1424
|
const scanResult = {
|
|
1415
1425
|
name: exec2.name,
|
|
1416
1426
|
type: exec2.type,
|
|
@@ -1500,7 +1510,7 @@ var AppInfo = class _AppInfo extends ScanInfo {
|
|
|
1500
1510
|
if (this.#sortedLibs)
|
|
1501
1511
|
return this.#sortedLibs;
|
|
1502
1512
|
const libIndices = LibInfo.getSortedLibIndices();
|
|
1503
|
-
this.#sortedLibs = this.
|
|
1513
|
+
this.#sortedLibs = this.getScanResult().libDeps.sort((libNameA, libNameB) => {
|
|
1504
1514
|
const indexA = libIndices.get(libNameA);
|
|
1505
1515
|
const indexB = libIndices.get(libNameB);
|
|
1506
1516
|
if (indexA === void 0 || indexB === void 0)
|
|
@@ -1540,7 +1550,7 @@ var LibInfo = class _LibInfo extends ScanInfo {
|
|
|
1540
1550
|
if (this.#sortedLibIndices)
|
|
1541
1551
|
return this.#sortedLibIndices;
|
|
1542
1552
|
this.#sortedLibIndices = new Map(
|
|
1543
|
-
[...this.libInfos.entries()].sort(([_, libInfoA], [__, libInfoB]) => libInfoA.
|
|
1553
|
+
[...this.libInfos.entries()].sort(([_, libInfoA], [__, libInfoB]) => libInfoA.getScanResult().libDeps.includes(libInfoB.name) ? 1 : -1).map(([libName], index) => [libName, index])
|
|
1544
1554
|
);
|
|
1545
1555
|
return this.#sortedLibIndices;
|
|
1546
1556
|
}
|
|
@@ -1574,7 +1584,7 @@ var LibInfo = class _LibInfo extends ScanInfo {
|
|
|
1574
1584
|
if (this.#sortedLibs)
|
|
1575
1585
|
return this.#sortedLibs;
|
|
1576
1586
|
const libs = _LibInfo.getSortedLibIndices();
|
|
1577
|
-
this.#sortedLibs = this.
|
|
1587
|
+
this.#sortedLibs = this.scanResult.libDeps.sort((libNameA, libNameB) => {
|
|
1578
1588
|
const indexA = libs.get(libNameA);
|
|
1579
1589
|
const indexB = libs.get(libNameB);
|
|
1580
1590
|
if (indexA === void 0 || indexB === void 0)
|
|
@@ -1587,7 +1597,7 @@ var LibInfo = class _LibInfo extends ScanInfo {
|
|
|
1587
1597
|
return this.#getSortedLibs();
|
|
1588
1598
|
}
|
|
1589
1599
|
getLibInfo(libName) {
|
|
1590
|
-
if (!this.getScanResult().
|
|
1600
|
+
if (!this.getScanResult().libDeps.includes(libName))
|
|
1591
1601
|
return void 0;
|
|
1592
1602
|
const libSet = new Set(this.#getSortedLibs());
|
|
1593
1603
|
if (!libSet.has(libName))
|
|
@@ -1612,7 +1622,13 @@ var PkgInfo = class _PkgInfo {
|
|
|
1612
1622
|
static async getScanResult(exec2) {
|
|
1613
1623
|
const tsconfig = exec2.getTsConfig();
|
|
1614
1624
|
const rootPackageJson = exec2.workspace.getPackageJson();
|
|
1615
|
-
const
|
|
1625
|
+
const gitignorePatterns = exec2.workspace.getGitignorePatterns();
|
|
1626
|
+
const scanner = new TypeScriptDependencyScanner(exec2.cwdPath, {
|
|
1627
|
+
workspaceRoot: exec2.workspace.cwdPath,
|
|
1628
|
+
tsconfig,
|
|
1629
|
+
rootPackageJson,
|
|
1630
|
+
gitignorePatterns
|
|
1631
|
+
});
|
|
1616
1632
|
const npmSet = new Set(Object.keys({ ...rootPackageJson.dependencies, ...rootPackageJson.devDependencies }));
|
|
1617
1633
|
const pkgPathSet = new Set(
|
|
1618
1634
|
Object.keys(tsconfig.compilerOptions.paths ?? {}).filter((path10) => tsconfig.compilerOptions.paths?.[path10]?.some((resolve) => resolve.startsWith("pkgs/"))).map((path10) => path10.replace("/*", ""))
|
|
@@ -2137,6 +2153,14 @@ var Executor = class _Executor {
|
|
|
2137
2153
|
this.writeJson("package.json", packageJson);
|
|
2138
2154
|
this.#packageJson = packageJson;
|
|
2139
2155
|
}
|
|
2156
|
+
#gitignorePatterns = [];
|
|
2157
|
+
getGitignorePatterns() {
|
|
2158
|
+
if (this.#gitignorePatterns.length)
|
|
2159
|
+
return this.#gitignorePatterns;
|
|
2160
|
+
const gitignore = this.readFile(".gitignore");
|
|
2161
|
+
this.#gitignorePatterns = gitignore.split("\n").map((line) => line.trim()).filter((line) => !!line && !line.startsWith("#"));
|
|
2162
|
+
return this.#gitignorePatterns;
|
|
2163
|
+
}
|
|
2140
2164
|
async #applyTemplateFile({
|
|
2141
2165
|
templatePath,
|
|
2142
2166
|
targetPath,
|
|
@@ -2432,7 +2456,12 @@ var SysExecutor = class extends Executor {
|
|
|
2432
2456
|
async getConfig({ refresh } = {}) {
|
|
2433
2457
|
if (this.#akanConfig && !refresh)
|
|
2434
2458
|
return this.#akanConfig;
|
|
2435
|
-
|
|
2459
|
+
const tsconfig = this.getTsConfig();
|
|
2460
|
+
this.#akanConfig = this.type === "app" ? await getAppConfig(
|
|
2461
|
+
this.cwdPath,
|
|
2462
|
+
{ ...this.workspace.getBaseDevEnv(), type: "app", name: this.name },
|
|
2463
|
+
tsconfig
|
|
2464
|
+
) : await getLibConfig(this.cwdPath, { ...this.workspace.getBaseDevEnv(), type: "lib", name: this.name });
|
|
2436
2465
|
return this.#akanConfig;
|
|
2437
2466
|
}
|
|
2438
2467
|
async getModules() {
|
|
@@ -2586,11 +2615,11 @@ var SysExecutor = class extends Executor {
|
|
|
2586
2615
|
return modules.map((module2) => this.getLocalFile(`lib/${module2}/${module2}.constant.ts`));
|
|
2587
2616
|
}
|
|
2588
2617
|
async getConstantFilesWithLibs() {
|
|
2589
|
-
const
|
|
2618
|
+
const scanInfo = this.type === "app" ? await AppInfo.fromExecutor(this) : await LibInfo.fromExecutor(this);
|
|
2590
2619
|
const sysContantFiles = await this.getConstantFiles();
|
|
2591
2620
|
const sysScalarConstantFiles = await this.getScalarConstantFiles();
|
|
2592
2621
|
const libConstantFiles = await Promise.all(
|
|
2593
|
-
|
|
2622
|
+
scanInfo.getLibs().map(async (lib) => [
|
|
2594
2623
|
...await LibExecutor.from(this, lib).getConstantFiles(),
|
|
2595
2624
|
...await LibExecutor.from(this, lib).getScalarConstantFiles()
|
|
2596
2625
|
])
|
|
@@ -2643,11 +2672,11 @@ var AppExecutor = class _AppExecutor extends SysExecutor {
|
|
|
2643
2672
|
async getConfig({ refresh } = {}) {
|
|
2644
2673
|
if (this.#akanConfig && !refresh)
|
|
2645
2674
|
return this.#akanConfig;
|
|
2646
|
-
this.#akanConfig = await getAppConfig(
|
|
2647
|
-
|
|
2648
|
-
type: "app",
|
|
2649
|
-
|
|
2650
|
-
|
|
2675
|
+
this.#akanConfig = await getAppConfig(
|
|
2676
|
+
this.cwdPath,
|
|
2677
|
+
{ ...this.workspace.getBaseDevEnv(), type: "app", name: this.name },
|
|
2678
|
+
this.getTsConfig()
|
|
2679
|
+
);
|
|
2651
2680
|
return this.#akanConfig;
|
|
2652
2681
|
}
|
|
2653
2682
|
async syncAssets(libDeps) {
|
|
@@ -2670,10 +2699,18 @@ var AppExecutor = class _AppExecutor extends SysExecutor {
|
|
|
2670
2699
|
]);
|
|
2671
2700
|
}
|
|
2672
2701
|
async increaseBuildNum() {
|
|
2673
|
-
await increaseBuildNum(
|
|
2702
|
+
await increaseBuildNum(
|
|
2703
|
+
this.cwdPath,
|
|
2704
|
+
{ ...this.workspace.getBaseDevEnv(), type: "app", name: this.name },
|
|
2705
|
+
this.getTsConfig()
|
|
2706
|
+
);
|
|
2674
2707
|
}
|
|
2675
2708
|
async decreaseBuildNum() {
|
|
2676
|
-
await decreaseBuildNum(
|
|
2709
|
+
await decreaseBuildNum(
|
|
2710
|
+
this.cwdPath,
|
|
2711
|
+
{ ...this.workspace.getBaseDevEnv(), type: "app", name: this.name },
|
|
2712
|
+
this.getTsConfig()
|
|
2713
|
+
);
|
|
2677
2714
|
}
|
|
2678
2715
|
};
|
|
2679
2716
|
var LibExecutor = class _LibExecutor extends SysExecutor {
|
|
@@ -4476,7 +4513,7 @@ var ApplicationRunner = class {
|
|
|
4476
4513
|
}
|
|
4477
4514
|
async scanSync(app, { refresh = false } = {}) {
|
|
4478
4515
|
const scanInfo = await app.scan({ refresh });
|
|
4479
|
-
await app.syncAssets(scanInfo.getScanResult().
|
|
4516
|
+
await app.syncAssets(scanInfo.getScanResult().libDeps);
|
|
4480
4517
|
return scanInfo;
|
|
4481
4518
|
}
|
|
4482
4519
|
async getScriptFilename(app) {
|
|
@@ -6688,7 +6725,7 @@ var import_latest_version2 = __toESM(require("latest-version"), 1);
|
|
|
6688
6725
|
var import_path6 = __toESM(require("path"), 1);
|
|
6689
6726
|
var import_uuid2 = require("uuid");
|
|
6690
6727
|
var WorkspaceRunner = class {
|
|
6691
|
-
async createWorkspace(repoName, appName, dirname3 = ".") {
|
|
6728
|
+
async createWorkspace(repoName, appName, { dirname: dirname3 = ".", tag = "latest" }) {
|
|
6692
6729
|
const cwdPath = process.cwd();
|
|
6693
6730
|
const workspaceRoot = import_path6.default.join(cwdPath, dirname3, repoName);
|
|
6694
6731
|
const workspace = WorkspaceExecutor.fromRoot({ workspaceRoot, repoName });
|
|
@@ -6718,7 +6755,7 @@ var WorkspaceRunner = class {
|
|
|
6718
6755
|
"@akanjs/ui"
|
|
6719
6756
|
];
|
|
6720
6757
|
const devDependencies = ["@akanjs/devkit", "@akanjs/lint", "@akanjs/test"];
|
|
6721
|
-
const latestPublishedVersionOfBase = await (0, import_latest_version2.default)("@akanjs/base");
|
|
6758
|
+
const latestPublishedVersionOfBase = await (0, import_latest_version2.default)("@akanjs/base", { version: tag });
|
|
6722
6759
|
const packageJson = {
|
|
6723
6760
|
...rootPackageJson,
|
|
6724
6761
|
dependencies: {
|
|
@@ -6787,8 +6824,8 @@ var WorkspaceScript = class {
|
|
|
6787
6824
|
#runner = new WorkspaceRunner();
|
|
6788
6825
|
applicationScript = new ApplicationScript();
|
|
6789
6826
|
libraryScript = new LibraryScript();
|
|
6790
|
-
async createWorkspace(repoName, appName, dirname3 = ".", installLibs) {
|
|
6791
|
-
const workspace = await this.#runner.createWorkspace(repoName, appName, dirname3);
|
|
6827
|
+
async createWorkspace(repoName, appName, { dirname: dirname3 = ".", installLibs = false, tag = "latest" }) {
|
|
6828
|
+
const workspace = await this.#runner.createWorkspace(repoName, appName, { dirname: dirname3, tag });
|
|
6792
6829
|
if (installLibs) {
|
|
6793
6830
|
await this.libraryScript.installLibrary(workspace, "util");
|
|
6794
6831
|
await this.libraryScript.installLibrary(workspace, "shared");
|
|
@@ -6853,12 +6890,11 @@ var WorkspaceScript = class {
|
|
|
6853
6890
|
// pkgs/@akanjs/cli/src/workspace/workspace.command.ts
|
|
6854
6891
|
var WorkspaceCommand = class {
|
|
6855
6892
|
workspaceScript = new WorkspaceScript();
|
|
6856
|
-
async createWorkspace(workspaceName, app, dir, libs) {
|
|
6893
|
+
async createWorkspace(workspaceName, app, dir, libs, tag) {
|
|
6857
6894
|
await this.workspaceScript.createWorkspace(
|
|
6858
6895
|
workspaceName.toLowerCase().replace(/ /g, "-"),
|
|
6859
6896
|
app.toLowerCase().replace(/ /g, "-"),
|
|
6860
|
-
dir,
|
|
6861
|
-
libs
|
|
6897
|
+
{ dirname: dir, installLibs: libs, tag }
|
|
6862
6898
|
);
|
|
6863
6899
|
}
|
|
6864
6900
|
async generateMongo(workspace) {
|
|
@@ -6895,6 +6931,11 @@ __decorateClass([
|
|
|
6895
6931
|
value: true
|
|
6896
6932
|
}
|
|
6897
6933
|
]
|
|
6934
|
+
})),
|
|
6935
|
+
__decorateParam(4, Option("tag", {
|
|
6936
|
+
desc: "tag of the update",
|
|
6937
|
+
default: "latest",
|
|
6938
|
+
enum: ["latest", "dev", "canary", "beta", "rc", "alpha"]
|
|
6898
6939
|
}))
|
|
6899
6940
|
], WorkspaceCommand.prototype, "createWorkspace", 1);
|
|
6900
6941
|
__decorateClass([
|
|
@@ -7310,7 +7351,7 @@ var ScalarPrompt = class extends Prompter {
|
|
|
7310
7351
|
boilerplate,
|
|
7311
7352
|
constantFiles
|
|
7312
7353
|
}) {
|
|
7313
|
-
const
|
|
7354
|
+
const scanInfo = await this.sys.scan();
|
|
7314
7355
|
const guideJson = await Prompter.getGuideJson("scalarConstant");
|
|
7315
7356
|
const request = await this.makeTsFileUpdatePrompt({
|
|
7316
7357
|
context: `
|
|
@@ -7323,7 +7364,7 @@ ${await this.getDocumentation("enumConstant")}
|
|
|
7323
7364
|
3. How to write Fields in __scalar/<model>/<model>.constant.ts file
|
|
7324
7365
|
${await this.getDocumentation("fieldDecorator")}
|
|
7325
7366
|
|
|
7326
|
-
4. List of constant.ts files in other libraries connected to current ${this.sys.name} ${this.sys.type === "app" ? "Application" : "Library"} ${
|
|
7367
|
+
4. List of constant.ts files in other libraries connected to current ${this.sys.name} ${this.sys.type === "app" ? "Application" : "Library"} ${scanInfo.getLibs().map((lib) => lib).join(", ")}
|
|
7327
7368
|
Please understand the content and file patterns below, and feel free to reuse any constants or enums if available.
|
|
7328
7369
|
${constantFiles.map(
|
|
7329
7370
|
(constant) => `
|
|
@@ -7401,6 +7442,14 @@ ${boilerplate}
|
|
|
7401
7442
|
|
|
7402
7443
|
// pkgs/@akanjs/cli/src/scalar/scalar.runner.ts
|
|
7403
7444
|
var ScalarRunner = class {
|
|
7445
|
+
async applyScalarTemplate(sys3, scalarName) {
|
|
7446
|
+
await sys3.applyTemplate({
|
|
7447
|
+
basePath: "./lib/__scalar",
|
|
7448
|
+
template: "__scalar",
|
|
7449
|
+
dict: { model: scalarName, models: (0, import_pluralize3.default)(scalarName), sysName: sys3.name },
|
|
7450
|
+
overwrite: false
|
|
7451
|
+
});
|
|
7452
|
+
}
|
|
7404
7453
|
async createScalarConstant(sys3, scalarName) {
|
|
7405
7454
|
const isContinued = sys3.exists(`lib/__scalar/${scalarName}/${scalarName}.constant.ts`);
|
|
7406
7455
|
const prompt = new ScalarPrompt(sys3, scalarName);
|
|
@@ -7409,12 +7458,7 @@ var ScalarRunner = class {
|
|
|
7409
7458
|
const writes = await session.writeTypescripts(request, sys3, { validate });
|
|
7410
7459
|
const scalarNames = writes.map(({ filePath }) => filePath.split("/").at(-2)).filter((name) => !!name);
|
|
7411
7460
|
for (const name of scalarNames)
|
|
7412
|
-
await
|
|
7413
|
-
basePath: "./lib/__scalar",
|
|
7414
|
-
template: "__scalar",
|
|
7415
|
-
dict: { model: name, models: (0, import_pluralize3.default)(name), sysName: sys3.name },
|
|
7416
|
-
overwrite: false
|
|
7417
|
-
});
|
|
7461
|
+
await this.applyScalarTemplate(sys3, name);
|
|
7418
7462
|
return { session, scalarNames, writes, prompt };
|
|
7419
7463
|
}
|
|
7420
7464
|
async updateScalarDictionaries(sys3, scalarNames, { session }) {
|
|
@@ -7434,6 +7478,9 @@ var ScalarRunner = class {
|
|
|
7434
7478
|
var ScalarScript = class {
|
|
7435
7479
|
#runner = new ScalarRunner();
|
|
7436
7480
|
async createScalar(sys3, scalarName) {
|
|
7481
|
+
await this.#runner.applyScalarTemplate(sys3, scalarName);
|
|
7482
|
+
}
|
|
7483
|
+
async createScalarWithAi(sys3, scalarName) {
|
|
7437
7484
|
const { session, scalarNames } = await this.#runner.createScalarConstant(sys3, scalarName);
|
|
7438
7485
|
await this.#runner.updateScalarDictionaries(sys3, scalarNames, { session });
|
|
7439
7486
|
}
|
|
@@ -7445,22 +7492,22 @@ var ScalarScript = class {
|
|
|
7445
7492
|
// pkgs/@akanjs/cli/src/scalar/scalar.command.ts
|
|
7446
7493
|
var ScalarCommand = class {
|
|
7447
7494
|
scalarScript = new ScalarScript();
|
|
7448
|
-
async createScalar(
|
|
7495
|
+
async createScalar(scalarName, sys3) {
|
|
7449
7496
|
await this.scalarScript.createScalar(sys3, lowerlize(scalarName.replace(/ /g, "")));
|
|
7450
7497
|
}
|
|
7451
|
-
async removeScalar(
|
|
7498
|
+
async removeScalar(scalarName, sys3) {
|
|
7452
7499
|
await this.scalarScript.removeScalar(sys3, scalarName);
|
|
7453
7500
|
}
|
|
7454
7501
|
};
|
|
7455
7502
|
__decorateClass([
|
|
7456
7503
|
Target.Public(),
|
|
7457
|
-
__decorateParam(0,
|
|
7458
|
-
__decorateParam(1,
|
|
7504
|
+
__decorateParam(0, Argument("scalarName", { desc: "name of scalar scalar" })),
|
|
7505
|
+
__decorateParam(1, Sys())
|
|
7459
7506
|
], ScalarCommand.prototype, "createScalar", 1);
|
|
7460
7507
|
__decorateClass([
|
|
7461
7508
|
Target.Public(),
|
|
7462
|
-
__decorateParam(0,
|
|
7463
|
-
__decorateParam(1,
|
|
7509
|
+
__decorateParam(0, Argument("scalarName", { desc: "name of scalar scalar" })),
|
|
7510
|
+
__decorateParam(1, Sys())
|
|
7464
7511
|
], ScalarCommand.prototype, "removeScalar", 1);
|
|
7465
7512
|
ScalarCommand = __decorateClass([
|
|
7466
7513
|
Commands()
|
|
@@ -24,21 +24,14 @@ __export(model_dictionary_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(model_dictionary_exports);
|
|
25
25
|
function getContent(scanInfo, dict) {
|
|
26
26
|
return `
|
|
27
|
-
import {
|
|
27
|
+
import { scalarDictionary } from "@akanjs/dictionary";
|
|
28
28
|
|
|
29
29
|
import type { ${dict.Model} } from "./${dict.model}.constant";
|
|
30
30
|
|
|
31
|
-
export const dictionary =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
field: ["Field", "\uD544\uB4DC"],
|
|
37
|
-
"desc-field": ["Field", "\uD544\uB4DC"],
|
|
38
|
-
// * ==================== Model ==================== * //
|
|
39
|
-
|
|
40
|
-
// * ==================== Etc ==================== * //
|
|
41
|
-
// * ==================== Etc ==================== * //
|
|
42
|
-
} satisfies ModelDictionary<${dict.Model}>;
|
|
31
|
+
export const dictionary = scalarDictionary(["en", "ko"])
|
|
32
|
+
.of((t) => t(["${dict.Model}", "${dict.Model}"]).desc(["${dict.Model} description", "${dict.Model} \uC124\uBA85"]))
|
|
33
|
+
.model<${dict.Model}>((t) => ({
|
|
34
|
+
field: t(["Field", "\uD544\uB4DC"]).desc(["Field Description", "\uD544\uB4DC \uC124\uBA85"]),
|
|
35
|
+
}));
|
|
43
36
|
`;
|
|
44
37
|
}
|
|
@@ -22,13 +22,11 @@ __export(akan_config_exports, {
|
|
|
22
22
|
default: () => getContent
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(akan_config_exports);
|
|
25
|
-
function getContent(scanInfo, dict
|
|
25
|
+
function getContent(scanInfo, dict) {
|
|
26
26
|
return `
|
|
27
27
|
import type { AppConfig } from "@akanjs/config";
|
|
28
28
|
|
|
29
|
-
const config: AppConfig =
|
|
30
|
-
libs: ["util", "shared"],
|
|
31
|
-
}` : "{}"};
|
|
29
|
+
const config: AppConfig = {};
|
|
32
30
|
|
|
33
31
|
export default config;
|
|
34
32
|
`;
|
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// pkgs/@akanjs/cli/src/templates/env/
|
|
19
|
+
// pkgs/@akanjs/cli/src/templates/env/_env.server.type.ts
|
|
20
20
|
var env_server_type_exports = {};
|
|
21
21
|
__export(env_server_type_exports, {
|
|
22
22
|
default: () => getContent
|
|
@@ -26,11 +26,14 @@ function getContent(scanInfo, dict = {}) {
|
|
|
26
26
|
if (!scanInfo)
|
|
27
27
|
return null;
|
|
28
28
|
const libs = scanInfo.getLibs();
|
|
29
|
-
return
|
|
29
|
+
return {
|
|
30
|
+
filename: "env.server.type.ts",
|
|
31
|
+
content: `
|
|
30
32
|
${libs.length ? libs.map((lib) => `import { env as ${lib}Option } from "@${lib}/server";`).join("\n") : 'import { baseEnv } from "@akanjs/base";'}
|
|
31
33
|
|
|
32
34
|
export const libEnv = {
|
|
33
35
|
${libs.length ? libs.map((lib) => ` ...${lib}Option,`).join("\n") : " ...baseEnv,"}
|
|
34
36
|
};
|
|
35
|
-
|
|
37
|
+
`
|
|
38
|
+
};
|
|
36
39
|
}
|
|
@@ -27,7 +27,7 @@ function getContent(scanInfo, dict = {}) {
|
|
|
27
27
|
if (!scanInfo)
|
|
28
28
|
return null;
|
|
29
29
|
const scanResult = scanInfo.getScanResult();
|
|
30
|
-
const libs = scanResult.
|
|
30
|
+
const libs = scanResult.libDeps;
|
|
31
31
|
const libInfos = scanInfo.getLibInfos();
|
|
32
32
|
const extendedModels = Object.fromEntries(
|
|
33
33
|
[...scanInfo.file.constant.databases].map(
|
|
@@ -26,7 +26,7 @@ function getContent(scanInfo, dict = {}) {
|
|
|
26
26
|
if (!scanInfo)
|
|
27
27
|
return null;
|
|
28
28
|
const scanResult = scanInfo.getScanResult();
|
|
29
|
-
const libs =
|
|
29
|
+
const libs = scanResult.libDeps;
|
|
30
30
|
const libInfos = scanInfo.getLibInfos();
|
|
31
31
|
const extendedModels = Object.fromEntries(
|
|
32
32
|
[...scanInfo.file.dictionary.databases].map(
|
|
@@ -27,7 +27,6 @@ function getContent(scanInfo, dict) {
|
|
|
27
27
|
import { modelDictionary } from "@akanjs/dictionary";
|
|
28
28
|
|
|
29
29
|
import type { ${dict.Model}, ${dict.Model}Insight } from "./${dict.model}.constant";
|
|
30
|
-
import type { ${dict.Model}Filter } from "./${dict.model}.document";
|
|
31
30
|
import type { ${dict.Model}Endpoint, ${dict.Model}Slice } from "./${dict.model}.signal";
|
|
32
31
|
|
|
33
32
|
export const dictionary = modelDictionary(["en", "ko"])
|