@akanjs/cli 0.0.87 → 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
CHANGED
|
@@ -486,22 +486,6 @@ var sleep = async (ms) => {
|
|
|
486
486
|
var import_fs6 = __toESM(require("fs"));
|
|
487
487
|
var import_path2 = __toESM(require("path"));
|
|
488
488
|
|
|
489
|
-
// pkgs/@akanjs/config/src/baseConfigEnv.ts
|
|
490
|
-
var getBaseConfigEnv = (appName = process.env.NEXT_PUBLIC_APP_NAME) => {
|
|
491
|
-
if (!appName)
|
|
492
|
-
throw new Error("NEXT_PUBLIC_APP_NAME is not set");
|
|
493
|
-
const repoName = process.env.NEXT_PUBLIC_REPO_NAME;
|
|
494
|
-
if (!repoName)
|
|
495
|
-
throw new Error("NEXT_PUBLIC_REPO_NAME is not set");
|
|
496
|
-
const serveDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN;
|
|
497
|
-
if (!serveDomain)
|
|
498
|
-
throw new Error("NEXT_PUBLIC_SERVE_DOMAIN is not set");
|
|
499
|
-
const env = process.env.NEXT_PUBLIC_ENV ?? "debug";
|
|
500
|
-
if (!env)
|
|
501
|
-
throw new Error("NEXT_PUBLIC_ENV is not set");
|
|
502
|
-
return { appName, repoName, serveDomain, env };
|
|
503
|
-
};
|
|
504
|
-
|
|
505
489
|
// pkgs/@akanjs/config/src/nextConfig.ts
|
|
506
490
|
var import_bundle_analyzer = __toESM(require("@next/bundle-analyzer"));
|
|
507
491
|
var import_next_pwa = __toESM(require("next-pwa"));
|
|
@@ -656,15 +640,8 @@ export default getNextConfig(config, appInfo);
|
|
|
656
640
|
`;
|
|
657
641
|
|
|
658
642
|
// pkgs/@akanjs/config/src/akanConfig.ts
|
|
659
|
-
var makeAppConfig = (config, props
|
|
660
|
-
const
|
|
661
|
-
const {
|
|
662
|
-
appName = baseConfigEnv.appName,
|
|
663
|
-
repoName = baseConfigEnv.repoName,
|
|
664
|
-
serveDomain = baseConfigEnv.serveDomain,
|
|
665
|
-
env = baseConfigEnv.env,
|
|
666
|
-
command = "build"
|
|
667
|
-
} = props;
|
|
643
|
+
var makeAppConfig = (config, props) => {
|
|
644
|
+
const { name, repoName, serveDomain, env, command = "build" } = props;
|
|
668
645
|
return {
|
|
669
646
|
rootLib: config.rootLib,
|
|
670
647
|
libs: config.libs ?? [],
|
|
@@ -686,7 +663,7 @@ ENV PORT 8080
|
|
|
686
663
|
ENV NODE_OPTIONS=--max_old_space_size=8192
|
|
687
664
|
ENV NEXT_PUBLIC_REPO_NAME=${repoName}
|
|
688
665
|
ENV NEXT_PUBLIC_SERVE_DOMAIN=${serveDomain}
|
|
689
|
-
ENV NEXT_PUBLIC_APP_NAME=${
|
|
666
|
+
ENV NEXT_PUBLIC_APP_NAME=${name}
|
|
690
667
|
ENV NEXT_PUBLIC_ENV=${env}
|
|
691
668
|
ENV NEXT_PUBLIC_OPERATION_MODE=cloud
|
|
692
669
|
CMD ["node", "main.js"]`,
|
|
@@ -705,12 +682,12 @@ ENV PORT 4200
|
|
|
705
682
|
ENV NODE_OPTIONS=--max_old_space_size=8192
|
|
706
683
|
ENV NEXT_PUBLIC_REPO_NAME=${repoName}
|
|
707
684
|
ENV NEXT_PUBLIC_SERVE_DOMAIN=${serveDomain}
|
|
708
|
-
ENV NEXT_PUBLIC_APP_NAME=${
|
|
685
|
+
ENV NEXT_PUBLIC_APP_NAME=${name}
|
|
709
686
|
ENV NEXT_PUBLIC_ENV=${env}
|
|
710
687
|
ENV NEXT_PUBLIC_OPERATION_MODE=cloud
|
|
711
688
|
CMD ["npm", "start"]`,
|
|
712
689
|
nextConfig: withBase(
|
|
713
|
-
|
|
690
|
+
name,
|
|
714
691
|
config.frontend?.nextConfig ? typeof config.frontend.nextConfig === "function" ? config.frontend.nextConfig() : config.frontend.nextConfig : {},
|
|
715
692
|
config.libs ?? [],
|
|
716
693
|
config.frontend?.routes
|
|
@@ -727,7 +704,7 @@ var getAppConfig = async (appRoot, props) => {
|
|
|
727
704
|
const config = typeof configImp === "function" ? configImp(props) : configImp;
|
|
728
705
|
return makeAppConfig(config, props);
|
|
729
706
|
};
|
|
730
|
-
var makeLibConfig = (config, props
|
|
707
|
+
var makeLibConfig = (config, props) => {
|
|
731
708
|
return {
|
|
732
709
|
rootLib: config.rootLib,
|
|
733
710
|
libs: config.libs ?? [],
|
|
@@ -1172,7 +1149,7 @@ var WorkspaceExecutor = class _WorkspaceExecutor extends Executor {
|
|
|
1172
1149
|
const env = process.env.NEXT_PUBLIC_ENV ?? envFile.NEXT_PUBLIC_ENV ?? "debug";
|
|
1173
1150
|
if (!env)
|
|
1174
1151
|
throw new Error("NEXT_PUBLIC_ENV is not set");
|
|
1175
|
-
return { ...appName ? { appName } : {}, repoName, serveDomain, env };
|
|
1152
|
+
return { ...appName ? { name: appName } : {}, repoName, serveDomain, env };
|
|
1176
1153
|
}
|
|
1177
1154
|
async scan() {
|
|
1178
1155
|
const [appNames, libNames, pkgNames] = await Promise.all([this.getApps(), this.getLibs(), this.getPkgs()]);
|
|
@@ -1276,7 +1253,7 @@ var SysExecutor = class extends Executor {
|
|
|
1276
1253
|
this.type = type;
|
|
1277
1254
|
}
|
|
1278
1255
|
async getConfig(command) {
|
|
1279
|
-
return this.type === "app" ? await getAppConfig(this.cwdPath, { ...this.workspace.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 });
|
|
1280
1257
|
}
|
|
1281
1258
|
async scan({
|
|
1282
1259
|
tsconfig = this.getTsConfig(`${this.cwdPath}/tsconfig.json`),
|
|
@@ -1392,6 +1369,8 @@ var SysExecutor = class extends Executor {
|
|
|
1392
1369
|
const scanResult = {
|
|
1393
1370
|
name: this.name,
|
|
1394
1371
|
type: this.type,
|
|
1372
|
+
repoName: this.workspace.repoName,
|
|
1373
|
+
serveDomain: this.workspace.getBaseDevEnv().serveDomain,
|
|
1395
1374
|
akanConfig,
|
|
1396
1375
|
files,
|
|
1397
1376
|
libDeps,
|
|
@@ -1474,7 +1453,12 @@ var AppExecutor = class _AppExecutor extends SysExecutor {
|
|
|
1474
1453
|
return new _AppExecutor({ workspace: executor.workspace, name });
|
|
1475
1454
|
}
|
|
1476
1455
|
async getConfig(command) {
|
|
1477
|
-
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
|
+
});
|
|
1478
1462
|
}
|
|
1479
1463
|
async syncAssets(libDeps) {
|
|
1480
1464
|
const projectPublicLibPath = `${this.cwdPath}/public/libs`;
|
|
@@ -1515,7 +1499,12 @@ var LibExecutor = class _LibExecutor extends SysExecutor {
|
|
|
1515
1499
|
return new _LibExecutor({ workspace: executor.workspace, name });
|
|
1516
1500
|
}
|
|
1517
1501
|
async getConfig(command) {
|
|
1518
|
-
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
|
+
});
|
|
1519
1508
|
}
|
|
1520
1509
|
};
|
|
1521
1510
|
var PkgExecutor = class _PkgExecutor extends Executor {
|
|
@@ -3209,7 +3198,8 @@ var ApplicationRunner = class {
|
|
|
3209
3198
|
async scanSync(app) {
|
|
3210
3199
|
const akanConfig = await getAppConfig(app.cwdPath, {
|
|
3211
3200
|
...app.workspace.getBaseDevEnv(),
|
|
3212
|
-
|
|
3201
|
+
type: "app",
|
|
3202
|
+
name: app.name,
|
|
3213
3203
|
command: "serve"
|
|
3214
3204
|
});
|
|
3215
3205
|
const scanResult = await app.scan({ akanConfig });
|
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[];
|
|
@@ -53,7 +53,7 @@ export declare class WorkspaceExecutor extends Executor {
|
|
|
53
53
|
repoName: string;
|
|
54
54
|
serveDomain: string;
|
|
55
55
|
env: "debug" | "testing" | "develop" | "main";
|
|
56
|
-
|
|
56
|
+
name?: string | undefined;
|
|
57
57
|
};
|
|
58
58
|
scan(): Promise<WorkspaceScanResult>;
|
|
59
59
|
getApps(): Promise<string[]>;
|