@akanjs/cli 0.0.43 → 0.0.44
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/index.js +97 -92
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -47,26 +47,31 @@
|
|
|
47
47
|
var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
|
|
48
48
|
|
|
49
49
|
// pkgs/@akanjs/devkit/src/baseDevEnv.ts
|
|
50
|
-
var
|
|
50
|
+
var getBaseDevEnv, getSshTunnelOptions;
|
|
51
51
|
var init_baseDevEnv = __esm({
|
|
52
52
|
"pkgs/@akanjs/devkit/src/baseDevEnv.ts"() {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
53
|
+
getBaseDevEnv = () => {
|
|
54
|
+
const appName = process.env.NEXT_PUBLIC_APP_NAME;
|
|
55
|
+
const repoName = process.env.NEXT_PUBLIC_REPO_NAME;
|
|
56
|
+
if (!repoName)
|
|
57
|
+
throw new Error("NEXT_PUBLIC_REPO_NAME is not set");
|
|
58
|
+
const serveDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN;
|
|
59
|
+
if (!serveDomain)
|
|
60
|
+
throw new Error("NEXT_PUBLIC_SERVE_DOMAIN is not set");
|
|
61
|
+
const env = process.env.NEXT_PUBLIC_ENV ?? "debug";
|
|
62
|
+
if (!env)
|
|
63
|
+
throw new Error("NEXT_PUBLIC_ENV is not set");
|
|
64
|
+
return { ...appName ? { appName } : {}, repoName, serveDomain, env };
|
|
65
|
+
};
|
|
66
|
+
getSshTunnelOptions = (appName, environment) => {
|
|
67
|
+
const { serveDomain, repoName } = getBaseDevEnv();
|
|
68
|
+
return {
|
|
69
|
+
host: `${appName}-${environment}.${serveDomain}`,
|
|
70
|
+
port: process.env.SSU_TUNNEL_PORT ? parseInt(process.env.SSU_TUNNEL_PORT) : 32767,
|
|
71
|
+
username: process.env.SSU_TUNNEL_USERNAME ?? "root",
|
|
72
|
+
password: process.env.SSU_TUNNEL_PASSWORD ?? repoName
|
|
73
|
+
};
|
|
74
|
+
};
|
|
70
75
|
}
|
|
71
76
|
});
|
|
72
77
|
|
|
@@ -76,14 +81,14 @@
|
|
|
76
81
|
"pkgs/@akanjs/devkit/src/createTunnel.ts"() {
|
|
77
82
|
import_tunnel_ssh = __require("tunnel-ssh");
|
|
78
83
|
init_baseDevEnv();
|
|
79
|
-
createTunnel = async ({ appName
|
|
84
|
+
createTunnel = async ({ appName, environment, port = 27017 }) => {
|
|
80
85
|
const tunnelOptions = { autoClose: true, reconnectOnError: true };
|
|
81
|
-
const sshOptions = getSshTunnelOptions(
|
|
86
|
+
const sshOptions = getSshTunnelOptions(appName, environment);
|
|
82
87
|
const serverOptions = { port };
|
|
83
88
|
const forwardOptions = {
|
|
84
89
|
srcAddr: "0.0.0.0",
|
|
85
90
|
srcPort: port,
|
|
86
|
-
dstAddr: `mongo-0.mongo-svc.${
|
|
91
|
+
dstAddr: `mongo-0.mongo-svc.${appName}-${environment}`,
|
|
87
92
|
dstPort: 27017
|
|
88
93
|
};
|
|
89
94
|
const [server, client] = await (0, import_tunnel_ssh.createTunnel)(tunnelOptions, serverOptions, sshOptions, forwardOptions);
|
|
@@ -677,19 +682,19 @@
|
|
|
677
682
|
var getBaseConfigEnv;
|
|
678
683
|
var init_baseConfigEnv = __esm({
|
|
679
684
|
"pkgs/@akanjs/config/src/baseConfigEnv.ts"() {
|
|
680
|
-
getBaseConfigEnv = (
|
|
681
|
-
if (!
|
|
685
|
+
getBaseConfigEnv = (appName = process.env.NEXT_PUBLIC_APP_NAME) => {
|
|
686
|
+
if (!appName)
|
|
682
687
|
throw new Error("NEXT_PUBLIC_APP_NAME is not set");
|
|
683
|
-
const
|
|
684
|
-
if (!
|
|
688
|
+
const repoName = process.env.NEXT_PUBLIC_REPO_NAME;
|
|
689
|
+
if (!repoName)
|
|
685
690
|
throw new Error("NEXT_PUBLIC_REPO_NAME is not set");
|
|
686
|
-
const
|
|
687
|
-
if (!
|
|
691
|
+
const serveDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN;
|
|
692
|
+
if (!serveDomain)
|
|
688
693
|
throw new Error("NEXT_PUBLIC_SERVE_DOMAIN is not set");
|
|
689
|
-
const
|
|
690
|
-
if (!
|
|
694
|
+
const env = process.env.NEXT_PUBLIC_ENV ?? "debug";
|
|
695
|
+
if (!env)
|
|
691
696
|
throw new Error("NEXT_PUBLIC_ENV is not set");
|
|
692
|
-
return { appName
|
|
697
|
+
return { appName, repoName, serveDomain, env };
|
|
693
698
|
};
|
|
694
699
|
}
|
|
695
700
|
});
|
|
@@ -728,7 +733,7 @@
|
|
|
728
733
|
disable: commandType === "serve"
|
|
729
734
|
});
|
|
730
735
|
devDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN ?? "akanjs.com";
|
|
731
|
-
withBase = (
|
|
736
|
+
withBase = (appName, config, libs, routes = []) => {
|
|
732
737
|
return composePlugins(
|
|
733
738
|
(0, import_bundle_analyzer.default)({ enabled: process.env.ANALYZE === "true" }),
|
|
734
739
|
...commandType !== "serve" || process.env.USE_PWA === "true" ? [withPWA] : []
|
|
@@ -762,7 +767,7 @@
|
|
|
762
767
|
experimental: {
|
|
763
768
|
...config.experimental ?? {},
|
|
764
769
|
optimizePackageImports: [
|
|
765
|
-
...[
|
|
770
|
+
...[appName, ...libs].map((lib) => [`@${lib}/ui`, `@${lib}/next`, `@${lib}/common`, `@${lib}/client`]).flat(),
|
|
766
771
|
"@contract",
|
|
767
772
|
"@akanjs/next",
|
|
768
773
|
"@akanjs/common"
|
|
@@ -873,10 +878,10 @@ export default getNextConfig(config, appInfo);
|
|
|
873
878
|
makeAppConfig = (config, props = {}) => {
|
|
874
879
|
const baseConfigEnv = getBaseConfigEnv(props.appName);
|
|
875
880
|
const {
|
|
876
|
-
appName
|
|
877
|
-
repoName
|
|
878
|
-
serveDomain
|
|
879
|
-
env
|
|
881
|
+
appName = baseConfigEnv.appName,
|
|
882
|
+
repoName = baseConfigEnv.repoName,
|
|
883
|
+
serveDomain = baseConfigEnv.serveDomain,
|
|
884
|
+
env = baseConfigEnv.env,
|
|
880
885
|
command = "build"
|
|
881
886
|
} = props;
|
|
882
887
|
return {
|
|
@@ -898,10 +903,10 @@ RUN npx pnpm i --prod
|
|
|
898
903
|
COPY . .
|
|
899
904
|
ENV PORT 8080
|
|
900
905
|
ENV NODE_OPTIONS=--max_old_space_size=8192
|
|
901
|
-
ENV NEXT_PUBLIC_REPO_NAME=${
|
|
902
|
-
ENV NEXT_PUBLIC_SERVE_DOMAIN=${
|
|
903
|
-
ENV NEXT_PUBLIC_APP_NAME=${
|
|
904
|
-
ENV NEXT_PUBLIC_ENV=${
|
|
906
|
+
ENV NEXT_PUBLIC_REPO_NAME=${repoName}
|
|
907
|
+
ENV NEXT_PUBLIC_SERVE_DOMAIN=${serveDomain}
|
|
908
|
+
ENV NEXT_PUBLIC_APP_NAME=${appName}
|
|
909
|
+
ENV NEXT_PUBLIC_ENV=${env}
|
|
905
910
|
ENV NEXT_PUBLIC_OPERATION_MODE=cloud
|
|
906
911
|
CMD ["node", "main.js"]`,
|
|
907
912
|
explicitDependencies: config.backend?.explicitDependencies ?? []
|
|
@@ -917,14 +922,14 @@ RUN npx pnpm i --prod
|
|
|
917
922
|
COPY . .
|
|
918
923
|
ENV PORT 4200
|
|
919
924
|
ENV NODE_OPTIONS=--max_old_space_size=8192
|
|
920
|
-
ENV NEXT_PUBLIC_REPO_NAME=${
|
|
921
|
-
ENV NEXT_PUBLIC_SERVE_DOMAIN=${
|
|
922
|
-
ENV NEXT_PUBLIC_APP_NAME=${
|
|
923
|
-
ENV NEXT_PUBLIC_ENV=${
|
|
925
|
+
ENV NEXT_PUBLIC_REPO_NAME=${repoName}
|
|
926
|
+
ENV NEXT_PUBLIC_SERVE_DOMAIN=${serveDomain}
|
|
927
|
+
ENV NEXT_PUBLIC_APP_NAME=${appName}
|
|
928
|
+
ENV NEXT_PUBLIC_ENV=${env}
|
|
924
929
|
ENV NEXT_PUBLIC_OPERATION_MODE=cloud
|
|
925
930
|
CMD ["npm", "start"]`,
|
|
926
931
|
nextConfig: withBase(
|
|
927
|
-
|
|
932
|
+
appName,
|
|
928
933
|
config.frontend?.nextConfig ? typeof config.frontend.nextConfig === "function" ? config.frontend.nextConfig() : config.frontend.nextConfig : {},
|
|
929
934
|
config.libs ?? [],
|
|
930
935
|
config.frontend?.routes
|
|
@@ -1345,21 +1350,21 @@ CMD ["npm", "start"]`,
|
|
|
1345
1350
|
WorkspaceExecutor = class _WorkspaceExecutor extends Executor {
|
|
1346
1351
|
workspaceRoot;
|
|
1347
1352
|
repoName;
|
|
1348
|
-
constructor({ workspaceRoot, repoName
|
|
1349
|
-
super(`${
|
|
1353
|
+
constructor({ workspaceRoot, repoName }) {
|
|
1354
|
+
super(`${repoName} Executor`, workspaceRoot);
|
|
1350
1355
|
this.workspaceRoot = workspaceRoot;
|
|
1351
|
-
this.repoName =
|
|
1356
|
+
this.repoName = repoName;
|
|
1352
1357
|
}
|
|
1353
1358
|
static fromRoot() {
|
|
1354
|
-
const
|
|
1355
|
-
return new _WorkspaceExecutor({ workspaceRoot: process.cwd(), repoName
|
|
1359
|
+
const repoName = import_path3.default.basename(process.cwd());
|
|
1360
|
+
return new _WorkspaceExecutor({ workspaceRoot: process.cwd(), repoName });
|
|
1356
1361
|
}
|
|
1357
1362
|
async scan() {
|
|
1358
1363
|
const [appNames, libNames, pkgNames] = await Promise.all([this.getApps(), this.getLibs(), this.getPkgs()]);
|
|
1359
1364
|
const [appScanResults, libScanResults, pkgScanResults] = await Promise.all([
|
|
1360
1365
|
Promise.all(
|
|
1361
|
-
appNames.map(async (
|
|
1362
|
-
const app = AppExecutor.from(this,
|
|
1366
|
+
appNames.map(async (appName) => {
|
|
1367
|
+
const app = AppExecutor.from(this, appName);
|
|
1363
1368
|
const akanConfig = await app.getConfig("scan");
|
|
1364
1369
|
return await app.scan({ akanConfig });
|
|
1365
1370
|
})
|
|
@@ -1433,7 +1438,7 @@ CMD ["npm", "start"]`,
|
|
|
1433
1438
|
this.type = type;
|
|
1434
1439
|
}
|
|
1435
1440
|
async getConfig(command) {
|
|
1436
|
-
return this.type === "app" ? await getAppConfig(this.cwdPath, { ...
|
|
1441
|
+
return this.type === "app" ? await getAppConfig(this.cwdPath, { ...getBaseDevEnv(), appName: this.name, command }) : await getLibConfig(this.cwdPath, { ...getBaseDevEnv(), appName: this.name, command });
|
|
1437
1442
|
}
|
|
1438
1443
|
async scan({
|
|
1439
1444
|
tsconfig = this.getTsConfig(`${this.cwdPath}/tsconfig.json`),
|
|
@@ -1587,7 +1592,7 @@ CMD ["npm", "start"]`,
|
|
|
1587
1592
|
return new _AppExecutor({ workspace: executor.workspace, name });
|
|
1588
1593
|
}
|
|
1589
1594
|
async getConfig(command) {
|
|
1590
|
-
return await getAppConfig(this.cwdPath, { ...
|
|
1595
|
+
return await getAppConfig(this.cwdPath, { ...getBaseDevEnv(), appName: this.name, command });
|
|
1591
1596
|
}
|
|
1592
1597
|
async syncAssets(libDeps) {
|
|
1593
1598
|
const projectPublicLibPath = `${this.cwdPath}/public/libs`;
|
|
@@ -1628,7 +1633,7 @@ CMD ["npm", "start"]`,
|
|
|
1628
1633
|
return new _LibExecutor({ workspace: executor.workspace, name });
|
|
1629
1634
|
}
|
|
1630
1635
|
async getConfig(command) {
|
|
1631
|
-
return await getLibConfig(this.cwdPath, { ...
|
|
1636
|
+
return await getLibConfig(this.cwdPath, { ...getBaseDevEnv(), appName: this.name, command });
|
|
1632
1637
|
}
|
|
1633
1638
|
};
|
|
1634
1639
|
PkgExecutor = class _PkgExecutor extends Executor {
|
|
@@ -1671,10 +1676,10 @@ CMD ["npm", "start"]`,
|
|
|
1671
1676
|
workspaceRoot;
|
|
1672
1677
|
repoName;
|
|
1673
1678
|
name;
|
|
1674
|
-
constructor({ workspaceRoot, repoName
|
|
1679
|
+
constructor({ workspaceRoot, repoName, name }) {
|
|
1675
1680
|
super(`${name} Dist Pkg Executor`, `${workspaceRoot}/dist/pkgs/${name}`);
|
|
1676
1681
|
this.workspaceRoot = workspaceRoot;
|
|
1677
|
-
this.repoName =
|
|
1682
|
+
this.repoName = repoName;
|
|
1678
1683
|
this.name = name;
|
|
1679
1684
|
}
|
|
1680
1685
|
static from(workspaceExecutor, name) {
|
|
@@ -2132,8 +2137,8 @@ CMD ["npm", "start"]`,
|
|
|
2132
2137
|
if (value)
|
|
2133
2138
|
return AppExecutor.from(workspace, value);
|
|
2134
2139
|
const apps = await workspace.getApps();
|
|
2135
|
-
const
|
|
2136
|
-
return AppExecutor.from(workspace,
|
|
2140
|
+
const appName = await (0, import_prompts3.select)({ message: `Select the ${sysType} name`, choices: apps });
|
|
2141
|
+
return AppExecutor.from(workspace, appName);
|
|
2137
2142
|
} else if (sysType === "lib") {
|
|
2138
2143
|
if (value)
|
|
2139
2144
|
return LibExecutor.from(workspace, value);
|
|
@@ -3422,20 +3427,20 @@ page.tsx_end
|
|
|
3422
3427
|
init_application_prompt();
|
|
3423
3428
|
ApplicationRunner = class {
|
|
3424
3429
|
async scanSync(app) {
|
|
3425
|
-
const akanConfig = await getAppConfig(app.cwdPath, { ...
|
|
3430
|
+
const akanConfig = await getAppConfig(app.cwdPath, { ...getBaseDevEnv(), appName: app.name, command: "serve" });
|
|
3426
3431
|
const scanResult = await app.scan({ akanConfig });
|
|
3427
3432
|
await app.syncAssets(scanResult.akanConfig.libs);
|
|
3428
3433
|
return scanResult;
|
|
3429
3434
|
}
|
|
3430
3435
|
async #prepareCommand(app, distApp, type, target) {
|
|
3431
3436
|
await distApp.exec(`rm -rf ${target}`);
|
|
3432
|
-
const
|
|
3437
|
+
const env = import_dotenv2.default.parse(app.workspace.readFile(".env"));
|
|
3433
3438
|
if (target === "frontend")
|
|
3434
3439
|
app.writeFile("next.config.ts", defaultNextConfigFile);
|
|
3435
3440
|
return {
|
|
3436
3441
|
env: {
|
|
3437
3442
|
...process.env,
|
|
3438
|
-
...
|
|
3443
|
+
...env,
|
|
3439
3444
|
AKAN_COMMAND_TYPE: type,
|
|
3440
3445
|
NEXT_PUBLIC_APP_NAME: app.name,
|
|
3441
3446
|
AKAN_WORKSPACE_ROOT: app.workspace.workspaceRoot
|
|
@@ -3468,7 +3473,7 @@ page.tsx_end
|
|
|
3468
3473
|
distApp.writeFile(import_path4.default.join(distApp.cwdPath, "backend", "Dockerfile"), akanConfig.backend.dockerfile);
|
|
3469
3474
|
}
|
|
3470
3475
|
async serveBackend(app, distApp) {
|
|
3471
|
-
const { env
|
|
3476
|
+
const { env } = await this.#prepareCommand(app, distApp, "serve", "backend");
|
|
3472
3477
|
const ctx = await esbuild.context({
|
|
3473
3478
|
write: true,
|
|
3474
3479
|
entryPoints: [`${app.cwdPath}/main.ts`],
|
|
@@ -3480,12 +3485,12 @@ page.tsx_end
|
|
|
3480
3485
|
});
|
|
3481
3486
|
await ctx.watch();
|
|
3482
3487
|
await sleep(100);
|
|
3483
|
-
await distApp.spawn("node", ["--watch", "backend/main.js"], { env
|
|
3488
|
+
await distApp.spawn("node", ["--watch", "backend/main.js"], { env });
|
|
3484
3489
|
}
|
|
3485
3490
|
async buildFrontend(app, distApp) {
|
|
3486
|
-
const { env
|
|
3491
|
+
const { env } = await this.#prepareCommand(app, distApp, "build", "frontend");
|
|
3487
3492
|
const akanConfig = await app.getConfig("build");
|
|
3488
|
-
await app.spawn("npx", ["next", "build", "--no-lint"], { env
|
|
3493
|
+
await app.spawn("npx", ["next", "build", "--no-lint"], { env });
|
|
3489
3494
|
await esbuild.build({
|
|
3490
3495
|
entryPoints: [`${app.cwdPath}/next.config.ts`],
|
|
3491
3496
|
outdir: `${distApp.cwdPath}/frontend`,
|
|
@@ -3521,12 +3526,12 @@ page.tsx_end
|
|
|
3521
3526
|
distApp.writeFile("frontend/Dockerfile", akanConfig.frontend.dockerfile);
|
|
3522
3527
|
}
|
|
3523
3528
|
async serveFrontend(app, distApp) {
|
|
3524
|
-
const { env
|
|
3525
|
-
await app.spawn("npx", ["next", "dev", "-p", "4200"], { env
|
|
3529
|
+
const { env } = await this.#prepareCommand(app, distApp, "serve", "frontend");
|
|
3530
|
+
await app.spawn("npx", ["next", "dev", "-p", "4200"], { env });
|
|
3526
3531
|
}
|
|
3527
3532
|
async #getViteConfig(app, distApp) {
|
|
3528
|
-
const { env
|
|
3529
|
-
const processEnv =
|
|
3533
|
+
const { env } = await this.#prepareCommand(app, distApp, "build", "csr");
|
|
3534
|
+
const processEnv = env;
|
|
3530
3535
|
const akanjsPrefix = process.env.USE_AKANJS_PKGS === "true" ? "../../../../pkgs/" : "";
|
|
3531
3536
|
const config = vite.defineConfig({
|
|
3532
3537
|
root: `${app.cwdPath}/app`,
|
|
@@ -3839,11 +3844,11 @@ page.tsx_end
|
|
|
3839
3844
|
local
|
|
3840
3845
|
});
|
|
3841
3846
|
}
|
|
3842
|
-
async createApplicationTemplate(workspace,
|
|
3847
|
+
async createApplicationTemplate(workspace, appName) {
|
|
3843
3848
|
await workspace.applyTemplate({
|
|
3844
|
-
basePath: `apps/${
|
|
3849
|
+
basePath: `apps/${appName}`,
|
|
3845
3850
|
template: "appRoot",
|
|
3846
|
-
dict: { appName
|
|
3851
|
+
dict: { appName, AppName: capitalize(appName) }
|
|
3847
3852
|
});
|
|
3848
3853
|
}
|
|
3849
3854
|
async generateApplicationTemplate(app) {
|
|
@@ -4659,12 +4664,12 @@ ${names.Model}.Unit.Card\uC758 \uB9AC\uC561\uD2B8 \uCEF4\uD3EC\uB10C\uD2B8\uB97C
|
|
|
4659
4664
|
const [appNames, libNames] = await sys2.workspace.getSyss();
|
|
4660
4665
|
const scalarConstantExampleFiles = [
|
|
4661
4666
|
...(await Promise.all(
|
|
4662
|
-
appNames.map(async (
|
|
4663
|
-
const app = AppExecutor.from(sys2.workspace,
|
|
4667
|
+
appNames.map(async (appName) => {
|
|
4668
|
+
const app = AppExecutor.from(sys2.workspace, appName);
|
|
4664
4669
|
const scalarModules = await app.getScalarModules();
|
|
4665
4670
|
return await Promise.all(
|
|
4666
4671
|
scalarModules.map((scalarModule) => ({
|
|
4667
|
-
path: `${
|
|
4672
|
+
path: `${appName}/${scalarModule}/${scalarModule}.constant.ts`,
|
|
4668
4673
|
content: app.readFile(`lib/__scalar/${scalarModule}/${scalarModule}.constant.ts`)
|
|
4669
4674
|
}))
|
|
4670
4675
|
);
|
|
@@ -4885,19 +4890,19 @@ ${names.Model}.Unit.Card\uC758 \uB9AC\uC561\uD2B8 \uCEF4\uD3EC\uB10C\uD2B8\uB97C
|
|
|
4885
4890
|
init_devkit();
|
|
4886
4891
|
import_uuid2 = __require("uuid");
|
|
4887
4892
|
WorkspaceRunner = class {
|
|
4888
|
-
async createWorkspace(
|
|
4893
|
+
async createWorkspace(repoName, appName, dirname = ".") {
|
|
4889
4894
|
}
|
|
4890
4895
|
async generateMongo(workspace) {
|
|
4891
4896
|
const namespace = "00000000-0000-0000-0000-000000000000";
|
|
4892
4897
|
const appNames = await workspace.getApps();
|
|
4893
|
-
const apps = appNames.map((
|
|
4898
|
+
const apps = appNames.map((appName) => AppExecutor.from(workspace, appName));
|
|
4894
4899
|
const appDatas = apps.reduce(
|
|
4895
4900
|
(acc, app) => [
|
|
4896
4901
|
...acc,
|
|
4897
|
-
...["debug", "develop", "main"].map((
|
|
4902
|
+
...["debug", "develop", "main"].map((env) => ({
|
|
4898
4903
|
appName: app.name,
|
|
4899
|
-
env
|
|
4900
|
-
secret: getCredentials(app,
|
|
4904
|
+
env,
|
|
4905
|
+
secret: getCredentials(app, env)
|
|
4901
4906
|
}))
|
|
4902
4907
|
],
|
|
4903
4908
|
[]
|
|
@@ -4905,17 +4910,17 @@ ${names.Model}.Unit.Card\uC758 \uB9AC\uC561\uD2B8 \uCEF4\uD3EC\uB10C\uD2B8\uB97C
|
|
|
4905
4910
|
const mongoConnectionList = {
|
|
4906
4911
|
type: "Compass Connections",
|
|
4907
4912
|
version: { $numberInt: "1" },
|
|
4908
|
-
connections: appDatas.map(({ appName
|
|
4909
|
-
id: (0, import_uuid2.v5)(`${
|
|
4913
|
+
connections: appDatas.map(({ appName, env, secret }) => ({
|
|
4914
|
+
id: (0, import_uuid2.v5)(`${appName}-${env}`, namespace),
|
|
4910
4915
|
favorite: {
|
|
4911
|
-
name: `${
|
|
4916
|
+
name: `${appName}-${env}`,
|
|
4912
4917
|
color: "color9"
|
|
4913
4918
|
},
|
|
4914
4919
|
savedConnectionType: "favorite",
|
|
4915
4920
|
connectionOptions: {
|
|
4916
|
-
connectionString: `mongodb://${secret.mongo.account.user.username}:${secret.mongo.account.user.password}@mongo-0.mongo-svc.${
|
|
4921
|
+
connectionString: `mongodb://${secret.mongo.account.user.username}:${secret.mongo.account.user.password}@mongo-0.mongo-svc.${appName}-${env}/?directConnection=true&authSource=${appName}-${env}`,
|
|
4917
4922
|
sshTunnel: {
|
|
4918
|
-
host: `${
|
|
4923
|
+
host: `${appName}-${env}.akamir.com`,
|
|
4919
4924
|
port: "32767",
|
|
4920
4925
|
username: "root",
|
|
4921
4926
|
password: "akamir"
|
|
@@ -4945,10 +4950,10 @@ ${names.Model}.Unit.Card\uC758 \uB9AC\uC561\uD2B8 \uCEF4\uD3EC\uB10C\uD2B8\uB97C
|
|
|
4945
4950
|
init_workspace_runner();
|
|
4946
4951
|
WorkspaceScript = class {
|
|
4947
4952
|
#runner = new WorkspaceRunner();
|
|
4948
|
-
async createWorkspace(
|
|
4953
|
+
async createWorkspace(repoName, appName, dirname = ".") {
|
|
4949
4954
|
const cwdPath = process.cwd();
|
|
4950
|
-
const workspaceRoot = import_path5.default.join(cwdPath, dirname,
|
|
4951
|
-
const workspace = new WorkspaceExecutor({ workspaceRoot, repoName
|
|
4955
|
+
const workspaceRoot = import_path5.default.join(cwdPath, dirname, repoName);
|
|
4956
|
+
const workspace = new WorkspaceExecutor({ workspaceRoot, repoName });
|
|
4952
4957
|
const dependencies = [
|
|
4953
4958
|
"@akanjs/base",
|
|
4954
4959
|
"@akanjs/cli",
|
|
@@ -4969,9 +4974,9 @@ ${names.Model}.Unit.Card\uC758 \uB9AC\uC561\uD2B8 \uCEF4\uD3EC\uB10C\uD2B8\uB97C
|
|
|
4969
4974
|
const devDependencies = ["@akanjs/test", "@akanjs/devkit"];
|
|
4970
4975
|
const latestPublishedVersionOfBase = await (0, import_latest_version2.default)("@akanjs/base");
|
|
4971
4976
|
const packageJson = {
|
|
4972
|
-
name:
|
|
4977
|
+
name: repoName,
|
|
4973
4978
|
version: "0.0.1",
|
|
4974
|
-
description: `${
|
|
4979
|
+
description: `${repoName} workspace`,
|
|
4975
4980
|
dependencies: Object.fromEntries(dependencies.map((dependency) => [dependency, latestPublishedVersionOfBase])),
|
|
4976
4981
|
devDependencies: Object.fromEntries(
|
|
4977
4982
|
devDependencies.map((dependency) => [dependency, latestPublishedVersionOfBase])
|
|
@@ -4981,7 +4986,7 @@ ${names.Model}.Unit.Card\uC758 \uB9AC\uC561\uD2B8 \uCEF4\uD3EC\uB10C\uD2B8\uB97C
|
|
|
4981
4986
|
await workspace.applyTemplate({
|
|
4982
4987
|
basePath: ".",
|
|
4983
4988
|
template: "workspaceRoot",
|
|
4984
|
-
dict: { repoName
|
|
4989
|
+
dict: { repoName, RepoName: capitalize(repoName) }
|
|
4985
4990
|
});
|
|
4986
4991
|
workspace.log("Installing dependencies...");
|
|
4987
4992
|
await workspace.spawn("pnpm", ["i"]);
|