@akanjs/cli 0.9.58 → 0.9.60-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/cjs/index.js +105 -81
- package/cjs/src/guidelines/sharedUiUsage/sharedUiUsage.instruction.md +0 -3
- package/cjs/src/templates/app/akan.config.js +3 -4
- package/cjs/src/templates/app/app/[lang]/layout.js +4 -4
- package/cjs/src/templates/app/app/layout.js +4 -1
- package/cjs/src/templates/app/env/env.server.testing.ts.template +2 -3
- package/cjs/src/templates/app/lib/___appName__/__appName__.dictionary.js +6 -3
- package/cjs/src/templates/app/lib/___appName__/__appName__.service.js +1 -1
- package/cjs/src/templates/env/env.server.type.js +36 -0
- package/cjs/src/templates/lib/__lib/lib.signal.js +1 -2
- package/cjs/src/templates/lib/sig.js +1 -1
- package/cjs/src/templates/libRoot/.gitignore.template +9 -8
- package/cjs/src/templates/libRoot/akan.config.js +0 -1
- package/cjs/src/templates/libRoot/env/env.server.example.ts.template +2 -3
- package/cjs/src/templates/libRoot/env/env.server.testing.ts.template +2 -3
- package/cjs/src/templates/libRoot/lib/___libName__/__libName__.dictionary.js +7 -3
- package/cjs/src/templates/libRoot/lib/___libName__/__libName__.service.js +1 -1
- package/cjs/src/templates/localDev/docker-compose.yaml.template +2 -2
- package/cjs/src/templates/module/__model__.dictionary.js +0 -1
- package/cjs/src/templates/module/__model__.document.js +1 -1
- package/cjs/src/templates/module/__model__.service.js +1 -1
- package/cjs/src/templates/module/__model__.signal.js +1 -2
- package/cjs/src/templates/module/__model__.signal.spec.js +1 -13
- package/cjs/src/templates/module/__model__.signal.test.js +1 -22
- package/cjs/src/templates/workspaceRoot/.gitignore.template +1 -0
- package/cjs/src/templates/workspaceRoot/package.json.template +9 -9
- package/esm/index.js +105 -81
- package/esm/src/guidelines/sharedUiUsage/sharedUiUsage.instruction.md +0 -3
- package/esm/src/templates/app/akan.config.js +3 -4
- package/esm/src/templates/app/app/[lang]/layout.js +4 -4
- package/esm/src/templates/app/app/layout.js +4 -1
- package/esm/src/templates/app/env/env.server.testing.ts.template +2 -3
- package/esm/src/templates/app/lib/___appName__/__appName__.dictionary.js +6 -3
- package/esm/src/templates/app/lib/___appName__/__appName__.service.js +1 -1
- package/esm/src/templates/env/env.server.type.js +16 -0
- package/esm/src/templates/lib/__lib/lib.signal.js +1 -2
- package/esm/src/templates/lib/sig.js +1 -1
- package/esm/src/templates/libRoot/.gitignore.template +9 -8
- package/esm/src/templates/libRoot/akan.config.js +0 -1
- package/esm/src/templates/libRoot/env/env.server.example.ts.template +2 -3
- package/esm/src/templates/libRoot/env/env.server.testing.ts.template +2 -3
- package/esm/src/templates/libRoot/lib/___libName__/__libName__.dictionary.js +7 -3
- package/esm/src/templates/libRoot/lib/___libName__/__libName__.service.js +1 -1
- package/esm/src/templates/localDev/docker-compose.yaml.template +2 -2
- package/esm/src/templates/module/__model__.dictionary.js +0 -1
- package/esm/src/templates/module/__model__.document.js +1 -1
- package/esm/src/templates/module/__model__.service.js +1 -1
- package/esm/src/templates/module/__model__.signal.js +1 -2
- package/esm/src/templates/module/__model__.signal.spec.js +1 -13
- package/esm/src/templates/module/__model__.signal.test.js +1 -22
- package/esm/src/templates/workspaceRoot/.gitignore.template +1 -0
- package/esm/src/templates/workspaceRoot/package.json.template +9 -9
- package/package.json +1 -1
- package/src/application/application.runner.d.ts +1 -1
- package/src/application/application.script.d.ts +2 -1
- package/src/cloud/cloud.command.d.ts +1 -1
- package/src/cloud/cloud.runner.d.ts +1 -1
- package/src/cloud/cloud.script.d.ts +1 -1
- package/src/guidelines/sharedUiUsage/sharedUiUsage.instruction.md +0 -3
- package/src/templates/app/akan.config.d.ts +3 -1
- package/src/templates/app/app/[lang]/layout.d.ts +3 -1
- package/src/templates/env/env.server.type.d.ts +4 -0
- package/src/templates/module/__model__.signal.spec.d.ts +1 -1
- package/src/templates/module/__model__.signal.test.d.ts +1 -1
- package/src/workspace/workspace.command.d.ts +1 -1
- package/src/workspace/workspace.script.d.ts +1 -1
- package/cjs/src/templates/app/page.test.ts.template +0 -10
- package/cjs/src/templates/app/playwright.config.ts.template +0 -6
- package/esm/src/templates/app/page.test.ts.template +0 -10
- package/esm/src/templates/app/playwright.config.ts.template +0 -6
|
@@ -24,8 +24,12 @@ __export(libName_dictionary_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(libName_dictionary_exports);
|
|
25
25
|
function getContent(scanInfo, dict) {
|
|
26
26
|
return `
|
|
27
|
-
|
|
27
|
+
import { serviceDictionary } from "@akanjs/dictionary";
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
import type { ${dict.LibName}Endpoint } from "./${dict.libName}.signal";
|
|
30
|
+
|
|
31
|
+
export const dictionary = serviceDictionary(["en", "ko"])
|
|
32
|
+
.endpoint<${dict.LibName}Endpoint>((fn) => ({}))
|
|
33
|
+
.translate({});
|
|
34
|
+
`;
|
|
31
35
|
}
|
|
@@ -28,6 +28,6 @@ import { serve } from "@akanjs/service";
|
|
|
28
28
|
|
|
29
29
|
// import type * as srv from "../srv";
|
|
30
30
|
|
|
31
|
-
export class ${dict.LibName}Service extends serve("${dict.libName}" as const, { serverMode: "batch" }) {}
|
|
31
|
+
export class ${dict.LibName}Service extends serve("${dict.libName}" as const, { serverMode: "batch" }, () => ({})) {}
|
|
32
32
|
`;
|
|
33
33
|
}
|
|
@@ -22,8 +22,8 @@ services:
|
|
|
22
22
|
entrypoint: >
|
|
23
23
|
bash -c "
|
|
24
24
|
mongod --dbpath /data/db --replSet rs0 --bind_ip_all --fork --logpath /var/log/mongodb.log &&
|
|
25
|
-
mongosh --eval '
|
|
26
|
-
mongosh --eval 'try { rs.status() } catch(e) { rs.initiate({_id: \"rs0\", members: [{_id: 0, host: \"
|
|
25
|
+
until mongosh --eval 'db.adminCommand(\"ping\")' > /dev/null 2>&1; do sleep 1; done &&
|
|
26
|
+
mongosh --eval 'try { rs.status() } catch(e) { rs.initiate({_id: \"rs0\", members: [{_id: 0, host: \"localhost:27017\"}]}) }' &&
|
|
27
27
|
tail -f /var/log/mongodb.log
|
|
28
28
|
"
|
|
29
29
|
networks:
|
|
@@ -38,7 +38,6 @@ export const dictionary = modelDictionary(["en", "ko"])
|
|
|
38
38
|
field: t(["Field", "\uD544\uB4DC"]).desc(["Field description", "\uD544\uB4DC \uC124\uBA85"]),
|
|
39
39
|
}))
|
|
40
40
|
.insight<${dict.Model}Insight>((t) => ({}))
|
|
41
|
-
.query<${dict.Model}Filter>((fn) => ({}))
|
|
42
41
|
.slice<${dict.Model}Slice>((fn) => ({
|
|
43
42
|
inPublic: fn(["${dict.Model} In Public", "${dict.Model} \uACF5\uAC1C"]).arg((t) => ({})),
|
|
44
43
|
}))
|
|
@@ -35,7 +35,7 @@ export class ${dict.Model}Filter extends from(cnst.${dict.Model}, (filter) => ({
|
|
|
35
35
|
|
|
36
36
|
export class ${dict.Model} extends by(cnst.${dict.Model}) {}
|
|
37
37
|
|
|
38
|
-
export class ${dict.Model}Model extends into(${dict.Model}, ${dict.Model}Filter, cnst.${dict.model}) {}
|
|
38
|
+
export class ${dict.Model}Model extends into(${dict.Model}, ${dict.Model}Filter, cnst.${dict.model}, () => ({})) {}
|
|
39
39
|
|
|
40
40
|
export class ${dict.Model}Middleware extends beyond(${dict.Model}Model, ${dict.Model}) {
|
|
41
41
|
onSchema(schema: SchemaOf<${dict.Model}Model, ${dict.Model}>) {
|
|
@@ -29,6 +29,6 @@ import { serve } from "@akanjs/service";
|
|
|
29
29
|
import * as cnst from "../cnst";
|
|
30
30
|
import * as db from "../db";
|
|
31
31
|
|
|
32
|
-
export class ${dict.Model}Service extends serve(db.${dict.model}) {}
|
|
32
|
+
export class ${dict.Model}Service extends serve(db.${dict.model}, () => ({})) {}
|
|
33
33
|
`;
|
|
34
34
|
}
|
|
@@ -26,14 +26,13 @@ function getContent(scanInfo, dict) {
|
|
|
26
26
|
return `
|
|
27
27
|
import { Public } from "@akanjs/nest";
|
|
28
28
|
import { endpoint, internal, slice } from "@akanjs/signal";
|
|
29
|
-
import { Admin } from "@shared/nest";
|
|
30
29
|
|
|
31
30
|
import * as cnst from "../cnst";
|
|
32
31
|
import * as srv from "../srv";
|
|
33
32
|
|
|
34
33
|
export class ${dict.Model}Internal extends internal(srv.${dict.model}, () => ({})) {}
|
|
35
34
|
|
|
36
|
-
export class ${dict.Model}Slice extends slice(srv.${dict.model}, { guards: { root:
|
|
35
|
+
export class ${dict.Model}Slice extends slice(srv.${dict.model}, { guards: { root: Public, get: Public, cru: Public } }, (init) => ({
|
|
37
36
|
inPublic: init()
|
|
38
37
|
.exec(function () {
|
|
39
38
|
return this.${dict.model}Service.queryAny();
|
|
@@ -23,17 +23,5 @@ __export(model_signal_spec_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(model_signal_spec_exports);
|
|
25
25
|
function getContent(scanInfo, dict) {
|
|
26
|
-
return
|
|
27
|
-
import * as adminSpec from "@shared/lib/admin/admin.signal.spec";
|
|
28
|
-
import * as userSpec from "@${dict.sysName}/lib/user/user.signal.spec";
|
|
29
|
-
import * as cnst from "../cnst";
|
|
30
|
-
import { fetch } from "../sig";
|
|
31
|
-
import { sampleOf } from "@akanjs/test";
|
|
32
|
-
|
|
33
|
-
export const create${dict.Model} = async (adminAgent: userSpec.AdminAgent, userAgent: userSpec.UserAgent) => {
|
|
34
|
-
const ${dict.model}Input = sampleOf(cnst.${dict.Model}Input);
|
|
35
|
-
const ${dict.model} = await adminAgent.fetch.create${dict.Model}(${dict.model}Input);
|
|
36
|
-
return ${dict.model};
|
|
37
|
-
};
|
|
38
|
-
`;
|
|
26
|
+
return null;
|
|
39
27
|
}
|
|
@@ -23,26 +23,5 @@ __export(model_signal_test_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(model_signal_test_exports);
|
|
25
25
|
function getContent(scanInfo, dict) {
|
|
26
|
-
return
|
|
27
|
-
import * as adminSpec from "@shared/lib/admin/admin.signal.spec";
|
|
28
|
-
import * as userSpec from "@${dict.sysName}/lib/user/user.signal.spec";
|
|
29
|
-
import * as ${dict.model}Spec from "@${dict.sysName}/lib/${dict.model}/${dict.model}.signal.spec";
|
|
30
|
-
import * as cnst from "../cnst";
|
|
31
|
-
import { fetch } from "../sig";
|
|
32
|
-
|
|
33
|
-
describe("${dict.Model} Signal", () => {
|
|
34
|
-
describe("${dict.Model} Service", () => {
|
|
35
|
-
let adminAgent: userSpec.AdminAgent;
|
|
36
|
-
let userAgent: userSpec.UserAgent;
|
|
37
|
-
let ${dict.model}: cnst.${dict.Model};
|
|
38
|
-
beforeAll(async () => {
|
|
39
|
-
// adminAgent = await adminSpec.getAdminAgentWithInitialize();
|
|
40
|
-
// userAgent = await userSpec.getUserAgentWithPhone();
|
|
41
|
-
});
|
|
42
|
-
it("can create ${dict.model}", async () => {
|
|
43
|
-
// ${dict.model} = await ${dict.model}Spec.create${dict.Model}(adminAgent, userAgent);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
`;
|
|
26
|
+
return null;
|
|
48
27
|
}
|
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
"description": "<%= repoName %> workspace",
|
|
4
4
|
"version": "0.0.1",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"next": "
|
|
7
|
-
"react": "19.
|
|
8
|
-
"react-dom": "19.
|
|
9
|
-
"tailwindcss": "^4.1.
|
|
10
|
-
"daisyui": "^5.
|
|
6
|
+
"next": "16.0.3",
|
|
7
|
+
"react": "19.2.0",
|
|
8
|
+
"react-dom": "19.2.0",
|
|
9
|
+
"tailwindcss": "^4.1.11",
|
|
10
|
+
"daisyui": "^5.5.5"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@types/node": "^22.
|
|
14
|
-
"@tailwindcss/postcss": "^4.1.
|
|
15
|
-
"@types/react": "19.
|
|
16
|
-
"@types/react-dom": "19.
|
|
13
|
+
"@types/node": "^22.10.4",
|
|
14
|
+
"@tailwindcss/postcss": "^4.1.11",
|
|
15
|
+
"@types/react": "19.2.0",
|
|
16
|
+
"@types/react-dom": "19.2.0",
|
|
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
|
@@ -252,8 +252,8 @@ import ora from "ora";
|
|
|
252
252
|
var Spinner = class _Spinner {
|
|
253
253
|
static padding = 12;
|
|
254
254
|
spinner;
|
|
255
|
-
stopWatch;
|
|
256
|
-
startAt;
|
|
255
|
+
stopWatch = null;
|
|
256
|
+
startAt = /* @__PURE__ */ new Date();
|
|
257
257
|
prefix;
|
|
258
258
|
message;
|
|
259
259
|
enableSpin;
|
|
@@ -690,7 +690,6 @@ var archs = ["amd64", "arm64"];
|
|
|
690
690
|
var makeAppConfig = (config, props) => {
|
|
691
691
|
const { name, repoName } = props;
|
|
692
692
|
return {
|
|
693
|
-
rootLib: config.rootLib,
|
|
694
693
|
libs: config.libs ?? [],
|
|
695
694
|
backend: {
|
|
696
695
|
docker: makeDockerfile("backend", config.backend?.docker ?? {}, props),
|
|
@@ -732,7 +731,6 @@ var getAppConfig = async (appRoot, props) => {
|
|
|
732
731
|
};
|
|
733
732
|
var makeLibConfig = (config, props) => {
|
|
734
733
|
return {
|
|
735
|
-
rootLib: config.rootLib,
|
|
736
734
|
libs: config.libs ?? [],
|
|
737
735
|
backend: {
|
|
738
736
|
explicitDependencies: config.backend?.explicitDependencies ?? []
|
|
@@ -1408,32 +1406,31 @@ var ScanInfo = class {
|
|
|
1408
1406
|
constructor(scanResult) {
|
|
1409
1407
|
this.name = scanResult.name;
|
|
1410
1408
|
this.scanResult = scanResult;
|
|
1411
|
-
Object.entries(scanResult.files).forEach(
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
);
|
|
1409
|
+
Object.entries(scanResult.files).forEach(([_key, value]) => {
|
|
1410
|
+
const key = _key;
|
|
1411
|
+
const { databases, services, scalars } = value;
|
|
1412
|
+
databases.forEach((modelName) => {
|
|
1413
|
+
const model = this.database.get(modelName) ?? /* @__PURE__ */ new Set();
|
|
1414
|
+
model.add(key);
|
|
1415
|
+
this.database.set(modelName, model);
|
|
1416
|
+
this.file[key].all.add(modelName);
|
|
1417
|
+
this.file[key].databases.add(modelName);
|
|
1418
|
+
});
|
|
1419
|
+
services?.forEach((serviceName) => {
|
|
1420
|
+
const service = this.service.get(serviceName) ?? /* @__PURE__ */ new Set();
|
|
1421
|
+
service.add(key);
|
|
1422
|
+
this.service.set(serviceName, service);
|
|
1423
|
+
this.file[key].all.add(serviceName);
|
|
1424
|
+
this.file[key].services.add(serviceName);
|
|
1425
|
+
});
|
|
1426
|
+
scalars?.forEach((scalarName) => {
|
|
1427
|
+
const scalar = this.scalar.get(scalarName) ?? /* @__PURE__ */ new Set();
|
|
1428
|
+
scalar.add(key);
|
|
1429
|
+
this.scalar.set(scalarName, scalar);
|
|
1430
|
+
this.file[key].all.add(scalarName);
|
|
1431
|
+
this.file[key].scalars.add(scalarName);
|
|
1432
|
+
});
|
|
1433
|
+
});
|
|
1437
1434
|
}
|
|
1438
1435
|
getScanResult() {
|
|
1439
1436
|
return this.scanResult;
|
|
@@ -2123,10 +2120,10 @@ var Executor = class _Executor {
|
|
|
2123
2120
|
targetPath,
|
|
2124
2121
|
scanInfo,
|
|
2125
2122
|
overwrite = true
|
|
2126
|
-
}, dict = {}) {
|
|
2123
|
+
}, dict = {}, options = {}) {
|
|
2127
2124
|
if (targetPath.endsWith(".js") || targetPath.endsWith(".jsx")) {
|
|
2128
2125
|
const getContent = await import(templatePath);
|
|
2129
|
-
const result = getContent.default(scanInfo ?? null, dict);
|
|
2126
|
+
const result = getContent.default(scanInfo ?? null, dict, options);
|
|
2130
2127
|
if (result === null)
|
|
2131
2128
|
return null;
|
|
2132
2129
|
const filename = typeof result === "object" ? result.filename : path7.basename(targetPath).replace(".js", ".ts");
|
|
@@ -2158,6 +2155,7 @@ var Executor = class _Executor {
|
|
|
2158
2155
|
template,
|
|
2159
2156
|
scanInfo,
|
|
2160
2157
|
dict = {},
|
|
2158
|
+
options = {},
|
|
2161
2159
|
overwrite = true
|
|
2162
2160
|
}) {
|
|
2163
2161
|
const templatePath = `${getDirname(import.meta.url)}/src/templates${template ? `/${template}` : ""}`;
|
|
@@ -2166,7 +2164,8 @@ var Executor = class _Executor {
|
|
|
2166
2164
|
const filename = path7.basename(prefixTemplatePath);
|
|
2167
2165
|
const fileContent = await this.#applyTemplateFile(
|
|
2168
2166
|
{ templatePath: prefixTemplatePath, targetPath: path7.join(basePath2, filename), scanInfo, overwrite },
|
|
2169
|
-
dict
|
|
2167
|
+
dict,
|
|
2168
|
+
options
|
|
2170
2169
|
);
|
|
2171
2170
|
return fileContent ? [fileContent] : [];
|
|
2172
2171
|
} else {
|
|
@@ -2177,7 +2176,8 @@ var Executor = class _Executor {
|
|
|
2177
2176
|
if (fs8.statSync(subpath).isFile()) {
|
|
2178
2177
|
const fileContent = await this.#applyTemplateFile(
|
|
2179
2178
|
{ templatePath: subpath, targetPath: path7.join(basePath2, subdir), scanInfo, overwrite },
|
|
2180
|
-
dict
|
|
2179
|
+
dict,
|
|
2180
|
+
options
|
|
2181
2181
|
);
|
|
2182
2182
|
return fileContent ? [fileContent] : [];
|
|
2183
2183
|
} else
|
|
@@ -2186,7 +2186,8 @@ var Executor = class _Executor {
|
|
|
2186
2186
|
template: path7.join(template, subdir),
|
|
2187
2187
|
scanInfo,
|
|
2188
2188
|
dict,
|
|
2189
|
-
overwrite
|
|
2189
|
+
overwrite,
|
|
2190
|
+
options
|
|
2190
2191
|
});
|
|
2191
2192
|
})
|
|
2192
2193
|
)).flat();
|
|
@@ -2427,6 +2428,7 @@ var SysExecutor = class extends Executor {
|
|
|
2427
2428
|
const scanInfo = this.type === "app" ? await AppInfo.fromExecutor(this, { refresh }) : await LibInfo.fromExecutor(this, { refresh });
|
|
2428
2429
|
if (write) {
|
|
2429
2430
|
await Promise.all([
|
|
2431
|
+
this._applyTemplate({ basePath: "env", template: "env", scanInfo }),
|
|
2430
2432
|
this._applyTemplate({ basePath: "lib", template: "lib", scanInfo }),
|
|
2431
2433
|
this._applyTemplate({ basePath: ".", template: "server.ts", scanInfo }),
|
|
2432
2434
|
this._applyTemplate({ basePath: ".", template: "client.ts", scanInfo }),
|
|
@@ -2455,6 +2457,7 @@ var SysExecutor = class extends Executor {
|
|
|
2455
2457
|
const libInfos = [...scanInfo.getLibInfos().values()];
|
|
2456
2458
|
await Promise.all(
|
|
2457
2459
|
libInfos.map((libInfo) => [
|
|
2460
|
+
libInfo.exec._applyTemplate({ basePath: "env", template: "env", scanInfo: libInfo }),
|
|
2458
2461
|
libInfo.exec._applyTemplate({ basePath: "lib", template: "lib", scanInfo: libInfo }),
|
|
2459
2462
|
libInfo.exec._applyTemplate({ basePath: ".", template: "server.ts", scanInfo: libInfo }),
|
|
2460
2463
|
libInfo.exec._applyTemplate({ basePath: ".", template: "client.ts", scanInfo: libInfo }),
|
|
@@ -2652,8 +2655,6 @@ var AppExecutor = class _AppExecutor extends SysExecutor {
|
|
|
2652
2655
|
}
|
|
2653
2656
|
};
|
|
2654
2657
|
var LibExecutor = class _LibExecutor extends SysExecutor {
|
|
2655
|
-
workspaceRoot;
|
|
2656
|
-
repoName;
|
|
2657
2658
|
dist;
|
|
2658
2659
|
emoji = execEmoji.lib;
|
|
2659
2660
|
constructor({ workspace, name }) {
|
|
@@ -2745,7 +2746,7 @@ var getHostConfig = (host = akanCloudHost) => {
|
|
|
2745
2746
|
};
|
|
2746
2747
|
var setHostConfig = (host = akanCloudHost, config = {}) => {
|
|
2747
2748
|
const akanConfig = getAkanGlobalConfig();
|
|
2748
|
-
akanConfig[host] = config;
|
|
2749
|
+
akanConfig.cloudHost[host] = config;
|
|
2749
2750
|
setAkanGlobalConfig(akanConfig);
|
|
2750
2751
|
};
|
|
2751
2752
|
var getSelf = async (token) => {
|
|
@@ -2852,24 +2853,24 @@ var FileEditor = class {
|
|
|
2852
2853
|
var CapacitorApp = class {
|
|
2853
2854
|
constructor(app) {
|
|
2854
2855
|
this.app = app;
|
|
2856
|
+
this.project = new MobileProject(this.app.cwdPath, {
|
|
2857
|
+
android: { path: "android" },
|
|
2858
|
+
ios: { path: "ios/App" }
|
|
2859
|
+
});
|
|
2855
2860
|
}
|
|
2856
2861
|
project;
|
|
2857
2862
|
iosTargetName = "App";
|
|
2858
2863
|
async init() {
|
|
2859
|
-
const project =
|
|
2860
|
-
|
|
2861
|
-
ios: { path: "ios/App" }
|
|
2862
|
-
});
|
|
2863
|
-
await project.load();
|
|
2864
|
+
const project = this.project;
|
|
2865
|
+
await this.project.load();
|
|
2864
2866
|
if (!project.android) {
|
|
2865
2867
|
await this.app.spawn("npx", ["cap", "add", "android"]);
|
|
2866
|
-
await project.load();
|
|
2868
|
+
await this.project.load();
|
|
2867
2869
|
}
|
|
2868
2870
|
if (!project.ios) {
|
|
2869
2871
|
await this.app.spawn("npx", ["cap", "add", "ios"]);
|
|
2870
|
-
await project.load();
|
|
2872
|
+
await this.project.load();
|
|
2871
2873
|
}
|
|
2872
|
-
this.project = project;
|
|
2873
2874
|
return this;
|
|
2874
2875
|
}
|
|
2875
2876
|
async save() {
|
|
@@ -3291,13 +3292,16 @@ var handleOption = (programCommand, argMeta) => {
|
|
|
3291
3292
|
flag = argMeta.name.slice(0, 1).toLowerCase(),
|
|
3292
3293
|
desc = argMeta.name,
|
|
3293
3294
|
example,
|
|
3294
|
-
enum:
|
|
3295
|
+
enum: enumChoices,
|
|
3295
3296
|
ask
|
|
3296
3297
|
} = argMeta.argsOption;
|
|
3297
3298
|
const kebabName = camelToKebabCase(argMeta.name);
|
|
3299
|
+
const choices = enumChoices?.map(
|
|
3300
|
+
(choice) => typeof choice === "object" ? { value: choice.value, name: choice.label } : { value: choice, name: choice.toString() }
|
|
3301
|
+
);
|
|
3298
3302
|
programCommand.option(
|
|
3299
3303
|
`-${flag}, --${kebabName}${type === "boolean" ? " [boolean]" : ` <${kebabName}>`}`,
|
|
3300
|
-
`${desc}${ask ? ` (${ask})` : ""}${example ? ` (example: ${example})` : ""}${choices ? ` (choices: ${choices.join(", ")})` : ""}`
|
|
3304
|
+
`${desc}${ask ? ` (${ask})` : ""}${example ? ` (example: ${example})` : ""}${choices ? ` (choices: ${choices.map((choice) => choice.name).join(", ")})` : ""}`
|
|
3301
3305
|
);
|
|
3302
3306
|
return programCommand;
|
|
3303
3307
|
};
|
|
@@ -3322,7 +3326,7 @@ var convertOptionValue = (value, type) => {
|
|
|
3322
3326
|
var getOptionValue = async (argMeta, opt) => {
|
|
3323
3327
|
const {
|
|
3324
3328
|
name,
|
|
3325
|
-
argsOption: { enum:
|
|
3329
|
+
argsOption: { enum: enumChoices, default: defaultValue, type, desc, nullable, example, ask }
|
|
3326
3330
|
} = argMeta;
|
|
3327
3331
|
if (opt[argMeta.name] !== void 0)
|
|
3328
3332
|
return convertOptionValue(opt[argMeta.name], type ?? "string");
|
|
@@ -3330,11 +3334,11 @@ var getOptionValue = async (argMeta, opt) => {
|
|
|
3330
3334
|
return defaultValue;
|
|
3331
3335
|
else if (nullable)
|
|
3332
3336
|
return null;
|
|
3333
|
-
if (
|
|
3334
|
-
const
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
});
|
|
3337
|
+
if (enumChoices) {
|
|
3338
|
+
const choices = enumChoices.map(
|
|
3339
|
+
(choice2) => typeof choice2 === "object" ? { value: choice2.value, name: choice2.label } : { value: choice2, name: choice2.toString() }
|
|
3340
|
+
);
|
|
3341
|
+
const choice = await select2({ message: ask ?? desc ?? `Select the ${name} value`, choices });
|
|
3338
3342
|
return choice;
|
|
3339
3343
|
} else if (type === "boolean") {
|
|
3340
3344
|
const message = ask ?? desc ?? `Do you want to set ${name}? ${desc ? ` (${desc})` : ""}: `;
|
|
@@ -3629,7 +3633,7 @@ var AiSession = class _AiSession {
|
|
|
3629
3633
|
}
|
|
3630
3634
|
messageHistory = [];
|
|
3631
3635
|
sessionKey;
|
|
3632
|
-
isCacheLoaded;
|
|
3636
|
+
isCacheLoaded = false;
|
|
3633
3637
|
workspace;
|
|
3634
3638
|
constructor(type, { workspace, cacheKey, isContinued }) {
|
|
3635
3639
|
this.workspace = workspace;
|
|
@@ -4434,11 +4438,12 @@ import commonjs from "vite-plugin-commonjs";
|
|
|
4434
4438
|
import { nodePolyfills } from "vite-plugin-node-polyfills";
|
|
4435
4439
|
import tsconfigPaths from "vite-tsconfig-paths";
|
|
4436
4440
|
var ApplicationRunner = class {
|
|
4437
|
-
async createApplication(appName, workspace) {
|
|
4441
|
+
async createApplication(appName, workspace, libs = []) {
|
|
4438
4442
|
await workspace.applyTemplate({
|
|
4439
4443
|
basePath: `apps/${appName}`,
|
|
4440
4444
|
template: "app",
|
|
4441
|
-
dict: { appName, companyName: workspace.repoName, startDomain: "localhost" }
|
|
4445
|
+
dict: { appName, companyName: workspace.repoName, startDomain: "localhost" },
|
|
4446
|
+
options: { libs }
|
|
4442
4447
|
});
|
|
4443
4448
|
workspace.setTsPaths("app", appName);
|
|
4444
4449
|
return AppExecutor.from(workspace, appName);
|
|
@@ -4528,7 +4533,7 @@ var ApplicationRunner = class {
|
|
|
4528
4533
|
});
|
|
4529
4534
|
const rootPackageJson = app.workspace.getPackageJson();
|
|
4530
4535
|
const dependencies = extractDependencies(buildResult.outputFiles, rootPackageJson);
|
|
4531
|
-
buildResult.outputFiles.
|
|
4536
|
+
buildResult.outputFiles.forEach((file) => app.dist.writeFile(file.path, file.text));
|
|
4532
4537
|
const appPackageJson = {
|
|
4533
4538
|
name: `${app.name}/backend`,
|
|
4534
4539
|
description: `${app.name} backend`,
|
|
@@ -4586,7 +4591,7 @@ var ApplicationRunner = class {
|
|
|
4586
4591
|
"react-dom",
|
|
4587
4592
|
"typescript"
|
|
4588
4593
|
]);
|
|
4589
|
-
buildResult.outputFiles.
|
|
4594
|
+
buildResult.outputFiles.forEach((file) => app.dist.writeFile(file.path, file.text));
|
|
4590
4595
|
const appPackageJson = {
|
|
4591
4596
|
name: `${app.name}/frontend`,
|
|
4592
4597
|
description: `${app.name} frontend`,
|
|
@@ -5154,9 +5159,9 @@ var ApplicationRunner = class {
|
|
|
5154
5159
|
var ApplicationScript = class {
|
|
5155
5160
|
#runner = new ApplicationRunner();
|
|
5156
5161
|
libraryScript = new LibraryScript();
|
|
5157
|
-
async createApplication(appName, workspace, { start = false } = {}) {
|
|
5162
|
+
async createApplication(appName, workspace, { start = false, libs = [] } = {}) {
|
|
5158
5163
|
const spinner = workspace.spinning("Creating application...");
|
|
5159
|
-
const app = await this.#runner.createApplication(appName, workspace);
|
|
5164
|
+
const app = await this.#runner.createApplication(appName, workspace, libs);
|
|
5160
5165
|
spinner.succeed(`Application created in apps/${app.name}`);
|
|
5161
5166
|
await this.syncApplication(app);
|
|
5162
5167
|
if (start)
|
|
@@ -5812,8 +5817,8 @@ ${chalk6.green("\u27A4")} Authentication Required`));
|
|
|
5812
5817
|
const tag = isOfficialRelease ? "latest" : patchVersionOfBase.split("-").at(1) ?? "dev";
|
|
5813
5818
|
const getNextVersion = async (prefix, tag2) => {
|
|
5814
5819
|
try {
|
|
5815
|
-
const latestPublishedVersionOfBase = await latestVersion("@akanjs/base", { version:
|
|
5816
|
-
const latestPatch = parseInt(latestPublishedVersionOfBase.split(".").at(-1) ?? "
|
|
5820
|
+
const latestPublishedVersionOfBase = await latestVersion("@akanjs/base", { version: tag2 });
|
|
5821
|
+
const latestPatch = latestPublishedVersionOfBase.startsWith(prefix) ? parseInt(latestPublishedVersionOfBase.split(".").at(-1) ?? "-1") : -1;
|
|
5817
5822
|
const nextVersion2 = `${prefix}.${latestPatch + 1}`;
|
|
5818
5823
|
return { nextVersion: nextVersion2, latestPublishedVersion: latestPublishedVersionOfBase };
|
|
5819
5824
|
} catch (e) {
|
|
@@ -5847,17 +5852,17 @@ ${chalk6.green("\u27A4")} Authentication Required`));
|
|
|
5847
5852
|
);
|
|
5848
5853
|
Logger.info("All libraries are published to npm");
|
|
5849
5854
|
}
|
|
5850
|
-
async update(workspace) {
|
|
5855
|
+
async update(workspace, tag = "latest") {
|
|
5851
5856
|
if (!workspace.exists("package.json"))
|
|
5852
|
-
await workspace.spawn("npm", ["update", "-g", "@akanjs/cli", "--latest"]);
|
|
5857
|
+
await workspace.spawn("npm", ["update", "-g", "@akanjs/cli", "--latest", `--tag=${tag}`]);
|
|
5853
5858
|
else
|
|
5854
5859
|
await Promise.all([
|
|
5855
|
-
workspace.spawn("npm", ["update", "-g", "@akanjs/cli", "--latest"]),
|
|
5856
|
-
this.#updateAkanPkgs(workspace)
|
|
5860
|
+
workspace.spawn("npm", ["update", "-g", "@akanjs/cli", "--latest", `--tag=${tag}`]),
|
|
5861
|
+
this.#updateAkanPkgs(workspace, tag)
|
|
5857
5862
|
]);
|
|
5858
5863
|
}
|
|
5859
|
-
async #updateAkanPkgs(workspace) {
|
|
5860
|
-
const latestPublishedVersionOfBase = await latestVersion("@akanjs/base");
|
|
5864
|
+
async #updateAkanPkgs(workspace, tag = "latest") {
|
|
5865
|
+
const latestPublishedVersionOfBase = await latestVersion("@akanjs/base", { version: tag });
|
|
5861
5866
|
const rootPackageJson = workspace.getPackageJson();
|
|
5862
5867
|
if (!rootPackageJson.dependencies)
|
|
5863
5868
|
throw new Error("No dependencies found in package.json");
|
|
@@ -5901,9 +5906,9 @@ var CloudScript = class {
|
|
|
5901
5906
|
);
|
|
5902
5907
|
await this.#runner.deployAkan(workspace, akanPkgs);
|
|
5903
5908
|
}
|
|
5904
|
-
async update(workspace) {
|
|
5909
|
+
async update(workspace, tag = "latest") {
|
|
5905
5910
|
const spinner = workspace.spinning("Updating Akan.js packages and CLI...");
|
|
5906
|
-
await this.#runner.update(workspace);
|
|
5911
|
+
await this.#runner.update(workspace, tag);
|
|
5907
5912
|
spinner.succeed("Akan.js packages and CLI updated, global version is below");
|
|
5908
5913
|
Logger.raw("> Akan version: ");
|
|
5909
5914
|
await workspace.spawn("akan", ["--version"], { stdio: "inherit" });
|
|
@@ -5931,8 +5936,8 @@ var CloudCommand = class {
|
|
|
5931
5936
|
async deployAkan(workspace) {
|
|
5932
5937
|
await this.cloudScript.deployAkan(workspace);
|
|
5933
5938
|
}
|
|
5934
|
-
async update(workspace) {
|
|
5935
|
-
await this.cloudScript.update(workspace);
|
|
5939
|
+
async update(workspace, tag) {
|
|
5940
|
+
await this.cloudScript.update(workspace, tag);
|
|
5936
5941
|
}
|
|
5937
5942
|
};
|
|
5938
5943
|
__decorateClass([
|
|
@@ -5962,7 +5967,12 @@ __decorateClass([
|
|
|
5962
5967
|
], CloudCommand.prototype, "deployAkan", 1);
|
|
5963
5968
|
__decorateClass([
|
|
5964
5969
|
Target.Public(),
|
|
5965
|
-
__decorateParam(0, Workspace())
|
|
5970
|
+
__decorateParam(0, Workspace()),
|
|
5971
|
+
__decorateParam(1, Option("tag", {
|
|
5972
|
+
desc: "tag of the update",
|
|
5973
|
+
default: "latest",
|
|
5974
|
+
enum: ["latest", "dev", "canary", "beta", "rc", "alpha"]
|
|
5975
|
+
}))
|
|
5966
5976
|
], CloudCommand.prototype, "update", 1);
|
|
5967
5977
|
CloudCommand = __decorateClass([
|
|
5968
5978
|
Commands()
|
|
@@ -6758,11 +6768,13 @@ var WorkspaceScript = class {
|
|
|
6758
6768
|
#runner = new WorkspaceRunner();
|
|
6759
6769
|
applicationScript = new ApplicationScript();
|
|
6760
6770
|
libraryScript = new LibraryScript();
|
|
6761
|
-
async createWorkspace(repoName, appName, dirname3 = ".") {
|
|
6771
|
+
async createWorkspace(repoName, appName, dirname3 = ".", installLibs) {
|
|
6762
6772
|
const workspace = await this.#runner.createWorkspace(repoName, appName, dirname3);
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
|
|
6773
|
+
if (installLibs) {
|
|
6774
|
+
await this.libraryScript.installLibrary(workspace, "util");
|
|
6775
|
+
await this.libraryScript.installLibrary(workspace, "shared");
|
|
6776
|
+
}
|
|
6777
|
+
await this.applicationScript.createApplication(appName, workspace, { libs: installLibs ? ["util", "shared"] : [] });
|
|
6766
6778
|
Logger.rawLog(`
|
|
6767
6779
|
\u{1F389} Welcome aboard! Workspace created in ${dirname3}/${repoName}`);
|
|
6768
6780
|
Logger.rawLog(`\u{1F680} Run \`cd ${repoName} && akan start ${appName}\` to start the development server.`);
|
|
@@ -6822,11 +6834,12 @@ var WorkspaceScript = class {
|
|
|
6822
6834
|
// pkgs/@akanjs/cli/src/workspace/workspace.command.ts
|
|
6823
6835
|
var WorkspaceCommand = class {
|
|
6824
6836
|
workspaceScript = new WorkspaceScript();
|
|
6825
|
-
async createWorkspace(workspaceName, app, dir) {
|
|
6837
|
+
async createWorkspace(workspaceName, app, dir, libs) {
|
|
6826
6838
|
await this.workspaceScript.createWorkspace(
|
|
6827
6839
|
workspaceName.toLowerCase().replace(/ /g, "-"),
|
|
6828
6840
|
app.toLowerCase().replace(/ /g, "-"),
|
|
6829
|
-
dir
|
|
6841
|
+
dir,
|
|
6842
|
+
libs
|
|
6830
6843
|
);
|
|
6831
6844
|
}
|
|
6832
6845
|
async generateMongo(workspace) {
|
|
@@ -6852,7 +6865,18 @@ __decorateClass([
|
|
|
6852
6865
|
Target.Public(),
|
|
6853
6866
|
__decorateParam(0, Argument("workspaceName", { desc: "what is the name of your organization?" })),
|
|
6854
6867
|
__decorateParam(1, Option("app", { desc: "what is the codename of your first application? (e.g. myapp)" })),
|
|
6855
|
-
__decorateParam(2, Option("dir", { desc: "directory of workspace", default: process.env.USE_AKANJS_PKGS === "true" ? "local" : "." }))
|
|
6868
|
+
__decorateParam(2, Option("dir", { desc: "directory of workspace", default: process.env.USE_AKANJS_PKGS === "true" ? "local" : "." })),
|
|
6869
|
+
__decorateParam(3, Option("libs", {
|
|
6870
|
+
type: "boolean",
|
|
6871
|
+
desc: "Do you want to install shared and util libraries? (admin, user file, etc.)",
|
|
6872
|
+
enum: [
|
|
6873
|
+
{ label: "No, I want to start with empty workspace (Recommended)", value: false },
|
|
6874
|
+
{
|
|
6875
|
+
label: "Yes, I want to accelerate development by installing shared and util libraries (for akanjs experts)",
|
|
6876
|
+
value: true
|
|
6877
|
+
}
|
|
6878
|
+
]
|
|
6879
|
+
}))
|
|
6856
6880
|
], WorkspaceCommand.prototype, "createWorkspace", 1);
|
|
6857
6881
|
__decorateClass([
|
|
6858
6882
|
Target.Public(),
|
|
@@ -88,8 +88,6 @@ const MyComponent = () => {
|
|
|
88
88
|
value={formState.status}
|
|
89
89
|
items={cnst.Status}
|
|
90
90
|
onChange={(status) => st.do.setStatusOnMyModel(status)}
|
|
91
|
-
model="myModel"
|
|
92
|
-
field="status"
|
|
93
91
|
/>
|
|
94
92
|
</>
|
|
95
93
|
);
|
|
@@ -280,7 +278,6 @@ Components seamlessly integrate with the state management:
|
|
|
280
278
|
## Best Practices
|
|
281
279
|
|
|
282
280
|
1. **Use the appropriate component type** for each part of your feature:
|
|
283
|
-
|
|
284
281
|
- Use **Field** components for data entry
|
|
285
282
|
- Use **Data** components for data visualization and management
|
|
286
283
|
- Use **Load** components for data fetching
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
// pkgs/@akanjs/cli/src/templates/app/akan.config.ts
|
|
2
|
-
function getContent(scanInfo, dict) {
|
|
2
|
+
function getContent(scanInfo, dict, options) {
|
|
3
3
|
return `
|
|
4
4
|
import type { AppConfig } from "@akanjs/config";
|
|
5
5
|
|
|
6
|
-
const config: AppConfig = {
|
|
7
|
-
rootLib: "shared",
|
|
6
|
+
const config: AppConfig = ${options.libs.length ? `{
|
|
8
7
|
libs: ["util", "shared"],
|
|
9
|
-
};
|
|
8
|
+
}` : "{}"};
|
|
10
9
|
|
|
11
10
|
export default config;
|
|
12
11
|
`;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// pkgs/@akanjs/cli/src/templates/app/app/[lang]/layout.tsx
|
|
2
|
-
function getContent(scanInfo, dict) {
|
|
2
|
+
function getContent(scanInfo, dict, options) {
|
|
3
|
+
const isUsingShared = options.libs.includes("shared");
|
|
3
4
|
return {
|
|
4
5
|
filename: "layout.tsx",
|
|
5
6
|
content: `
|
|
@@ -8,7 +9,7 @@ import { RootLayoutProps } from "@akanjs/client";
|
|
|
8
9
|
import { System } from "@akanjs/ui";
|
|
9
10
|
import { env } from "@${dict.appName}/env/env.client";
|
|
10
11
|
import { fetch } from "@${dict.appName}/client";
|
|
11
|
-
import { Auth } from
|
|
12
|
+
${isUsingShared ? "import { Auth } from '@shared/ui';" : ""}
|
|
12
13
|
|
|
13
14
|
export const metadata = { title: "${dict.appName}" };
|
|
14
15
|
|
|
@@ -22,8 +23,7 @@ export default function Layout({ children, params }: RootLayoutProps) {
|
|
|
22
23
|
// className="bg-base-100"
|
|
23
24
|
env={env}
|
|
24
25
|
>
|
|
25
|
-
{children}
|
|
26
|
-
<Auth.User />
|
|
26
|
+
{children}${isUsingShared ? "\n <Auth.User />\n <Auth.Admin />" : ""}
|
|
27
27
|
</System.Provider>
|
|
28
28
|
);
|
|
29
29
|
}
|