@akanjs/config 0.0.83 → 0.0.85

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.
@@ -0,0 +1,145 @@
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 akanConfig_exports = {};
29
+ __export(akanConfig_exports, {
30
+ getAppConfig: () => getAppConfig,
31
+ getLibConfig: () => getLibConfig,
32
+ getNextConfig: () => getNextConfig,
33
+ makeAppConfig: () => makeAppConfig,
34
+ makeLibConfig: () => makeLibConfig
35
+ });
36
+ module.exports = __toCommonJS(akanConfig_exports);
37
+ var import_fs = __toESM(require("fs"));
38
+ var import_path = __toESM(require("path"));
39
+ var import_baseConfigEnv = require("./baseConfigEnv");
40
+ var import_nextConfig = require("./nextConfig");
41
+ const makeAppConfig = (config, props = {}) => {
42
+ const baseConfigEnv = (0, import_baseConfigEnv.getBaseConfigEnv)(props.appName);
43
+ const {
44
+ appName = baseConfigEnv.appName,
45
+ repoName = baseConfigEnv.repoName,
46
+ serveDomain = baseConfigEnv.serveDomain,
47
+ env = baseConfigEnv.env,
48
+ command = "build"
49
+ } = props;
50
+ return {
51
+ rootLib: config.rootLib,
52
+ libs: config.libs ?? [],
53
+ backend: {
54
+ dockerfile: config.backend?.dockerfile ?? `FROM node:22-slim
55
+ RUN ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
56
+ RUN apt-get update && apt-get upgrade -y
57
+ 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
58
+ ARG TARGETARCH
59
+ 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
60
+ RUN apt-get install -y git redis build-essential python3
61
+ RUN rm -rf /var/lib/apt/lists/*
62
+ RUN mkdir -p /workspace
63
+ WORKDIR /workspace
64
+ COPY ./package.json ./package.json
65
+ RUN npx pnpm i --prod
66
+ COPY . .
67
+ ENV PORT 8080
68
+ ENV NODE_OPTIONS=--max_old_space_size=8192
69
+ ENV NEXT_PUBLIC_REPO_NAME=${repoName}
70
+ ENV NEXT_PUBLIC_SERVE_DOMAIN=${serveDomain}
71
+ ENV NEXT_PUBLIC_APP_NAME=${appName}
72
+ ENV NEXT_PUBLIC_ENV=${env}
73
+ ENV NEXT_PUBLIC_OPERATION_MODE=cloud
74
+ CMD ["node", "main.js"]`,
75
+ explicitDependencies: config.backend?.explicitDependencies ?? []
76
+ },
77
+ frontend: {
78
+ dockerfile: config.frontend?.dockerfile ?? `FROM node:22-alpine
79
+ RUN ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
80
+ RUN apk --no-cache add git
81
+ RUN mkdir -p /workspace
82
+ WORKDIR /workspace
83
+ COPY ./package.json ./package.json
84
+ RUN npx pnpm i --prod
85
+ COPY . .
86
+ ENV PORT 4200
87
+ ENV NODE_OPTIONS=--max_old_space_size=8192
88
+ ENV NEXT_PUBLIC_REPO_NAME=${repoName}
89
+ ENV NEXT_PUBLIC_SERVE_DOMAIN=${serveDomain}
90
+ ENV NEXT_PUBLIC_APP_NAME=${appName}
91
+ ENV NEXT_PUBLIC_ENV=${env}
92
+ ENV NEXT_PUBLIC_OPERATION_MODE=cloud
93
+ CMD ["npm", "start"]`,
94
+ nextConfig: (0, import_nextConfig.withBase)(
95
+ appName,
96
+ config.frontend?.nextConfig ? typeof config.frontend.nextConfig === "function" ? config.frontend.nextConfig() : config.frontend.nextConfig : {},
97
+ config.libs ?? [],
98
+ config.frontend?.routes
99
+ ),
100
+ explicitDependencies: config.frontend?.explicitDependencies ?? []
101
+ }
102
+ };
103
+ };
104
+ const getAppConfig = async (appRoot, props) => {
105
+ const akanConfigPath = import_path.default.join(appRoot, "akan.config.ts");
106
+ if (!import_fs.default.existsSync(akanConfigPath))
107
+ throw new Error(`application akan.config.ts is not found ${appRoot}`);
108
+ const configImp = (await import(`${appRoot}/akan.config.ts`)).default;
109
+ const config = typeof configImp === "function" ? configImp(props) : configImp;
110
+ return makeAppConfig(config, props);
111
+ };
112
+ const makeLibConfig = (config, props = {}) => {
113
+ return {
114
+ rootLib: config.rootLib,
115
+ libs: config.libs ?? [],
116
+ backend: {
117
+ explicitDependencies: config.backend?.explicitDependencies ?? []
118
+ },
119
+ frontend: {
120
+ explicitDependencies: config.frontend?.explicitDependencies ?? []
121
+ }
122
+ };
123
+ };
124
+ const getLibConfig = async (libRoot, props) => {
125
+ const akanConfigPath = import_path.default.join(libRoot, "akan.config.ts");
126
+ if (!import_fs.default.existsSync(akanConfigPath))
127
+ throw new Error(`library akan.config.ts is not found ${libRoot}`);
128
+ const configImp = (await import(`${libRoot}/akan.config.ts`)).default;
129
+ const config = typeof configImp === "function" ? configImp(props) : configImp;
130
+ return makeLibConfig(config, props);
131
+ };
132
+ const getNextConfig = (configImp, appData) => {
133
+ const appInfo = appData;
134
+ const baseConfigEnv = (0, import_baseConfigEnv.getBaseConfigEnv)(appInfo.name);
135
+ const props = {
136
+ appName: baseConfigEnv.appName,
137
+ repoName: baseConfigEnv.repoName,
138
+ serveDomain: baseConfigEnv.serveDomain,
139
+ env: baseConfigEnv.env,
140
+ command: "build"
141
+ };
142
+ const config = typeof configImp === "function" ? configImp(props) : configImp;
143
+ const akanConfig = makeAppConfig(config, props);
144
+ return akanConfig.frontend.nextConfig;
145
+ };
@@ -1,47 +1,26 @@
1
- import type {
2
- AppConfig,
3
- AppConfigResult,
4
- AppScanResult,
5
- DeepPartial,
6
- LibConfig,
7
- LibConfigResult,
8
- RunnerProps,
9
- } from "@akanjs/config";
10
1
  import fs from "fs";
11
- import type { NextConfig } from "next";
12
2
  import path from "path";
13
-
14
3
  import { getBaseConfigEnv } from "./baseConfigEnv";
15
4
  import { withBase } from "./nextConfig";
16
-
17
- export const makeAppConfig = (
18
- config: DeepPartial<AppConfigResult>,
19
- props: Partial<RunnerProps> = {}
20
- ): AppConfigResult => {
5
+ const makeAppConfig = (config, props = {}) => {
21
6
  const baseConfigEnv = getBaseConfigEnv(props.appName);
22
7
  const {
23
8
  appName = baseConfigEnv.appName,
24
9
  repoName = baseConfigEnv.repoName,
25
10
  serveDomain = baseConfigEnv.serveDomain,
26
11
  env = baseConfigEnv.env,
27
- command = "build",
12
+ command = "build"
28
13
  } = props;
29
14
  return {
30
15
  rootLib: config.rootLib,
31
16
  libs: config.libs ?? [],
32
17
  backend: {
33
- dockerfile:
34
- config.backend?.dockerfile ??
35
- `FROM node:22-slim
18
+ dockerfile: config.backend?.dockerfile ?? `FROM node:22-slim
36
19
  RUN ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
37
20
  RUN apt-get update && apt-get upgrade -y
38
21
  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
39
22
  ARG TARGETARCH
40
- RUN if [ "$TARGETARCH" = "amd64" ]; then \
41
- wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-debian92-x86_64-100.3.1.deb && \
42
- apt-get install -y ./mongodb-database-tools-*.deb && \
43
- rm -f mongodb-database-tools-*.deb; \
44
- fi
23
+ 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
45
24
  RUN apt-get install -y git redis build-essential python3
46
25
  RUN rm -rf /var/lib/apt/lists/*
47
26
  RUN mkdir -p /workspace
@@ -57,12 +36,10 @@ ENV NEXT_PUBLIC_APP_NAME=${appName}
57
36
  ENV NEXT_PUBLIC_ENV=${env}
58
37
  ENV NEXT_PUBLIC_OPERATION_MODE=cloud
59
38
  CMD ["node", "main.js"]`,
60
- explicitDependencies: (config.backend?.explicitDependencies as string[] | undefined) ?? ([] as string[]),
39
+ explicitDependencies: config.backend?.explicitDependencies ?? []
61
40
  },
62
41
  frontend: {
63
- dockerfile:
64
- config.frontend?.dockerfile ??
65
- `FROM node:22-alpine
42
+ dockerfile: config.frontend?.dockerfile ?? `FROM node:22-alpine
66
43
  RUN ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
67
44
  RUN apk --no-cache add git
68
45
  RUN mkdir -p /workspace
@@ -80,62 +57,60 @@ ENV NEXT_PUBLIC_OPERATION_MODE=cloud
80
57
  CMD ["npm", "start"]`,
81
58
  nextConfig: withBase(
82
59
  appName,
83
- config.frontend?.nextConfig
84
- ? typeof config.frontend.nextConfig === "function"
85
- ? (config.frontend as { nextConfig: () => NextConfig }).nextConfig()
86
- : config.frontend.nextConfig
87
- : {},
60
+ config.frontend?.nextConfig ? typeof config.frontend.nextConfig === "function" ? config.frontend.nextConfig() : config.frontend.nextConfig : {},
88
61
  config.libs ?? [],
89
62
  config.frontend?.routes
90
63
  ),
91
- explicitDependencies: (config.frontend?.explicitDependencies as string[] | undefined) ?? ([] as string[]),
92
- },
64
+ explicitDependencies: config.frontend?.explicitDependencies ?? []
65
+ }
93
66
  };
94
67
  };
95
-
96
- export const getAppConfig = async (appRoot: string, props: RunnerProps): Promise<AppConfigResult> => {
68
+ const getAppConfig = async (appRoot, props) => {
97
69
  const akanConfigPath = path.join(appRoot, "akan.config.ts");
98
- if (!fs.existsSync(akanConfigPath)) throw new Error(`application akan.config.ts is not found ${appRoot}`);
99
- const configImp = ((await import(`${appRoot}/akan.config.ts`)) as { default: AppConfig }).default;
70
+ if (!fs.existsSync(akanConfigPath))
71
+ throw new Error(`application akan.config.ts is not found ${appRoot}`);
72
+ const configImp = (await import(`${appRoot}/akan.config.ts`)).default;
100
73
  const config = typeof configImp === "function" ? configImp(props) : configImp;
101
74
  return makeAppConfig(config, props);
102
75
  };
103
-
104
- export const makeLibConfig = (
105
- config: DeepPartial<LibConfigResult>,
106
- props: Partial<RunnerProps> = {}
107
- ): LibConfigResult => {
76
+ const makeLibConfig = (config, props = {}) => {
108
77
  return {
109
78
  rootLib: config.rootLib,
110
79
  libs: config.libs ?? [],
111
80
  backend: {
112
- explicitDependencies: (config.backend?.explicitDependencies as string[] | undefined) ?? ([] as string[]),
81
+ explicitDependencies: config.backend?.explicitDependencies ?? []
113
82
  },
114
83
  frontend: {
115
- explicitDependencies: (config.frontend?.explicitDependencies as string[] | undefined) ?? ([] as string[]),
116
- },
84
+ explicitDependencies: config.frontend?.explicitDependencies ?? []
85
+ }
117
86
  };
118
87
  };
119
-
120
- export const getLibConfig = async (libRoot: string, props: RunnerProps): Promise<LibConfigResult> => {
88
+ const getLibConfig = async (libRoot, props) => {
121
89
  const akanConfigPath = path.join(libRoot, "akan.config.ts");
122
- if (!fs.existsSync(akanConfigPath)) throw new Error(`library akan.config.ts is not found ${libRoot}`);
123
- const configImp = ((await import(`${libRoot}/akan.config.ts`)) as { default: LibConfig }).default;
90
+ if (!fs.existsSync(akanConfigPath))
91
+ throw new Error(`library akan.config.ts is not found ${libRoot}`);
92
+ const configImp = (await import(`${libRoot}/akan.config.ts`)).default;
124
93
  const config = typeof configImp === "function" ? configImp(props) : configImp;
125
94
  return makeLibConfig(config, props);
126
95
  };
127
-
128
- export const getNextConfig = (configImp: AppConfig, appData: any) => {
129
- const appInfo = appData as AppScanResult;
96
+ const getNextConfig = (configImp, appData) => {
97
+ const appInfo = appData;
130
98
  const baseConfigEnv = getBaseConfigEnv(appInfo.name);
131
- const props: RunnerProps = {
99
+ const props = {
132
100
  appName: baseConfigEnv.appName,
133
101
  repoName: baseConfigEnv.repoName,
134
102
  serveDomain: baseConfigEnv.serveDomain,
135
103
  env: baseConfigEnv.env,
136
- command: "build",
104
+ command: "build"
137
105
  };
138
106
  const config = typeof configImp === "function" ? configImp(props) : configImp;
139
107
  const akanConfig = makeAppConfig(config, props);
140
108
  return akanConfig.frontend.nextConfig;
141
109
  };
110
+ export {
111
+ getAppConfig,
112
+ getLibConfig,
113
+ getNextConfig,
114
+ makeAppConfig,
115
+ makeLibConfig
116
+ };
@@ -0,0 +1,36 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var baseConfigEnv_exports = {};
19
+ __export(baseConfigEnv_exports, {
20
+ getBaseConfigEnv: () => getBaseConfigEnv
21
+ });
22
+ module.exports = __toCommonJS(baseConfigEnv_exports);
23
+ const getBaseConfigEnv = (appName = process.env.NEXT_PUBLIC_APP_NAME) => {
24
+ if (!appName)
25
+ throw new Error("NEXT_PUBLIC_APP_NAME is not set");
26
+ const repoName = process.env.NEXT_PUBLIC_REPO_NAME;
27
+ if (!repoName)
28
+ throw new Error("NEXT_PUBLIC_REPO_NAME is not set");
29
+ const serveDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN;
30
+ if (!serveDomain)
31
+ throw new Error("NEXT_PUBLIC_SERVE_DOMAIN is not set");
32
+ const env = process.env.NEXT_PUBLIC_ENV ?? "debug";
33
+ if (!env)
34
+ throw new Error("NEXT_PUBLIC_ENV is not set");
35
+ return { appName, repoName, serveDomain, env };
36
+ };
@@ -0,0 +1,17 @@
1
+ const getBaseConfigEnv = (appName = process.env.NEXT_PUBLIC_APP_NAME) => {
2
+ if (!appName)
3
+ throw new Error("NEXT_PUBLIC_APP_NAME is not set");
4
+ const repoName = process.env.NEXT_PUBLIC_REPO_NAME;
5
+ if (!repoName)
6
+ throw new Error("NEXT_PUBLIC_REPO_NAME is not set");
7
+ const serveDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN;
8
+ if (!serveDomain)
9
+ throw new Error("NEXT_PUBLIC_SERVE_DOMAIN is not set");
10
+ const env = process.env.NEXT_PUBLIC_ENV ?? "debug";
11
+ if (!env)
12
+ throw new Error("NEXT_PUBLIC_ENV is not set");
13
+ return { appName, repoName, serveDomain, env };
14
+ };
15
+ export {
16
+ getBaseConfigEnv
17
+ };
@@ -0,0 +1,185 @@
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 nextConfig_exports = {};
29
+ __export(nextConfig_exports, {
30
+ composePlugins: () => composePlugins,
31
+ defaultNextConfigFile: () => defaultNextConfigFile,
32
+ withBase: () => withBase
33
+ });
34
+ module.exports = __toCommonJS(nextConfig_exports);
35
+ var import_bundle_analyzer = __toESM(require("@next/bundle-analyzer"));
36
+ var import_next_pwa = __toESM(require("next-pwa"));
37
+ var import_cache = __toESM(require("next-pwa/cache"));
38
+ var import_path = __toESM(require("path"));
39
+ const composePlugins = (...plugins) => {
40
+ return function(baseConfig) {
41
+ return async function combined(phase, context) {
42
+ let config = baseConfig;
43
+ for (const plugin of plugins) {
44
+ const fn = plugin;
45
+ const configOrFn = fn(config);
46
+ if (typeof configOrFn === "function")
47
+ config = await configOrFn(phase, context);
48
+ else
49
+ config = configOrFn;
50
+ }
51
+ return config;
52
+ };
53
+ };
54
+ };
55
+ const commandType = process.env.AKAN_COMMAND_TYPE?.includes("serve") ? "serve" : process.env.AKAN_COMMAND_TYPE?.includes("build") ? "build" : "deploy";
56
+ const withPWA = (0, import_next_pwa.default)({
57
+ dest: "public",
58
+ register: true,
59
+ skipWaiting: true,
60
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
61
+ runtimeCaching: import_cache.default,
62
+ disable: commandType === "serve"
63
+ });
64
+ const devDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN ?? "akanjs.com";
65
+ const withBase = (appName, config, libs, routes = []) => {
66
+ return composePlugins(
67
+ (0, import_bundle_analyzer.default)({ enabled: process.env.ANALYZE === "true" }),
68
+ ...commandType !== "serve" || process.env.USE_PWA === "true" ? [withPWA] : []
69
+ )({
70
+ ...config,
71
+ eslint: { ...config.eslint, ignoreDuringBuilds: true },
72
+ env: {
73
+ ...config.env,
74
+ basePaths: routes.map(({ basePath }) => basePath).join(",")
75
+ },
76
+ transpilePackages: ["swiper", "ssr-window", "dom7"],
77
+ reactStrictMode: commandType === "serve" ? false : true,
78
+ experimental: {
79
+ ...config.experimental ?? {},
80
+ optimizePackageImports: [
81
+ ...[appName, ...libs].map((lib) => [`@${lib}/ui`, `@${lib}/next`, `@${lib}/common`, `@${lib}/client`]).flat(),
82
+ "@contract",
83
+ "@akanjs/next",
84
+ "@akanjs/common"
85
+ ]
86
+ },
87
+ // modularizeImports: {
88
+ // "react-icons/?(((\\w*)?/?)*)": {
89
+ // transform: "@react-icons/all-files/{{ matches.[1] }}/{{member}}",
90
+ // skipDefaultConversion: true,
91
+ // },
92
+ // lodash: { transform: "lodash/{{member}}", preventFullImport: true },
93
+ // ...Object.fromEntries(
94
+ // [appName, ...libs].reduce(
95
+ // (acc, lib) => [
96
+ // ...acc,
97
+ // [`@${lib}/ui`, { transform: `@${lib}/ui/{{member}}`, skipDefaultConversion: true }],
98
+ // [`@${lib}/next`, { transform: `@${lib}/next/{{member}}`, skipDefaultConversion: true }],
99
+ // [`@${lib}/common`, { transform: `@${lib}/common/{{member}}`, skipDefaultConversion: true }],
100
+ // [`@${lib}/client`, { transform: `@${lib}/lib/{{ camelCase member }}`, skipDefaultConversion: true }],
101
+ // ],
102
+ // [
103
+ // ["@contract", { transform: `@contract/src/{{member}}`, skipDefaultConversion: true }],
104
+ // [`@akanjs/next`, { transform: `@akanjs/next/src/{{member}}`, skipDefaultConversion: true }],
105
+ // [`@akanjs/common`, { transform: `@akanjs/common/src/{{member}}`, skipDefaultConversion: true }],
106
+ // ]
107
+ // )
108
+ // ),
109
+ // ...(config.modularizeImports ?? {}),
110
+ // },
111
+ images: {
112
+ formats: ["image/avif", "image/webp"],
113
+ ...config.images ?? {},
114
+ remotePatterns: [
115
+ ...config.images?.remotePatterns ?? [],
116
+ ...routes.map(({ domains }) => [
117
+ ...domains.main?.map((domain) => ({ protocol: "https", hostname: `**.${domain}` })) ?? [],
118
+ ...domains.develop?.map((domain) => ({ protocol: "https", hostname: `**.${domain}` })) ?? [],
119
+ ...domains.debug?.map((domain) => ({ protocol: "https", hostname: `**.${domain}` })) ?? []
120
+ ]).flat(),
121
+ { protocol: "https", hostname: `**.${devDomain}` }
122
+ ]
123
+ },
124
+ webpack: (config2) => {
125
+ config2.resolve.alias.canvas = false;
126
+ config2.resolve.alias.encoding = false;
127
+ if (process.env.USE_AKANJS_PKGS === "true")
128
+ config2.resolve.alias["@akanjs/config"] = import_path.default.resolve(__dirname, "../../../../pkgs/@akanjs/config");
129
+ return config2;
130
+ },
131
+ turbopack: {
132
+ resolveAlias: {
133
+ // canvas: false,
134
+ // encoding: false,
135
+ ...process.env.USE_AKANJS_PKGS === "true" ? { "@akanjs/config": import_path.default.resolve(__dirname, "../../../../pkgs/@akanjs/config") } : {},
136
+ ...config.turbopack?.resolveAlias ?? {}
137
+ }
138
+ },
139
+ redirects() {
140
+ return routes.map(({ basePath, domains }) => [
141
+ { basePath, domain: `${basePath}-debug.${devDomain}` },
142
+ { basePath, domain: `${basePath}-develop.${devDomain}` },
143
+ { basePath, domain: `${basePath}-main.${devDomain}` },
144
+ ...domains.main?.map((domain) => ({ basePath, domain })) ?? [],
145
+ ...domains.develop?.map((domain) => ({ basePath, domain })) ?? [],
146
+ ...domains.debug?.map((domain) => ({ basePath, domain })) ?? []
147
+ ]).flat().map(({ basePath, domain }) => ({
148
+ source: `/:locale/${basePath}/:path*`,
149
+ has: [{ type: "host", value: domain }],
150
+ permanent: true,
151
+ destination: "/:locale/:path*"
152
+ }));
153
+ },
154
+ rewrites() {
155
+ return routes.map(({ basePath, domains }) => [
156
+ { basePath, domain: `${basePath}-debug.${devDomain}` },
157
+ { basePath, domain: `${basePath}-develop.${devDomain}` },
158
+ { basePath, domain: `${basePath}-main.${devDomain}` },
159
+ ...domains.main?.map((domain) => ({ basePath, domain })) ?? [],
160
+ ...domains.develop?.map((domain) => ({ basePath, domain })) ?? [],
161
+ ...domains.debug?.map((domain) => ({ basePath, domain })) ?? []
162
+ ]).flat().map(({ basePath, domain }) => [
163
+ {
164
+ source: "/:locale",
165
+ has: [{ type: "host", value: domain }],
166
+ destination: `/:locale/${basePath}`
167
+ },
168
+ {
169
+ source: `/:locale/:path((?!${basePath}$)(?!admin(?:/|$)).*)`,
170
+ has: [{ type: "host", value: domain }],
171
+ destination: `/:locale/${basePath}/:path*`
172
+ }
173
+ ]).flat();
174
+ }
175
+ });
176
+ };
177
+ const defaultNextConfigFile = `import "tsconfig-paths/register";
178
+
179
+ import { getNextConfig } from "@akanjs/config";
180
+
181
+ import appInfo from "./akan.app.json";
182
+ import config from "./akan.config";
183
+
184
+ export default getNextConfig(config, appInfo);
185
+ `;