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