@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.
@@ -0,0 +1,156 @@
1
+ import withAnalyze from "@next/bundle-analyzer";
2
+ import pwa from "next-pwa";
3
+ import runtimeCaching from "next-pwa/cache";
4
+ import path from "path";
5
+ const composePlugins = (...plugins) => {
6
+ return function(baseConfig) {
7
+ return async function combined(phase, context) {
8
+ let config = baseConfig;
9
+ for (const plugin of plugins) {
10
+ const fn = plugin;
11
+ const configOrFn = fn(config);
12
+ if (typeof configOrFn === "function")
13
+ config = await configOrFn(phase, context);
14
+ else
15
+ config = configOrFn;
16
+ }
17
+ return config;
18
+ };
19
+ };
20
+ };
21
+ const commandType = process.env.AKAN_COMMAND_TYPE?.includes("serve") ? "serve" : process.env.AKAN_COMMAND_TYPE?.includes("build") ? "build" : "deploy";
22
+ const withPWA = pwa({
23
+ dest: "public",
24
+ register: true,
25
+ skipWaiting: true,
26
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
27
+ runtimeCaching,
28
+ disable: commandType === "serve"
29
+ });
30
+ const devDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN ?? "akanjs.com";
31
+ const withBase = (appName, config, libs, routes = []) => {
32
+ return composePlugins(
33
+ withAnalyze({ enabled: process.env.ANALYZE === "true" }),
34
+ ...commandType !== "serve" || process.env.USE_PWA === "true" ? [withPWA] : []
35
+ )({
36
+ ...config,
37
+ eslint: { ...config.eslint, ignoreDuringBuilds: true },
38
+ env: {
39
+ ...config.env,
40
+ basePaths: routes.map(({ basePath }) => basePath).join(",")
41
+ },
42
+ transpilePackages: ["swiper", "ssr-window", "dom7"],
43
+ reactStrictMode: commandType === "serve" ? false : true,
44
+ experimental: {
45
+ ...config.experimental ?? {},
46
+ optimizePackageImports: [
47
+ ...[appName, ...libs].map((lib) => [`@${lib}/ui`, `@${lib}/next`, `@${lib}/common`, `@${lib}/client`]).flat(),
48
+ "@contract",
49
+ "@akanjs/next",
50
+ "@akanjs/common"
51
+ ]
52
+ },
53
+ // modularizeImports: {
54
+ // "react-icons/?(((\\w*)?/?)*)": {
55
+ // transform: "@react-icons/all-files/{{ matches.[1] }}/{{member}}",
56
+ // skipDefaultConversion: true,
57
+ // },
58
+ // lodash: { transform: "lodash/{{member}}", preventFullImport: true },
59
+ // ...Object.fromEntries(
60
+ // [appName, ...libs].reduce(
61
+ // (acc, lib) => [
62
+ // ...acc,
63
+ // [`@${lib}/ui`, { transform: `@${lib}/ui/{{member}}`, skipDefaultConversion: true }],
64
+ // [`@${lib}/next`, { transform: `@${lib}/next/{{member}}`, skipDefaultConversion: true }],
65
+ // [`@${lib}/common`, { transform: `@${lib}/common/{{member}}`, skipDefaultConversion: true }],
66
+ // [`@${lib}/client`, { transform: `@${lib}/lib/{{ camelCase member }}`, skipDefaultConversion: true }],
67
+ // ],
68
+ // [
69
+ // ["@contract", { transform: `@contract/src/{{member}}`, skipDefaultConversion: true }],
70
+ // [`@akanjs/next`, { transform: `@akanjs/next/src/{{member}}`, skipDefaultConversion: true }],
71
+ // [`@akanjs/common`, { transform: `@akanjs/common/src/{{member}}`, skipDefaultConversion: true }],
72
+ // ]
73
+ // )
74
+ // ),
75
+ // ...(config.modularizeImports ?? {}),
76
+ // },
77
+ images: {
78
+ formats: ["image/avif", "image/webp"],
79
+ ...config.images ?? {},
80
+ remotePatterns: [
81
+ ...config.images?.remotePatterns ?? [],
82
+ ...routes.map(({ domains }) => [
83
+ ...domains.main?.map((domain) => ({ protocol: "https", hostname: `**.${domain}` })) ?? [],
84
+ ...domains.develop?.map((domain) => ({ protocol: "https", hostname: `**.${domain}` })) ?? [],
85
+ ...domains.debug?.map((domain) => ({ protocol: "https", hostname: `**.${domain}` })) ?? []
86
+ ]).flat(),
87
+ { protocol: "https", hostname: `**.${devDomain}` }
88
+ ]
89
+ },
90
+ webpack: (config2) => {
91
+ config2.resolve.alias.canvas = false;
92
+ config2.resolve.alias.encoding = false;
93
+ if (process.env.USE_AKANJS_PKGS === "true")
94
+ config2.resolve.alias["@akanjs/config"] = path.resolve(__dirname, "../../../../pkgs/@akanjs/config");
95
+ return config2;
96
+ },
97
+ turbopack: {
98
+ resolveAlias: {
99
+ // canvas: false,
100
+ // encoding: false,
101
+ ...process.env.USE_AKANJS_PKGS === "true" ? { "@akanjs/config": path.resolve(__dirname, "../../../../pkgs/@akanjs/config") } : {},
102
+ ...config.turbopack?.resolveAlias ?? {}
103
+ }
104
+ },
105
+ redirects() {
106
+ return routes.map(({ basePath, domains }) => [
107
+ { basePath, domain: `${basePath}-debug.${devDomain}` },
108
+ { basePath, domain: `${basePath}-develop.${devDomain}` },
109
+ { basePath, domain: `${basePath}-main.${devDomain}` },
110
+ ...domains.main?.map((domain) => ({ basePath, domain })) ?? [],
111
+ ...domains.develop?.map((domain) => ({ basePath, domain })) ?? [],
112
+ ...domains.debug?.map((domain) => ({ basePath, domain })) ?? []
113
+ ]).flat().map(({ basePath, domain }) => ({
114
+ source: `/:locale/${basePath}/:path*`,
115
+ has: [{ type: "host", value: domain }],
116
+ permanent: true,
117
+ destination: "/:locale/:path*"
118
+ }));
119
+ },
120
+ rewrites() {
121
+ return routes.map(({ basePath, domains }) => [
122
+ { basePath, domain: `${basePath}-debug.${devDomain}` },
123
+ { basePath, domain: `${basePath}-develop.${devDomain}` },
124
+ { basePath, domain: `${basePath}-main.${devDomain}` },
125
+ ...domains.main?.map((domain) => ({ basePath, domain })) ?? [],
126
+ ...domains.develop?.map((domain) => ({ basePath, domain })) ?? [],
127
+ ...domains.debug?.map((domain) => ({ basePath, domain })) ?? []
128
+ ]).flat().map(({ basePath, domain }) => [
129
+ {
130
+ source: "/:locale",
131
+ has: [{ type: "host", value: domain }],
132
+ destination: `/:locale/${basePath}`
133
+ },
134
+ {
135
+ source: `/:locale/:path((?!${basePath}$)(?!admin(?:/|$)).*)`,
136
+ has: [{ type: "host", value: domain }],
137
+ destination: `/:locale/${basePath}/:path*`
138
+ }
139
+ ]).flat();
140
+ }
141
+ });
142
+ };
143
+ const defaultNextConfigFile = `import "tsconfig-paths/register";
144
+
145
+ import { getNextConfig } from "@akanjs/config";
146
+
147
+ import appInfo from "./akan.app.json";
148
+ import config from "./akan.config";
149
+
150
+ export default getNextConfig(config, appInfo);
151
+ `;
152
+ export {
153
+ composePlugins,
154
+ defaultNextConfigFile,
155
+ withBase
156
+ };
package/src/types.d.ts ADDED
@@ -0,0 +1,130 @@
1
+ import type { NextConfig } from "next";
2
+ export interface RunnerProps {
3
+ appName: string;
4
+ repoName: string;
5
+ serveDomain: string;
6
+ env: "testing" | "debug" | "develop" | "main";
7
+ command?: string;
8
+ }
9
+ export type Arch = "amd64" | "arm64";
10
+ export type ExplicitDependencies = string[] | {
11
+ [key in Arch]: string[];
12
+ };
13
+ export interface AppConfigResult {
14
+ rootLib?: string;
15
+ libs: string[];
16
+ backend: {
17
+ dockerfile: string;
18
+ explicitDependencies: ExplicitDependencies;
19
+ };
20
+ frontend: {
21
+ dockerfile: string;
22
+ nextConfig: NextConfig | (() => Promise<NextConfig> | NextConfig);
23
+ routes?: {
24
+ basePath?: string;
25
+ domains: {
26
+ main?: string[];
27
+ develop?: string[];
28
+ debug?: string[];
29
+ };
30
+ }[];
31
+ explicitDependencies: ExplicitDependencies;
32
+ };
33
+ }
34
+ export interface LibConfigResult {
35
+ rootLib?: string;
36
+ libs: string[];
37
+ backend: {
38
+ explicitDependencies: ExplicitDependencies;
39
+ };
40
+ frontend: {
41
+ explicitDependencies: ExplicitDependencies;
42
+ };
43
+ }
44
+ export type DeepPartial<T> = {
45
+ [P in keyof T]?: T[P] extends any[] ? T[P] : T[P] extends object ? DeepPartial<T[P]> : T[P];
46
+ };
47
+ export type AppConfig = DeepPartial<AppConfigResult> | ((props: RunnerProps) => DeepPartial<AppConfigResult>);
48
+ export type LibConfig = DeepPartial<LibConfigResult> | ((props: RunnerProps) => DeepPartial<LibConfigResult>);
49
+ export interface AkanConfigFile {
50
+ default: NextConfig;
51
+ }
52
+ export interface FileConventionScanResult {
53
+ constants: {
54
+ databases: string[];
55
+ scalars: string[];
56
+ };
57
+ dictionary: {
58
+ databases: string[];
59
+ services: string[];
60
+ scalars: string[];
61
+ };
62
+ documents: {
63
+ databases: string[];
64
+ scalars: string[];
65
+ };
66
+ services: {
67
+ databases: string[];
68
+ services: string[];
69
+ scalars: string[];
70
+ };
71
+ signal: {
72
+ databases: string[];
73
+ services: string[];
74
+ scalars: string[];
75
+ };
76
+ store: {
77
+ databases: string[];
78
+ services: string[];
79
+ scalars: string[];
80
+ };
81
+ components: {
82
+ databases: string[];
83
+ services: string[];
84
+ scalars: string[];
85
+ };
86
+ }
87
+ export declare const getDefaultFileScan: () => FileConventionScanResult;
88
+ export interface AppScanResult {
89
+ name: string;
90
+ type: "app" | "lib";
91
+ akanConfig: AppConfigResult;
92
+ files: FileConventionScanResult;
93
+ libDeps: string[];
94
+ pkgDeps: string[];
95
+ dependencies: string[];
96
+ libs: {
97
+ [key: string]: LibScanResult;
98
+ };
99
+ }
100
+ export interface LibScanResult {
101
+ name: string;
102
+ type: "app" | "lib";
103
+ akanConfig: LibConfigResult;
104
+ files: FileConventionScanResult;
105
+ libDeps: string[];
106
+ pkgDeps: string[];
107
+ dependencies: string[];
108
+ libs: {
109
+ [key: string]: LibScanResult;
110
+ };
111
+ }
112
+ export interface PkgScanResult {
113
+ name: string;
114
+ pkgDeps: string[];
115
+ dependencies: string[];
116
+ }
117
+ export interface WorkspaceScanResult {
118
+ appNames: string[];
119
+ libNames: string[];
120
+ pkgNames: string[];
121
+ apps: {
122
+ [key: string]: AppScanResult;
123
+ };
124
+ libs: {
125
+ [key: string]: LibScanResult;
126
+ };
127
+ pkgs: {
128
+ [key: string]: PkgScanResult;
129
+ };
130
+ }
package/src/types.js ADDED
@@ -0,0 +1,57 @@
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 types_exports = {};
19
+ __export(types_exports, {
20
+ getDefaultFileScan: () => getDefaultFileScan
21
+ });
22
+ module.exports = __toCommonJS(types_exports);
23
+ const getDefaultFileScan = () => ({
24
+ constants: {
25
+ databases: [],
26
+ scalars: []
27
+ },
28
+ dictionary: {
29
+ databases: [],
30
+ services: [],
31
+ scalars: []
32
+ },
33
+ documents: {
34
+ databases: [],
35
+ scalars: []
36
+ },
37
+ services: {
38
+ databases: [],
39
+ services: [],
40
+ scalars: []
41
+ },
42
+ signal: {
43
+ databases: [],
44
+ services: [],
45
+ scalars: []
46
+ },
47
+ store: {
48
+ databases: [],
49
+ services: [],
50
+ scalars: []
51
+ },
52
+ components: {
53
+ databases: [],
54
+ services: [],
55
+ scalars: []
56
+ }
57
+ });
package/src/types.mjs ADDED
@@ -0,0 +1,38 @@
1
+ const getDefaultFileScan = () => ({
2
+ constants: {
3
+ databases: [],
4
+ scalars: []
5
+ },
6
+ dictionary: {
7
+ databases: [],
8
+ services: [],
9
+ scalars: []
10
+ },
11
+ documents: {
12
+ databases: [],
13
+ scalars: []
14
+ },
15
+ services: {
16
+ databases: [],
17
+ services: [],
18
+ scalars: []
19
+ },
20
+ signal: {
21
+ databases: [],
22
+ services: [],
23
+ scalars: []
24
+ },
25
+ store: {
26
+ databases: [],
27
+ services: [],
28
+ scalars: []
29
+ },
30
+ components: {
31
+ databases: [],
32
+ services: [],
33
+ scalars: []
34
+ }
35
+ });
36
+ export {
37
+ getDefaultFileScan
38
+ };
@@ -63,7 +63,7 @@ a {
63
63
  font-weight: normal;
64
64
  }
65
65
  .page-content {
66
- @apply overflow-y-auto h-screen;
66
+ @apply h-screen overflow-y-auto;
67
67
  }
68
68
 
69
69
  @property --percentage {
@@ -1,21 +0,0 @@
1
- interface BaseConfigEnv {
2
- appName: string;
3
- repoName: string;
4
- serveDomain: string;
5
- env: "testing" | "debug" | "develop" | "main";
6
- }
7
-
8
- export const getBaseConfigEnv = (appName = process.env.NEXT_PUBLIC_APP_NAME): BaseConfigEnv => {
9
- if (!appName) throw new Error("NEXT_PUBLIC_APP_NAME is not set");
10
-
11
- const repoName = process.env.NEXT_PUBLIC_REPO_NAME;
12
- if (!repoName) throw new Error("NEXT_PUBLIC_REPO_NAME is not set");
13
-
14
- const serveDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN;
15
- if (!serveDomain) throw new Error("NEXT_PUBLIC_SERVE_DOMAIN is not set");
16
-
17
- const env = (process.env.NEXT_PUBLIC_ENV ?? "debug") as "testing" | "debug" | "develop" | "main" | undefined;
18
- if (!env) throw new Error("NEXT_PUBLIC_ENV is not set");
19
-
20
- return { appName, repoName, serveDomain, env };
21
- };
@@ -1,39 +0,0 @@
1
- import type { 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.NEXT_PUBLIC_APP_NAME;
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}`,
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/nextConfig.ts DELETED
@@ -1,174 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-unsafe-member-access */
2
- import withAnalyze from "@next/bundle-analyzer";
3
- import type { NextConfig } from "next";
4
- import pwa from "next-pwa";
5
- import runtimeCaching from "next-pwa/cache";
6
- import path from "path";
7
-
8
- export type NextConfigFn = (phase: string, context?: any) => Promise<NextConfig> | NextConfig;
9
-
10
- export type NextPlugin = (config: NextConfig) => NextConfig;
11
-
12
- export type NextPluginThatReturnsConfigFn = (config: NextConfig) => NextConfigFn;
13
-
14
- export const composePlugins = (
15
- ...plugins: (NextPlugin | NextPluginThatReturnsConfigFn)[]
16
- ): ((baseConfig: NextConfig) => NextConfigFn) => {
17
- return function (baseConfig: NextConfig) {
18
- return async function combined(phase: string, context: any): Promise<NextConfig> {
19
- let config = baseConfig;
20
- for (const plugin of plugins) {
21
- const fn = plugin;
22
- const configOrFn = fn(config);
23
- if (typeof configOrFn === "function") config = await configOrFn(phase, context);
24
- else config = configOrFn;
25
- }
26
- return config;
27
- };
28
- };
29
- };
30
-
31
- const commandType = process.env.AKAN_COMMAND_TYPE?.includes("serve")
32
- ? "serve"
33
- : process.env.AKAN_COMMAND_TYPE?.includes("build")
34
- ? "build"
35
- : "deploy";
36
- const withPWA = pwa({
37
- dest: "public",
38
- register: true,
39
- skipWaiting: true,
40
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
41
- runtimeCaching,
42
- disable: commandType === "serve",
43
- });
44
- const devDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN ?? "akanjs.com";
45
-
46
- export const withBase = (
47
- appName: string,
48
- config: NextConfig,
49
- libs: string[],
50
- routes: { basePath?: string; domains: { main?: string[]; develop?: string[]; debug?: string[] } }[] = []
51
- ) => {
52
- return composePlugins(
53
- withAnalyze({ enabled: process.env.ANALYZE === "true" }) as unknown as NextPlugin,
54
- ...(commandType !== "serve" || process.env.USE_PWA === "true" ? [withPWA as unknown as NextPlugin] : [])
55
- )({
56
- ...config,
57
- eslint: { ...config.eslint, ignoreDuringBuilds: true },
58
- env: {
59
- ...config.env,
60
- basePaths: routes.map(({ basePath }) => basePath).join(","),
61
- },
62
- transpilePackages: ["swiper", "ssr-window", "dom7"],
63
- reactStrictMode: commandType === "serve" ? false : true,
64
- experimental: {
65
- ...(config.experimental ?? {}),
66
- optimizePackageImports: [
67
- ...[appName, ...libs].map((lib) => [`@${lib}/ui`, `@${lib}/next`, `@${lib}/common`, `@${lib}/client`]).flat(),
68
- "@contract",
69
- "@akanjs/next",
70
- "@akanjs/common",
71
- ],
72
- },
73
- // modularizeImports: {
74
- // "react-icons/?(((\\w*)?/?)*)": {
75
- // transform: "@react-icons/all-files/{{ matches.[1] }}/{{member}}",
76
- // skipDefaultConversion: true,
77
- // },
78
- // lodash: { transform: "lodash/{{member}}", preventFullImport: true },
79
- // ...Object.fromEntries(
80
- // [appName, ...libs].reduce(
81
- // (acc, lib) => [
82
- // ...acc,
83
- // [`@${lib}/ui`, { transform: `@${lib}/ui/{{member}}`, skipDefaultConversion: true }],
84
- // [`@${lib}/next`, { transform: `@${lib}/next/{{member}}`, skipDefaultConversion: true }],
85
- // [`@${lib}/common`, { transform: `@${lib}/common/{{member}}`, skipDefaultConversion: true }],
86
- // [`@${lib}/client`, { transform: `@${lib}/lib/{{ camelCase member }}`, skipDefaultConversion: true }],
87
- // ],
88
- // [
89
- // ["@contract", { transform: `@contract/src/{{member}}`, skipDefaultConversion: true }],
90
- // [`@akanjs/next`, { transform: `@akanjs/next/src/{{member}}`, skipDefaultConversion: true }],
91
- // [`@akanjs/common`, { transform: `@akanjs/common/src/{{member}}`, skipDefaultConversion: true }],
92
- // ]
93
- // )
94
- // ),
95
- // ...(config.modularizeImports ?? {}),
96
- // },
97
- images: {
98
- formats: ["image/avif", "image/webp"],
99
- ...(config.images ?? {}),
100
- remotePatterns: [
101
- ...(config.images?.remotePatterns ?? []),
102
- ...routes
103
- .map(({ domains }) => [
104
- ...(domains.main?.map((domain) => ({ protocol: "https", hostname: `**.${domain}` })) ?? []),
105
- ...(domains.develop?.map((domain) => ({ protocol: "https", hostname: `**.${domain}` })) ?? []),
106
- ...(domains.debug?.map((domain) => ({ protocol: "https", hostname: `**.${domain}` })) ?? []),
107
- ])
108
- .flat(),
109
- { protocol: "https", hostname: `**.${devDomain}` },
110
- ],
111
- },
112
- webpack: (config: NextConfig) => {
113
- // react-pdf error fix
114
- config.resolve.alias.canvas = false;
115
- config.resolve.alias.encoding = false;
116
- if (process.env.USE_AKANJS_PKGS === "true")
117
- config.resolve.alias["@akanjs/config"] = path.resolve(__dirname, "../../../../pkgs/@akanjs/config");
118
- return config;
119
- },
120
- redirects() {
121
- return routes
122
- .map(({ basePath, domains }) => [
123
- { basePath, domain: `${basePath}-debug.${devDomain}` },
124
- { basePath, domain: `${basePath}-develop.${devDomain}` },
125
- { basePath, domain: `${basePath}-main.${devDomain}` },
126
- ...(domains.main?.map((domain) => ({ basePath, domain })) ?? []),
127
- ...(domains.develop?.map((domain) => ({ basePath, domain })) ?? []),
128
- ...(domains.debug?.map((domain) => ({ basePath, domain })) ?? []),
129
- ])
130
- .flat()
131
- .map(({ basePath, domain }) => ({
132
- source: `/:locale/${basePath}/:path*`,
133
- has: [{ type: "host", value: domain }],
134
- permanent: true,
135
- destination: "/:locale/:path*",
136
- }));
137
- },
138
- rewrites() {
139
- return routes
140
- .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
- ])
148
- .flat()
149
- .map(({ basePath, domain }) => [
150
- {
151
- source: "/:locale",
152
- has: [{ type: "host", value: domain }],
153
- destination: `/:locale/${basePath}`,
154
- },
155
- {
156
- source: `/:locale/:path((?!${basePath}$)(?!admin(?:/|$)).*)`,
157
- has: [{ type: "host", value: domain }],
158
- destination: `/:locale/${basePath}/:path*`,
159
- },
160
- ])
161
- .flat();
162
- },
163
- } as unknown as NextConfig);
164
- };
165
-
166
- export const defaultNextConfigFile = `import "tsconfig-paths/register";
167
-
168
- import { getNextConfig } from "@akanjs/config";
169
-
170
- import appInfo from "./akan.app.json";
171
- import config from "./akan.config";
172
-
173
- export default getNextConfig(config, appInfo);
174
- `;