@akanjs/cli 0.9.33 → 0.9.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/cjs/index.js +58 -50
- package/cjs/src/templates/app/ui/UiComponent.js +5 -2
- package/cjs/src/templates/libRoot/lib/___libName__/_server.js +2 -2
- package/cjs/src/templates/libRoot/lib/summary/Summary.Template.js +1 -1
- package/cjs/src/templates/module/__Model__.View.js +5 -6
- package/cjs/src/templates/workspaceRoot/package.json.template +4 -4
- package/esm/index.js +58 -50
- package/esm/src/templates/app/ui/UiComponent.js +5 -2
- package/esm/src/templates/libRoot/lib/___libName__/_server.js +2 -2
- package/esm/src/templates/libRoot/lib/summary/Summary.Template.js +1 -1
- package/esm/src/templates/module/__Model__.View.js +5 -6
- package/esm/src/templates/workspaceRoot/package.json.template +4 -4
- package/package.json +6 -6
- package/src/templates/app/ui/UiComponent.d.ts +4 -1
- package/src/templates/libRoot/lib/___libName__/_server.d.ts +2 -2
- package/src/templates/libRoot/lib/summary/Summary.Template.d.ts +1 -1
package/cjs/index.js
CHANGED
|
@@ -717,6 +717,44 @@ import config from "./akan.config";
|
|
|
717
717
|
export default getNextConfig(config, appInfo);
|
|
718
718
|
`;
|
|
719
719
|
|
|
720
|
+
// pkgs/@akanjs/config/src/types.ts
|
|
721
|
+
var archs = ["amd64", "arm64"];
|
|
722
|
+
var getDefaultFileScan = () => ({
|
|
723
|
+
constants: {
|
|
724
|
+
databases: [],
|
|
725
|
+
scalars: []
|
|
726
|
+
},
|
|
727
|
+
dictionary: {
|
|
728
|
+
databases: [],
|
|
729
|
+
services: [],
|
|
730
|
+
scalars: []
|
|
731
|
+
},
|
|
732
|
+
documents: {
|
|
733
|
+
databases: [],
|
|
734
|
+
scalars: []
|
|
735
|
+
},
|
|
736
|
+
services: {
|
|
737
|
+
databases: [],
|
|
738
|
+
services: [],
|
|
739
|
+
scalars: []
|
|
740
|
+
},
|
|
741
|
+
signal: {
|
|
742
|
+
databases: [],
|
|
743
|
+
services: [],
|
|
744
|
+
scalars: []
|
|
745
|
+
},
|
|
746
|
+
store: {
|
|
747
|
+
databases: [],
|
|
748
|
+
services: [],
|
|
749
|
+
scalars: []
|
|
750
|
+
},
|
|
751
|
+
components: {
|
|
752
|
+
databases: [],
|
|
753
|
+
services: [],
|
|
754
|
+
scalars: []
|
|
755
|
+
}
|
|
756
|
+
});
|
|
757
|
+
|
|
720
758
|
// pkgs/@akanjs/config/src/akanConfig.ts
|
|
721
759
|
var makeAppConfig = (config, props) => {
|
|
722
760
|
const { name, repoName, serveDomain, env, command = "build" } = props;
|
|
@@ -840,7 +878,7 @@ WORKDIR /workspace
|
|
|
840
878
|
COPY ./package.json ./package.json
|
|
841
879
|
RUN npx pnpm i --prod
|
|
842
880
|
COPY . .
|
|
843
|
-
ENV PORT
|
|
881
|
+
ENV PORT=4200
|
|
844
882
|
ENV NODE_OPTIONS=--max_old_space_size=8192
|
|
845
883
|
ENV NEXT_PUBLIC_REPO_NAME=${repoName}
|
|
846
884
|
ENV NEXT_PUBLIC_SERVE_DOMAIN=${serveDomain}
|
|
@@ -859,44 +897,6 @@ CMD [${command.map((c) => `"${c}"`).join(",")}]`;
|
|
|
859
897
|
}
|
|
860
898
|
};
|
|
861
899
|
|
|
862
|
-
// pkgs/@akanjs/config/src/types.ts
|
|
863
|
-
var archs = ["amd64", "arm64"];
|
|
864
|
-
var getDefaultFileScan = () => ({
|
|
865
|
-
constants: {
|
|
866
|
-
databases: [],
|
|
867
|
-
scalars: []
|
|
868
|
-
},
|
|
869
|
-
dictionary: {
|
|
870
|
-
databases: [],
|
|
871
|
-
services: [],
|
|
872
|
-
scalars: []
|
|
873
|
-
},
|
|
874
|
-
documents: {
|
|
875
|
-
databases: [],
|
|
876
|
-
scalars: []
|
|
877
|
-
},
|
|
878
|
-
services: {
|
|
879
|
-
databases: [],
|
|
880
|
-
services: [],
|
|
881
|
-
scalars: []
|
|
882
|
-
},
|
|
883
|
-
signal: {
|
|
884
|
-
databases: [],
|
|
885
|
-
services: [],
|
|
886
|
-
scalars: []
|
|
887
|
-
},
|
|
888
|
-
store: {
|
|
889
|
-
databases: [],
|
|
890
|
-
services: [],
|
|
891
|
-
scalars: []
|
|
892
|
-
},
|
|
893
|
-
components: {
|
|
894
|
-
databases: [],
|
|
895
|
-
services: [],
|
|
896
|
-
scalars: []
|
|
897
|
-
}
|
|
898
|
-
});
|
|
899
|
-
|
|
900
900
|
// pkgs/@akanjs/devkit/src/executors.ts
|
|
901
901
|
var import_chalk3 = __toESM(require("chalk"));
|
|
902
902
|
var import_child_process = require("child_process");
|
|
@@ -1790,10 +1790,11 @@ var WorkspaceExecutor = class _WorkspaceExecutor extends Executor {
|
|
|
1790
1790
|
const serveDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN ?? envFile.NEXT_PUBLIC_SERVE_DOMAIN;
|
|
1791
1791
|
if (!serveDomain)
|
|
1792
1792
|
throw new Error("NEXT_PUBLIC_SERVE_DOMAIN is not set");
|
|
1793
|
+
const portOffset = parseInt(process.env.PORT_OFFSET ?? envFile.PORT_OFFSET ?? "0");
|
|
1793
1794
|
const env = process.env.NEXT_PUBLIC_ENV ?? envFile.NEXT_PUBLIC_ENV ?? "debug";
|
|
1794
1795
|
if (!env)
|
|
1795
1796
|
throw new Error("NEXT_PUBLIC_ENV is not set");
|
|
1796
|
-
return { ...appName ? { name: appName } : {}, repoName, serveDomain, env };
|
|
1797
|
+
return { ...appName ? { name: appName } : {}, repoName, serveDomain, env, portOffset };
|
|
1797
1798
|
}
|
|
1798
1799
|
async scan() {
|
|
1799
1800
|
const [appNames, libNames, pkgNames] = await Promise.all([this.getApps(), this.getLibs(), this.getPkgs()]);
|
|
@@ -3412,9 +3413,9 @@ var import_dotenv2 = __toESM(require("dotenv"), 1);
|
|
|
3412
3413
|
var LibraryRunner = class {
|
|
3413
3414
|
async createLibrary(libName, workspace) {
|
|
3414
3415
|
await workspace.exec(`mkdir -p libs/${libName}`);
|
|
3415
|
-
|
|
3416
|
-
await lib.applyTemplate({ basePath: ".", template: "libRoot", dict: { libName } });
|
|
3416
|
+
await workspace.applyTemplate({ basePath: `libs/${libName}`, template: "libRoot", dict: { libName } });
|
|
3417
3417
|
workspace.setTsPaths("lib", libName);
|
|
3418
|
+
const lib = LibExecutor.from(workspace, libName);
|
|
3418
3419
|
return lib;
|
|
3419
3420
|
}
|
|
3420
3421
|
async removeLibrary(lib) {
|
|
@@ -3909,17 +3910,23 @@ var ApplicationRunner = class {
|
|
|
3909
3910
|
});
|
|
3910
3911
|
await app.spawn("node", [`scripts/${filename}.js`], {
|
|
3911
3912
|
stdio: "inherit",
|
|
3912
|
-
env: this.#getEnv(app)
|
|
3913
|
+
env: this.#getEnv(app, "backend")
|
|
3913
3914
|
});
|
|
3914
3915
|
}
|
|
3915
|
-
#getEnv(app, env = {}) {
|
|
3916
|
+
#getEnv(app, target, env = {}) {
|
|
3916
3917
|
const rootEnv = import_dotenv3.default.parse(app.workspace.readFile(".env"));
|
|
3918
|
+
const basePort = target === "backend" ? 8080 : target === "frontend" ? 4200 : target === "csr" ? 4201 : void 0;
|
|
3919
|
+
const portOffset = app.workspace.getBaseDevEnv().portOffset;
|
|
3920
|
+
const PORT = basePort ? (basePort + portOffset).toString() : void 0;
|
|
3921
|
+
const NEXT_PUBLIC_SERVER_PORT = portOffset ? (8080 + portOffset).toString() : void 0;
|
|
3917
3922
|
return {
|
|
3918
3923
|
...process.env,
|
|
3919
3924
|
...rootEnv,
|
|
3920
3925
|
NEXT_PUBLIC_APP_NAME: app.name,
|
|
3921
3926
|
AKAN_WORKSPACE_ROOT: app.workspace.workspaceRoot,
|
|
3922
3927
|
NODE_NO_WARNINGS: "1",
|
|
3928
|
+
...PORT ? { PORT, NEXT_PUBLIC_CLIENT_PORT: PORT } : {},
|
|
3929
|
+
...NEXT_PUBLIC_SERVER_PORT ? { NEXT_PUBLIC_SERVER_PORT } : {},
|
|
3923
3930
|
...env
|
|
3924
3931
|
};
|
|
3925
3932
|
}
|
|
@@ -3933,7 +3940,7 @@ var ApplicationRunner = class {
|
|
|
3933
3940
|
await app.workspace.exec("rm -rf node_modules/.vite");
|
|
3934
3941
|
else if (target === "backend")
|
|
3935
3942
|
await app.cp("assets", import_path4.default.join(app.dist.cwdPath, "backend", "assets"));
|
|
3936
|
-
return { env: this.#getEnv(app, { AKAN_COMMAND_TYPE: type }) };
|
|
3943
|
+
return { env: this.#getEnv(app, target, { AKAN_COMMAND_TYPE: type }) };
|
|
3937
3944
|
}
|
|
3938
3945
|
async buildBackend(app) {
|
|
3939
3946
|
await this.#prepareCommand(app, "start", "backend");
|
|
@@ -4026,15 +4033,16 @@ var ApplicationRunner = class {
|
|
|
4026
4033
|
} = {}) {
|
|
4027
4034
|
const { env } = await this.#prepareCommand(app, "start", "frontend");
|
|
4028
4035
|
if (open2)
|
|
4029
|
-
setTimeout(() => (0, import_open.default)(
|
|
4036
|
+
setTimeout(() => (0, import_open.default)(`http://localhost:${env.PORT ?? 4200}`), 3e3);
|
|
4030
4037
|
onStart?.();
|
|
4031
|
-
return app.spawnSync("npx", ["next", "dev", "-p",
|
|
4038
|
+
return app.spawnSync("npx", ["next", "dev", ...env.PORT ? ["-p", env.PORT] : [], ...turbo ? ["--turbo"] : []], {
|
|
4032
4039
|
env,
|
|
4033
4040
|
stdio: withInk ? ["ignore", "pipe", "pipe"] : "inherit"
|
|
4034
4041
|
});
|
|
4035
4042
|
}
|
|
4036
4043
|
async #getViteConfig(app, command, viteConfig = {}) {
|
|
4037
4044
|
const { env } = await this.#prepareCommand(app, command, "csr");
|
|
4045
|
+
const { NODE_ENV, NODE_NO_WARNINGS, ...applyEnvs } = env;
|
|
4038
4046
|
const tsconfig = app.workspace.getTsConfig();
|
|
4039
4047
|
const akanConfig = await app.getConfig();
|
|
4040
4048
|
const basePaths = akanConfig.frontend.routes ? [...new Set(akanConfig.frontend.routes.map(({ basePath: basePath2 }) => basePath2))].join(",") : void 0;
|
|
@@ -4094,13 +4102,13 @@ var ApplicationRunner = class {
|
|
|
4094
4102
|
},
|
|
4095
4103
|
define: {
|
|
4096
4104
|
"process.env": {
|
|
4105
|
+
...applyEnvs,
|
|
4097
4106
|
AKAN_COMMAND_TYPE: "start",
|
|
4098
4107
|
NEXT_PUBLIC_REPO_NAME: app.workspace.repoName,
|
|
4099
4108
|
NEXT_PUBLIC_SERVE_DOMAIN: processEnv.NEXT_PUBLIC_SERVE_DOMAIN ?? "localhost",
|
|
4100
4109
|
NEXT_PUBLIC_ENV: processEnv.NEXT_PUBLIC_ENV ?? "debug",
|
|
4101
4110
|
NEXT_PUBLIC_OPERATION_MODE: processEnv.NEXT_PUBLIC_OPERATION_MODE ?? "local",
|
|
4102
4111
|
NEXT_PUBLIC_LOG_LEVEL: processEnv.NEXT_PUBLIC_LOG_LEVEL ?? "log",
|
|
4103
|
-
NEXT_PUBLIC_APP_NAME: app.name,
|
|
4104
4112
|
APP_OPERATION_MODE: processEnv.APP_OPERATION_MODE ?? "local",
|
|
4105
4113
|
AKAN_WORKSPACE_ROOT: app.workspace.workspaceRoot,
|
|
4106
4114
|
AKAN_APP_ROOT: app.cwdPath,
|
|
@@ -4149,7 +4157,7 @@ var ApplicationRunner = class {
|
|
|
4149
4157
|
} : {}
|
|
4150
4158
|
);
|
|
4151
4159
|
const server = await vite.createServer(config);
|
|
4152
|
-
await server.listen(4201);
|
|
4160
|
+
await server.listen(4201 + app.workspace.getBaseDevEnv().portOffset);
|
|
4153
4161
|
onStart?.();
|
|
4154
4162
|
if (open2)
|
|
4155
4163
|
setTimeout(() => (0, import_open.default)("http://localhost:4201"), 3e3);
|
|
@@ -4399,7 +4407,7 @@ var ApplicationRunner = class {
|
|
|
4399
4407
|
["node_modules/jest/bin/jest.js", `apps/${app.name}`, "-c", `apps/${app.name}/jest.config.ts`],
|
|
4400
4408
|
{
|
|
4401
4409
|
env: {
|
|
4402
|
-
...this.#getEnv(app),
|
|
4410
|
+
...this.#getEnv(app, "backend"),
|
|
4403
4411
|
NEXT_PUBLIC_ENV: "testing",
|
|
4404
4412
|
NEXT_PUBLIC_OPERATION_MODE: "local",
|
|
4405
4413
|
NEXT_PUBLIC_APP_NAME: app.name,
|
|
@@ -23,7 +23,9 @@ __export(UiComponent_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(UiComponent_exports);
|
|
25
25
|
function getContent(scanResult, dict) {
|
|
26
|
-
return
|
|
26
|
+
return {
|
|
27
|
+
filename: "UiComponent.tsx",
|
|
28
|
+
content: `
|
|
27
29
|
// This is a Sample UI component that can be used in the app.
|
|
28
30
|
// You can use it by \`import { UiComponent } from "@${dict.appName}/ui";\` in the page or other components.
|
|
29
31
|
// File name and export name should be same, because of modularizedImport feature of Next.js.
|
|
@@ -31,5 +33,6 @@ function getContent(scanResult, dict) {
|
|
|
31
33
|
export const UiComponent = () => {
|
|
32
34
|
return <div>UiComponent</div>;
|
|
33
35
|
};
|
|
34
|
-
|
|
36
|
+
`
|
|
37
|
+
};
|
|
35
38
|
}
|
|
@@ -27,8 +27,8 @@ function getContent(scanResult, dict) {
|
|
|
27
27
|
import { batchModuleOf } from "@akanjs/server";
|
|
28
28
|
|
|
29
29
|
import type { ModulesOptions } from "../option";
|
|
30
|
-
import { ${dict.
|
|
30
|
+
import { ${dict.LibName}Service } from "./${dict.libName}.service";
|
|
31
31
|
|
|
32
|
-
export const register${dict.
|
|
32
|
+
export const register${dict.LibName}Module = (option: ModulesOptions) => batchModuleOf({ service: ${dict.LibName}Service, uses: {} });
|
|
33
33
|
`;
|
|
34
34
|
}
|
|
@@ -27,7 +27,7 @@ function getContent(scanResult, dict) {
|
|
|
27
27
|
filename: "Summary.Template.tsx",
|
|
28
28
|
content: `
|
|
29
29
|
"use client";
|
|
30
|
-
import { st, usePage } from "@${dict.
|
|
30
|
+
import { st, usePage } from "@${dict.libName}/client";
|
|
31
31
|
|
|
32
32
|
interface SummaryEditProps {
|
|
33
33
|
summaryId?: string | null;
|
|
@@ -27,19 +27,18 @@ function getContent(scanResult, dict) {
|
|
|
27
27
|
filename: `${dict.Model}.View.tsx`,
|
|
28
28
|
content: `
|
|
29
29
|
import { clsx } from "@akanjs/client";
|
|
30
|
-
import { cnst } from "@${dict.sysName}/client";
|
|
31
|
-
import { Image } from "@akanjs/ui";
|
|
30
|
+
import { cnst, usePage } from "@${dict.sysName}/client";
|
|
32
31
|
|
|
33
32
|
interface ${dict.Model}ViewProps {
|
|
34
33
|
className?: string;
|
|
35
34
|
${dict.model}: cnst.${dict.Model};
|
|
36
|
-
self?: { id?: string } | null;
|
|
37
35
|
}
|
|
38
36
|
|
|
39
|
-
export const General = ({ className, ${dict.model}
|
|
37
|
+
export const General = ({ className, ${dict.model} }: ${dict.Model}ViewProps) => {
|
|
38
|
+
const { l } = usePage();
|
|
40
39
|
return (
|
|
41
|
-
<div className={clsx(
|
|
42
|
-
<div>{${dict.model}.id}</div>
|
|
40
|
+
<div className={clsx("w-full", className)}>
|
|
41
|
+
<div>{l("${dict.model}.id")}: {${dict.model}.id}</div>
|
|
43
42
|
</div>
|
|
44
43
|
);
|
|
45
44
|
};
|
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
"version": "0.0.1",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"next": "15.3.2",
|
|
7
|
-
"react": "
|
|
8
|
-
"react-dom": "
|
|
7
|
+
"react": "19.1.1",
|
|
8
|
+
"react-dom": "19.1.1",
|
|
9
9
|
"tailwindcss": "^4.1.7",
|
|
10
10
|
"daisyui": "^5.0.35"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"@types/node": "^22.9.0",
|
|
14
14
|
"@tailwindcss/postcss": "^4.1.7",
|
|
15
|
-
"@types/react": "
|
|
16
|
-
"@types/react-dom": "
|
|
15
|
+
"@types/react": "19.1.1",
|
|
16
|
+
"@types/react-dom": "19.1.1",
|
|
17
17
|
"crypto-browserify": "^3.12.1",
|
|
18
18
|
"eslint": "^9.19.0",
|
|
19
19
|
"https-browserify": "^1.0.0",
|
package/esm/index.js
CHANGED
|
@@ -697,6 +697,44 @@ import config from "./akan.config";
|
|
|
697
697
|
export default getNextConfig(config, appInfo);
|
|
698
698
|
`;
|
|
699
699
|
|
|
700
|
+
// pkgs/@akanjs/config/src/types.ts
|
|
701
|
+
var archs = ["amd64", "arm64"];
|
|
702
|
+
var getDefaultFileScan = () => ({
|
|
703
|
+
constants: {
|
|
704
|
+
databases: [],
|
|
705
|
+
scalars: []
|
|
706
|
+
},
|
|
707
|
+
dictionary: {
|
|
708
|
+
databases: [],
|
|
709
|
+
services: [],
|
|
710
|
+
scalars: []
|
|
711
|
+
},
|
|
712
|
+
documents: {
|
|
713
|
+
databases: [],
|
|
714
|
+
scalars: []
|
|
715
|
+
},
|
|
716
|
+
services: {
|
|
717
|
+
databases: [],
|
|
718
|
+
services: [],
|
|
719
|
+
scalars: []
|
|
720
|
+
},
|
|
721
|
+
signal: {
|
|
722
|
+
databases: [],
|
|
723
|
+
services: [],
|
|
724
|
+
scalars: []
|
|
725
|
+
},
|
|
726
|
+
store: {
|
|
727
|
+
databases: [],
|
|
728
|
+
services: [],
|
|
729
|
+
scalars: []
|
|
730
|
+
},
|
|
731
|
+
components: {
|
|
732
|
+
databases: [],
|
|
733
|
+
services: [],
|
|
734
|
+
scalars: []
|
|
735
|
+
}
|
|
736
|
+
});
|
|
737
|
+
|
|
700
738
|
// pkgs/@akanjs/config/src/akanConfig.ts
|
|
701
739
|
var makeAppConfig = (config, props) => {
|
|
702
740
|
const { name, repoName, serveDomain, env, command = "build" } = props;
|
|
@@ -820,7 +858,7 @@ WORKDIR /workspace
|
|
|
820
858
|
COPY ./package.json ./package.json
|
|
821
859
|
RUN npx pnpm i --prod
|
|
822
860
|
COPY . .
|
|
823
|
-
ENV PORT
|
|
861
|
+
ENV PORT=4200
|
|
824
862
|
ENV NODE_OPTIONS=--max_old_space_size=8192
|
|
825
863
|
ENV NEXT_PUBLIC_REPO_NAME=${repoName}
|
|
826
864
|
ENV NEXT_PUBLIC_SERVE_DOMAIN=${serveDomain}
|
|
@@ -839,44 +877,6 @@ CMD [${command.map((c) => `"${c}"`).join(",")}]`;
|
|
|
839
877
|
}
|
|
840
878
|
};
|
|
841
879
|
|
|
842
|
-
// pkgs/@akanjs/config/src/types.ts
|
|
843
|
-
var archs = ["amd64", "arm64"];
|
|
844
|
-
var getDefaultFileScan = () => ({
|
|
845
|
-
constants: {
|
|
846
|
-
databases: [],
|
|
847
|
-
scalars: []
|
|
848
|
-
},
|
|
849
|
-
dictionary: {
|
|
850
|
-
databases: [],
|
|
851
|
-
services: [],
|
|
852
|
-
scalars: []
|
|
853
|
-
},
|
|
854
|
-
documents: {
|
|
855
|
-
databases: [],
|
|
856
|
-
scalars: []
|
|
857
|
-
},
|
|
858
|
-
services: {
|
|
859
|
-
databases: [],
|
|
860
|
-
services: [],
|
|
861
|
-
scalars: []
|
|
862
|
-
},
|
|
863
|
-
signal: {
|
|
864
|
-
databases: [],
|
|
865
|
-
services: [],
|
|
866
|
-
scalars: []
|
|
867
|
-
},
|
|
868
|
-
store: {
|
|
869
|
-
databases: [],
|
|
870
|
-
services: [],
|
|
871
|
-
scalars: []
|
|
872
|
-
},
|
|
873
|
-
components: {
|
|
874
|
-
databases: [],
|
|
875
|
-
services: [],
|
|
876
|
-
scalars: []
|
|
877
|
-
}
|
|
878
|
-
});
|
|
879
|
-
|
|
880
880
|
// pkgs/@akanjs/devkit/src/executors.ts
|
|
881
881
|
import chalk3 from "chalk";
|
|
882
882
|
import { exec, fork, spawn } from "child_process";
|
|
@@ -1769,10 +1769,11 @@ var WorkspaceExecutor = class _WorkspaceExecutor extends Executor {
|
|
|
1769
1769
|
const serveDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN ?? envFile.NEXT_PUBLIC_SERVE_DOMAIN;
|
|
1770
1770
|
if (!serveDomain)
|
|
1771
1771
|
throw new Error("NEXT_PUBLIC_SERVE_DOMAIN is not set");
|
|
1772
|
+
const portOffset = parseInt(process.env.PORT_OFFSET ?? envFile.PORT_OFFSET ?? "0");
|
|
1772
1773
|
const env = process.env.NEXT_PUBLIC_ENV ?? envFile.NEXT_PUBLIC_ENV ?? "debug";
|
|
1773
1774
|
if (!env)
|
|
1774
1775
|
throw new Error("NEXT_PUBLIC_ENV is not set");
|
|
1775
|
-
return { ...appName ? { name: appName } : {}, repoName, serveDomain, env };
|
|
1776
|
+
return { ...appName ? { name: appName } : {}, repoName, serveDomain, env, portOffset };
|
|
1776
1777
|
}
|
|
1777
1778
|
async scan() {
|
|
1778
1779
|
const [appNames, libNames, pkgNames] = await Promise.all([this.getApps(), this.getLibs(), this.getPkgs()]);
|
|
@@ -3394,9 +3395,9 @@ import dotenv2 from "dotenv";
|
|
|
3394
3395
|
var LibraryRunner = class {
|
|
3395
3396
|
async createLibrary(libName, workspace) {
|
|
3396
3397
|
await workspace.exec(`mkdir -p libs/${libName}`);
|
|
3397
|
-
|
|
3398
|
-
await lib.applyTemplate({ basePath: ".", template: "libRoot", dict: { libName } });
|
|
3398
|
+
await workspace.applyTemplate({ basePath: `libs/${libName}`, template: "libRoot", dict: { libName } });
|
|
3399
3399
|
workspace.setTsPaths("lib", libName);
|
|
3400
|
+
const lib = LibExecutor.from(workspace, libName);
|
|
3400
3401
|
return lib;
|
|
3401
3402
|
}
|
|
3402
3403
|
async removeLibrary(lib) {
|
|
@@ -3891,17 +3892,23 @@ var ApplicationRunner = class {
|
|
|
3891
3892
|
});
|
|
3892
3893
|
await app.spawn("node", [`scripts/${filename}.js`], {
|
|
3893
3894
|
stdio: "inherit",
|
|
3894
|
-
env: this.#getEnv(app)
|
|
3895
|
+
env: this.#getEnv(app, "backend")
|
|
3895
3896
|
});
|
|
3896
3897
|
}
|
|
3897
|
-
#getEnv(app, env = {}) {
|
|
3898
|
+
#getEnv(app, target, env = {}) {
|
|
3898
3899
|
const rootEnv = dotenv3.parse(app.workspace.readFile(".env"));
|
|
3900
|
+
const basePort = target === "backend" ? 8080 : target === "frontend" ? 4200 : target === "csr" ? 4201 : void 0;
|
|
3901
|
+
const portOffset = app.workspace.getBaseDevEnv().portOffset;
|
|
3902
|
+
const PORT = basePort ? (basePort + portOffset).toString() : void 0;
|
|
3903
|
+
const NEXT_PUBLIC_SERVER_PORT = portOffset ? (8080 + portOffset).toString() : void 0;
|
|
3899
3904
|
return {
|
|
3900
3905
|
...process.env,
|
|
3901
3906
|
...rootEnv,
|
|
3902
3907
|
NEXT_PUBLIC_APP_NAME: app.name,
|
|
3903
3908
|
AKAN_WORKSPACE_ROOT: app.workspace.workspaceRoot,
|
|
3904
3909
|
NODE_NO_WARNINGS: "1",
|
|
3910
|
+
...PORT ? { PORT, NEXT_PUBLIC_CLIENT_PORT: PORT } : {},
|
|
3911
|
+
...NEXT_PUBLIC_SERVER_PORT ? { NEXT_PUBLIC_SERVER_PORT } : {},
|
|
3905
3912
|
...env
|
|
3906
3913
|
};
|
|
3907
3914
|
}
|
|
@@ -3915,7 +3922,7 @@ var ApplicationRunner = class {
|
|
|
3915
3922
|
await app.workspace.exec("rm -rf node_modules/.vite");
|
|
3916
3923
|
else if (target === "backend")
|
|
3917
3924
|
await app.cp("assets", path7.join(app.dist.cwdPath, "backend", "assets"));
|
|
3918
|
-
return { env: this.#getEnv(app, { AKAN_COMMAND_TYPE: type }) };
|
|
3925
|
+
return { env: this.#getEnv(app, target, { AKAN_COMMAND_TYPE: type }) };
|
|
3919
3926
|
}
|
|
3920
3927
|
async buildBackend(app) {
|
|
3921
3928
|
await this.#prepareCommand(app, "start", "backend");
|
|
@@ -4008,15 +4015,16 @@ var ApplicationRunner = class {
|
|
|
4008
4015
|
} = {}) {
|
|
4009
4016
|
const { env } = await this.#prepareCommand(app, "start", "frontend");
|
|
4010
4017
|
if (open2)
|
|
4011
|
-
setTimeout(() => openBrowser(
|
|
4018
|
+
setTimeout(() => openBrowser(`http://localhost:${env.PORT ?? 4200}`), 3e3);
|
|
4012
4019
|
onStart?.();
|
|
4013
|
-
return app.spawnSync("npx", ["next", "dev", "-p",
|
|
4020
|
+
return app.spawnSync("npx", ["next", "dev", ...env.PORT ? ["-p", env.PORT] : [], ...turbo ? ["--turbo"] : []], {
|
|
4014
4021
|
env,
|
|
4015
4022
|
stdio: withInk ? ["ignore", "pipe", "pipe"] : "inherit"
|
|
4016
4023
|
});
|
|
4017
4024
|
}
|
|
4018
4025
|
async #getViteConfig(app, command, viteConfig = {}) {
|
|
4019
4026
|
const { env } = await this.#prepareCommand(app, command, "csr");
|
|
4027
|
+
const { NODE_ENV, NODE_NO_WARNINGS, ...applyEnvs } = env;
|
|
4020
4028
|
const tsconfig = app.workspace.getTsConfig();
|
|
4021
4029
|
const akanConfig = await app.getConfig();
|
|
4022
4030
|
const basePaths = akanConfig.frontend.routes ? [...new Set(akanConfig.frontend.routes.map(({ basePath: basePath2 }) => basePath2))].join(",") : void 0;
|
|
@@ -4076,13 +4084,13 @@ var ApplicationRunner = class {
|
|
|
4076
4084
|
},
|
|
4077
4085
|
define: {
|
|
4078
4086
|
"process.env": {
|
|
4087
|
+
...applyEnvs,
|
|
4079
4088
|
AKAN_COMMAND_TYPE: "start",
|
|
4080
4089
|
NEXT_PUBLIC_REPO_NAME: app.workspace.repoName,
|
|
4081
4090
|
NEXT_PUBLIC_SERVE_DOMAIN: processEnv.NEXT_PUBLIC_SERVE_DOMAIN ?? "localhost",
|
|
4082
4091
|
NEXT_PUBLIC_ENV: processEnv.NEXT_PUBLIC_ENV ?? "debug",
|
|
4083
4092
|
NEXT_PUBLIC_OPERATION_MODE: processEnv.NEXT_PUBLIC_OPERATION_MODE ?? "local",
|
|
4084
4093
|
NEXT_PUBLIC_LOG_LEVEL: processEnv.NEXT_PUBLIC_LOG_LEVEL ?? "log",
|
|
4085
|
-
NEXT_PUBLIC_APP_NAME: app.name,
|
|
4086
4094
|
APP_OPERATION_MODE: processEnv.APP_OPERATION_MODE ?? "local",
|
|
4087
4095
|
AKAN_WORKSPACE_ROOT: app.workspace.workspaceRoot,
|
|
4088
4096
|
AKAN_APP_ROOT: app.cwdPath,
|
|
@@ -4131,7 +4139,7 @@ var ApplicationRunner = class {
|
|
|
4131
4139
|
} : {}
|
|
4132
4140
|
);
|
|
4133
4141
|
const server = await vite.createServer(config);
|
|
4134
|
-
await server.listen(4201);
|
|
4142
|
+
await server.listen(4201 + app.workspace.getBaseDevEnv().portOffset);
|
|
4135
4143
|
onStart?.();
|
|
4136
4144
|
if (open2)
|
|
4137
4145
|
setTimeout(() => openBrowser("http://localhost:4201"), 3e3);
|
|
@@ -4381,7 +4389,7 @@ var ApplicationRunner = class {
|
|
|
4381
4389
|
["node_modules/jest/bin/jest.js", `apps/${app.name}`, "-c", `apps/${app.name}/jest.config.ts`],
|
|
4382
4390
|
{
|
|
4383
4391
|
env: {
|
|
4384
|
-
...this.#getEnv(app),
|
|
4392
|
+
...this.#getEnv(app, "backend"),
|
|
4385
4393
|
NEXT_PUBLIC_ENV: "testing",
|
|
4386
4394
|
NEXT_PUBLIC_OPERATION_MODE: "local",
|
|
4387
4395
|
NEXT_PUBLIC_APP_NAME: app.name,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// pkgs/@akanjs/cli/src/templates/app/ui/UiComponent.ts
|
|
2
2
|
function getContent(scanResult, dict) {
|
|
3
|
-
return
|
|
3
|
+
return {
|
|
4
|
+
filename: "UiComponent.tsx",
|
|
5
|
+
content: `
|
|
4
6
|
// This is a Sample UI component that can be used in the app.
|
|
5
7
|
// You can use it by \`import { UiComponent } from "@${dict.appName}/ui";\` in the page or other components.
|
|
6
8
|
// File name and export name should be same, because of modularizedImport feature of Next.js.
|
|
@@ -8,7 +10,8 @@ function getContent(scanResult, dict) {
|
|
|
8
10
|
export const UiComponent = () => {
|
|
9
11
|
return <div>UiComponent</div>;
|
|
10
12
|
};
|
|
11
|
-
|
|
13
|
+
`
|
|
14
|
+
};
|
|
12
15
|
}
|
|
13
16
|
export {
|
|
14
17
|
getContent as default
|
|
@@ -4,9 +4,9 @@ function getContent(scanResult, dict) {
|
|
|
4
4
|
import { batchModuleOf } from "@akanjs/server";
|
|
5
5
|
|
|
6
6
|
import type { ModulesOptions } from "../option";
|
|
7
|
-
import { ${dict.
|
|
7
|
+
import { ${dict.LibName}Service } from "./${dict.libName}.service";
|
|
8
8
|
|
|
9
|
-
export const register${dict.
|
|
9
|
+
export const register${dict.LibName}Module = (option: ModulesOptions) => batchModuleOf({ service: ${dict.LibName}Service, uses: {} });
|
|
10
10
|
`;
|
|
11
11
|
}
|
|
12
12
|
export {
|
|
@@ -4,7 +4,7 @@ function getContent(scanResult, dict) {
|
|
|
4
4
|
filename: "Summary.Template.tsx",
|
|
5
5
|
content: `
|
|
6
6
|
"use client";
|
|
7
|
-
import { st, usePage } from "@${dict.
|
|
7
|
+
import { st, usePage } from "@${dict.libName}/client";
|
|
8
8
|
|
|
9
9
|
interface SummaryEditProps {
|
|
10
10
|
summaryId?: string | null;
|
|
@@ -4,19 +4,18 @@ function getContent(scanResult, dict) {
|
|
|
4
4
|
filename: `${dict.Model}.View.tsx`,
|
|
5
5
|
content: `
|
|
6
6
|
import { clsx } from "@akanjs/client";
|
|
7
|
-
import { cnst } from "@${dict.sysName}/client";
|
|
8
|
-
import { Image } from "@akanjs/ui";
|
|
7
|
+
import { cnst, usePage } from "@${dict.sysName}/client";
|
|
9
8
|
|
|
10
9
|
interface ${dict.Model}ViewProps {
|
|
11
10
|
className?: string;
|
|
12
11
|
${dict.model}: cnst.${dict.Model};
|
|
13
|
-
self?: { id?: string } | null;
|
|
14
12
|
}
|
|
15
13
|
|
|
16
|
-
export const General = ({ className, ${dict.model}
|
|
14
|
+
export const General = ({ className, ${dict.model} }: ${dict.Model}ViewProps) => {
|
|
15
|
+
const { l } = usePage();
|
|
17
16
|
return (
|
|
18
|
-
<div className={clsx(
|
|
19
|
-
<div>{${dict.model}.id}</div>
|
|
17
|
+
<div className={clsx("w-full", className)}>
|
|
18
|
+
<div>{l("${dict.model}.id")}: {${dict.model}.id}</div>
|
|
20
19
|
</div>
|
|
21
20
|
);
|
|
22
21
|
};
|
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
"version": "0.0.1",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"next": "15.3.2",
|
|
7
|
-
"react": "
|
|
8
|
-
"react-dom": "
|
|
7
|
+
"react": "19.1.1",
|
|
8
|
+
"react-dom": "19.1.1",
|
|
9
9
|
"tailwindcss": "^4.1.7",
|
|
10
10
|
"daisyui": "^5.0.35"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"@types/node": "^22.9.0",
|
|
14
14
|
"@tailwindcss/postcss": "^4.1.7",
|
|
15
|
-
"@types/react": "
|
|
16
|
-
"@types/react-dom": "
|
|
15
|
+
"@types/react": "19.1.1",
|
|
16
|
+
"@types/react-dom": "19.1.1",
|
|
17
17
|
"crypto-browserify": "^3.12.1",
|
|
18
18
|
"eslint": "^9.19.0",
|
|
19
19
|
"https-browserify": "^1.0.0",
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"type": "module",
|
|
3
3
|
"sourceType": "module",
|
|
4
4
|
"name": "@akanjs/cli",
|
|
5
|
-
"version": "0.9.
|
|
5
|
+
"version": "0.9.35",
|
|
6
6
|
"bin": {
|
|
7
7
|
"akan": "esm/index.js"
|
|
8
8
|
},
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@langchain/openai": "^0.5.10",
|
|
26
26
|
"@next/bundle-analyzer": "^15.1.3",
|
|
27
27
|
"@trapezedev/project": "^7.1.3",
|
|
28
|
-
"@vitejs/plugin-react": "^4.
|
|
28
|
+
"@vitejs/plugin-react": "^4.7.0",
|
|
29
29
|
"axios": "^1.7.9",
|
|
30
30
|
"chalk": "^5.4.1",
|
|
31
31
|
"commander": "^13.1.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"esbuild-plugin-d.ts": "^1.3.1",
|
|
37
37
|
"eslint": "^9.19.0",
|
|
38
38
|
"form-data": "^4.0.1",
|
|
39
|
-
"ink": "^
|
|
39
|
+
"ink": "^6.1.0",
|
|
40
40
|
"js-yaml": "^4.1.0",
|
|
41
41
|
"latest-version": "^9.0.0",
|
|
42
42
|
"lodash": "^4.17.21",
|
|
@@ -46,16 +46,16 @@
|
|
|
46
46
|
"ora": "^3.4.0",
|
|
47
47
|
"pluralize": "^8.0.0",
|
|
48
48
|
"qrcode": "^1.5.4",
|
|
49
|
-
"react": "
|
|
49
|
+
"react": "19.1.1",
|
|
50
50
|
"react-icons": "^5.4.0",
|
|
51
51
|
"reflect-metadata": "^0.2.2",
|
|
52
52
|
"tsconfig-paths": "^4.2.0",
|
|
53
53
|
"tunnel-ssh": "^5.2.0",
|
|
54
54
|
"typescript": "5.8.3",
|
|
55
55
|
"uuid": "^11.0.3",
|
|
56
|
-
"vite": "^
|
|
56
|
+
"vite": "^7.0.6",
|
|
57
57
|
"vite-plugin-commonjs": "^0.10.4",
|
|
58
|
-
"vite-plugin-node-polyfills": "^0.
|
|
58
|
+
"vite-plugin-node-polyfills": "^0.24.0",
|
|
59
59
|
"vite-tsconfig-paths": "^5.1.4"
|
|
60
60
|
},
|
|
61
61
|
"esbuild": {
|
|
@@ -2,5 +2,8 @@ import type { AppScanResult, LibScanResult } from "@akanjs/config";
|
|
|
2
2
|
interface Dict {
|
|
3
3
|
appName: string;
|
|
4
4
|
}
|
|
5
|
-
export default function getContent(scanResult: AppScanResult | LibScanResult | null, dict: Dict):
|
|
5
|
+
export default function getContent(scanResult: AppScanResult | LibScanResult | null, dict: Dict): {
|
|
6
|
+
filename: string;
|
|
7
|
+
content: string;
|
|
8
|
+
};
|
|
6
9
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AppScanResult, LibScanResult } from "@akanjs/config";
|
|
2
2
|
interface Dict {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
libName: string;
|
|
4
|
+
LibName: string;
|
|
5
5
|
}
|
|
6
6
|
export default function getContent(scanResult: AppScanResult | LibScanResult | null, dict: Dict): string;
|
|
7
7
|
export {};
|