@akanjs/config 0.0.84 → 0.0.86
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/capacitor.base.config.d.ts +2 -0
- package/capacitor.base.config.js +68 -0
- package/capacitor.base.config.mjs +39 -0
- package/index.d.ts +1 -130
- package/index.js +4 -336
- package/index.mjs +3 -0
- package/package.json +19 -2
- package/{src/postcss.config.base.js → postcss.config.base.js} +1 -2
- package/src/akanConfig.js +145 -0
- package/src/{akanConfig.ts → akanConfig.mjs} +32 -57
- package/src/baseConfigEnv.js +36 -0
- package/src/baseConfigEnv.mjs +17 -0
- package/src/nextConfig.js +185 -0
- package/src/nextConfig.mjs +156 -0
- package/src/types.d.ts +130 -0
- package/src/types.js +57 -0
- package/src/types.mjs +38 -0
- package/{src/styles.css → styles.css} +1 -1
- package/src/baseConfigEnv.ts +0 -21
- package/src/capacitor.base.config.ts +0 -39
- package/src/nextConfig.ts +0 -174
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var capacitor_base_config_exports = {};
|
|
29
|
+
__export(capacitor_base_config_exports, {
|
|
30
|
+
withBase: () => withBase
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(capacitor_base_config_exports);
|
|
33
|
+
var import_os = __toESM(require("os"));
|
|
34
|
+
const getLocalIP = () => {
|
|
35
|
+
const interfaces = import_os.default.networkInterfaces();
|
|
36
|
+
for (const interfaceName in interfaces) {
|
|
37
|
+
const iface = interfaces[interfaceName];
|
|
38
|
+
if (!iface)
|
|
39
|
+
continue;
|
|
40
|
+
for (const alias of iface) {
|
|
41
|
+
if (alias.family === "IPv4" && !alias.internal)
|
|
42
|
+
return alias.address;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return "127.0.0.1";
|
|
46
|
+
};
|
|
47
|
+
const withBase = (applyConfig) => {
|
|
48
|
+
const projectName = process.env.NEXT_PUBLIC_APP_NAME;
|
|
49
|
+
if (!projectName)
|
|
50
|
+
throw new Error("projectName is not defined, please run with nx command");
|
|
51
|
+
const ip = getLocalIP();
|
|
52
|
+
const baseConfig = {
|
|
53
|
+
appId: `com.${projectName}`,
|
|
54
|
+
appName: projectName,
|
|
55
|
+
webDir: `../../dist/apps/${projectName}/csr/`,
|
|
56
|
+
// bundledWebRuntime: false, !not used
|
|
57
|
+
server: process.env.APP_OPERATION_MODE !== "release" ? {
|
|
58
|
+
androidScheme: "http",
|
|
59
|
+
url: `http://${ip}:4201`,
|
|
60
|
+
cleartext: true,
|
|
61
|
+
allowNavigation: [`http://${ip}:8080/*`]
|
|
62
|
+
} : void 0,
|
|
63
|
+
plugins: {
|
|
64
|
+
CapacitorCookies: { enabled: true }
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
return applyConfig(baseConfig);
|
|
68
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import os from "os";
|
|
2
|
+
const getLocalIP = () => {
|
|
3
|
+
const interfaces = os.networkInterfaces();
|
|
4
|
+
for (const interfaceName in interfaces) {
|
|
5
|
+
const iface = interfaces[interfaceName];
|
|
6
|
+
if (!iface)
|
|
7
|
+
continue;
|
|
8
|
+
for (const alias of iface) {
|
|
9
|
+
if (alias.family === "IPv4" && !alias.internal)
|
|
10
|
+
return alias.address;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return "127.0.0.1";
|
|
14
|
+
};
|
|
15
|
+
const withBase = (applyConfig) => {
|
|
16
|
+
const projectName = process.env.NEXT_PUBLIC_APP_NAME;
|
|
17
|
+
if (!projectName)
|
|
18
|
+
throw new Error("projectName is not defined, please run with nx command");
|
|
19
|
+
const ip = getLocalIP();
|
|
20
|
+
const baseConfig = {
|
|
21
|
+
appId: `com.${projectName}`,
|
|
22
|
+
appName: projectName,
|
|
23
|
+
webDir: `../../dist/apps/${projectName}/csr/`,
|
|
24
|
+
// bundledWebRuntime: false, !not used
|
|
25
|
+
server: process.env.APP_OPERATION_MODE !== "release" ? {
|
|
26
|
+
androidScheme: "http",
|
|
27
|
+
url: `http://${ip}:4201`,
|
|
28
|
+
cleartext: true,
|
|
29
|
+
allowNavigation: [`http://${ip}:8080/*`]
|
|
30
|
+
} : void 0,
|
|
31
|
+
plugins: {
|
|
32
|
+
CapacitorCookies: { enabled: true }
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
return applyConfig(baseConfig);
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
withBase
|
|
39
|
+
};
|
package/index.d.ts
CHANGED
|
@@ -1,132 +1,3 @@
|
|
|
1
|
-
import { NextConfig } from "next";
|
|
2
1
|
export * from "./src/akanConfig";
|
|
3
2
|
export * from "./src/nextConfig";
|
|
4
|
-
export
|
|
5
|
-
appName: string;
|
|
6
|
-
repoName: string;
|
|
7
|
-
serveDomain: string;
|
|
8
|
-
env: "testing" | "debug" | "develop" | "main";
|
|
9
|
-
command?: string;
|
|
10
|
-
}
|
|
11
|
-
export type Arch = "amd64" | "arm64";
|
|
12
|
-
export type ExplicitDependencies = string[] | {
|
|
13
|
-
[key in Arch]: string[];
|
|
14
|
-
};
|
|
15
|
-
export interface AppConfigResult {
|
|
16
|
-
rootLib?: string;
|
|
17
|
-
libs: string[];
|
|
18
|
-
backend: {
|
|
19
|
-
dockerfile: string;
|
|
20
|
-
explicitDependencies: ExplicitDependencies;
|
|
21
|
-
};
|
|
22
|
-
frontend: {
|
|
23
|
-
dockerfile: string;
|
|
24
|
-
nextConfig: NextConfig | (() => Promise<NextConfig> | NextConfig);
|
|
25
|
-
routes?: {
|
|
26
|
-
basePath?: string;
|
|
27
|
-
domains: {
|
|
28
|
-
main?: string[];
|
|
29
|
-
develop?: string[];
|
|
30
|
-
debug?: string[];
|
|
31
|
-
};
|
|
32
|
-
}[];
|
|
33
|
-
explicitDependencies: ExplicitDependencies;
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
export interface LibConfigResult {
|
|
37
|
-
rootLib?: string;
|
|
38
|
-
libs: string[];
|
|
39
|
-
backend: {
|
|
40
|
-
explicitDependencies: ExplicitDependencies;
|
|
41
|
-
};
|
|
42
|
-
frontend: {
|
|
43
|
-
explicitDependencies: ExplicitDependencies;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
export type DeepPartial<T> = {
|
|
47
|
-
[P in keyof T]?: T[P] extends any[] ? T[P] : T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
48
|
-
};
|
|
49
|
-
export type AppConfig = DeepPartial<AppConfigResult> | ((props: RunnerProps) => DeepPartial<AppConfigResult>);
|
|
50
|
-
export type LibConfig = DeepPartial<LibConfigResult> | ((props: RunnerProps) => DeepPartial<LibConfigResult>);
|
|
51
|
-
export interface AkanConfigFile {
|
|
52
|
-
default: NextConfig;
|
|
53
|
-
}
|
|
54
|
-
export interface FileConventionScanResult {
|
|
55
|
-
constants: {
|
|
56
|
-
databases: string[];
|
|
57
|
-
scalars: string[];
|
|
58
|
-
};
|
|
59
|
-
dictionary: {
|
|
60
|
-
databases: string[];
|
|
61
|
-
services: string[];
|
|
62
|
-
scalars: string[];
|
|
63
|
-
};
|
|
64
|
-
documents: {
|
|
65
|
-
databases: string[];
|
|
66
|
-
scalars: string[];
|
|
67
|
-
};
|
|
68
|
-
services: {
|
|
69
|
-
databases: string[];
|
|
70
|
-
services: string[];
|
|
71
|
-
scalars: string[];
|
|
72
|
-
};
|
|
73
|
-
signal: {
|
|
74
|
-
databases: string[];
|
|
75
|
-
services: string[];
|
|
76
|
-
scalars: string[];
|
|
77
|
-
};
|
|
78
|
-
store: {
|
|
79
|
-
databases: string[];
|
|
80
|
-
services: string[];
|
|
81
|
-
scalars: string[];
|
|
82
|
-
};
|
|
83
|
-
components: {
|
|
84
|
-
databases: string[];
|
|
85
|
-
services: string[];
|
|
86
|
-
scalars: string[];
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
export declare const getDefaultFileScan: () => FileConventionScanResult;
|
|
90
|
-
export interface AppScanResult {
|
|
91
|
-
name: string;
|
|
92
|
-
type: "app" | "lib";
|
|
93
|
-
akanConfig: AppConfigResult;
|
|
94
|
-
files: FileConventionScanResult;
|
|
95
|
-
libDeps: string[];
|
|
96
|
-
pkgDeps: string[];
|
|
97
|
-
dependencies: string[];
|
|
98
|
-
libs: {
|
|
99
|
-
[key: string]: LibScanResult;
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
export interface LibScanResult {
|
|
103
|
-
name: string;
|
|
104
|
-
type: "app" | "lib";
|
|
105
|
-
akanConfig: LibConfigResult;
|
|
106
|
-
files: FileConventionScanResult;
|
|
107
|
-
libDeps: string[];
|
|
108
|
-
pkgDeps: string[];
|
|
109
|
-
dependencies: string[];
|
|
110
|
-
libs: {
|
|
111
|
-
[key: string]: LibScanResult;
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
export interface PkgScanResult {
|
|
115
|
-
name: string;
|
|
116
|
-
pkgDeps: string[];
|
|
117
|
-
dependencies: string[];
|
|
118
|
-
}
|
|
119
|
-
export interface WorkspaceScanResult {
|
|
120
|
-
appNames: string[];
|
|
121
|
-
libNames: string[];
|
|
122
|
-
pkgNames: string[];
|
|
123
|
-
apps: {
|
|
124
|
-
[key: string]: AppScanResult;
|
|
125
|
-
};
|
|
126
|
-
libs: {
|
|
127
|
-
[key: string]: LibScanResult;
|
|
128
|
-
};
|
|
129
|
-
pkgs: {
|
|
130
|
-
[key: string]: PkgScanResult;
|
|
131
|
-
};
|
|
132
|
-
}
|
|
3
|
+
export * from "./src/types";
|
package/index.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
5
|
var __copyProps = (to, from, except, desc) => {
|
|
12
6
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
7
|
for (let key of __getOwnPropNames(from))
|
|
@@ -16,336 +10,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
10
|
}
|
|
17
11
|
return to;
|
|
18
12
|
};
|
|
19
|
-
var
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
27
14
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// pkgs/@akanjs/config/index.ts
|
|
30
15
|
var config_exports = {};
|
|
31
|
-
__export(config_exports, {
|
|
32
|
-
composePlugins: () => composePlugins,
|
|
33
|
-
defaultNextConfigFile: () => defaultNextConfigFile,
|
|
34
|
-
getAppConfig: () => getAppConfig,
|
|
35
|
-
getDefaultFileScan: () => getDefaultFileScan,
|
|
36
|
-
getLibConfig: () => getLibConfig,
|
|
37
|
-
getNextConfig: () => getNextConfig,
|
|
38
|
-
makeAppConfig: () => makeAppConfig,
|
|
39
|
-
makeLibConfig: () => makeLibConfig,
|
|
40
|
-
withBase: () => withBase
|
|
41
|
-
});
|
|
42
16
|
module.exports = __toCommonJS(config_exports);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
var import_path2 = __toESM(require("path"));
|
|
47
|
-
|
|
48
|
-
// pkgs/@akanjs/config/src/baseConfigEnv.ts
|
|
49
|
-
var getBaseConfigEnv = (appName = process.env.NEXT_PUBLIC_APP_NAME) => {
|
|
50
|
-
if (!appName)
|
|
51
|
-
throw new Error("NEXT_PUBLIC_APP_NAME is not set");
|
|
52
|
-
const repoName = process.env.NEXT_PUBLIC_REPO_NAME;
|
|
53
|
-
if (!repoName)
|
|
54
|
-
throw new Error("NEXT_PUBLIC_REPO_NAME is not set");
|
|
55
|
-
const serveDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN;
|
|
56
|
-
if (!serveDomain)
|
|
57
|
-
throw new Error("NEXT_PUBLIC_SERVE_DOMAIN is not set");
|
|
58
|
-
const env = process.env.NEXT_PUBLIC_ENV ?? "debug";
|
|
59
|
-
if (!env)
|
|
60
|
-
throw new Error("NEXT_PUBLIC_ENV is not set");
|
|
61
|
-
return { appName, repoName, serveDomain, env };
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
// pkgs/@akanjs/config/src/nextConfig.ts
|
|
65
|
-
var import_bundle_analyzer = __toESM(require("@next/bundle-analyzer"));
|
|
66
|
-
var import_next_pwa = __toESM(require("next-pwa"));
|
|
67
|
-
var import_cache = __toESM(require("next-pwa/cache"));
|
|
68
|
-
var import_path = __toESM(require("path"));
|
|
69
|
-
var composePlugins = (...plugins) => {
|
|
70
|
-
return function(baseConfig) {
|
|
71
|
-
return async function combined(phase, context) {
|
|
72
|
-
let config = baseConfig;
|
|
73
|
-
for (const plugin of plugins) {
|
|
74
|
-
const fn = plugin;
|
|
75
|
-
const configOrFn = fn(config);
|
|
76
|
-
if (typeof configOrFn === "function")
|
|
77
|
-
config = await configOrFn(phase, context);
|
|
78
|
-
else
|
|
79
|
-
config = configOrFn;
|
|
80
|
-
}
|
|
81
|
-
return config;
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
var commandType = process.env.AKAN_COMMAND_TYPE?.includes("serve") ? "serve" : process.env.AKAN_COMMAND_TYPE?.includes("build") ? "build" : "deploy";
|
|
86
|
-
var withPWA = (0, import_next_pwa.default)({
|
|
87
|
-
dest: "public",
|
|
88
|
-
register: true,
|
|
89
|
-
skipWaiting: true,
|
|
90
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
91
|
-
runtimeCaching: import_cache.default,
|
|
92
|
-
disable: commandType === "serve"
|
|
93
|
-
});
|
|
94
|
-
var devDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN ?? "akanjs.com";
|
|
95
|
-
var withBase = (appName, config, libs, routes = []) => {
|
|
96
|
-
return composePlugins(
|
|
97
|
-
(0, import_bundle_analyzer.default)({ enabled: process.env.ANALYZE === "true" }),
|
|
98
|
-
...commandType !== "serve" || process.env.USE_PWA === "true" ? [withPWA] : []
|
|
99
|
-
)({
|
|
100
|
-
...config,
|
|
101
|
-
eslint: { ...config.eslint, ignoreDuringBuilds: true },
|
|
102
|
-
env: {
|
|
103
|
-
...config.env,
|
|
104
|
-
basePaths: routes.map(({ basePath }) => basePath).join(",")
|
|
105
|
-
},
|
|
106
|
-
transpilePackages: ["swiper", "ssr-window", "dom7"],
|
|
107
|
-
reactStrictMode: commandType === "serve" ? false : true,
|
|
108
|
-
experimental: {
|
|
109
|
-
...config.experimental ?? {},
|
|
110
|
-
optimizePackageImports: [
|
|
111
|
-
...[appName, ...libs].map((lib) => [`@${lib}/ui`, `@${lib}/next`, `@${lib}/common`, `@${lib}/client`]).flat(),
|
|
112
|
-
"@contract",
|
|
113
|
-
"@akanjs/next",
|
|
114
|
-
"@akanjs/common"
|
|
115
|
-
]
|
|
116
|
-
},
|
|
117
|
-
// modularizeImports: {
|
|
118
|
-
// "react-icons/?(((\\w*)?/?)*)": {
|
|
119
|
-
// transform: "@react-icons/all-files/{{ matches.[1] }}/{{member}}",
|
|
120
|
-
// skipDefaultConversion: true,
|
|
121
|
-
// },
|
|
122
|
-
// lodash: { transform: "lodash/{{member}}", preventFullImport: true },
|
|
123
|
-
// ...Object.fromEntries(
|
|
124
|
-
// [appName, ...libs].reduce(
|
|
125
|
-
// (acc, lib) => [
|
|
126
|
-
// ...acc,
|
|
127
|
-
// [`@${lib}/ui`, { transform: `@${lib}/ui/{{member}}`, skipDefaultConversion: true }],
|
|
128
|
-
// [`@${lib}/next`, { transform: `@${lib}/next/{{member}}`, skipDefaultConversion: true }],
|
|
129
|
-
// [`@${lib}/common`, { transform: `@${lib}/common/{{member}}`, skipDefaultConversion: true }],
|
|
130
|
-
// [`@${lib}/client`, { transform: `@${lib}/lib/{{ camelCase member }}`, skipDefaultConversion: true }],
|
|
131
|
-
// ],
|
|
132
|
-
// [
|
|
133
|
-
// ["@contract", { transform: `@contract/src/{{member}}`, skipDefaultConversion: true }],
|
|
134
|
-
// [`@akanjs/next`, { transform: `@akanjs/next/src/{{member}}`, skipDefaultConversion: true }],
|
|
135
|
-
// [`@akanjs/common`, { transform: `@akanjs/common/src/{{member}}`, skipDefaultConversion: true }],
|
|
136
|
-
// ]
|
|
137
|
-
// )
|
|
138
|
-
// ),
|
|
139
|
-
// ...(config.modularizeImports ?? {}),
|
|
140
|
-
// },
|
|
141
|
-
images: {
|
|
142
|
-
formats: ["image/avif", "image/webp"],
|
|
143
|
-
...config.images ?? {},
|
|
144
|
-
remotePatterns: [
|
|
145
|
-
...config.images?.remotePatterns ?? [],
|
|
146
|
-
...routes.map(({ domains }) => [
|
|
147
|
-
...domains.main?.map((domain) => ({ protocol: "https", hostname: `**.${domain}` })) ?? [],
|
|
148
|
-
...domains.develop?.map((domain) => ({ protocol: "https", hostname: `**.${domain}` })) ?? [],
|
|
149
|
-
...domains.debug?.map((domain) => ({ protocol: "https", hostname: `**.${domain}` })) ?? []
|
|
150
|
-
]).flat(),
|
|
151
|
-
{ protocol: "https", hostname: `**.${devDomain}` }
|
|
152
|
-
]
|
|
153
|
-
},
|
|
154
|
-
webpack: (config2) => {
|
|
155
|
-
config2.resolve.alias.canvas = false;
|
|
156
|
-
config2.resolve.alias.encoding = false;
|
|
157
|
-
if (process.env.USE_AKANJS_PKGS === "true")
|
|
158
|
-
config2.resolve.alias["@akanjs/config"] = import_path.default.resolve(__dirname, "../../../../pkgs/@akanjs/config");
|
|
159
|
-
return config2;
|
|
160
|
-
},
|
|
161
|
-
redirects() {
|
|
162
|
-
return routes.map(({ basePath, domains }) => [
|
|
163
|
-
{ basePath, domain: `${basePath}-debug.${devDomain}` },
|
|
164
|
-
{ basePath, domain: `${basePath}-develop.${devDomain}` },
|
|
165
|
-
{ basePath, domain: `${basePath}-main.${devDomain}` },
|
|
166
|
-
...domains.main?.map((domain) => ({ basePath, domain })) ?? [],
|
|
167
|
-
...domains.develop?.map((domain) => ({ basePath, domain })) ?? [],
|
|
168
|
-
...domains.debug?.map((domain) => ({ basePath, domain })) ?? []
|
|
169
|
-
]).flat().map(({ basePath, domain }) => ({
|
|
170
|
-
source: `/:locale/${basePath}/:path*`,
|
|
171
|
-
has: [{ type: "host", value: domain }],
|
|
172
|
-
permanent: true,
|
|
173
|
-
destination: "/:locale/:path*"
|
|
174
|
-
}));
|
|
175
|
-
},
|
|
176
|
-
rewrites() {
|
|
177
|
-
return routes.map(({ basePath, domains }) => [
|
|
178
|
-
{ basePath, domain: `${basePath}-debug.${devDomain}` },
|
|
179
|
-
{ basePath, domain: `${basePath}-develop.${devDomain}` },
|
|
180
|
-
{ basePath, domain: `${basePath}-main.${devDomain}` },
|
|
181
|
-
...domains.main?.map((domain) => ({ basePath, domain })) ?? [],
|
|
182
|
-
...domains.develop?.map((domain) => ({ basePath, domain })) ?? [],
|
|
183
|
-
...domains.debug?.map((domain) => ({ basePath, domain })) ?? []
|
|
184
|
-
]).flat().map(({ basePath, domain }) => [
|
|
185
|
-
{
|
|
186
|
-
source: "/:locale",
|
|
187
|
-
has: [{ type: "host", value: domain }],
|
|
188
|
-
destination: `/:locale/${basePath}`
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
source: `/:locale/:path((?!${basePath}$)(?!admin(?:/|$)).*)`,
|
|
192
|
-
has: [{ type: "host", value: domain }],
|
|
193
|
-
destination: `/:locale/${basePath}/:path*`
|
|
194
|
-
}
|
|
195
|
-
]).flat();
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
};
|
|
199
|
-
var defaultNextConfigFile = `import "tsconfig-paths/register";
|
|
200
|
-
|
|
201
|
-
import { getNextConfig } from "@akanjs/config";
|
|
202
|
-
|
|
203
|
-
import appInfo from "./akan.app.json";
|
|
204
|
-
import config from "./akan.config";
|
|
205
|
-
|
|
206
|
-
export default getNextConfig(config, appInfo);
|
|
207
|
-
`;
|
|
208
|
-
|
|
209
|
-
// pkgs/@akanjs/config/src/akanConfig.ts
|
|
210
|
-
var makeAppConfig = (config, props = {}) => {
|
|
211
|
-
const baseConfigEnv = getBaseConfigEnv(props.appName);
|
|
212
|
-
const {
|
|
213
|
-
appName = baseConfigEnv.appName,
|
|
214
|
-
repoName = baseConfigEnv.repoName,
|
|
215
|
-
serveDomain = baseConfigEnv.serveDomain,
|
|
216
|
-
env = baseConfigEnv.env,
|
|
217
|
-
command = "build"
|
|
218
|
-
} = props;
|
|
219
|
-
return {
|
|
220
|
-
rootLib: config.rootLib,
|
|
221
|
-
libs: config.libs ?? [],
|
|
222
|
-
backend: {
|
|
223
|
-
dockerfile: config.backend?.dockerfile ?? `FROM node:22-slim
|
|
224
|
-
RUN ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
|
|
225
|
-
RUN apt-get update && apt-get upgrade -y
|
|
226
|
-
RUN apt-get install -y ca-certificates fonts-liberation libappindicator3-1 libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils udev ffmpeg
|
|
227
|
-
ARG TARGETARCH
|
|
228
|
-
RUN if [ "$TARGETARCH" = "amd64" ]; then wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-debian92-x86_64-100.3.1.deb && apt-get install -y ./mongodb-database-tools-*.deb && rm -f mongodb-database-tools-*.deb; fi
|
|
229
|
-
RUN apt-get install -y git redis build-essential python3
|
|
230
|
-
RUN rm -rf /var/lib/apt/lists/*
|
|
231
|
-
RUN mkdir -p /workspace
|
|
232
|
-
WORKDIR /workspace
|
|
233
|
-
COPY ./package.json ./package.json
|
|
234
|
-
RUN npx pnpm i --prod
|
|
235
|
-
COPY . .
|
|
236
|
-
ENV PORT 8080
|
|
237
|
-
ENV NODE_OPTIONS=--max_old_space_size=8192
|
|
238
|
-
ENV NEXT_PUBLIC_REPO_NAME=${repoName}
|
|
239
|
-
ENV NEXT_PUBLIC_SERVE_DOMAIN=${serveDomain}
|
|
240
|
-
ENV NEXT_PUBLIC_APP_NAME=${appName}
|
|
241
|
-
ENV NEXT_PUBLIC_ENV=${env}
|
|
242
|
-
ENV NEXT_PUBLIC_OPERATION_MODE=cloud
|
|
243
|
-
CMD ["node", "main.js"]`,
|
|
244
|
-
explicitDependencies: config.backend?.explicitDependencies ?? []
|
|
245
|
-
},
|
|
246
|
-
frontend: {
|
|
247
|
-
dockerfile: config.frontend?.dockerfile ?? `FROM node:22-alpine
|
|
248
|
-
RUN ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
|
|
249
|
-
RUN apk --no-cache add git
|
|
250
|
-
RUN mkdir -p /workspace
|
|
251
|
-
WORKDIR /workspace
|
|
252
|
-
COPY ./package.json ./package.json
|
|
253
|
-
RUN npx pnpm i --prod
|
|
254
|
-
COPY . .
|
|
255
|
-
ENV PORT 4200
|
|
256
|
-
ENV NODE_OPTIONS=--max_old_space_size=8192
|
|
257
|
-
ENV NEXT_PUBLIC_REPO_NAME=${repoName}
|
|
258
|
-
ENV NEXT_PUBLIC_SERVE_DOMAIN=${serveDomain}
|
|
259
|
-
ENV NEXT_PUBLIC_APP_NAME=${appName}
|
|
260
|
-
ENV NEXT_PUBLIC_ENV=${env}
|
|
261
|
-
ENV NEXT_PUBLIC_OPERATION_MODE=cloud
|
|
262
|
-
CMD ["npm", "start"]`,
|
|
263
|
-
nextConfig: withBase(
|
|
264
|
-
appName,
|
|
265
|
-
config.frontend?.nextConfig ? typeof config.frontend.nextConfig === "function" ? config.frontend.nextConfig() : config.frontend.nextConfig : {},
|
|
266
|
-
config.libs ?? [],
|
|
267
|
-
config.frontend?.routes
|
|
268
|
-
),
|
|
269
|
-
explicitDependencies: config.frontend?.explicitDependencies ?? []
|
|
270
|
-
}
|
|
271
|
-
};
|
|
272
|
-
};
|
|
273
|
-
var getAppConfig = async (appRoot, props) => {
|
|
274
|
-
const akanConfigPath = import_path2.default.join(appRoot, "akan.config.ts");
|
|
275
|
-
if (!import_fs.default.existsSync(akanConfigPath))
|
|
276
|
-
throw new Error(`application akan.config.ts is not found ${appRoot}`);
|
|
277
|
-
const configImp = (await import(`${appRoot}/akan.config.ts`)).default;
|
|
278
|
-
const config = typeof configImp === "function" ? configImp(props) : configImp;
|
|
279
|
-
return makeAppConfig(config, props);
|
|
280
|
-
};
|
|
281
|
-
var makeLibConfig = (config, props = {}) => {
|
|
282
|
-
return {
|
|
283
|
-
rootLib: config.rootLib,
|
|
284
|
-
libs: config.libs ?? [],
|
|
285
|
-
backend: {
|
|
286
|
-
explicitDependencies: config.backend?.explicitDependencies ?? []
|
|
287
|
-
},
|
|
288
|
-
frontend: {
|
|
289
|
-
explicitDependencies: config.frontend?.explicitDependencies ?? []
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
};
|
|
293
|
-
var getLibConfig = async (libRoot, props) => {
|
|
294
|
-
const akanConfigPath = import_path2.default.join(libRoot, "akan.config.ts");
|
|
295
|
-
if (!import_fs.default.existsSync(akanConfigPath))
|
|
296
|
-
throw new Error(`library akan.config.ts is not found ${libRoot}`);
|
|
297
|
-
const configImp = (await import(`${libRoot}/akan.config.ts`)).default;
|
|
298
|
-
const config = typeof configImp === "function" ? configImp(props) : configImp;
|
|
299
|
-
return makeLibConfig(config, props);
|
|
300
|
-
};
|
|
301
|
-
var getNextConfig = (configImp, appData) => {
|
|
302
|
-
const appInfo = appData;
|
|
303
|
-
const baseConfigEnv = getBaseConfigEnv(appInfo.name);
|
|
304
|
-
const props = {
|
|
305
|
-
appName: baseConfigEnv.appName,
|
|
306
|
-
repoName: baseConfigEnv.repoName,
|
|
307
|
-
serveDomain: baseConfigEnv.serveDomain,
|
|
308
|
-
env: baseConfigEnv.env,
|
|
309
|
-
command: "build"
|
|
310
|
-
};
|
|
311
|
-
const config = typeof configImp === "function" ? configImp(props) : configImp;
|
|
312
|
-
const akanConfig = makeAppConfig(config, props);
|
|
313
|
-
return akanConfig.frontend.nextConfig;
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
// pkgs/@akanjs/config/index.ts
|
|
317
|
-
var getDefaultFileScan = () => ({
|
|
318
|
-
constants: {
|
|
319
|
-
databases: [],
|
|
320
|
-
scalars: []
|
|
321
|
-
},
|
|
322
|
-
dictionary: {
|
|
323
|
-
databases: [],
|
|
324
|
-
services: [],
|
|
325
|
-
scalars: []
|
|
326
|
-
},
|
|
327
|
-
documents: {
|
|
328
|
-
databases: [],
|
|
329
|
-
scalars: []
|
|
330
|
-
},
|
|
331
|
-
services: {
|
|
332
|
-
databases: [],
|
|
333
|
-
services: [],
|
|
334
|
-
scalars: []
|
|
335
|
-
},
|
|
336
|
-
signal: {
|
|
337
|
-
databases: [],
|
|
338
|
-
services: [],
|
|
339
|
-
scalars: []
|
|
340
|
-
},
|
|
341
|
-
store: {
|
|
342
|
-
databases: [],
|
|
343
|
-
services: [],
|
|
344
|
-
scalars: []
|
|
345
|
-
},
|
|
346
|
-
components: {
|
|
347
|
-
databases: [],
|
|
348
|
-
services: [],
|
|
349
|
-
scalars: []
|
|
350
|
-
}
|
|
351
|
-
});
|
|
17
|
+
__reExport(config_exports, require("./src/akanConfig"), module.exports);
|
|
18
|
+
__reExport(config_exports, require("./src/nextConfig"), module.exports);
|
|
19
|
+
__reExport(config_exports, require("./src/types"), module.exports);
|
package/index.mjs
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/config",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.86",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"module": {
|
|
6
6
|
"access": "public"
|
|
@@ -32,5 +32,22 @@
|
|
|
32
32
|
"main": "./index.js",
|
|
33
33
|
"engines": {
|
|
34
34
|
"node": ">=22"
|
|
35
|
+
},
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"require": "./index.js",
|
|
39
|
+
"import": "./index.mjs"
|
|
40
|
+
},
|
|
41
|
+
"./capacitor.base.config": {
|
|
42
|
+
"require": "./capacitor.base.config.js",
|
|
43
|
+
"import": "./capacitor.base.config.mjs"
|
|
44
|
+
},
|
|
45
|
+
"./postcss.config.base": {
|
|
46
|
+
"require": "./postcss.config.base.js",
|
|
47
|
+
"import": "./postcss.config.base.js"
|
|
48
|
+
},
|
|
49
|
+
"./styles.css": {
|
|
50
|
+
"default": "./styles.css"
|
|
51
|
+
}
|
|
35
52
|
}
|
|
36
|
-
}
|
|
53
|
+
}
|
|
@@ -7,8 +7,7 @@ const withBase = (config = {}) => ({
|
|
|
7
7
|
? {
|
|
8
8
|
"postcss-import": {
|
|
9
9
|
resolve(id) {
|
|
10
|
-
if (id.startsWith("@akanjs/config/
|
|
11
|
-
return path.resolve(__dirname, id.replace("@akanjs/config/src/", ""));
|
|
10
|
+
if (id.startsWith("@akanjs/config")) return path.resolve(__dirname, id.replace("@akanjs/config/", ""));
|
|
12
11
|
else return id;
|
|
13
12
|
},
|
|
14
13
|
},
|