@akanjs/cli 2.3.3-rc.0 → 2.3.3
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/incrementalBuilder.proc.js +15 -22
- package/index.js +62 -34
- package/package.json +2 -2
- package/templates/workspaceRoot/biome.json.template +2 -1
|
@@ -688,7 +688,7 @@ import { resolveAkanI18nConfig } from "akanjs/common";
|
|
|
688
688
|
import { archs } from "akanjs";
|
|
689
689
|
|
|
690
690
|
// pkgs/@akanjs/devkit/akanConfig/akanConfig.ts
|
|
691
|
-
var DEFAULT_BARREL_IMPORTS = ["akanjs/webkit", "akanjs/common", "akanjs/ui"];
|
|
691
|
+
var DEFAULT_BARREL_IMPORTS = ["akanjs/webkit", "akanjs/common", "akanjs/ui", "akanjs/server"];
|
|
692
692
|
var DEFAULT_OPTIMIZE_IMPORTS = [
|
|
693
693
|
"lucide-react",
|
|
694
694
|
"date-fns",
|
|
@@ -716,18 +716,8 @@ var DEFAULT_OPTIMIZE_IMPORTS = [
|
|
|
716
716
|
"mui-core",
|
|
717
717
|
"react-icons/*"
|
|
718
718
|
];
|
|
719
|
-
var WORKSPACE_BARREL_FACETS = [
|
|
720
|
-
|
|
721
|
-
"webkit",
|
|
722
|
-
"common",
|
|
723
|
-
"client",
|
|
724
|
-
"server"
|
|
725
|
-
];
|
|
726
|
-
var SSR_RUNTIME_PACKAGES = [
|
|
727
|
-
"react",
|
|
728
|
-
"react-dom",
|
|
729
|
-
"react-server-dom-webpack"
|
|
730
|
-
];
|
|
719
|
+
var WORKSPACE_BARREL_FACETS = ["ui", "webkit", "common", "client", "server"];
|
|
720
|
+
var SSR_RUNTIME_PACKAGES = ["react", "react-dom", "react-server-dom-webpack"];
|
|
731
721
|
var NATIVE_RUNTIME_PACKAGES = ["sharp"];
|
|
732
722
|
var DEFAULT_BACKEND_RUNTIME_PACKAGES = ["croner"];
|
|
733
723
|
var DATABASE_MODE_RUNTIME_PACKAGES = {
|
|
@@ -787,12 +777,7 @@ class AkanAppConfig {
|
|
|
787
777
|
...libs.flatMap((lib) => WORKSPACE_BARREL_FACETS.map((facet) => `@libs/${lib}/${facet}`)),
|
|
788
778
|
...config?.barrelImports ?? []
|
|
789
779
|
];
|
|
790
|
-
this.optimizeImports = [
|
|
791
|
-
...new Set([
|
|
792
|
-
...DEFAULT_OPTIMIZE_IMPORTS,
|
|
793
|
-
...config?.optimizeImports ?? []
|
|
794
|
-
])
|
|
795
|
-
];
|
|
780
|
+
this.optimizeImports = [...new Set([...DEFAULT_OPTIMIZE_IMPORTS, ...config?.optimizeImports ?? []])];
|
|
796
781
|
this.images = mergeImageConfig(config?.images);
|
|
797
782
|
this.i18n = resolveAkanI18nConfig(config?.i18n);
|
|
798
783
|
process.env.AKAN_PUBLIC_DEFAULT_LOCALE = this.i18n.defaultLocale;
|
|
@@ -1054,9 +1039,7 @@ class AkanLibConfig {
|
|
|
1054
1039
|
this.externalLibs = config?.externalLibs ?? [];
|
|
1055
1040
|
}
|
|
1056
1041
|
static async from(lib) {
|
|
1057
|
-
const [configImp] = await Promise.all([
|
|
1058
|
-
import(`${lib.cwdPath}/akan.config.ts`).then((mod) => mod.default)
|
|
1059
|
-
]);
|
|
1042
|
+
const [configImp] = await Promise.all([import(`${lib.cwdPath}/akan.config.ts`).then((mod) => mod.default)]);
|
|
1060
1043
|
const config = typeof configImp === "function" ? configImp(lib) : configImp;
|
|
1061
1044
|
return new AkanLibConfig(lib, config);
|
|
1062
1045
|
}
|
|
@@ -7764,6 +7747,14 @@ import path28 from "path";
|
|
|
7764
7747
|
var DEFAULT_INCLUDE = ["akanjs/", "@apps/", "@libs/"];
|
|
7765
7748
|
var DEFAULT_EXCLUDE_EXACT = new Set(["akanjs/webkit", "@akanjs/cli", "@akanjs/devkit"]);
|
|
7766
7749
|
var DEFAULT_EXCLUDE_PREFIX = ["@akanjs/cli/", "@akanjs/devkit/"];
|
|
7750
|
+
var OPTIONAL_BACKEND_EXTERNAL_EXACT = new Set([
|
|
7751
|
+
"@libsql/client",
|
|
7752
|
+
"bullmq",
|
|
7753
|
+
"croner",
|
|
7754
|
+
"ioredis",
|
|
7755
|
+
"postgres",
|
|
7756
|
+
"protobufjs"
|
|
7757
|
+
]);
|
|
7767
7758
|
var RUNTIME_EXTERNAL_EXACT = new Set([
|
|
7768
7759
|
"react",
|
|
7769
7760
|
"react-dom",
|
|
@@ -7828,6 +7819,8 @@ async function createExternalizeFrameworkPlugin(options) {
|
|
|
7828
7819
|
if (spec.startsWith(prefix))
|
|
7829
7820
|
return { path: spec, external: true };
|
|
7830
7821
|
}
|
|
7822
|
+
if (OPTIONAL_BACKEND_EXTERNAL_EXACT.has(spec))
|
|
7823
|
+
return { path: spec, external: true };
|
|
7831
7824
|
if (RUNTIME_EXTERNAL_EXACT.has(spec))
|
|
7832
7825
|
return { path: spec, external: true };
|
|
7833
7826
|
for (const prefix of RUNTIME_EXTERNAL_PREFIX) {
|
package/index.js
CHANGED
|
@@ -222,16 +222,16 @@ class CloudApi {
|
|
|
222
222
|
Authorization: `Bearer ${this.#accessToken.jwt}`
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
|
-
async uploadEnv(
|
|
225
|
+
async uploadEnv(devProjectId2, file) {
|
|
226
226
|
const formData = new FormData;
|
|
227
|
-
formData.append("devProjectId",
|
|
227
|
+
formData.append("devProjectId", devProjectId2);
|
|
228
228
|
formData.append("file", file);
|
|
229
|
-
const data = await this.#api.post(`/uploadEnv/${
|
|
229
|
+
const data = await this.#api.post(`/uploadEnv/${devProjectId2}`, formData);
|
|
230
230
|
return data;
|
|
231
231
|
}
|
|
232
|
-
async downloadEnv(
|
|
232
|
+
async downloadEnv(devProjectId2) {
|
|
233
233
|
const localPath = `${this.#workspace.workspaceRoot}/local/env.tar`;
|
|
234
|
-
await this.#api.getFile(`/downloadEnv/${
|
|
234
|
+
await this.#api.getFile(`/downloadEnv/${devProjectId2}`, localPath);
|
|
235
235
|
return localPath;
|
|
236
236
|
}
|
|
237
237
|
async getRemoteAuthToken(remoteId) {
|
|
@@ -686,7 +686,7 @@ import { resolveAkanI18nConfig } from "akanjs/common";
|
|
|
686
686
|
import { archs } from "akanjs";
|
|
687
687
|
|
|
688
688
|
// pkgs/@akanjs/devkit/akanConfig/akanConfig.ts
|
|
689
|
-
var DEFAULT_BARREL_IMPORTS = ["akanjs/webkit", "akanjs/common", "akanjs/ui"];
|
|
689
|
+
var DEFAULT_BARREL_IMPORTS = ["akanjs/webkit", "akanjs/common", "akanjs/ui", "akanjs/server"];
|
|
690
690
|
var DEFAULT_OPTIMIZE_IMPORTS = [
|
|
691
691
|
"lucide-react",
|
|
692
692
|
"date-fns",
|
|
@@ -714,18 +714,8 @@ var DEFAULT_OPTIMIZE_IMPORTS = [
|
|
|
714
714
|
"mui-core",
|
|
715
715
|
"react-icons/*"
|
|
716
716
|
];
|
|
717
|
-
var WORKSPACE_BARREL_FACETS = [
|
|
718
|
-
|
|
719
|
-
"webkit",
|
|
720
|
-
"common",
|
|
721
|
-
"client",
|
|
722
|
-
"server"
|
|
723
|
-
];
|
|
724
|
-
var SSR_RUNTIME_PACKAGES = [
|
|
725
|
-
"react",
|
|
726
|
-
"react-dom",
|
|
727
|
-
"react-server-dom-webpack"
|
|
728
|
-
];
|
|
717
|
+
var WORKSPACE_BARREL_FACETS = ["ui", "webkit", "common", "client", "server"];
|
|
718
|
+
var SSR_RUNTIME_PACKAGES = ["react", "react-dom", "react-server-dom-webpack"];
|
|
729
719
|
var NATIVE_RUNTIME_PACKAGES = ["sharp"];
|
|
730
720
|
var DEFAULT_BACKEND_RUNTIME_PACKAGES = ["croner"];
|
|
731
721
|
var DATABASE_MODE_RUNTIME_PACKAGES = {
|
|
@@ -785,12 +775,7 @@ class AkanAppConfig {
|
|
|
785
775
|
...libs.flatMap((lib) => WORKSPACE_BARREL_FACETS.map((facet) => `@libs/${lib}/${facet}`)),
|
|
786
776
|
...config?.barrelImports ?? []
|
|
787
777
|
];
|
|
788
|
-
this.optimizeImports = [
|
|
789
|
-
...new Set([
|
|
790
|
-
...DEFAULT_OPTIMIZE_IMPORTS,
|
|
791
|
-
...config?.optimizeImports ?? []
|
|
792
|
-
])
|
|
793
|
-
];
|
|
778
|
+
this.optimizeImports = [...new Set([...DEFAULT_OPTIMIZE_IMPORTS, ...config?.optimizeImports ?? []])];
|
|
794
779
|
this.images = mergeImageConfig(config?.images);
|
|
795
780
|
this.i18n = resolveAkanI18nConfig(config?.i18n);
|
|
796
781
|
process.env.AKAN_PUBLIC_DEFAULT_LOCALE = this.i18n.defaultLocale;
|
|
@@ -1052,9 +1037,7 @@ class AkanLibConfig {
|
|
|
1052
1037
|
this.externalLibs = config?.externalLibs ?? [];
|
|
1053
1038
|
}
|
|
1054
1039
|
static async from(lib) {
|
|
1055
|
-
const [configImp] = await Promise.all([
|
|
1056
|
-
import(`${lib.cwdPath}/akan.config.ts`).then((mod) => mod.default)
|
|
1057
|
-
]);
|
|
1040
|
+
const [configImp] = await Promise.all([import(`${lib.cwdPath}/akan.config.ts`).then((mod) => mod.default)]);
|
|
1058
1041
|
const config = typeof configImp === "function" ? configImp(lib) : configImp;
|
|
1059
1042
|
return new AkanLibConfig(lib, config);
|
|
1060
1043
|
}
|
|
@@ -7762,6 +7745,14 @@ import path28 from "path";
|
|
|
7762
7745
|
var DEFAULT_INCLUDE = ["akanjs/", "@apps/", "@libs/"];
|
|
7763
7746
|
var DEFAULT_EXCLUDE_EXACT = new Set(["akanjs/webkit", "@akanjs/cli", "@akanjs/devkit"]);
|
|
7764
7747
|
var DEFAULT_EXCLUDE_PREFIX = ["@akanjs/cli/", "@akanjs/devkit/"];
|
|
7748
|
+
var OPTIONAL_BACKEND_EXTERNAL_EXACT = new Set([
|
|
7749
|
+
"@libsql/client",
|
|
7750
|
+
"bullmq",
|
|
7751
|
+
"croner",
|
|
7752
|
+
"ioredis",
|
|
7753
|
+
"postgres",
|
|
7754
|
+
"protobufjs"
|
|
7755
|
+
]);
|
|
7765
7756
|
var RUNTIME_EXTERNAL_EXACT = new Set([
|
|
7766
7757
|
"react",
|
|
7767
7758
|
"react-dom",
|
|
@@ -7826,6 +7817,8 @@ async function createExternalizeFrameworkPlugin(options) {
|
|
|
7826
7817
|
if (spec.startsWith(prefix))
|
|
7827
7818
|
return { path: spec, external: true };
|
|
7828
7819
|
}
|
|
7820
|
+
if (OPTIONAL_BACKEND_EXTERNAL_EXACT.has(spec))
|
|
7821
|
+
return { path: spec, external: true };
|
|
7829
7822
|
if (RUNTIME_EXTERNAL_EXACT.has(spec))
|
|
7830
7823
|
return { path: spec, external: true };
|
|
7831
7824
|
for (const prefix of RUNTIME_EXTERNAL_PREFIX) {
|
|
@@ -12122,10 +12115,10 @@ ${chalk7.green("\u27A4")} Authentication Required`));
|
|
|
12122
12115
|
|
|
12123
12116
|
// pkgs/@akanjs/cli/cloud/cloud.script.ts
|
|
12124
12117
|
class CloudScript extends script("cloud", [CloudRunner, ApplicationScript, PackageScript]) {
|
|
12125
|
-
async login(
|
|
12118
|
+
async login(workspace, host = GlobalConfig.akanCloudHost) {
|
|
12126
12119
|
await this.cloudRunner.login(host, workspace);
|
|
12127
12120
|
}
|
|
12128
|
-
async logout(
|
|
12121
|
+
async logout(workspace, host = GlobalConfig.akanCloudHost) {
|
|
12129
12122
|
await this.cloudRunner.logout(host);
|
|
12130
12123
|
}
|
|
12131
12124
|
async setLlm(workspace) {
|
|
@@ -12138,9 +12131,9 @@ class CloudScript extends script("cloud", [CloudRunner, ApplicationScript, Packa
|
|
|
12138
12131
|
const session = new AiSession("general", { workspace, isContinued: true });
|
|
12139
12132
|
await session.ask(question);
|
|
12140
12133
|
}
|
|
12141
|
-
async downloadEnv(workspace) {
|
|
12142
|
-
const workspaceId = workspace.getWorkspaceId({ allowEmpty: true });
|
|
12134
|
+
async downloadEnv(workspace, workspaceId = workspace.getWorkspaceId({ allowEmpty: true })) {
|
|
12143
12135
|
if (workspaceId) {
|
|
12136
|
+
await this.login(workspace);
|
|
12144
12137
|
const cloudApi2 = await CloudApi.fromHost(workspace);
|
|
12145
12138
|
await this.cloudRunner.downloadEnv(cloudApi2, workspace, workspaceId);
|
|
12146
12139
|
return;
|
|
@@ -12151,6 +12144,7 @@ class CloudScript extends script("cloud", [CloudRunner, ApplicationScript, Packa
|
|
|
12151
12144
|
const workspaceId = workspace.getWorkspaceId({ allowEmpty: true });
|
|
12152
12145
|
const { path: path40 } = await this.cloudRunner.gatherEnvFiles(workspace);
|
|
12153
12146
|
if (workspaceId) {
|
|
12147
|
+
await this.login(workspace);
|
|
12154
12148
|
const cloudApi2 = await CloudApi.fromHost(workspace);
|
|
12155
12149
|
await this.cloudRunner.uploadEnv(cloudApi2, workspaceId, path40);
|
|
12156
12150
|
return;
|
|
@@ -12184,10 +12178,10 @@ var resolveRegistryUrl = (registry) => registry === "local" ? localRegistryUrl()
|
|
|
12184
12178
|
|
|
12185
12179
|
class CloudCommand extends command("cloud", [CloudScript], ({ public: target }) => ({
|
|
12186
12180
|
login: target({ desc: "Login to Akan Cloud services" }).option("host", String, { desc: "host of the cloud", default: GlobalConfig.akanCloudHost }).with(Workspace).exec(async function(host, workspace) {
|
|
12187
|
-
await this.cloudScript.login(
|
|
12181
|
+
await this.cloudScript.login(workspace, host);
|
|
12188
12182
|
}),
|
|
12189
12183
|
logout: target({ desc: "Logout from Akan Cloud services" }).option("host", String, { desc: "host of the cloud", default: GlobalConfig.akanCloudHost }).with(Workspace).exec(async function(host, workspace) {
|
|
12190
|
-
await this.cloudScript.logout(
|
|
12184
|
+
await this.cloudScript.logout(workspace, host);
|
|
12191
12185
|
}),
|
|
12192
12186
|
setLlm: target({ desc: "Configure LLM (Large Language Model) API key" }).with(Workspace).exec(async function(workspace) {
|
|
12193
12187
|
await this.cloudScript.setLlm(workspace);
|
|
@@ -14012,6 +14006,25 @@ class WorkspaceRunner extends runner("workspace") {
|
|
|
14012
14006
|
exec2.cwdPath
|
|
14013
14007
|
]);
|
|
14014
14008
|
}
|
|
14009
|
+
async writeTopLevelEnv(workspace, devProjectId2) {
|
|
14010
|
+
await workspace.writeFile(".env", `AKAN_WORKSPACE_ID=${devProjectId2}
|
|
14011
|
+
|
|
14012
|
+
# organization configuration, no need to change
|
|
14013
|
+
AKAN_PUBLIC_REPO_NAME=${workspace.repoName}
|
|
14014
|
+
|
|
14015
|
+
# serve domain, it changes the domain of the server.
|
|
14016
|
+
AKAN_PUBLIC_SERVE_DOMAIN=try.akanjs.com
|
|
14017
|
+
|
|
14018
|
+
# development branch, debug, develop, main, etc. mainly it changes databases.
|
|
14019
|
+
AKAN_PUBLIC_ENV=local
|
|
14020
|
+
|
|
14021
|
+
# local, cloud, edge it changes the connection point of the clients.
|
|
14022
|
+
AKAN_PUBLIC_OPERATION_MODE=local
|
|
14023
|
+
|
|
14024
|
+
# log level, debug, info, warn, error
|
|
14025
|
+
AKAN_PUBLIC_LOG_LEVEL=debug
|
|
14026
|
+
`);
|
|
14027
|
+
}
|
|
14015
14028
|
}
|
|
14016
14029
|
|
|
14017
14030
|
// pkgs/@akanjs/cli/workspace/workspace.script.ts
|
|
@@ -14019,7 +14032,8 @@ class WorkspaceScript extends script("workspace", [
|
|
|
14019
14032
|
WorkspaceRunner,
|
|
14020
14033
|
ApplicationScript,
|
|
14021
14034
|
LibraryScript,
|
|
14022
|
-
PackageScript
|
|
14035
|
+
PackageScript,
|
|
14036
|
+
CloudScript
|
|
14023
14037
|
]) {
|
|
14024
14038
|
async createWorkspace(repoName, appName, {
|
|
14025
14039
|
dirname: dirname2 = ".",
|
|
@@ -14095,6 +14109,17 @@ class WorkspaceScript extends script("workspace", [
|
|
|
14095
14109
|
for (const appName of appNames)
|
|
14096
14110
|
await this.applicationScript.sync(AppExecutor.from(workspace, appName));
|
|
14097
14111
|
}
|
|
14112
|
+
async init(devProjectId2, workspace) {
|
|
14113
|
+
const spinner2 = workspace.spinning("Initializing workspace...");
|
|
14114
|
+
try {
|
|
14115
|
+
await this.workspaceRunner.writeTopLevelEnv(workspace, devProjectId2);
|
|
14116
|
+
await this.cloudScript.downloadEnv(workspace, devProjectId2);
|
|
14117
|
+
spinner2.succeed("Workspace initialized");
|
|
14118
|
+
} catch (error) {
|
|
14119
|
+
spinner2.fail("Workspace initialization failed");
|
|
14120
|
+
throw error;
|
|
14121
|
+
}
|
|
14122
|
+
}
|
|
14098
14123
|
}
|
|
14099
14124
|
|
|
14100
14125
|
// pkgs/@akanjs/cli/workspace/workspace.command.ts
|
|
@@ -14135,6 +14160,9 @@ class WorkspaceCommand extends command("workspace", [WorkspaceScript], ({ public
|
|
|
14135
14160
|
}),
|
|
14136
14161
|
syncAll: target({ desc: "Sync dependencies and configuration for all apps and libraries" }).with(Workspace).exec(async function(workspace) {
|
|
14137
14162
|
await this.workspaceScript.syncAll(workspace);
|
|
14163
|
+
}),
|
|
14164
|
+
init: target({ desc: "Initialize the workspace" }).arg("devProjectId", String, { desc: "the ID of the workspace" }).with(Workspace).exec(async function(workspace) {
|
|
14165
|
+
await this.workspaceScript.init(devProjectId, workspace);
|
|
14138
14166
|
})
|
|
14139
14167
|
})) {
|
|
14140
14168
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/cli",
|
|
3
|
-
"version": "2.3.3
|
|
3
|
+
"version": "2.3.3",
|
|
4
4
|
"sourceType": "module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@langchain/openai": "^1.4.6",
|
|
36
36
|
"@tailwindcss/node": "^4.3.0",
|
|
37
37
|
"@trapezedev/project": "^7.1.4",
|
|
38
|
-
"akanjs": "2.3.3
|
|
38
|
+
"akanjs": "2.3.3",
|
|
39
39
|
"chalk": "^5.6.2",
|
|
40
40
|
"commander": "^14.0.3",
|
|
41
41
|
"daisyui": "^5.5.20",
|