@akanjs/devkit 2.1.0-rc.10 → 2.1.0-rc.12
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.
|
@@ -132,6 +132,7 @@ describe("AkanAppConfig", () => {
|
|
|
132
132
|
react: "19.0.0",
|
|
133
133
|
"react-dom": "19.0.0",
|
|
134
134
|
"react-server-dom-webpack": "19.0.0",
|
|
135
|
+
croner: akanPackageJson.peerDependencies?.croner,
|
|
135
136
|
sharp: "1.0.0",
|
|
136
137
|
"@external/runtime": "2.0.0",
|
|
137
138
|
},
|
|
@@ -168,10 +169,45 @@ describe("AkanAppConfig", () => {
|
|
|
168
169
|
react: runtimeDependencies.react,
|
|
169
170
|
"react-dom": runtimeDependencies["react-dom"],
|
|
170
171
|
"react-server-dom-webpack": runtimeDependencies["react-server-dom-webpack"],
|
|
172
|
+
croner: runtimeDependencies.croner,
|
|
171
173
|
sharp: runtimeDependencies.sharp,
|
|
172
174
|
});
|
|
173
175
|
});
|
|
174
176
|
|
|
177
|
+
test("adds backend runtime packages by database mode", () => {
|
|
178
|
+
const runtimeDependencies = { ...akanPackageJson.dependencies, ...akanPackageJson.peerDependencies };
|
|
179
|
+
const singleConfig = new AkanAppConfig(app, [], packageJson, { defaultDatabaseMode: "single" }, baseDevEnv);
|
|
180
|
+
const multipleConfig = new AkanAppConfig(app, [], packageJson, { defaultDatabaseMode: "multiple" }, baseDevEnv);
|
|
181
|
+
const clusterConfig = new AkanAppConfig(app, [], packageJson, { defaultDatabaseMode: "cluster" }, baseDevEnv);
|
|
182
|
+
|
|
183
|
+
expect(singleConfig.getProductionPackageJson().dependencies).toMatchObject({
|
|
184
|
+
croner: runtimeDependencies.croner,
|
|
185
|
+
});
|
|
186
|
+
expect(singleConfig.getProductionPackageJson().dependencies).not.toHaveProperty("ioredis");
|
|
187
|
+
expect(singleConfig.getProductionPackageJson().dependencies).not.toHaveProperty("bullmq");
|
|
188
|
+
expect(singleConfig.getProductionPackageJson().dependencies).not.toHaveProperty("@libsql/client");
|
|
189
|
+
expect(singleConfig.getProductionPackageJson().dependencies).not.toHaveProperty("postgres");
|
|
190
|
+
expect(singleConfig.getProductionPackageJson().dependencies).not.toHaveProperty("protobufjs");
|
|
191
|
+
|
|
192
|
+
expect(multipleConfig.getProductionPackageJson().dependencies).toMatchObject({
|
|
193
|
+
"@libsql/client": runtimeDependencies["@libsql/client"],
|
|
194
|
+
bullmq: runtimeDependencies.bullmq,
|
|
195
|
+
croner: runtimeDependencies.croner,
|
|
196
|
+
ioredis: runtimeDependencies.ioredis,
|
|
197
|
+
protobufjs: runtimeDependencies.protobufjs,
|
|
198
|
+
});
|
|
199
|
+
expect(multipleConfig.getProductionPackageJson().dependencies).not.toHaveProperty("postgres");
|
|
200
|
+
|
|
201
|
+
expect(clusterConfig.getProductionPackageJson().dependencies).toMatchObject({
|
|
202
|
+
bullmq: runtimeDependencies.bullmq,
|
|
203
|
+
croner: runtimeDependencies.croner,
|
|
204
|
+
ioredis: runtimeDependencies.ioredis,
|
|
205
|
+
postgres: runtimeDependencies.postgres,
|
|
206
|
+
protobufjs: runtimeDependencies.protobufjs,
|
|
207
|
+
});
|
|
208
|
+
expect(clusterConfig.getProductionPackageJson().dependencies).not.toHaveProperty("@libsql/client");
|
|
209
|
+
});
|
|
210
|
+
|
|
175
211
|
test("normalizes multiple mobile targets and validates base paths", () => {
|
|
176
212
|
const config = new AkanAppConfig(
|
|
177
213
|
app,
|
package/akanConfig/akanConfig.ts
CHANGED
|
@@ -50,7 +50,18 @@ const DEFAULT_OPTIMIZE_IMPORTS = [
|
|
|
50
50
|
const WORKSPACE_BARREL_FACETS = ["ui", "webkit", "common", "client", "server"] as const;
|
|
51
51
|
const SSR_RUNTIME_PACKAGES = ["react", "react-dom", "react-server-dom-webpack"] as const;
|
|
52
52
|
const NATIVE_RUNTIME_PACKAGES = ["sharp"] as const;
|
|
53
|
-
const
|
|
53
|
+
const DEFAULT_BACKEND_RUNTIME_PACKAGES = ["croner"] as const;
|
|
54
|
+
const DATABASE_MODE_RUNTIME_PACKAGES = {
|
|
55
|
+
single: [],
|
|
56
|
+
multiple: ["@libsql/client", "bullmq", "ioredis", "protobufjs"],
|
|
57
|
+
cluster: ["bullmq", "ioredis", "postgres", "protobufjs"],
|
|
58
|
+
} satisfies Record<DatabaseMode, readonly string[]>;
|
|
59
|
+
const AKAN_RUNTIME_PACKAGES = new Set<string>([
|
|
60
|
+
...SSR_RUNTIME_PACKAGES,
|
|
61
|
+
...NATIVE_RUNTIME_PACKAGES,
|
|
62
|
+
...DEFAULT_BACKEND_RUNTIME_PACKAGES,
|
|
63
|
+
...Object.values(DATABASE_MODE_RUNTIME_PACKAGES).flat(),
|
|
64
|
+
]);
|
|
54
65
|
const DEFAULT_AKAN_IMAGE_CONFIG: AkanImageConfig = {
|
|
55
66
|
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
|
|
56
67
|
imageSizes: [32, 48, 64, 96, 128, 256, 384],
|
|
@@ -272,6 +283,15 @@ CMD [${command.map((c) => `"${c}"`).join(",")}]`;
|
|
|
272
283
|
if (AKAN_RUNTIME_PACKAGES.has(lib))
|
|
273
284
|
return akanPackageJson.dependencies?.[lib] ?? akanPackageJson.peerDependencies?.[lib];
|
|
274
285
|
}
|
|
286
|
+
#getProductionRuntimePackages() {
|
|
287
|
+
return [
|
|
288
|
+
...this.externalLibs,
|
|
289
|
+
...SSR_RUNTIME_PACKAGES,
|
|
290
|
+
...NATIVE_RUNTIME_PACKAGES,
|
|
291
|
+
...DEFAULT_BACKEND_RUNTIME_PACKAGES,
|
|
292
|
+
...DATABASE_MODE_RUNTIME_PACKAGES[this.defaultDatabaseMode],
|
|
293
|
+
];
|
|
294
|
+
}
|
|
275
295
|
getProductionPackageJson(data: Partial<PackageJson> = {}): PackageJson {
|
|
276
296
|
return {
|
|
277
297
|
name: this.app.name,
|
|
@@ -279,7 +299,7 @@ CMD [${command.map((c) => `"${c}"`).join(",")}]`;
|
|
|
279
299
|
version: "1.0.0",
|
|
280
300
|
main: "./main.js",
|
|
281
301
|
dependencies: Object.fromEntries(
|
|
282
|
-
[...new Set(
|
|
302
|
+
[...new Set(this.#getProductionRuntimePackages())].map((lib) => {
|
|
283
303
|
const version = this.#resolveProductionDependencyVersion(lib);
|
|
284
304
|
if (!version) throw new Error(`Dependency ${lib} not found in package.json`);
|
|
285
305
|
return [lib, version];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { AKAN_OPTIONAL_BACKEND_EXTERNALS } from "./applicationBuildRunner";
|
|
3
|
+
|
|
4
|
+
describe("ApplicationBuildRunner", () => {
|
|
5
|
+
test("externalizes Akan optional backend dependencies", () => {
|
|
6
|
+
expect(AKAN_OPTIONAL_BACKEND_EXTERNALS).toEqual(
|
|
7
|
+
expect.arrayContaining(["@libsql/client", "bullmq", "croner", "ioredis", "postgres", "protobufjs"]),
|
|
8
|
+
);
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -53,6 +53,15 @@ const SSR_RENDER_EXTERNALS = [
|
|
|
53
53
|
"react-server-dom-webpack/client.browser",
|
|
54
54
|
] as const;
|
|
55
55
|
|
|
56
|
+
export const AKAN_OPTIONAL_BACKEND_EXTERNALS = [
|
|
57
|
+
"@libsql/client",
|
|
58
|
+
"bullmq",
|
|
59
|
+
"croner",
|
|
60
|
+
"ioredis",
|
|
61
|
+
"postgres",
|
|
62
|
+
"protobufjs",
|
|
63
|
+
] as const;
|
|
64
|
+
|
|
56
65
|
export class ApplicationBuildRunner {
|
|
57
66
|
#app: App;
|
|
58
67
|
#fast: boolean;
|
|
@@ -163,7 +172,9 @@ export class ApplicationBuildRunner {
|
|
|
163
172
|
|
|
164
173
|
async #buildBackend() {
|
|
165
174
|
const akanConfig = await this.#app.getConfig();
|
|
166
|
-
const backendExternals = [
|
|
175
|
+
const backendExternals = [
|
|
176
|
+
...new Set([...akanConfig.externalLibs, ...SSR_RENDER_EXTERNALS, ...AKAN_OPTIONAL_BACKEND_EXTERNALS]),
|
|
177
|
+
];
|
|
167
178
|
const backendEntryPoints = [`${this.#app.cwdPath}/main.ts`, `${this.#app.cwdPath}/server.ts`];
|
|
168
179
|
for (const entrypoint of backendEntryPoints) {
|
|
169
180
|
if (!(await Bun.file(entrypoint).exists())) throw new Error(`Backend entrypoint not found: ${entrypoint}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/devkit",
|
|
3
|
-
"version": "2.1.0-rc.
|
|
3
|
+
"version": "2.1.0-rc.12",
|
|
4
4
|
"sourceType": "module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@langchain/deepseek": "^1.0.26",
|
|
32
32
|
"@langchain/openai": "^1.4.6",
|
|
33
33
|
"@trapezedev/project": "^7.1.4",
|
|
34
|
-
"akanjs": "2.1.0-rc.
|
|
34
|
+
"akanjs": "2.1.0-rc.12",
|
|
35
35
|
"chalk": "^5.6.2",
|
|
36
36
|
"commander": "^14.0.3",
|
|
37
37
|
"daisyui": "^5.5.20",
|