@akanjs/cli 3.0.0-alpha.1 → 3.0.0-alpha.10
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/.build-stamp +1 -1
- package/{agent.command-yv00p0s0.js → agent.command-f0gqkfgz.js} +7 -6
- package/{application.command-0qsczf4k.js → application.command-x903m2qq.js} +5 -4
- package/{applicationBuildRunner-ct2pxyvw.js → applicationBuildRunner-ha3y8ew8.js} +3 -3
- package/buildBatch.proc.js +4 -3
- package/{capacitorApp-4r9sm3qg.js → capacitorApp-9xswcgx7.js} +5 -2
- package/{cloud.command-dxfv18sa.js → cloud.command-zs6kyf83.js} +8 -7
- package/{context.command-8d9e3k6b.js → context.command-fmepgjzg.js} +14 -13
- package/getDirname-m9s0cmhq.js +8 -0
- package/{guideline.command-3jbkxzh6.js → guideline.command-n6sw0a0c.js} +5 -4
- package/guidelines/conventions/conventions.generate.json +25 -0
- package/guidelines/conventions/conventions.instruction.md +668 -0
- package/guidelines/workspaceOnboarding/workspaceOnboarding.generate.json +24 -0
- package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +972 -0
- package/incrementalBuilder.proc.js +3 -2
- package/index-1577bej2.js +7 -0
- package/{index-bekddz9q.js → index-3vta1tqa.js} +4 -4
- package/{index-zasydjxd.js → index-4m0bphac.js} +3 -3
- package/{index-1pvex4az.js → index-5sn5w2mt.js} +13 -13
- package/{index-e16gnn26.js → index-62955kn5.js} +7 -7
- package/{index-a00jg8x8.js → index-774gcx29.js} +49 -32
- package/{index-t3723f99.js → index-779ske1y.js} +86 -17
- package/{index-nm6wghb6.js → index-82jrh4hj.js} +5 -5
- package/{index-7c6k4yvg.js → index-d43t8af2.js} +2 -2
- package/{index-ej426mcr.js → index-eyyf2149.js} +34 -6
- package/{index-k95xkh4p.js → index-gcv8ncfh.js} +2 -2
- package/{index-tdbas9r0.js → index-j37qq1f2.js} +1 -1
- package/{index-rh16j3c7.js → index-j9cxndc0.js} +3 -2
- package/{index-mr5s7mqd.js → index-jf2ya7r2.js} +3 -3
- package/{index-yzmhasdb.js → index-jhpa13zj.js} +7 -7
- package/{index-8hsbnyes.js → index-kdh76j26.js} +4 -2
- package/{index-pyt2b4nw.js → index-qb61h0k7.js} +52 -17
- package/{index-2q1f5j9k.js → index-qzdjd4ct.js} +3 -3
- package/{index-rzwcpcc3.js → index-rxkpk7n4.js} +1 -1
- package/{index-bbkek1bp.js → index-xmmzf150.js} +1 -1
- package/{index-ec09pws3.js → index-y4vkyhvv.js} +3 -3
- package/{index-hgna5rjy.js → index-z8ptfkzv.js} +83 -39
- package/index.js +19 -18
- package/{library.command-ebdj1vnm.js → library.command-cv9gdbmg.js} +4 -3
- package/{localRegistry.command-gb178ne8.js → localRegistry.command-d8fg36zc.js} +7 -6
- package/{module.command-9c1bnsx4.js → module.command-qyr1s9cn.js} +7 -6
- package/{package.command-t93p4jkj.js → package.command-wsjx0k47.js} +4 -3
- package/package.json +2 -2
- package/{page.command-k3k0meh2.js → page.command-rdzg65rm.js} +4 -3
- package/{primitive.command-de6nktdt.js → primitive.command-89g38b53.js} +8 -7
- package/{quality.command-z5kth2wa.js → quality.command-0cs2z92d.js} +10 -40
- package/{repair.command-ehf2g112.js → repair.command-6fphxfwj.js} +6 -5
- package/{routeSourceValidator-cncd92fv.js → routeSourceValidator-e4jmbfcx.js} +2 -38
- package/{scalar.command-7a2jtv33.js → scalar.command-xfer69s6.js} +6 -5
- package/templates/app/page/styles.css.template +3 -3
- package/templates/crudPages/[__model__Id]/edit/page.tsx +1 -1
- package/templates/crudPages/new/page.tsx +1 -1
- package/templates/crudSinglePage/page.tsx +1 -1
- package/templates/lib/db.ts +3 -1
- package/templates/lib/useClient.ts +9 -3
- package/templates/module/__Model__.Util.tsx +1 -1
- package/templates/module/__Model__.Zone.tsx +3 -5
- package/templates/workspaceRoot/AGENTS.md.template +0 -948
- package/templates/workspaceRoot/biome.json.template +3 -198
- package/templates/workspaceRoot/docs/AI-DEVELOPMENT.md.template +4 -1
- package/{workflow.command-e0tt0vk2.js → workflow.command-2ygfqt4f.js} +13 -12
- package/{workspace.command-fpda0evj.js → workspace.command-vbgpjkf9.js} +35 -33
- package/templates/libRoot/base/baseLogic.ts +0 -14
- package/templates/libRoot/base/index.ts +0 -8
- package/templates/workspaceRoot/.cursor/rules/akan-page-routing.mdc.template +0 -43
- package/templates/workspaceRoot/.cursor/rules/akan-sync-conventions.mdc.template +0 -33
- package/templates/workspaceRoot/.cursor/rules/application-test-commands.mdc.template +0 -16
- package/templates/workspaceRoot/.cursor/rules/change-scope.mdc.template +0 -12
- package/templates/workspaceRoot/.cursor/rules/client-server-boundaries.mdc.template +0 -18
- package/templates/workspaceRoot/.cursor/rules/coding-comments.mdc.template +0 -25
- package/templates/workspaceRoot/.cursor/rules/coding-style.mdc.template +0 -44
- package/templates/workspaceRoot/.cursor/rules/domain-module-conventions.mdc.template +0 -17
- package/templates/workspaceRoot/.cursor/rules/format-lint.mdc.template +0 -12
- package/templates/workspaceRoot/.cursor/rules/lint-enforced-rules.mdc.template +0 -18
- package/templates/workspaceRoot/.cursor/rules/module-file-playbook.mdc.template +0 -61
- package/templates/workspaceRoot/.cursor/rules/naming-conventions.mdc.template +0 -15
- package/templates/workspaceRoot/.cursor/rules/react-component-style.mdc.template +0 -21
- package/templates/workspaceRoot/.cursor/rules/repo-overview.mdc.template +0 -17
- package/templates/workspaceRoot/.cursor/rules/scalar-modeling.mdc.template +0 -58
- package/templates/workspaceRoot/.cursor/rules/secrets-and-env.mdc.template +0 -13
- package/templates/workspaceRoot/.cursor/rules/service-signal-conventions.mdc.template +0 -83
- package/templates/workspaceRoot/.cursor/rules/srvkit-adapters-and-guards.mdc.template +0 -50
- package/templates/workspaceRoot/.cursor/rules/ssr-first.mdc.template +0 -59
- package/templates/workspaceRoot/.cursor/rules/typescript-imports.mdc.template +0 -16
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
ModuleScript
|
|
4
|
-
} from "./index-
|
|
5
|
-
import"./index-bbkek1bp.js";
|
|
4
|
+
} from "./index-jhpa13zj.js";
|
|
6
5
|
import"./index-ss469dec.js";
|
|
6
|
+
import"./index-xmmzf150.js";
|
|
7
7
|
import"./index-0cj2zxbm.js";
|
|
8
8
|
import {
|
|
9
9
|
renderPrimitiveReport
|
|
10
|
-
} from "./index-
|
|
11
|
-
import"./index-
|
|
10
|
+
} from "./index-rxkpk7n4.js";
|
|
11
|
+
import"./index-j37qq1f2.js";
|
|
12
12
|
import {
|
|
13
13
|
Module,
|
|
14
14
|
Sys,
|
|
15
15
|
command
|
|
16
|
-
} from "./index-
|
|
17
|
-
import"./index-
|
|
16
|
+
} from "./index-kdh76j26.js";
|
|
17
|
+
import"./index-z8ptfkzv.js";
|
|
18
18
|
import"./index-mxvakhsm.js";
|
|
19
|
+
import"./index-1577bej2.js";
|
|
19
20
|
import"./index-67546d0j.js";
|
|
20
21
|
import"./index-r24hmh0q.js";
|
|
21
22
|
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
PackageScript
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-gcv8ncfh.js";
|
|
5
5
|
import {
|
|
6
6
|
Pkg,
|
|
7
7
|
Workspace,
|
|
8
8
|
command
|
|
9
|
-
} from "./index-
|
|
10
|
-
import"./index-
|
|
9
|
+
} from "./index-kdh76j26.js";
|
|
10
|
+
import"./index-z8ptfkzv.js";
|
|
11
11
|
import"./index-mxvakhsm.js";
|
|
12
|
+
import"./index-1577bej2.js";
|
|
12
13
|
import"./index-46tjzh6s.js";
|
|
13
14
|
import"./index-67546d0j.js";
|
|
14
15
|
import"./index-r24hmh0q.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/cli",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.10",
|
|
4
4
|
"sourceType": "module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@langchain/openai": "^1.4.6",
|
|
35
35
|
"@tailwindcss/node": "^4.3.0",
|
|
36
36
|
"@trapezedev/project": "^7.1.4",
|
|
37
|
-
"akanjs": "3.0.0-alpha.
|
|
37
|
+
"akanjs": "3.0.0-alpha.10",
|
|
38
38
|
"chalk": "^5.6.2",
|
|
39
39
|
"commander": "^14.0.3",
|
|
40
40
|
"dayjs": "^1.11.20",
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
PageScript
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-xmmzf150.js";
|
|
5
5
|
import {
|
|
6
6
|
App,
|
|
7
7
|
Module,
|
|
8
8
|
command
|
|
9
|
-
} from "./index-
|
|
10
|
-
import"./index-
|
|
9
|
+
} from "./index-kdh76j26.js";
|
|
10
|
+
import"./index-z8ptfkzv.js";
|
|
11
11
|
import"./index-mxvakhsm.js";
|
|
12
|
+
import"./index-1577bej2.js";
|
|
12
13
|
import"./index-67546d0j.js";
|
|
13
14
|
import"./index-r24hmh0q.js";
|
|
14
15
|
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
PrimitiveScript
|
|
4
|
-
} from "./index-
|
|
5
|
-
import"./index-
|
|
6
|
-
import"./index-bbkek1bp.js";
|
|
4
|
+
} from "./index-3vta1tqa.js";
|
|
5
|
+
import"./index-jhpa13zj.js";
|
|
7
6
|
import"./index-ss469dec.js";
|
|
7
|
+
import"./index-xmmzf150.js";
|
|
8
8
|
import"./index-0cj2zxbm.js";
|
|
9
9
|
import {
|
|
10
10
|
renderPrimitiveReport
|
|
11
|
-
} from "./index-
|
|
12
|
-
import"./index-
|
|
11
|
+
} from "./index-rxkpk7n4.js";
|
|
12
|
+
import"./index-j37qq1f2.js";
|
|
13
13
|
import {
|
|
14
14
|
Workspace,
|
|
15
15
|
command
|
|
16
|
-
} from "./index-
|
|
17
|
-
import"./index-
|
|
16
|
+
} from "./index-kdh76j26.js";
|
|
17
|
+
import"./index-z8ptfkzv.js";
|
|
18
18
|
import"./index-mxvakhsm.js";
|
|
19
|
+
import"./index-1577bej2.js";
|
|
19
20
|
import"./index-67546d0j.js";
|
|
20
21
|
import"./index-r24hmh0q.js";
|
|
21
22
|
|
|
@@ -7,9 +7,13 @@ import {
|
|
|
7
7
|
command,
|
|
8
8
|
runner,
|
|
9
9
|
script
|
|
10
|
-
} from "./index-
|
|
11
|
-
import
|
|
10
|
+
} from "./index-kdh76j26.js";
|
|
11
|
+
import {
|
|
12
|
+
appRootAllowedFiles,
|
|
13
|
+
libFacetRootAllowedFiles
|
|
14
|
+
} from "./index-z8ptfkzv.js";
|
|
12
15
|
import"./index-mxvakhsm.js";
|
|
16
|
+
import"./index-1577bej2.js";
|
|
13
17
|
import"./index-67546d0j.js";
|
|
14
18
|
import"./index-r24hmh0q.js";
|
|
15
19
|
|
|
@@ -17,6 +21,7 @@ import"./index-r24hmh0q.js";
|
|
|
17
21
|
import { createHash } from "crypto";
|
|
18
22
|
import { readdir, readFile, stat } from "fs/promises";
|
|
19
23
|
import path from "path";
|
|
24
|
+
import { RESERVED_ROUTE_CONFIG_EXPORTS } from "akanjs/common";
|
|
20
25
|
import ignore from "ignore";
|
|
21
26
|
import ts2 from "typescript";
|
|
22
27
|
|
|
@@ -404,27 +409,6 @@ var SUGGESTED_RULES = [
|
|
|
404
409
|
"Move shared app utilities to apps/*/common instead of creating apps/*/base.",
|
|
405
410
|
"Avoid large mixed-purpose class files; class export files should import helpers from neighboring utility files instead of declaring them inline."
|
|
406
411
|
];
|
|
407
|
-
var APP_ROOT_FILES = new Set([
|
|
408
|
-
"akan.app.json",
|
|
409
|
-
"akan.config.ts",
|
|
410
|
-
"capacitor.config.ts",
|
|
411
|
-
"client.ts",
|
|
412
|
-
"main.ts",
|
|
413
|
-
"package.json",
|
|
414
|
-
"server.ts",
|
|
415
|
-
"tsconfig.json"
|
|
416
|
-
]);
|
|
417
|
-
var LIB_ROOT_FILES = new Set([
|
|
418
|
-
"cnst.ts",
|
|
419
|
-
"db.ts",
|
|
420
|
-
"dict.ts",
|
|
421
|
-
"option.ts",
|
|
422
|
-
"sig.ts",
|
|
423
|
-
"srv.ts",
|
|
424
|
-
"st.ts",
|
|
425
|
-
"useClient.ts",
|
|
426
|
-
"useServer.ts"
|
|
427
|
-
]);
|
|
428
412
|
var CONVENTION_SUFFIXES = [
|
|
429
413
|
".constant.ts",
|
|
430
414
|
".dictionary.ts",
|
|
@@ -433,20 +417,6 @@ var CONVENTION_SUFFIXES = [
|
|
|
433
417
|
".signal.ts",
|
|
434
418
|
".store.ts"
|
|
435
419
|
];
|
|
436
|
-
var PAGE_RESERVED_EXPORTS = new Set([
|
|
437
|
-
"pageConfig",
|
|
438
|
-
"head",
|
|
439
|
-
"metadata",
|
|
440
|
-
"generateHead",
|
|
441
|
-
"generateMetadata",
|
|
442
|
-
"fonts",
|
|
443
|
-
"manifest",
|
|
444
|
-
"theme",
|
|
445
|
-
"reconnect",
|
|
446
|
-
"wsConnect",
|
|
447
|
-
"layoutStyle",
|
|
448
|
-
"gaTrackingId"
|
|
449
|
-
]);
|
|
450
420
|
var RULE_FIXES = {
|
|
451
421
|
"akan.global.duplicate-exported-function-name": "Rename one of the exports, or if they are the same thing, extract it into one shared module and import it in both places.",
|
|
452
422
|
"akan.global.duplicate-exported-function-body": "Extract the shared implementation into a single exported helper and import it, instead of copying the body.",
|
|
@@ -703,7 +673,7 @@ class AkanQualityScanner {
|
|
|
703
673
|
#scanLayoutQuality(sourceFile) {
|
|
704
674
|
const segments = sourceFile.file.split("/");
|
|
705
675
|
const warnings = [];
|
|
706
|
-
if (segments[0] === "apps" && segments.length === 3 && !
|
|
676
|
+
if (segments[0] === "apps" && segments.length === 3 && !appRootAllowedFiles.has(segments[2])) {
|
|
707
677
|
warnings.push({
|
|
708
678
|
rule: "akan.layout.app-root-file",
|
|
709
679
|
scope: "layout",
|
|
@@ -713,7 +683,7 @@ class AkanQualityScanner {
|
|
|
713
683
|
});
|
|
714
684
|
}
|
|
715
685
|
const libRootFile = getLibRootFile(sourceFile.file);
|
|
716
|
-
if (libRootFile && !
|
|
686
|
+
if (libRootFile && !libFacetRootAllowedFiles.has(libRootFile)) {
|
|
717
687
|
warnings.push({
|
|
718
688
|
rule: "akan.layout.lib-root-file",
|
|
719
689
|
scope: "layout",
|
|
@@ -929,7 +899,7 @@ function isRestrictedInternalKind(kind) {
|
|
|
929
899
|
function isAllowedComponentExport(declaration, isPage) {
|
|
930
900
|
if (isComponentValueKind(declaration.kind) && isPascalCaseName(declaration.name))
|
|
931
901
|
return true;
|
|
932
|
-
return isPage &&
|
|
902
|
+
return isPage && RESERVED_ROUTE_CONFIG_EXPORTS.has(declaration.name);
|
|
933
903
|
}
|
|
934
904
|
function isPascalCaseName(name) {
|
|
935
905
|
return /^[A-Z]/.test(name) && !/^[A-Z0-9_]+$/.test(name);
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
RepairRunner
|
|
4
|
-
} from "./index-
|
|
5
|
-
import"./index-
|
|
6
|
-
import"./index-
|
|
4
|
+
} from "./index-jf2ya7r2.js";
|
|
5
|
+
import"./index-774gcx29.js";
|
|
6
|
+
import"./index-rxkpk7n4.js";
|
|
7
7
|
import {
|
|
8
8
|
Workspace,
|
|
9
9
|
command,
|
|
10
10
|
script
|
|
11
|
-
} from "./index-
|
|
12
|
-
import"./index-
|
|
11
|
+
} from "./index-kdh76j26.js";
|
|
12
|
+
import"./index-z8ptfkzv.js";
|
|
13
13
|
import"./index-mxvakhsm.js";
|
|
14
14
|
import"./index-xys926f2.js";
|
|
15
|
+
import"./index-1577bej2.js";
|
|
15
16
|
import"./index-67546d0j.js";
|
|
16
17
|
import"./index-r24hmh0q.js";
|
|
17
18
|
|
|
@@ -2,49 +2,13 @@
|
|
|
2
2
|
import"./index-r24hmh0q.js";
|
|
3
3
|
|
|
4
4
|
// pkgs/@akanjs/devkit/routeSourceValidator.ts
|
|
5
|
+
import { getRouteExports } from "akanjs/common";
|
|
5
6
|
import ts from "typescript";
|
|
6
7
|
|
|
7
8
|
class RouteSourceValidator {
|
|
8
|
-
static #pageExports = new Set([
|
|
9
|
-
"default",
|
|
10
|
-
"pageConfig",
|
|
11
|
-
"head",
|
|
12
|
-
"metadata",
|
|
13
|
-
"generateHead",
|
|
14
|
-
"generateMetadata",
|
|
15
|
-
"Loading"
|
|
16
|
-
]);
|
|
17
|
-
static #rootLayoutExports = new Set([
|
|
18
|
-
"default",
|
|
19
|
-
"pageConfig",
|
|
20
|
-
"head",
|
|
21
|
-
"metadata",
|
|
22
|
-
"generateHead",
|
|
23
|
-
"generateMetadata",
|
|
24
|
-
"fonts",
|
|
25
|
-
"manifest",
|
|
26
|
-
"theme",
|
|
27
|
-
"reconnect",
|
|
28
|
-
"layoutStyle",
|
|
29
|
-
"gaTrackingId",
|
|
30
|
-
"Loading",
|
|
31
|
-
"NotFound",
|
|
32
|
-
"Error"
|
|
33
|
-
]);
|
|
34
|
-
static #layoutExports = new Set([
|
|
35
|
-
"default",
|
|
36
|
-
"pageConfig",
|
|
37
|
-
"head",
|
|
38
|
-
"metadata",
|
|
39
|
-
"generateHead",
|
|
40
|
-
"generateMetadata",
|
|
41
|
-
"Loading",
|
|
42
|
-
"NotFound",
|
|
43
|
-
"Error"
|
|
44
|
-
]);
|
|
45
9
|
static validateRouteSourceExports(source, filePath, kind, options = {}) {
|
|
46
10
|
const sourceFile = ts.createSourceFile(filePath, source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX);
|
|
47
|
-
const allowed = kind
|
|
11
|
+
const allowed = getRouteExports(kind, { rootLayout: options.rootLayout });
|
|
48
12
|
const exported = new Set;
|
|
49
13
|
const assertExport = (name) => {
|
|
50
14
|
if (!allowed.has(name)) {
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
ScalarScript
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-y4vkyhvv.js";
|
|
5
5
|
import"./index-ss469dec.js";
|
|
6
6
|
import"./index-0cj2zxbm.js";
|
|
7
7
|
import {
|
|
8
8
|
renderPrimitiveReport
|
|
9
|
-
} from "./index-
|
|
10
|
-
import"./index-
|
|
9
|
+
} from "./index-rxkpk7n4.js";
|
|
10
|
+
import"./index-j37qq1f2.js";
|
|
11
11
|
import {
|
|
12
12
|
Sys,
|
|
13
13
|
command
|
|
14
|
-
} from "./index-
|
|
15
|
-
import"./index-
|
|
14
|
+
} from "./index-kdh76j26.js";
|
|
15
|
+
import"./index-z8ptfkzv.js";
|
|
16
16
|
import"./index-mxvakhsm.js";
|
|
17
|
+
import"./index-1577bej2.js";
|
|
17
18
|
import"./index-67546d0j.js";
|
|
18
19
|
import"./index-r24hmh0q.js";
|
|
19
20
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
@import "tailwindcss";
|
|
2
2
|
@import "akanjs/ui/styles.css";
|
|
3
3
|
|
|
4
|
-
/*
|
|
5
|
-
akanjs/ui/styles.css
|
|
4
|
+
/* The theme system (brand-neutral default palette, @theme inline mapping, dark variant, and runtime
|
|
5
|
+
data-theme switching) is fully provided by akanjs/ui/styles.css. This app works from the import alone.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
To use this app's own brand colors, override the tokens like this:
|
|
8
8
|
|
|
9
9
|
:root,
|
|
10
10
|
[data-theme="dark"] {
|
|
@@ -30,7 +30,7 @@ export default async function Page({ params }: PageProps) {
|
|
|
30
30
|
</div>
|
|
31
31
|
<Load.Edit
|
|
32
32
|
className="flex flex-col items-center"
|
|
33
|
-
slice={fetch.slice
|
|
33
|
+
slice={fetch.slice.${dict.model}InPublic}
|
|
34
34
|
edit={${dict.model}Edit}
|
|
35
35
|
type="form"
|
|
36
36
|
onCancel="back"
|
|
@@ -20,7 +20,7 @@ export default async function Page() {
|
|
|
20
20
|
<>
|
|
21
21
|
<div className="animate-fadeIn flex items-center gap-4 px-4 pt-4">
|
|
22
22
|
<div className="text-lg font-bold md:text-4xl">{l("${dict.model}.modelName")}</div>
|
|
23
|
-
<Model.New className="inline-flex items-center gap-2 rounded-field px-3 py-1.5 text-sm transition-colors hover:bg-muted" slice={fetch.slice
|
|
23
|
+
<Model.New className="inline-flex items-center gap-2 rounded-field px-3 py-1.5 text-sm transition-colors hover:bg-muted" slice={fetch.slice.${dict.model}InPublic} renderTitle="id">
|
|
24
24
|
<${dict.Model}.Template.General />
|
|
25
25
|
</Model.New>
|
|
26
26
|
</div>
|
package/templates/lib/db.ts
CHANGED
|
@@ -16,7 +16,9 @@ ${databaseModules.map((module) => `import * as ${module}Db from "./${module}/${m
|
|
|
16
16
|
${libs.map((lib) => `export { db as ${lib} } from "@libs/${lib}/server";`).join("\n")}
|
|
17
17
|
|
|
18
18
|
${databaseModules.map((module) => `class ${capitalize(module)}Input extends by(cnst.${capitalize(module)}Input) {}`).join("\n")}
|
|
19
|
+
${databaseModules.map((module) => `class ${capitalize(module)}Insight extends by(cnst.${capitalize(module)}Insight) {}`).join("\n")}
|
|
19
20
|
${databaseModules.length ? `export type { ${databaseModules.map((module) => `${capitalize(module)}Input`).join(", ")} };` : ""}
|
|
21
|
+
${databaseModules.length ? `export type { ${databaseModules.map((module) => `${capitalize(module)}Insight`).join(", ")} };` : ""}
|
|
20
22
|
|
|
21
23
|
${scalarModules.map((module) => `export type * from "./__scalar/${module}/${module}.document";`).join("\n")}
|
|
22
24
|
${databaseModules.map((module) => `export type * from "./${module}/${module}.document";`).join("\n")}
|
|
@@ -24,7 +26,7 @@ ${databaseModules.map((module) => `export type * from "./${module}/${module}.doc
|
|
|
24
26
|
${databaseModules
|
|
25
27
|
.map((module) => {
|
|
26
28
|
const names = { Module: module.charAt(0).toUpperCase() + module.slice(1) };
|
|
27
|
-
return `export const ${module} = DatabaseRegistry.buildModel("${module}" as const, ${names.Module}Input, ${module}Db.${names.Module}, ${module}Db.${names.Module}Model, cnst.${names.Module},
|
|
29
|
+
return `export const ${module} = DatabaseRegistry.buildModel("${module}" as const, ${names.Module}Input, ${module}Db.${names.Module}, ${module}Db.${names.Module}Model, cnst.${names.Module}, ${names.Module}Insight, ${module}Db.${names.Module}Filter);`;
|
|
28
30
|
})
|
|
29
31
|
.join("\n")}
|
|
30
32
|
${scalarModules.map((module) => `export const ${module} = DatabaseRegistry.buildScalar("${module}" as const, ${capitalize(module)});`).join("\n")}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import type { AppInfo, LibInfo } from "akanjs";
|
|
2
2
|
|
|
3
3
|
export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: { [key: string]: string } = {}) {
|
|
4
|
+
const isApp = (scanInfo?.type ?? "lib") === "app";
|
|
4
5
|
return `
|
|
5
6
|
import { makePageProto, registerClientRuntime } from "akanjs/client";
|
|
6
7
|
import { FetchClient } from "akanjs/fetch";
|
|
7
8
|
import * as cnst from "./cnst";
|
|
8
|
-
import { getAllDictionary } from "./dict" with { type: "macro" };
|
|
9
|
-
import type * as dict from "./dict";
|
|
9
|
+
${isApp ? `import { getAllDictionary } from "./dict" with { type: "macro" };\n` : ""}import type * as dict from "./dict";
|
|
10
10
|
import { getSerializedSignal } from "./sig" with { type: "macro" };
|
|
11
11
|
import type * as signal from "./sig";
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
${
|
|
14
|
+
isApp
|
|
15
|
+
? `const dictionary = process.env.AKAN_PUBLIC_RENDER_ENV === "csr" ? getAllDictionary() : {};`
|
|
16
|
+
: `// dict.ts is cumulative, so a lib dictionary is a subset of the mounting app's. Translator state is global,
|
|
17
|
+
// so the app's seed already resolves l() here — seeding again would ship the same payload a second time.
|
|
18
|
+
const dictionary = {};`
|
|
19
|
+
}
|
|
14
20
|
const pageProto = makePageProto<typeof dict>(dictionary);
|
|
15
21
|
const fetchProto = FetchClient.build<typeof signal>(cnst, getSerializedSignal(), { Err: pageProto.Err });
|
|
16
22
|
export const runtime = registerClientRuntime({ ...pageProto, ...fetchProto }, { scope: ${JSON.stringify(scanInfo?.type ?? "lib")} });
|
|
@@ -21,7 +21,7 @@ interface RemoveProps {
|
|
|
21
21
|
export const Remove = ({ ${dict.model}Id }: RemoveProps) => {
|
|
22
22
|
const { l } = usePage();
|
|
23
23
|
return (
|
|
24
|
-
<Model.Remove modelId={${dict.model}Id} slice={fetch.slice
|
|
24
|
+
<Model.Remove modelId={${dict.model}Id} slice={fetch.slice.${dict.model}}>
|
|
25
25
|
<BiTrash /> {l("base.remove")}
|
|
26
26
|
</Model.Remove>
|
|
27
27
|
);
|
|
@@ -12,9 +12,7 @@ export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: Dic
|
|
|
12
12
|
content: `
|
|
13
13
|
"use client";
|
|
14
14
|
import { Load } from "akanjs/ui";
|
|
15
|
-
|
|
16
|
-
// (a model literally named "card" or "view" would otherwise shadow this import).
|
|
17
|
-
import { type cnst, ${dict.Model} as ${dict.Model}Domain } from "@${dict.sysType}s/${dict.sysName}/client";
|
|
15
|
+
import { type cnst, ${dict.Model} as ${dict.Model} } from "@${dict.sysType}s/${dict.sysName}/client";
|
|
18
16
|
import type { ClientInit, ClientView, SliceMeta } from "akanjs/fetch";
|
|
19
17
|
|
|
20
18
|
interface CardProps {
|
|
@@ -28,7 +26,7 @@ export const Card = ({ className, init, slice }: CardProps) => {
|
|
|
28
26
|
className={className}
|
|
29
27
|
init={init}
|
|
30
28
|
renderItem={(${dict.model}) => (
|
|
31
|
-
<${dict.Model}
|
|
29
|
+
<${dict.Model}.Unit.Card key={${dict.model}.id} href={\`/${dict.model}/\${${dict.model}.id}\`} ${dict.model}={${dict.model}} />
|
|
32
30
|
)}
|
|
33
31
|
/>
|
|
34
32
|
);
|
|
@@ -39,7 +37,7 @@ interface ViewProps {
|
|
|
39
37
|
view: ClientView<"${dict.model}", cnst.${dict.Model}>;
|
|
40
38
|
}
|
|
41
39
|
export const View = ({ view }: ViewProps) => {
|
|
42
|
-
return <Load.View view={view} renderView={(${dict.model}) => <${dict.Model}
|
|
40
|
+
return <Load.View view={view} renderView={(${dict.model}) => <${dict.Model}.View.General ${dict.model}={${dict.model}} />} />;
|
|
43
41
|
};
|
|
44
42
|
`,
|
|
45
43
|
};
|