@akanjs/cli 0.9.60-canary.9 → 1.0.1-canary.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/README.md +1 -12
- package/cjs/index.js +16 -47
- package/cjs/src/guidelines/scalarConstant/scalarConstant.generate.json +24 -20
- package/cjs/src/guidelines/scalarConstant/scalarConstant.instruction.md +284 -326
- package/cjs/src/guidelines/scalarDictionary/scalarDictionary.generate.json +32 -32
- package/cjs/src/guidelines/scalarDictionary/scalarDictionary.instruction.md +175 -249
- package/cjs/src/templates/app/app/[lang]/page.js +19 -36
- package/cjs/src/templates/workspaceRoot/package.json.template +6 -5
- package/esm/index.js +16 -47
- package/esm/src/guidelines/scalarConstant/scalarConstant.generate.json +24 -20
- package/esm/src/guidelines/scalarConstant/scalarConstant.instruction.md +284 -326
- package/esm/src/guidelines/scalarDictionary/scalarDictionary.generate.json +32 -32
- package/esm/src/guidelines/scalarDictionary/scalarDictionary.instruction.md +175 -249
- package/esm/src/templates/app/app/[lang]/page.js +19 -36
- package/esm/src/templates/workspaceRoot/package.json.template +6 -5
- package/package.json +6 -4
- package/src/guidelines/scalarConstant/scalarConstant.instruction.md +284 -326
- package/src/guidelines/scalarDictionary/scalarDictionary.instruction.md +175 -249
- package/src/library/library.command.d.ts +0 -2
- package/src/library/library.runner.d.ts +0 -2
- package/src/library/library.script.d.ts +0 -2
- package/src/scalar/scalar.command.d.ts +1 -1
- package/cjs/src/guidelines/fieldDecorator/fieldDecorator.generate.json +0 -135
- package/cjs/src/guidelines/fieldDecorator/fieldDecorator.instruction.md +0 -606
- package/esm/src/guidelines/fieldDecorator/fieldDecorator.generate.json +0 -135
- package/esm/src/guidelines/fieldDecorator/fieldDecorator.instruction.md +0 -606
- package/src/guidelines/fieldDecorator/fieldDecorator.instruction.md +0 -606
|
@@ -26,16 +26,8 @@ function getContent(scanInfo, dict) {
|
|
|
26
26
|
return {
|
|
27
27
|
filename: "page.tsx",
|
|
28
28
|
content: `
|
|
29
|
-
import {
|
|
30
|
-
|
|
31
|
-
FaBook,
|
|
32
|
-
FaCloudUploadAlt,
|
|
33
|
-
FaCode,
|
|
34
|
-
FaExternalLinkAlt,
|
|
35
|
-
FaGraduationCap,
|
|
36
|
-
FaHeart,
|
|
37
|
-
FaShieldAlt,
|
|
38
|
-
} from "react-icons/fa";
|
|
29
|
+
import { Link } from "@akanjs/ui";
|
|
30
|
+
import { FaBolt, FaBook, FaExternalLinkAlt, FaGraduationCap, FaHeart, FaShieldAlt } from "react-icons/fa";
|
|
39
31
|
|
|
40
32
|
export const metadata = {
|
|
41
33
|
title: "Akan.js",
|
|
@@ -65,14 +57,8 @@ export default function Page() {
|
|
|
65
57
|
</div>
|
|
66
58
|
</div>
|
|
67
59
|
</div>
|
|
68
|
-
<div className="mb-12 text-center">
|
|
69
|
-
<button className="btn btn-primary btn-lg bg-primary border-none px-12 py-4 text-lg font-semibold">
|
|
70
|
-
<FaCloudUploadAlt className="mr-3 text-xl" />
|
|
71
|
-
Deploy Now
|
|
72
|
-
</button>
|
|
73
|
-
</div>
|
|
74
60
|
<div className="mb-16 rounded-lg bg-slate-800 p-8">
|
|
75
|
-
<h2 className="
|
|
61
|
+
<h2 className="mb-6 text-center text-2xl font-bold text-gray-200">Quick Start</h2>
|
|
76
62
|
<div className="mockup-code">
|
|
77
63
|
<pre data-prefix="$">
|
|
78
64
|
<code className="text-success">npx create-akan-workspace</code>
|
|
@@ -85,44 +71,41 @@ export default function Page() {
|
|
|
85
71
|
</pre>
|
|
86
72
|
</div>
|
|
87
73
|
</div>
|
|
88
|
-
<div className="mb-16 grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-
|
|
89
|
-
<div className="card bg-slate-800">
|
|
90
|
-
<div className="card-body p-6 text-center">
|
|
91
|
-
<FaBook className="mx-auto mb-4 text-4xl text-purple-400" />
|
|
92
|
-
<h3 className="text-gray-200 mb-2 text-lg font-semibold">Documentation</h3>
|
|
93
|
-
<p className="mb-4 text-sm text-gray-400">Complete API guides and tutorials</p>
|
|
94
|
-
<button className="btn btn-sm w-full">Read Documentation</button>
|
|
95
|
-
</div>
|
|
96
|
-
</div>
|
|
74
|
+
<div className="mb-16 grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3">
|
|
97
75
|
<div className="card bg-slate-800">
|
|
98
76
|
<div className="card-body p-6 text-center">
|
|
99
77
|
<FaGraduationCap className="mx-auto mb-4 text-4xl text-blue-400" />
|
|
100
|
-
<h3 className="
|
|
78
|
+
<h3 className="mb-2 text-lg font-semibold text-gray-200">Learn</h3>
|
|
101
79
|
<p className="mb-4 text-sm text-gray-400">Step-by-step learning guides</p>
|
|
102
|
-
<
|
|
80
|
+
<Link href="https://akanjs.com/docs/intro/practice" target="_blank">
|
|
81
|
+
<button className="btn btn-sm w-full">Learn</button>
|
|
82
|
+
</Link>
|
|
103
83
|
</div>
|
|
104
84
|
</div>
|
|
105
85
|
<div className="card bg-slate-800">
|
|
106
86
|
<div className="card-body p-6 text-center">
|
|
107
|
-
<
|
|
108
|
-
<h3 className="
|
|
109
|
-
<p className="mb-4 text-sm text-gray-400">
|
|
110
|
-
<
|
|
87
|
+
<FaBook className="mx-auto mb-4 text-4xl text-purple-400" />
|
|
88
|
+
<h3 className="mb-2 text-lg font-semibold text-gray-200">Documentation</h3>
|
|
89
|
+
<p className="mb-4 text-sm text-gray-400">Complete API guides and tutorials</p>
|
|
90
|
+
<Link href="https://akanjs.com/docs/systemArch/overview" target="_blank">
|
|
91
|
+
<button className="btn btn-sm w-full">Read Documentation</button>
|
|
92
|
+
</Link>
|
|
111
93
|
</div>
|
|
112
94
|
</div>
|
|
113
95
|
<div className="card bg-slate-800">
|
|
114
96
|
<div className="card-body p-6 text-center">
|
|
115
97
|
<FaExternalLinkAlt className="mx-auto mb-4 text-4xl text-yellow-400" />
|
|
116
|
-
<h3 className="
|
|
98
|
+
<h3 className="mb-2 text-lg font-semibold text-gray-200">Official Site</h3>
|
|
117
99
|
<p className="mb-4 text-sm text-gray-400">Visit our official website</p>
|
|
118
|
-
<
|
|
100
|
+
<Link href="https://akanjs.com" target="_blank">
|
|
101
|
+
<button className="btn btn-sm w-full">Go to akanjs.com</button>
|
|
102
|
+
</Link>
|
|
119
103
|
</div>
|
|
120
104
|
</div>
|
|
121
105
|
</div>
|
|
122
106
|
</div>
|
|
123
107
|
</div>
|
|
124
108
|
);
|
|
125
|
-
}
|
|
126
|
-
`
|
|
109
|
+
}`
|
|
127
110
|
};
|
|
128
111
|
}
|
|
@@ -3,17 +3,18 @@
|
|
|
3
3
|
"description": "<%= repoName %> workspace",
|
|
4
4
|
"version": "0.0.1",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"next": "16.0.
|
|
7
|
-
"react": "19.2.
|
|
8
|
-
"react-dom": "19.2.
|
|
6
|
+
"next": "16.0.10",
|
|
7
|
+
"react": "19.2.3",
|
|
8
|
+
"react-dom": "19.2.3",
|
|
9
|
+
"react-icons": "^5.4.0",
|
|
9
10
|
"tailwindcss": "^4.1.11",
|
|
10
11
|
"daisyui": "^5.5.5"
|
|
11
12
|
},
|
|
12
13
|
"devDependencies": {
|
|
13
14
|
"@types/node": "^22.10.4",
|
|
14
15
|
"@tailwindcss/postcss": "^4.1.11",
|
|
15
|
-
"@types/react": "19.2.
|
|
16
|
-
"@types/react-dom": "19.2.
|
|
16
|
+
"@types/react": "19.2.3",
|
|
17
|
+
"@types/react-dom": "19.2.3",
|
|
17
18
|
"crypto-browserify": "^3.12.1",
|
|
18
19
|
"eslint": "^9.19.0",
|
|
19
20
|
"https-browserify": "^1.0.0",
|
package/esm/index.js
CHANGED
|
@@ -1729,7 +1729,8 @@ ${errorMessages}`);
|
|
|
1729
1729
|
const diagnostics = [
|
|
1730
1730
|
...program2.getSemanticDiagnostics(),
|
|
1731
1731
|
...program2.getSyntacticDiagnostics(),
|
|
1732
|
-
|
|
1732
|
+
// Only check declaration diagnostics when declaration emit is enabled
|
|
1733
|
+
...this.config.options.declaration ? program2.getDeclarationDiagnostics() : []
|
|
1733
1734
|
];
|
|
1734
1735
|
const errors = diagnostics.filter((diagnostic) => diagnostic.category === ts3.DiagnosticCategory.Error);
|
|
1735
1736
|
const warnings = diagnostics.filter((diagnostic) => diagnostic.category === ts3.DiagnosticCategory.Warning);
|
|
@@ -4028,7 +4029,11 @@ var LibraryRunner = class {
|
|
|
4028
4029
|
lib.workspace.unsetTsPaths("lib", lib.name);
|
|
4029
4030
|
}
|
|
4030
4031
|
async installLibrary(workspace, libName) {
|
|
4031
|
-
|
|
4032
|
+
workspace.mkdir("node_modules/.akan");
|
|
4033
|
+
if (workspace.exists("node_modules/.akan/akanjs"))
|
|
4034
|
+
await workspace.removeDir("node_modules/.akan/akanjs");
|
|
4035
|
+
await workspace.exec(`cd node_modules/.akan && git clone git@github.com:akan-team/akanjs.git`);
|
|
4036
|
+
await workspace.cp(`node_modules/.akan/akanjs/libs/${libName}`, `libs/${libName}`);
|
|
4032
4037
|
await workspace.cp(`libs/${libName}/env/env.server.example.ts`, `libs/${libName}/env/env.server.testing.ts`);
|
|
4033
4038
|
workspace.setTsPaths("lib", libName);
|
|
4034
4039
|
await workspace.commit(`Add ${libName} library`);
|
|
@@ -4060,16 +4065,6 @@ var LibraryRunner = class {
|
|
|
4060
4065
|
await lib.workspace.spawn("pnpm", ["install", "--reporter=silent"]);
|
|
4061
4066
|
await lib.workspace.commit(`Merge ${lib.name} library dependencies`);
|
|
4062
4067
|
}
|
|
4063
|
-
async pushLibrary(lib, branch) {
|
|
4064
|
-
await lib.workspace.exec(
|
|
4065
|
-
`git subtree push --prefix=libs/${lib.name} git@github.com:akan-team/${lib.name}.git ${branch}`
|
|
4066
|
-
);
|
|
4067
|
-
}
|
|
4068
|
-
async pullLibrary(lib, branch) {
|
|
4069
|
-
await lib.workspace.exec(
|
|
4070
|
-
`git subtree pull --prefix=libs/${lib.name} git@github.com:akan-team/${lib.name}.git ${branch}`
|
|
4071
|
-
);
|
|
4072
|
-
}
|
|
4073
4068
|
#getEnv(lib, env = {}) {
|
|
4074
4069
|
const rootEnv = dotenv2.parse(lib.workspace.readFile(".env"));
|
|
4075
4070
|
return {
|
|
@@ -4125,19 +4120,6 @@ var LibraryScript = class {
|
|
|
4125
4120
|
await this.#runner.mergeLibraryDependencies(lib);
|
|
4126
4121
|
mergeSpinner.succeed(`${libName} library (libs/${libName}) dependencies merged to root package.json`);
|
|
4127
4122
|
}
|
|
4128
|
-
async pushLibrary(lib, branch) {
|
|
4129
|
-
const pushSpinner = lib.spinning("Pushing library...");
|
|
4130
|
-
await this.#runner.pushLibrary(lib, branch);
|
|
4131
|
-
pushSpinner.succeed(`Library ${lib.name} (libs/${lib.name}) pushed to ${branch} branch`);
|
|
4132
|
-
}
|
|
4133
|
-
async pullLibrary(lib, branch) {
|
|
4134
|
-
const pullSpinner = lib.spinning("Pulling library...");
|
|
4135
|
-
await this.#runner.pullLibrary(lib, branch);
|
|
4136
|
-
pullSpinner.succeed(`Library ${lib.name} (libs/${lib.name}) pulled from ${branch} branch`);
|
|
4137
|
-
const mergeSpinner = lib.spinning("Merging library dependencies...");
|
|
4138
|
-
await this.#runner.mergeLibraryDependencies(lib);
|
|
4139
|
-
mergeSpinner.succeed(`Library ${lib.name} (libs/${lib.name}) dependencies merged to root package.json`);
|
|
4140
|
-
}
|
|
4141
4123
|
async testLibrary(lib) {
|
|
4142
4124
|
const spinner = lib.spinning("Testing library...");
|
|
4143
4125
|
await this.#runner.testLibrary(lib);
|
|
@@ -6030,12 +6012,6 @@ var LibraryCommand = class {
|
|
|
6030
6012
|
async installLibrary(libName, workspace) {
|
|
6031
6013
|
await this.libraryScript.installLibrary(workspace, libName);
|
|
6032
6014
|
}
|
|
6033
|
-
async pushLibrary(lib, branch) {
|
|
6034
|
-
await this.libraryScript.pushLibrary(lib, branch);
|
|
6035
|
-
}
|
|
6036
|
-
async pullLibrary(lib, branch) {
|
|
6037
|
-
await this.libraryScript.pullLibrary(lib, branch);
|
|
6038
|
-
}
|
|
6039
6015
|
};
|
|
6040
6016
|
__decorateClass([
|
|
6041
6017
|
Target.Public(),
|
|
@@ -6055,16 +6031,6 @@ __decorateClass([
|
|
|
6055
6031
|
__decorateParam(0, Argument("libName", { desc: "name of library", nullable: true })),
|
|
6056
6032
|
__decorateParam(1, Workspace())
|
|
6057
6033
|
], LibraryCommand.prototype, "installLibrary", 1);
|
|
6058
|
-
__decorateClass([
|
|
6059
|
-
Target.Public({ devOnly: true }),
|
|
6060
|
-
__decorateParam(0, Lib()),
|
|
6061
|
-
__decorateParam(1, Option("branch", { desc: "branch to push", default: "main" }))
|
|
6062
|
-
], LibraryCommand.prototype, "pushLibrary", 1);
|
|
6063
|
-
__decorateClass([
|
|
6064
|
-
Target.Public(),
|
|
6065
|
-
__decorateParam(0, Lib()),
|
|
6066
|
-
__decorateParam(1, Option("branch", { desc: "branch to pull", default: "main" }))
|
|
6067
|
-
], LibraryCommand.prototype, "pullLibrary", 1);
|
|
6068
6034
|
LibraryCommand = __decorateClass([
|
|
6069
6035
|
Commands()
|
|
6070
6036
|
], LibraryCommand);
|
|
@@ -7310,8 +7276,8 @@ var ScalarPrompt = class extends Prompter {
|
|
|
7310
7276
|
}
|
|
7311
7277
|
async requestCreateConstant() {
|
|
7312
7278
|
const constantFiles = await this.sys.getConstantFilesWithLibs();
|
|
7313
|
-
const description = await input5({ message: "description of scalar
|
|
7314
|
-
const schemaDescription = await input5({ message: "schema description of scalar
|
|
7279
|
+
const description = await input5({ message: "description of scalar" });
|
|
7280
|
+
const schemaDescription = await input5({ message: "schema description of scalar" });
|
|
7315
7281
|
await this.sys.applyTemplate({
|
|
7316
7282
|
basePath: "./lib/__scalar",
|
|
7317
7283
|
template: "__scalar",
|
|
@@ -7472,7 +7438,9 @@ var ScalarScript = class {
|
|
|
7472
7438
|
// pkgs/@akanjs/cli/src/scalar/scalar.command.ts
|
|
7473
7439
|
var ScalarCommand = class {
|
|
7474
7440
|
scalarScript = new ScalarScript();
|
|
7475
|
-
async createScalar(scalarName, sys3) {
|
|
7441
|
+
async createScalar(scalarName, ai, sys3) {
|
|
7442
|
+
if (ai)
|
|
7443
|
+
await this.scalarScript.createScalarWithAi(sys3, lowerlize(scalarName.replace(/ /g, "")));
|
|
7476
7444
|
await this.scalarScript.createScalar(sys3, lowerlize(scalarName.replace(/ /g, "")));
|
|
7477
7445
|
}
|
|
7478
7446
|
async removeScalar(scalarName, sys3) {
|
|
@@ -7481,12 +7449,13 @@ var ScalarCommand = class {
|
|
|
7481
7449
|
};
|
|
7482
7450
|
__decorateClass([
|
|
7483
7451
|
Target.Public(),
|
|
7484
|
-
__decorateParam(0, Argument("scalarName", { desc: "name of scalar
|
|
7485
|
-
__decorateParam(1,
|
|
7452
|
+
__decorateParam(0, Argument("scalarName", { desc: "name of scalar" })),
|
|
7453
|
+
__decorateParam(1, Option("ai", { type: "boolean", default: false, desc: "use ai to create scalar" })),
|
|
7454
|
+
__decorateParam(2, Sys())
|
|
7486
7455
|
], ScalarCommand.prototype, "createScalar", 1);
|
|
7487
7456
|
__decorateClass([
|
|
7488
7457
|
Target.Public(),
|
|
7489
|
-
__decorateParam(0, Argument("scalarName", { desc: "name of scalar
|
|
7458
|
+
__decorateParam(0, Argument("scalarName", { desc: "name of scalar" })),
|
|
7490
7459
|
__decorateParam(1, Sys())
|
|
7491
7460
|
], ScalarCommand.prototype, "removeScalar", 1);
|
|
7492
7461
|
ScalarCommand = __decorateClass([
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
"type": "source",
|
|
17
|
-
"description": "scalar
|
|
18
|
-
"path": "pkgs/@akanjs/constant/src/
|
|
17
|
+
"description": "via() function and scalar implementation",
|
|
18
|
+
"path": "pkgs/@akanjs/constant/src/baseGql.ts"
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"type": "source",
|
|
@@ -72,30 +72,34 @@
|
|
|
72
72
|
"Purpose of scalar constants in Akan.js",
|
|
73
73
|
"File structure and location conventions",
|
|
74
74
|
"Naming standards for directories, files, classes and enums",
|
|
75
|
-
"Required imports and
|
|
76
|
-
"
|
|
77
|
-
"Field definitions with
|
|
78
|
-
"Field options reference table",
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
75
|
+
"Required imports from @akanjs/constant and @akanjs/base",
|
|
76
|
+
"Basic syntax with via() function",
|
|
77
|
+
"Field definitions with field() helper function",
|
|
78
|
+
"Field options reference table (default, min, max, minlength, maxlength, validate, example)",
|
|
79
|
+
"Available field types (String, Int, Float, Boolean, Date, ID)",
|
|
80
|
+
"Array fields using bracket notation [Type]",
|
|
81
|
+
"Optional fields using .optional() chain method",
|
|
82
|
+
"Enum definition with enumOf(name, values) class pattern",
|
|
83
|
+
"Instance methods in scalar classes",
|
|
82
84
|
"Static methods in scalar classes",
|
|
83
|
-
"Validation rules and checklists",
|
|
84
85
|
"Common mistakes and fixes",
|
|
86
|
+
"Implementation checklist",
|
|
85
87
|
"Full examples of scalar.constant.ts files"
|
|
86
88
|
],
|
|
87
89
|
"rules": [
|
|
88
|
-
"One scalar.constant.ts should contain only one
|
|
89
|
-
"The directory and filename convention is camelCase, such as `
|
|
90
|
-
"The class name should be PascalCase, matching the camelCase directory name (e.g.,
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
90
|
+
"One scalar.constant.ts should contain only one scalar class extending via(). If you need more than one scalar model, make another scalar.constant.ts file.",
|
|
91
|
+
"The directory and filename convention is camelCase, such as `encourageInfo/encourageInfo.constant.ts`",
|
|
92
|
+
"The class name should be PascalCase, matching the camelCase directory name (e.g., EncourageInfo for encourageInfo)",
|
|
93
|
+
"Use `extends via((field) => ({...}))` pattern to define scalar classes, not decorators",
|
|
94
|
+
"Import `via` from `@akanjs/constant` and `enumOf`, `ID`, `Int`, `Float`, `dayjs` from `@akanjs/base`",
|
|
95
|
+
"The values of enum strings must be camelCase (e.g., 'waitPay', not 'WAIT_PAY')",
|
|
96
|
+
"Define enums using class pattern: `export class EnumName extends enumOf('enumName', [...] as const) {}`",
|
|
97
|
+
"The first argument of enumOf() is the enum name string used in dictionary/GraphQL",
|
|
98
|
+
"Use .optional() chain method for nullable fields, not { nullable: true } option",
|
|
97
99
|
"Use bracket notation for arrays ([Type]) rather than generics (Array<Type>)",
|
|
98
|
-
"
|
|
100
|
+
"Use factory functions for dynamic defaults: { default: () => dayjs() }, not { default: dayjs() }",
|
|
101
|
+
"Always export both the scalar class and enum classes",
|
|
102
|
+
"Add 'as const' to enum value arrays for better TypeScript type inference"
|
|
99
103
|
]
|
|
100
104
|
},
|
|
101
105
|
"page": "/[lang]/akanjs/(docs)/docs/scalar/constant/page.tsx"
|