@akanjs/cli 2.1.1-rc.2 → 2.1.2-rc.0
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/guidelines/modelConstant/modelConstant.generate.json +1 -0
- package/guidelines/modelDictionary/modelDictionary.generate.json +1 -0
- package/guidelines/scalarConstant/scalarConstant.generate.json +1 -0
- package/guidelines/scalarDictionary/scalarDictionary.generate.json +1 -0
- package/incrementalBuilder.proc.js +447 -134
- package/index.js +614 -256
- package/package.json +2 -2
- package/templates/lib/dict.ts +5 -2
- package/templates/lib/useClient.ts +6 -2
- package/templates/module/__Model__.Unit.tsx +5 -2
- package/typecheck.proc.js +19 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/cli",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2-rc.0",
|
|
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.1.
|
|
38
|
+
"akanjs": "2.1.2-rc.0",
|
|
39
39
|
"chalk": "^5.6.2",
|
|
40
40
|
"commander": "^14.0.3",
|
|
41
41
|
"daisyui": "^5.5.20",
|
package/templates/lib/dict.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { AppInfo, LibInfo } from "akanjs";
|
|
2
2
|
|
|
3
3
|
const capitalize = (str: string) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
4
|
-
export default function getContent(
|
|
4
|
+
export default function getContent(
|
|
5
|
+
scanInfo: AppInfo | LibInfo | null,
|
|
6
|
+
dict: { [key: string]: string } = {},
|
|
7
|
+
) {
|
|
5
8
|
if (!scanInfo) return null;
|
|
6
9
|
const databaseModules = scanInfo.getDatabaseModules();
|
|
7
10
|
const scalarModules = scanInfo.getScalarModules();
|
|
@@ -44,6 +47,6 @@ export const dictionary = makeDictionary(${libs.length ? libs.join(", ") : "base
|
|
|
44
47
|
].join(",\n ")}
|
|
45
48
|
});
|
|
46
49
|
|
|
47
|
-
export const { Err, translate, msg, getAllDictionary, __Dict_Key__, __Error_Key__ } = makeTrans(dictionary);
|
|
50
|
+
export const { Err, translate, msg, getDictionary, getAllDictionary, __Dict_Key__, __Error_Key__ } = makeTrans(dictionary);
|
|
48
51
|
`;
|
|
49
52
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { AppInfo, LibInfo } from "akanjs";
|
|
2
2
|
|
|
3
|
-
export default function getContent(
|
|
3
|
+
export default function getContent(
|
|
4
|
+
scanInfo: AppInfo | LibInfo | null,
|
|
5
|
+
dict: { [key: string]: string } = {},
|
|
6
|
+
) {
|
|
4
7
|
return `
|
|
5
8
|
import { makePageProto, registerClientRuntime } from "akanjs/client";
|
|
6
9
|
import { FetchClient } from "akanjs/fetch";
|
|
@@ -10,7 +13,8 @@ import type * as dict from "./dict";
|
|
|
10
13
|
import { getSerializedSignal } from "./sig" with { type: "macro" };
|
|
11
14
|
import type * as signal from "./sig";
|
|
12
15
|
|
|
13
|
-
const
|
|
16
|
+
const dictionary = process.env.AKAN_PUBLIC_RENDER_ENV === "csr" ? getAllDictionary() : {};
|
|
17
|
+
const pageProto = makePageProto<typeof dict>(dictionary);
|
|
14
18
|
const fetchProto = FetchClient.build<typeof signal>(cnst, getSerializedSignal(), { Err: pageProto.Err });
|
|
15
19
|
export const runtime = registerClientRuntime({ ...pageProto, ...fetchProto }, { scope: ${JSON.stringify(scanInfo?.type ?? "lib")} });
|
|
16
20
|
|
|
@@ -5,11 +5,14 @@ interface Dict {
|
|
|
5
5
|
model: string;
|
|
6
6
|
sysName: string;
|
|
7
7
|
}
|
|
8
|
-
export default function getContent(
|
|
8
|
+
export default function getContent(
|
|
9
|
+
scanInfo: AppInfo | LibInfo | null,
|
|
10
|
+
dict: Dict,
|
|
11
|
+
) {
|
|
9
12
|
return {
|
|
10
13
|
filename: `${dict.Model}.Unit.tsx`,
|
|
11
14
|
content: `
|
|
12
|
-
import { ModelProps } from "akanjs/client";
|
|
15
|
+
import type { ModelProps } from "akanjs/client";
|
|
13
16
|
import { cnst, usePage } from "@${scanInfo?.type ?? "apps"}/${dict.sysName}/client";
|
|
14
17
|
import { Link } from "akanjs/ui";
|
|
15
18
|
|
package/typecheck.proc.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var __require = import.meta.require;
|
|
3
3
|
|
|
4
|
+
// pkgs/@akanjs/devkit/typecheck/typecheck.proc.ts
|
|
5
|
+
import { Logger } from "akanjs/common";
|
|
6
|
+
|
|
4
7
|
// pkgs/@akanjs/devkit/typeChecker.ts
|
|
5
8
|
import { readFileSync } from "fs";
|
|
6
9
|
import * as path from "path";
|
|
@@ -194,6 +197,22 @@ ${summary.join(", ")} found${output.join(`
|
|
|
194
197
|
|
|
195
198
|
// pkgs/@akanjs/devkit/typecheck/typecheck.proc.ts
|
|
196
199
|
try {
|
|
200
|
+
const filePath = process.env.AKAN_TYPECHECK_FILE;
|
|
201
|
+
if (filePath) {
|
|
202
|
+
const cwdPath = process.env.AKAN_TYPECHECK_CWD;
|
|
203
|
+
if (!cwdPath)
|
|
204
|
+
throw new Error("AKAN_TYPECHECK_CWD is required");
|
|
205
|
+
const typeChecker = new TypeChecker({ cwdPath });
|
|
206
|
+
const { fileDiagnostics, fileErrors, fileWarnings } = typeChecker.check(filePath);
|
|
207
|
+
const message = typeChecker.formatDiagnostics(fileDiagnostics);
|
|
208
|
+
Logger.rawLog(JSON.stringify({
|
|
209
|
+
fileDiagnosticsCount: fileDiagnostics.length,
|
|
210
|
+
fileErrorsCount: fileErrors.length,
|
|
211
|
+
fileWarningsCount: fileWarnings.length,
|
|
212
|
+
message
|
|
213
|
+
}));
|
|
214
|
+
process.exit(0);
|
|
215
|
+
}
|
|
197
216
|
const configPath = process.env.AKAN_TYPECHECK_TSCONFIG;
|
|
198
217
|
if (!configPath)
|
|
199
218
|
throw new Error("AKAN_TYPECHECK_TSCONFIG is required");
|