@akanjs/cli 0.0.86 → 0.0.88
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 +75 -73
- package/package.json +1 -1
- package/pkgs/@akanjs/config/src/akanConfig.d.ts +2 -2
- package/pkgs/@akanjs/config/src/types.d.ts +7 -2
- package/pkgs/@akanjs/devkit/src/createTunnel.d.ts +3 -2
- package/pkgs/@akanjs/devkit/src/executors.d.ts +11 -2
- package/pkgs/@akanjs/devkit/src/index.d.ts +0 -1
- package/pkgs/@akanjs/config/src/baseConfigEnv.d.ts +0 -8
- package/pkgs/@akanjs/devkit/src/baseDevEnv.d.ts +0 -10
package/index.js
CHANGED
|
@@ -32,40 +32,25 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
32
32
|
};
|
|
33
33
|
var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
|
|
34
34
|
|
|
35
|
-
// pkgs/@akanjs/devkit/src/
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
const repoName =
|
|
39
|
-
if (!repoName)
|
|
40
|
-
throw new Error("NEXT_PUBLIC_REPO_NAME is not set");
|
|
41
|
-
const serveDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN;
|
|
42
|
-
if (!serveDomain)
|
|
43
|
-
throw new Error("NEXT_PUBLIC_SERVE_DOMAIN is not set");
|
|
44
|
-
const env = process.env.NEXT_PUBLIC_ENV ?? "debug";
|
|
45
|
-
if (!env)
|
|
46
|
-
throw new Error("NEXT_PUBLIC_ENV is not set");
|
|
47
|
-
return { ...appName ? { appName } : {}, repoName, serveDomain, env };
|
|
48
|
-
};
|
|
49
|
-
var getSshTunnelOptions = (appName, environment) => {
|
|
50
|
-
const { serveDomain, repoName } = getBaseDevEnv();
|
|
35
|
+
// pkgs/@akanjs/devkit/src/createTunnel.ts
|
|
36
|
+
var import_tunnel_ssh = require("tunnel-ssh");
|
|
37
|
+
var getSshTunnelOptions = (app, environment) => {
|
|
38
|
+
const { serveDomain, repoName } = app.workspace.getBaseDevEnv();
|
|
51
39
|
return {
|
|
52
|
-
host: `${
|
|
53
|
-
port: process.env.
|
|
54
|
-
username: process.env.
|
|
55
|
-
password: process.env.
|
|
40
|
+
host: `${app.name}-${environment}.${serveDomain}`,
|
|
41
|
+
port: process.env.SSH_TUNNEL_PORT ? parseInt(process.env.SSH_TUNNEL_PORT) : 32767,
|
|
42
|
+
username: process.env.SSH_TUNNEL_USERNAME ?? "root",
|
|
43
|
+
password: process.env.SSH_TUNNEL_PASSWORD ?? repoName
|
|
56
44
|
};
|
|
57
45
|
};
|
|
58
|
-
|
|
59
|
-
// pkgs/@akanjs/devkit/src/createTunnel.ts
|
|
60
|
-
var import_tunnel_ssh = require("tunnel-ssh");
|
|
61
|
-
var createTunnel = async ({ appName, environment, port = 27017 }) => {
|
|
46
|
+
var createTunnel = async ({ app, environment, port = 27017 }) => {
|
|
62
47
|
const tunnelOptions = { autoClose: true, reconnectOnError: true };
|
|
63
|
-
const sshOptions = getSshTunnelOptions(
|
|
48
|
+
const sshOptions = getSshTunnelOptions(app, environment);
|
|
64
49
|
const serverOptions = { port };
|
|
65
50
|
const forwardOptions = {
|
|
66
51
|
srcAddr: "0.0.0.0",
|
|
67
52
|
srcPort: port,
|
|
68
|
-
dstAddr: `mongo-0.mongo-svc.${
|
|
53
|
+
dstAddr: `mongo-0.mongo-svc.${app.name}-${environment}`,
|
|
69
54
|
dstPort: 27017
|
|
70
55
|
};
|
|
71
56
|
const [server, client] = await (0, import_tunnel_ssh.createTunnel)(tunnelOptions, serverOptions, sshOptions, forwardOptions);
|
|
@@ -379,7 +364,7 @@ var Logger = class _Logger {
|
|
|
379
364
|
"NestApplication"
|
|
380
365
|
]);
|
|
381
366
|
static level = process.env.NEXT_PUBLIC_LOG_LEVEL ?? "log";
|
|
382
|
-
static #levelIdx = logLevels.findIndex((l) => l === process.env.NEXT_PUBLIC_LOG_LEVEL);
|
|
367
|
+
static #levelIdx = logLevels.findIndex((l) => l === (process.env.NEXT_PUBLIC_LOG_LEVEL ?? "log"));
|
|
383
368
|
static #startAt = (0, import_dayjs4.default)();
|
|
384
369
|
static setLevel(level) {
|
|
385
370
|
this.level = level;
|
|
@@ -501,22 +486,6 @@ var sleep = async (ms) => {
|
|
|
501
486
|
var import_fs6 = __toESM(require("fs"));
|
|
502
487
|
var import_path2 = __toESM(require("path"));
|
|
503
488
|
|
|
504
|
-
// pkgs/@akanjs/config/src/baseConfigEnv.ts
|
|
505
|
-
var getBaseConfigEnv = (appName = process.env.NEXT_PUBLIC_APP_NAME) => {
|
|
506
|
-
if (!appName)
|
|
507
|
-
throw new Error("NEXT_PUBLIC_APP_NAME is not set");
|
|
508
|
-
const repoName = process.env.NEXT_PUBLIC_REPO_NAME;
|
|
509
|
-
if (!repoName)
|
|
510
|
-
throw new Error("NEXT_PUBLIC_REPO_NAME is not set");
|
|
511
|
-
const serveDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN;
|
|
512
|
-
if (!serveDomain)
|
|
513
|
-
throw new Error("NEXT_PUBLIC_SERVE_DOMAIN is not set");
|
|
514
|
-
const env = process.env.NEXT_PUBLIC_ENV ?? "debug";
|
|
515
|
-
if (!env)
|
|
516
|
-
throw new Error("NEXT_PUBLIC_ENV is not set");
|
|
517
|
-
return { appName, repoName, serveDomain, env };
|
|
518
|
-
};
|
|
519
|
-
|
|
520
489
|
// pkgs/@akanjs/config/src/nextConfig.ts
|
|
521
490
|
var import_bundle_analyzer = __toESM(require("@next/bundle-analyzer"));
|
|
522
491
|
var import_next_pwa = __toESM(require("next-pwa"));
|
|
@@ -671,15 +640,8 @@ export default getNextConfig(config, appInfo);
|
|
|
671
640
|
`;
|
|
672
641
|
|
|
673
642
|
// pkgs/@akanjs/config/src/akanConfig.ts
|
|
674
|
-
var makeAppConfig = (config, props
|
|
675
|
-
const
|
|
676
|
-
const {
|
|
677
|
-
appName = baseConfigEnv.appName,
|
|
678
|
-
repoName = baseConfigEnv.repoName,
|
|
679
|
-
serveDomain = baseConfigEnv.serveDomain,
|
|
680
|
-
env = baseConfigEnv.env,
|
|
681
|
-
command = "build"
|
|
682
|
-
} = props;
|
|
643
|
+
var makeAppConfig = (config, props) => {
|
|
644
|
+
const { name, repoName, serveDomain, env, command = "build" } = props;
|
|
683
645
|
return {
|
|
684
646
|
rootLib: config.rootLib,
|
|
685
647
|
libs: config.libs ?? [],
|
|
@@ -701,7 +663,7 @@ ENV PORT 8080
|
|
|
701
663
|
ENV NODE_OPTIONS=--max_old_space_size=8192
|
|
702
664
|
ENV NEXT_PUBLIC_REPO_NAME=${repoName}
|
|
703
665
|
ENV NEXT_PUBLIC_SERVE_DOMAIN=${serveDomain}
|
|
704
|
-
ENV NEXT_PUBLIC_APP_NAME=${
|
|
666
|
+
ENV NEXT_PUBLIC_APP_NAME=${name}
|
|
705
667
|
ENV NEXT_PUBLIC_ENV=${env}
|
|
706
668
|
ENV NEXT_PUBLIC_OPERATION_MODE=cloud
|
|
707
669
|
CMD ["node", "main.js"]`,
|
|
@@ -720,12 +682,12 @@ ENV PORT 4200
|
|
|
720
682
|
ENV NODE_OPTIONS=--max_old_space_size=8192
|
|
721
683
|
ENV NEXT_PUBLIC_REPO_NAME=${repoName}
|
|
722
684
|
ENV NEXT_PUBLIC_SERVE_DOMAIN=${serveDomain}
|
|
723
|
-
ENV NEXT_PUBLIC_APP_NAME=${
|
|
685
|
+
ENV NEXT_PUBLIC_APP_NAME=${name}
|
|
724
686
|
ENV NEXT_PUBLIC_ENV=${env}
|
|
725
687
|
ENV NEXT_PUBLIC_OPERATION_MODE=cloud
|
|
726
688
|
CMD ["npm", "start"]`,
|
|
727
689
|
nextConfig: withBase(
|
|
728
|
-
|
|
690
|
+
name,
|
|
729
691
|
config.frontend?.nextConfig ? typeof config.frontend.nextConfig === "function" ? config.frontend.nextConfig() : config.frontend.nextConfig : {},
|
|
730
692
|
config.libs ?? [],
|
|
731
693
|
config.frontend?.routes
|
|
@@ -742,7 +704,7 @@ var getAppConfig = async (appRoot, props) => {
|
|
|
742
704
|
const config = typeof configImp === "function" ? configImp(props) : configImp;
|
|
743
705
|
return makeAppConfig(config, props);
|
|
744
706
|
};
|
|
745
|
-
var makeLibConfig = (config, props
|
|
707
|
+
var makeLibConfig = (config, props) => {
|
|
746
708
|
return {
|
|
747
709
|
rootLib: config.rootLib,
|
|
748
710
|
libs: config.libs ?? [],
|
|
@@ -805,6 +767,7 @@ var import_child_process = require("child_process");
|
|
|
805
767
|
var import_fs7 = __toESM(require("fs"), 1);
|
|
806
768
|
var import_promises = __toESM(require("fs/promises"), 1);
|
|
807
769
|
var import_path3 = __toESM(require("path"), 1);
|
|
770
|
+
var import_dotenv = __toESM(require("dotenv"), 1);
|
|
808
771
|
|
|
809
772
|
// pkgs/@akanjs/devkit/src/dependencyScanner.ts
|
|
810
773
|
var fs7 = __toESM(require("fs"), 1);
|
|
@@ -1029,7 +992,7 @@ var Executor = class {
|
|
|
1029
992
|
const readPath = this.#getPath(filePath);
|
|
1030
993
|
return import_fs7.default.existsSync(readPath);
|
|
1031
994
|
}
|
|
1032
|
-
writeFile(filePath, content) {
|
|
995
|
+
writeFile(filePath, content, { overwrite = true } = {}) {
|
|
1033
996
|
const writePath = this.#getPath(filePath);
|
|
1034
997
|
const dir = import_path3.default.dirname(writePath);
|
|
1035
998
|
if (!import_fs7.default.existsSync(dir))
|
|
@@ -1037,7 +1000,7 @@ var Executor = class {
|
|
|
1037
1000
|
const contentStr = typeof content === "string" ? content : JSON.stringify(content, null, 2);
|
|
1038
1001
|
if (import_fs7.default.existsSync(writePath)) {
|
|
1039
1002
|
const currentContent = import_fs7.default.readFileSync(writePath, "utf8");
|
|
1040
|
-
if (currentContent === contentStr)
|
|
1003
|
+
if (currentContent === contentStr || !overwrite)
|
|
1041
1004
|
this.logger.verbose(`File ${writePath} is unchanged`);
|
|
1042
1005
|
else {
|
|
1043
1006
|
import_fs7.default.writeFileSync(writePath, contentStr, "utf8");
|
|
@@ -1094,7 +1057,8 @@ var Executor = class {
|
|
|
1094
1057
|
async #applyTemplateFile({
|
|
1095
1058
|
templatePath,
|
|
1096
1059
|
targetPath,
|
|
1097
|
-
scanResult
|
|
1060
|
+
scanResult,
|
|
1061
|
+
overwrite = true
|
|
1098
1062
|
}, dict = {}) {
|
|
1099
1063
|
if (targetPath.endsWith(".js") || targetPath.endsWith(".jsx")) {
|
|
1100
1064
|
const getContent = await import(templatePath);
|
|
@@ -1128,12 +1092,16 @@ var Executor = class {
|
|
|
1128
1092
|
basePath: basePath2,
|
|
1129
1093
|
template,
|
|
1130
1094
|
scanResult,
|
|
1131
|
-
dict = {}
|
|
1095
|
+
dict = {},
|
|
1096
|
+
overwrite = true
|
|
1132
1097
|
}) {
|
|
1133
1098
|
const templatePath = `${__dirname}/src/templates${template ? `/${template}` : ""}`.replace(".ts", ".js");
|
|
1134
1099
|
if (import_fs7.default.statSync(templatePath).isFile()) {
|
|
1135
1100
|
const filename = import_path3.default.basename(templatePath);
|
|
1136
|
-
await this.#applyTemplateFile(
|
|
1101
|
+
await this.#applyTemplateFile(
|
|
1102
|
+
{ templatePath, targetPath: import_path3.default.join(basePath2, filename), scanResult, overwrite },
|
|
1103
|
+
dict
|
|
1104
|
+
);
|
|
1137
1105
|
} else {
|
|
1138
1106
|
const subdirs = await import_promises.default.readdir(templatePath);
|
|
1139
1107
|
await Promise.all(
|
|
@@ -1141,7 +1109,7 @@ var Executor = class {
|
|
|
1141
1109
|
const subpath = import_path3.default.join(templatePath, subdir);
|
|
1142
1110
|
if (import_fs7.default.statSync(subpath).isFile())
|
|
1143
1111
|
await this.#applyTemplateFile(
|
|
1144
|
-
{ templatePath: subpath, targetPath: import_path3.default.join(basePath2, subdir), scanResult },
|
|
1112
|
+
{ templatePath: subpath, targetPath: import_path3.default.join(basePath2, subdir), scanResult, overwrite },
|
|
1145
1113
|
dict
|
|
1146
1114
|
);
|
|
1147
1115
|
else
|
|
@@ -1149,7 +1117,8 @@ var Executor = class {
|
|
|
1149
1117
|
basePath: import_path3.default.join(basePath2, subdir),
|
|
1150
1118
|
template: import_path3.default.join(template, subdir),
|
|
1151
1119
|
scanResult,
|
|
1152
|
-
dict
|
|
1120
|
+
dict,
|
|
1121
|
+
overwrite
|
|
1153
1122
|
});
|
|
1154
1123
|
})
|
|
1155
1124
|
);
|
|
@@ -1168,6 +1137,20 @@ var WorkspaceExecutor = class _WorkspaceExecutor extends Executor {
|
|
|
1168
1137
|
const repoName = import_path3.default.basename(process.cwd());
|
|
1169
1138
|
return new _WorkspaceExecutor({ workspaceRoot: process.cwd(), repoName });
|
|
1170
1139
|
}
|
|
1140
|
+
getBaseDevEnv() {
|
|
1141
|
+
const envFile = import_dotenv.default.parse(this.readFile(".env"));
|
|
1142
|
+
const appName = process.env.NEXT_PUBLIC_APP_NAME ?? envFile.NEXT_PUBLIC_APP_NAME;
|
|
1143
|
+
const repoName = process.env.NEXT_PUBLIC_REPO_NAME ?? envFile.NEXT_PUBLIC_REPO_NAME;
|
|
1144
|
+
if (!repoName)
|
|
1145
|
+
throw new Error("NEXT_PUBLIC_REPO_NAME is not set");
|
|
1146
|
+
const serveDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN ?? envFile.NEXT_PUBLIC_SERVE_DOMAIN;
|
|
1147
|
+
if (!serveDomain)
|
|
1148
|
+
throw new Error("NEXT_PUBLIC_SERVE_DOMAIN is not set");
|
|
1149
|
+
const env = process.env.NEXT_PUBLIC_ENV ?? envFile.NEXT_PUBLIC_ENV ?? "debug";
|
|
1150
|
+
if (!env)
|
|
1151
|
+
throw new Error("NEXT_PUBLIC_ENV is not set");
|
|
1152
|
+
return { ...appName ? { name: appName } : {}, repoName, serveDomain, env };
|
|
1153
|
+
}
|
|
1171
1154
|
async scan() {
|
|
1172
1155
|
const [appNames, libNames, pkgNames] = await Promise.all([this.getApps(), this.getLibs(), this.getPkgs()]);
|
|
1173
1156
|
const [appScanResults, libScanResults, pkgScanResults] = await Promise.all([
|
|
@@ -1270,7 +1253,7 @@ var SysExecutor = class extends Executor {
|
|
|
1270
1253
|
this.type = type;
|
|
1271
1254
|
}
|
|
1272
1255
|
async getConfig(command) {
|
|
1273
|
-
return this.type === "app" ? await getAppConfig(this.cwdPath, { ...getBaseDevEnv(),
|
|
1256
|
+
return this.type === "app" ? await getAppConfig(this.cwdPath, { ...this.workspace.getBaseDevEnv(), type: "app", name: this.name, command }) : await getLibConfig(this.cwdPath, { ...this.workspace.getBaseDevEnv(), type: "lib", name: this.name, command });
|
|
1274
1257
|
}
|
|
1275
1258
|
async scan({
|
|
1276
1259
|
tsconfig = this.getTsConfig(`${this.cwdPath}/tsconfig.json`),
|
|
@@ -1386,6 +1369,8 @@ var SysExecutor = class extends Executor {
|
|
|
1386
1369
|
const scanResult = {
|
|
1387
1370
|
name: this.name,
|
|
1388
1371
|
type: this.type,
|
|
1372
|
+
repoName: this.workspace.repoName,
|
|
1373
|
+
serveDomain: this.workspace.getBaseDevEnv().serveDomain,
|
|
1389
1374
|
akanConfig,
|
|
1390
1375
|
files,
|
|
1391
1376
|
libDeps,
|
|
@@ -1468,7 +1453,12 @@ var AppExecutor = class _AppExecutor extends SysExecutor {
|
|
|
1468
1453
|
return new _AppExecutor({ workspace: executor.workspace, name });
|
|
1469
1454
|
}
|
|
1470
1455
|
async getConfig(command) {
|
|
1471
|
-
return await getAppConfig(this.cwdPath, {
|
|
1456
|
+
return await getAppConfig(this.cwdPath, {
|
|
1457
|
+
...this.workspace.getBaseDevEnv(),
|
|
1458
|
+
type: "app",
|
|
1459
|
+
name: this.name,
|
|
1460
|
+
command
|
|
1461
|
+
});
|
|
1472
1462
|
}
|
|
1473
1463
|
async syncAssets(libDeps) {
|
|
1474
1464
|
const projectPublicLibPath = `${this.cwdPath}/public/libs`;
|
|
@@ -1509,7 +1499,12 @@ var LibExecutor = class _LibExecutor extends SysExecutor {
|
|
|
1509
1499
|
return new _LibExecutor({ workspace: executor.workspace, name });
|
|
1510
1500
|
}
|
|
1511
1501
|
async getConfig(command) {
|
|
1512
|
-
return await getLibConfig(this.cwdPath, {
|
|
1502
|
+
return await getLibConfig(this.cwdPath, {
|
|
1503
|
+
...this.workspace.getBaseDevEnv(),
|
|
1504
|
+
type: "lib",
|
|
1505
|
+
name: this.name,
|
|
1506
|
+
command
|
|
1507
|
+
});
|
|
1513
1508
|
}
|
|
1514
1509
|
};
|
|
1515
1510
|
var PkgExecutor = class _PkgExecutor extends Executor {
|
|
@@ -2096,7 +2091,7 @@ var AiSession = class _AiSession {
|
|
|
2096
2091
|
|
|
2097
2092
|
// pkgs/@akanjs/cli/src/library/library.runner.ts
|
|
2098
2093
|
var import_compare_versions = require("compare-versions");
|
|
2099
|
-
var
|
|
2094
|
+
var import_dotenv2 = __toESM(require("dotenv"));
|
|
2100
2095
|
var LibraryRunner = class {
|
|
2101
2096
|
async scanSync(lib) {
|
|
2102
2097
|
const akanConfig = await lib.getConfig();
|
|
@@ -2150,7 +2145,7 @@ var LibraryRunner = class {
|
|
|
2150
2145
|
lib.logger.log(`${lib.name} library pulled from ${branch} branch`);
|
|
2151
2146
|
}
|
|
2152
2147
|
#getEnv(lib, env = {}) {
|
|
2153
|
-
const rootEnv =
|
|
2148
|
+
const rootEnv = import_dotenv2.default.parse(lib.workspace.readFile(".env"));
|
|
2154
2149
|
return {
|
|
2155
2150
|
...process.env,
|
|
2156
2151
|
...rootEnv,
|
|
@@ -2216,7 +2211,7 @@ var import_prompts6 = require("@langchain/core/prompts");
|
|
|
2216
2211
|
var import_runnables2 = require("@langchain/core/runnables");
|
|
2217
2212
|
var import_openai3 = require("@langchain/openai");
|
|
2218
2213
|
var import_plugin_react = __toESM(require("@vitejs/plugin-react"));
|
|
2219
|
-
var
|
|
2214
|
+
var import_dotenv3 = __toESM(require("dotenv"));
|
|
2220
2215
|
var esbuild = __toESM(require("esbuild"));
|
|
2221
2216
|
var import_fs12 = __toESM(require("fs"));
|
|
2222
2217
|
var import_promises2 = __toESM(require("fs/promises"));
|
|
@@ -3201,13 +3196,18 @@ var ApplicationRunner = class {
|
|
|
3201
3196
|
return AppExecutor.from(workspace, appName);
|
|
3202
3197
|
}
|
|
3203
3198
|
async scanSync(app) {
|
|
3204
|
-
const akanConfig = await getAppConfig(app.cwdPath, {
|
|
3199
|
+
const akanConfig = await getAppConfig(app.cwdPath, {
|
|
3200
|
+
...app.workspace.getBaseDevEnv(),
|
|
3201
|
+
type: "app",
|
|
3202
|
+
name: app.name,
|
|
3203
|
+
command: "serve"
|
|
3204
|
+
});
|
|
3205
3205
|
const scanResult = await app.scan({ akanConfig });
|
|
3206
3206
|
await app.syncAssets(scanResult.akanConfig.libs);
|
|
3207
3207
|
return scanResult;
|
|
3208
3208
|
}
|
|
3209
3209
|
#getEnv(app, env = {}) {
|
|
3210
|
-
const rootEnv =
|
|
3210
|
+
const rootEnv = import_dotenv3.default.parse(app.workspace.readFile(".env"));
|
|
3211
3211
|
return {
|
|
3212
3212
|
...process.env,
|
|
3213
3213
|
...rootEnv,
|
|
@@ -3218,8 +3218,10 @@ var ApplicationRunner = class {
|
|
|
3218
3218
|
}
|
|
3219
3219
|
async #prepareCommand(app, distApp, type, target) {
|
|
3220
3220
|
await distApp.exec(`rm -rf ${target}`);
|
|
3221
|
-
if (target === "frontend")
|
|
3221
|
+
if (target === "frontend") {
|
|
3222
|
+
await app.exec("rm -rf .next");
|
|
3222
3223
|
app.writeFile("next.config.ts", defaultNextConfigFile);
|
|
3224
|
+
}
|
|
3223
3225
|
return { env: this.#getEnv(app, { AKAN_COMMAND_TYPE: type }) };
|
|
3224
3226
|
}
|
|
3225
3227
|
async buildBackend(app, distApp) {
|
|
@@ -3454,7 +3456,7 @@ var ApplicationRunner = class {
|
|
|
3454
3456
|
return `mongodb://localhost:27017/${app.name}-${environment}`;
|
|
3455
3457
|
const secret = getCredentials(app, environment);
|
|
3456
3458
|
const mongoAccount = secret.mongo.account.user;
|
|
3457
|
-
const localUrl = await createTunnel({
|
|
3459
|
+
const localUrl = await createTunnel({ app, environment });
|
|
3458
3460
|
const mongoUri = `mongodb://${mongoAccount.username}:${encodeURIComponent(
|
|
3459
3461
|
mongoAccount.password
|
|
3460
3462
|
)}@${localUrl}/${app.name}-${environment}`;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AppConfig, AppConfigResult, DeepPartial, LibConfigResult, RunnerProps } from "@akanjs/config";
|
|
2
2
|
import type { NextConfig } from "next";
|
|
3
|
-
export declare const makeAppConfig: (config: DeepPartial<AppConfigResult>, props
|
|
3
|
+
export declare const makeAppConfig: (config: DeepPartial<AppConfigResult>, props: RunnerProps) => AppConfigResult;
|
|
4
4
|
export declare const getAppConfig: (appRoot: string, props: RunnerProps) => Promise<AppConfigResult>;
|
|
5
|
-
export declare const makeLibConfig: (config: DeepPartial<LibConfigResult>, props
|
|
5
|
+
export declare const makeLibConfig: (config: DeepPartial<LibConfigResult>, props: RunnerProps) => LibConfigResult;
|
|
6
6
|
export declare const getLibConfig: (libRoot: string, props: RunnerProps) => Promise<LibConfigResult>;
|
|
7
7
|
export declare const getNextConfig: (configImp: AppConfig, appData: any) => NextConfig | (() => Promise<NextConfig> | NextConfig);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { NextConfig } from "next";
|
|
2
2
|
export interface RunnerProps {
|
|
3
|
-
|
|
3
|
+
type: "app" | "lib";
|
|
4
|
+
name: string;
|
|
4
5
|
repoName: string;
|
|
5
6
|
serveDomain: string;
|
|
6
|
-
env: "testing" | "debug" | "develop" | "main";
|
|
7
|
+
env: "testing" | "local" | "debug" | "develop" | "main";
|
|
7
8
|
command?: string;
|
|
8
9
|
}
|
|
9
10
|
export type Arch = "amd64" | "arm64";
|
|
@@ -88,6 +89,8 @@ export declare const getDefaultFileScan: () => FileConventionScanResult;
|
|
|
88
89
|
export interface AppScanResult {
|
|
89
90
|
name: string;
|
|
90
91
|
type: "app" | "lib";
|
|
92
|
+
repoName: string;
|
|
93
|
+
serveDomain: string;
|
|
91
94
|
akanConfig: AppConfigResult;
|
|
92
95
|
files: FileConventionScanResult;
|
|
93
96
|
libDeps: string[];
|
|
@@ -100,6 +103,8 @@ export interface AppScanResult {
|
|
|
100
103
|
export interface LibScanResult {
|
|
101
104
|
name: string;
|
|
102
105
|
type: "app" | "lib";
|
|
106
|
+
repoName: string;
|
|
107
|
+
serveDomain: string;
|
|
103
108
|
akanConfig: LibConfigResult;
|
|
104
109
|
files: FileConventionScanResult;
|
|
105
110
|
libDeps: string[];
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { AppExecutor } from "./executors";
|
|
1
2
|
interface TunnelOption {
|
|
2
|
-
|
|
3
|
+
app: AppExecutor;
|
|
3
4
|
environment: string;
|
|
4
5
|
port?: number;
|
|
5
6
|
}
|
|
6
|
-
export declare const createTunnel: ({
|
|
7
|
+
export declare const createTunnel: ({ app, environment, port }: TunnelOption) => Promise<string>;
|
|
7
8
|
export {};
|
|
@@ -15,7 +15,9 @@ export declare class Executor {
|
|
|
15
15
|
fork(modulePath: string, args?: string[], options?: ForkOptions): Promise<unknown>;
|
|
16
16
|
mkdir(dirPath: string): this;
|
|
17
17
|
exists(filePath: string): boolean;
|
|
18
|
-
writeFile(filePath: string, content: string | object
|
|
18
|
+
writeFile(filePath: string, content: string | object, { overwrite }?: {
|
|
19
|
+
overwrite?: boolean;
|
|
20
|
+
}): this;
|
|
19
21
|
writeJson(filePath: string, content: object): this;
|
|
20
22
|
getLocalFile(filePath: string): {
|
|
21
23
|
filepath: string;
|
|
@@ -27,13 +29,14 @@ export declare class Executor {
|
|
|
27
29
|
log(msg: string): this;
|
|
28
30
|
verbose(msg: string): this;
|
|
29
31
|
getTsConfig(pathname: string): TsConfigJson;
|
|
30
|
-
applyTemplate({ basePath, template, scanResult, dict, }: {
|
|
32
|
+
applyTemplate({ basePath, template, scanResult, dict, overwrite, }: {
|
|
31
33
|
basePath: string;
|
|
32
34
|
template: string;
|
|
33
35
|
scanResult?: AppScanResult | LibScanResult | null;
|
|
34
36
|
dict?: {
|
|
35
37
|
[key: string]: string;
|
|
36
38
|
};
|
|
39
|
+
overwrite?: boolean;
|
|
37
40
|
}): Promise<void>;
|
|
38
41
|
}
|
|
39
42
|
interface ExecutorOptions {
|
|
@@ -46,6 +49,12 @@ export declare class WorkspaceExecutor extends Executor {
|
|
|
46
49
|
repoName: string;
|
|
47
50
|
constructor({ workspaceRoot, repoName }: ExecutorOptions);
|
|
48
51
|
static fromRoot(): WorkspaceExecutor;
|
|
52
|
+
getBaseDevEnv(): {
|
|
53
|
+
repoName: string;
|
|
54
|
+
serveDomain: string;
|
|
55
|
+
env: "debug" | "testing" | "develop" | "main";
|
|
56
|
+
name?: string | undefined;
|
|
57
|
+
};
|
|
49
58
|
scan(): Promise<WorkspaceScanResult>;
|
|
50
59
|
getApps(): Promise<string[]>;
|
|
51
60
|
getLibs(): Promise<string[]>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { SshOptions } from "tunnel-ssh";
|
|
2
|
-
interface BaseDevEnv {
|
|
3
|
-
appName?: string;
|
|
4
|
-
repoName: string;
|
|
5
|
-
serveDomain: string;
|
|
6
|
-
env: "testing" | "debug" | "develop" | "main";
|
|
7
|
-
}
|
|
8
|
-
export declare const getBaseDevEnv: () => BaseDevEnv;
|
|
9
|
-
export declare const getSshTunnelOptions: (appName: string, environment: string) => SshOptions;
|
|
10
|
-
export {};
|