@akanjs/cli 0.9.31 → 0.9.33
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 +82 -65
- package/cjs/src/templates/app/app/[lang]/{(__appName__)/layout.js → layout.js} +1 -1
- package/cjs/src/templates/app/app/[lang]/{(__appName__)/(public)/page.js → page.js} +1 -1
- package/cjs/src/templates/app/app/[lang]/{(__appName__)/(public)/unknown → unknown}/page.js +1 -1
- package/cjs/src/templates/crudPages/[__model__Id]/edit/page.js +2 -3
- package/cjs/src/templates/crudPages/[__model__Id]/page.js +2 -7
- package/cjs/src/templates/crudPages/new/page.js +3 -6
- package/cjs/src/templates/crudPages/page.js +3 -6
- package/cjs/src/templates/crudSinglePage/page.js +62 -0
- package/cjs/src/templates/module/__Model__.Unit.js +3 -2
- package/esm/index.js +82 -65
- package/esm/src/templates/app/app/[lang]/{(__appName__)/layout.js → layout.js} +1 -1
- package/esm/src/templates/app/app/[lang]/{(__appName__)/(public)/page.js → page.js} +1 -1
- package/esm/src/templates/app/app/[lang]/{(__appName__)/(public)/unknown → unknown}/page.js +1 -1
- package/esm/src/templates/crudPages/[__model__Id]/edit/page.js +2 -3
- package/esm/src/templates/crudPages/[__model__Id]/page.js +2 -7
- package/esm/src/templates/crudPages/new/page.js +3 -6
- package/esm/src/templates/crudPages/page.js +3 -6
- package/esm/src/templates/crudSinglePage/page.js +42 -0
- package/esm/src/templates/module/__Model__.Unit.js +3 -2
- package/package.json +1 -1
- package/src/module/module.command.d.ts +1 -1
- package/src/module/module.script.d.ts +9 -5
- package/src/page/page.command.d.ts +2 -2
- package/src/page/page.runner.d.ts +6 -2
- package/src/page/page.script.d.ts +6 -2
- package/src/templates/{app/app/[lang]/admin/layout.d.ts → crudSinglePage/page.d.ts} +2 -0
- package/cjs/src/templates/app/app/[lang]/admin/layout.js +0 -54
- package/esm/src/templates/app/app/[lang]/admin/layout.js +0 -34
- /package/cjs/src/templates/app/app/[lang]/{(__appName__)/styles.css.template → styles.css.template} +0 -0
- /package/esm/src/templates/app/app/[lang]/{(__appName__)/styles.css.template → styles.css.template} +0 -0
- /package/src/templates/app/app/[lang]/{(__appName__)/layout.d.ts → layout.d.ts} +0 -0
- /package/src/templates/app/app/[lang]/{(__appName__)/(public)/page.d.ts → page.d.ts} +0 -0
- /package/src/templates/app/app/[lang]/{(__appName__)/(public)/unknown → unknown}/page.d.ts +0 -0
package/cjs/index.js
CHANGED
|
@@ -3549,6 +3549,7 @@ var import_ink2 = require("ink");
|
|
|
3549
3549
|
var import_react2 = __toESM(require("react"), 1);
|
|
3550
3550
|
var HEADER_HEIGHT = 1;
|
|
3551
3551
|
var FOOTER_HEIGHT = 5;
|
|
3552
|
+
var OUTER_BORDER_HEIGHT = 2;
|
|
3552
3553
|
var BORDER_HEIGHT = 2;
|
|
3553
3554
|
var MultiScrollList = ({ logList, maxLength = 100 }) => {
|
|
3554
3555
|
const [width, height] = useStdoutDimensions();
|
|
@@ -3557,7 +3558,9 @@ var MultiScrollList = ({ logList, maxLength = 100 }) => {
|
|
|
3557
3558
|
const [scrollPos, setScrollPos] = (0, import_react2.useState)(0);
|
|
3558
3559
|
const [tabIndex, setTabIndex] = (0, import_react2.useState)(0);
|
|
3559
3560
|
const [isRunning, setIsRunning] = (0, import_react2.useState)(false);
|
|
3560
|
-
const [boxHeight, setBoxHeight] = (0, import_react2.useState)(
|
|
3561
|
+
const [boxHeight, setBoxHeight] = (0, import_react2.useState)(
|
|
3562
|
+
height - HEADER_HEIGHT - OUTER_BORDER_HEIGHT - FOOTER_HEIGHT - BORDER_HEIGHT
|
|
3563
|
+
);
|
|
3561
3564
|
const getLimitedLogs = (logs) => {
|
|
3562
3565
|
return logs.length > maxLength ? logs.slice(logs.length - maxLength) : logs;
|
|
3563
3566
|
};
|
|
@@ -3632,14 +3635,14 @@ var MultiScrollList = ({ logList, maxLength = 100 }) => {
|
|
|
3632
3635
|
}
|
|
3633
3636
|
}, [logList, isRunning, scrollPos, tabIndex, boxHeight, maxLength]);
|
|
3634
3637
|
(0, import_react2.useEffect)(() => {
|
|
3635
|
-
setBoxHeight(height - HEADER_HEIGHT - FOOTER_HEIGHT - BORDER_HEIGHT);
|
|
3638
|
+
setBoxHeight(height - HEADER_HEIGHT - OUTER_BORDER_HEIGHT - FOOTER_HEIGHT - BORDER_HEIGHT);
|
|
3636
3639
|
}, [height]);
|
|
3637
3640
|
(0, import_react2.useEffect)(() => {
|
|
3638
3641
|
setLengthMap(new Map(logList.map((log, index) => [index, Math.min(log.logs.length, maxLength)])));
|
|
3639
3642
|
}, [logList, maxLength]);
|
|
3640
|
-
return /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, { width, height, flexDirection: "column" }, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, { width
|
|
3643
|
+
return /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, { width, height, borderStyle: "round", borderColor: "blackBright", flexDirection: "column" }, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, { width: "100%", height: boxHeight + BORDER_HEIGHT + HEADER_HEIGHT, flexDirection: "row" }, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, { width: 30, height: "100%", flexDirection: "column" }, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, null, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, null, "List ", tabIndex + 1, "/", logList.length)), /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, { borderStyle: "round", borderColor: "blackBright", width: "100%", height: "100%", flexDirection: "column" }, logList.map((log, index) => {
|
|
3641
3644
|
return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { color: index === tabIndex ? "green" : "white" }, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, null, "\u25CF"), "\xA0", log.title.length > 25 ? log.title.slice(0, 25) + "..." : log.title));
|
|
3642
|
-
}))), /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, { width, height:
|
|
3645
|
+
}))), /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, { width: "100%", height: "100%", flexDirection: "column" }, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, { height: 1 }, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { color: logList[tabIndex].color }, logList[tabIndex].title)), /* @__PURE__ */ import_react2.default.createElement(
|
|
3643
3646
|
import_ink2.Box,
|
|
3644
3647
|
{
|
|
3645
3648
|
borderStyle: isRunning ? "double" : "round",
|
|
@@ -3649,11 +3652,11 @@ var MultiScrollList = ({ logList, maxLength = 100 }) => {
|
|
|
3649
3652
|
height: "100%"
|
|
3650
3653
|
},
|
|
3651
3654
|
scrollPos > 0 ? /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, focusLog.slice(0, focusLog.length - 1).map((log, index) => {
|
|
3652
|
-
return /* @__PURE__ */ import_react2.default.createElement(
|
|
3655
|
+
return /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { key: index }, log);
|
|
3653
3656
|
}), /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { backgroundColor: "green" }, "Scrolling... +", scrollPos)) : focusLog.map((log, index) => {
|
|
3654
|
-
return /* @__PURE__ */ import_react2.default.createElement(
|
|
3657
|
+
return /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { key: index }, log);
|
|
3655
3658
|
})
|
|
3656
|
-
))), /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, { width }, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { dimColor: true }, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, null, "You can use the following shortcuts:"), /* @__PURE__ */ import_react2.default.createElement(import_ink2.Newline, null), "* ", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { backgroundColor: "green" }, "tab"), " to switch tab.", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Newline, null), "* ", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { backgroundColor: "green" }, "up"), " and ", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { backgroundColor: "green" }, "down"), " to scroll.", " ", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { backgroundColor: "green" }, "shift"), " to scroll faster.", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Newline, null), "* ", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { backgroundColor: "green" }, "space"), " to scroll.", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Newline, null), "* ", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { backgroundColor: "green" }, "escape"), " to stop scrolling.")));
|
|
3659
|
+
))), /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, { width: "100%", height: FOOTER_HEIGHT }, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { dimColor: true }, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, null, "You can use the following shortcuts:"), /* @__PURE__ */ import_react2.default.createElement(import_ink2.Newline, null), "* ", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { backgroundColor: "green" }, "tab"), " to switch tab.", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Newline, null), "* ", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { backgroundColor: "green" }, "up"), " and ", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { backgroundColor: "green" }, "down"), " to scroll.", " ", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { backgroundColor: "green" }, "shift"), " to scroll faster. (x10)", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Newline, null), "* ", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { backgroundColor: "green" }, "space"), " to scroll.", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Newline, null), "* ", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { backgroundColor: "green" }, "escape"), " to stop scrolling.")));
|
|
3657
3660
|
};
|
|
3658
3661
|
|
|
3659
3662
|
// pkgs/@akanjs/cli/src/application/application.interface.tsx
|
|
@@ -5215,6 +5218,25 @@ LibraryCommand = __decorateClass([
|
|
|
5215
5218
|
// pkgs/@akanjs/cli/src/module/module.script.ts
|
|
5216
5219
|
var import_fs11 = __toESM(require("fs"), 1);
|
|
5217
5220
|
|
|
5221
|
+
// pkgs/@akanjs/cli/src/page/page.runner.ts
|
|
5222
|
+
var PageRunner = class {
|
|
5223
|
+
async createCrudPage(module2, { app, basePath: basePath2, single = false }) {
|
|
5224
|
+
await app.applyTemplate({
|
|
5225
|
+
basePath: basePath2 ?? `app/[lang]/(${app.name})/(public)/${module2.name}`,
|
|
5226
|
+
template: single ? "crudSinglePage" : "crudPages",
|
|
5227
|
+
dict: { model: module2.name, appName: module2.sys.name }
|
|
5228
|
+
});
|
|
5229
|
+
}
|
|
5230
|
+
};
|
|
5231
|
+
|
|
5232
|
+
// pkgs/@akanjs/cli/src/page/page.script.ts
|
|
5233
|
+
var PageScript = class {
|
|
5234
|
+
#runner = new PageRunner();
|
|
5235
|
+
async createCrudPage(module2, { app, basePath: basePath2, single = false }) {
|
|
5236
|
+
await this.#runner.createCrudPage(module2, { app, basePath: basePath2, single });
|
|
5237
|
+
}
|
|
5238
|
+
};
|
|
5239
|
+
|
|
5218
5240
|
// pkgs/@akanjs/cli/src/module/module.prompt.ts
|
|
5219
5241
|
var componentDefaultDescription = ({
|
|
5220
5242
|
modelName,
|
|
@@ -5589,10 +5611,15 @@ var ModuleRunner = class {
|
|
|
5589
5611
|
|
|
5590
5612
|
// pkgs/@akanjs/cli/src/module/module.script.ts
|
|
5591
5613
|
var ModuleScript = class {
|
|
5614
|
+
pageScript = new PageScript();
|
|
5592
5615
|
#runner = new ModuleRunner();
|
|
5593
|
-
async createModuleTemplate(sys3, name) {
|
|
5594
|
-
const
|
|
5595
|
-
await this.#runner.createModuleTemplate(
|
|
5616
|
+
async createModuleTemplate(sys3, name, { page = false } = {}) {
|
|
5617
|
+
const mod = ModuleExecutor.from(sys3, name);
|
|
5618
|
+
await this.#runner.createModuleTemplate(mod);
|
|
5619
|
+
if (page && sys3.type === "app")
|
|
5620
|
+
await this.pageScript.createCrudPage(mod, { app: sys3, basePath: null, single: false });
|
|
5621
|
+
const akanConfig = await sys3.getConfig();
|
|
5622
|
+
await sys3.scan({ akanConfig });
|
|
5596
5623
|
}
|
|
5597
5624
|
async createModule(sys3, name, description, schemaDescription) {
|
|
5598
5625
|
const session = new AiSession("createModule", { workspace: sys3.workspace, cacheKey: name });
|
|
@@ -5641,25 +5668,25 @@ var ModuleScript = class {
|
|
|
5641
5668
|
await this.createTemplate(executor);
|
|
5642
5669
|
sys3.log(`Module ${name} created in ${sys3.type}s/${sys3.name}/lib/${name}`);
|
|
5643
5670
|
}
|
|
5644
|
-
removeModule(
|
|
5645
|
-
this.#runner.removeModule(
|
|
5671
|
+
removeModule(mod) {
|
|
5672
|
+
this.#runner.removeModule(mod);
|
|
5646
5673
|
}
|
|
5647
5674
|
async createService(workspace, name) {
|
|
5648
5675
|
}
|
|
5649
5676
|
async createTest(workspace, name) {
|
|
5650
5677
|
}
|
|
5651
|
-
async createTemplate(
|
|
5652
|
-
const { component: template } = await this.#runner.createComponentTemplate(
|
|
5653
|
-
const templateExampleFiles = (await
|
|
5654
|
-
(f) => !f.filePath.includes(`${
|
|
5678
|
+
async createTemplate(mod) {
|
|
5679
|
+
const { component: template } = await this.#runner.createComponentTemplate(mod, "template");
|
|
5680
|
+
const templateExampleFiles = (await mod.sys.getTemplatesSourceCode()).filter(
|
|
5681
|
+
(f) => !f.filePath.includes(`${mod.name}.Template.tsx`)
|
|
5655
5682
|
);
|
|
5656
|
-
const Name = capitalize(
|
|
5657
|
-
const relatedCnsts = getRelatedCnsts(`${
|
|
5658
|
-
const constant = import_fs11.default.readFileSync(`${
|
|
5659
|
-
const session = new AiSession("createTemplate", { workspace:
|
|
5683
|
+
const Name = capitalize(mod.name);
|
|
5684
|
+
const relatedCnsts = getRelatedCnsts(`${mod.sys.cwdPath}/lib/${mod.name}/${mod.name}.constant.ts`);
|
|
5685
|
+
const constant = import_fs11.default.readFileSync(`${mod.sys.cwdPath}/lib/${mod.name}/${mod.name}.constant.ts`, "utf-8");
|
|
5686
|
+
const session = new AiSession("createTemplate", { workspace: mod.sys.workspace, cacheKey: mod.name });
|
|
5660
5687
|
const promptRst = requestTemplate({
|
|
5661
|
-
sysName:
|
|
5662
|
-
modelName:
|
|
5688
|
+
sysName: mod.sys.name,
|
|
5689
|
+
modelName: mod.name,
|
|
5663
5690
|
ModelName: Name,
|
|
5664
5691
|
constant,
|
|
5665
5692
|
boilerplate: template.content,
|
|
@@ -5667,20 +5694,20 @@ var ModuleScript = class {
|
|
|
5667
5694
|
exampleFiles: randomPicks(templateExampleFiles, Math.min(20, templateExampleFiles.length))
|
|
5668
5695
|
});
|
|
5669
5696
|
const content = await session.editTypescript(promptRst);
|
|
5670
|
-
|
|
5697
|
+
mod.writeFile(`${Name}.Template.tsx`, content);
|
|
5671
5698
|
}
|
|
5672
|
-
async createUnit(
|
|
5673
|
-
const { component: unit } = await this.#runner.createComponentTemplate(
|
|
5674
|
-
const Name = capitalize(
|
|
5675
|
-
const unitExampleFiles = (await
|
|
5676
|
-
(f) => !f.filePath.includes(`${
|
|
5699
|
+
async createUnit(mod) {
|
|
5700
|
+
const { component: unit } = await this.#runner.createComponentTemplate(mod, "unit");
|
|
5701
|
+
const Name = capitalize(mod.name);
|
|
5702
|
+
const unitExampleFiles = (await mod.sys.getUnitsSourceCode()).filter(
|
|
5703
|
+
(f) => !f.filePath.includes(`${mod.name}.Unit.tsx`)
|
|
5677
5704
|
);
|
|
5678
|
-
const relatedCnsts = getRelatedCnsts(`${
|
|
5679
|
-
const constant = import_fs11.default.readFileSync(`${
|
|
5680
|
-
const session = new AiSession("createUnit", { workspace:
|
|
5705
|
+
const relatedCnsts = getRelatedCnsts(`${mod.sys.cwdPath}/lib/${mod.name}/${mod.name}.constant.ts`);
|
|
5706
|
+
const constant = import_fs11.default.readFileSync(`${mod.sys.cwdPath}/lib/${mod.name}/${mod.name}.constant.ts`, "utf-8");
|
|
5707
|
+
const session = new AiSession("createUnit", { workspace: mod.sys.workspace, cacheKey: mod.name });
|
|
5681
5708
|
const promptRst = requestUnit({
|
|
5682
|
-
sysName:
|
|
5683
|
-
modelName:
|
|
5709
|
+
sysName: mod.sys.name,
|
|
5710
|
+
modelName: mod.name,
|
|
5684
5711
|
ModelName: Name,
|
|
5685
5712
|
constant,
|
|
5686
5713
|
properties: relatedCnsts.map((r) => ({ key: r.key, source: r.source })),
|
|
@@ -5688,20 +5715,20 @@ var ModuleScript = class {
|
|
|
5688
5715
|
boilerplate: unit.content
|
|
5689
5716
|
});
|
|
5690
5717
|
const content = await session.editTypescript(promptRst);
|
|
5691
|
-
|
|
5718
|
+
mod.writeFile(`${Name}.Unit.tsx`, content);
|
|
5692
5719
|
}
|
|
5693
|
-
async createView(
|
|
5694
|
-
const { component: view } = await this.#runner.createComponentTemplate(
|
|
5695
|
-
const viewExampleFiles = (await
|
|
5696
|
-
(f) => !f.filePath.includes(`${
|
|
5720
|
+
async createView(mod) {
|
|
5721
|
+
const { component: view } = await this.#runner.createComponentTemplate(mod, "view");
|
|
5722
|
+
const viewExampleFiles = (await mod.sys.getViewsSourceCode()).filter(
|
|
5723
|
+
(f) => !f.filePath.includes(`${mod.name}.View.tsx`)
|
|
5697
5724
|
);
|
|
5698
|
-
const Name = capitalize(
|
|
5699
|
-
const relatedCnsts = getRelatedCnsts(`${
|
|
5700
|
-
const constant = import_fs11.default.readFileSync(`${
|
|
5701
|
-
const session = new AiSession("createView", { workspace:
|
|
5725
|
+
const Name = capitalize(mod.name);
|
|
5726
|
+
const relatedCnsts = getRelatedCnsts(`${mod.sys.cwdPath}/lib/${mod.name}/${mod.name}.constant.ts`);
|
|
5727
|
+
const constant = import_fs11.default.readFileSync(`${mod.sys.cwdPath}/lib/${mod.name}/${mod.name}.constant.ts`, "utf-8");
|
|
5728
|
+
const session = new AiSession("createView", { workspace: mod.sys.workspace, cacheKey: mod.name });
|
|
5702
5729
|
const promptRst = requestView({
|
|
5703
|
-
sysName:
|
|
5704
|
-
modelName:
|
|
5730
|
+
sysName: mod.sys.name,
|
|
5731
|
+
modelName: mod.name,
|
|
5705
5732
|
ModelName: Name,
|
|
5706
5733
|
constant,
|
|
5707
5734
|
boilerplate: view.content,
|
|
@@ -5709,16 +5736,16 @@ var ModuleScript = class {
|
|
|
5709
5736
|
exampleFiles: randomPicks(viewExampleFiles, Math.min(20, viewExampleFiles.length))
|
|
5710
5737
|
});
|
|
5711
5738
|
const content = await session.editTypescript(promptRst);
|
|
5712
|
-
|
|
5739
|
+
mod.writeFile(`${Name}.View.tsx`, content);
|
|
5713
5740
|
}
|
|
5714
5741
|
};
|
|
5715
5742
|
|
|
5716
5743
|
// pkgs/@akanjs/cli/src/module/module.command.ts
|
|
5717
5744
|
var ModuleCommand = class {
|
|
5718
5745
|
moduleScript = new ModuleScript();
|
|
5719
|
-
async createModule(moduleName, sys3) {
|
|
5746
|
+
async createModule(moduleName, sys3, page) {
|
|
5720
5747
|
const name = lowerlize(moduleName.replace(/ /g, ""));
|
|
5721
|
-
await this.moduleScript.createModuleTemplate(sys3, name);
|
|
5748
|
+
await this.moduleScript.createModuleTemplate(sys3, name, { page });
|
|
5722
5749
|
}
|
|
5723
5750
|
removeModule(module2) {
|
|
5724
5751
|
this.moduleScript.removeModule(module2);
|
|
@@ -5736,7 +5763,8 @@ var ModuleCommand = class {
|
|
|
5736
5763
|
__decorateClass([
|
|
5737
5764
|
Target.Public(),
|
|
5738
5765
|
__decorateParam(0, Argument("moduleName", { desc: "name of module" })),
|
|
5739
|
-
__decorateParam(1, Sys())
|
|
5766
|
+
__decorateParam(1, Sys()),
|
|
5767
|
+
__decorateParam(2, Option("page", { type: "boolean", desc: "create page", default: false }))
|
|
5740
5768
|
], ModuleCommand.prototype, "createModule", 1);
|
|
5741
5769
|
__decorateClass([
|
|
5742
5770
|
Target.Public(),
|
|
@@ -5802,31 +5830,20 @@ PackageCommand = __decorateClass([
|
|
|
5802
5830
|
Commands()
|
|
5803
5831
|
], PackageCommand);
|
|
5804
5832
|
|
|
5805
|
-
// pkgs/@akanjs/cli/src/page/page.runner.ts
|
|
5806
|
-
var PageRunner = class {
|
|
5807
|
-
async createPage(app, name) {
|
|
5808
|
-
}
|
|
5809
|
-
};
|
|
5810
|
-
|
|
5811
|
-
// pkgs/@akanjs/cli/src/page/page.script.ts
|
|
5812
|
-
var PageScript = class {
|
|
5813
|
-
#runner = new PageRunner();
|
|
5814
|
-
async createPage(app, name) {
|
|
5815
|
-
await this.#runner.createPage(app, name);
|
|
5816
|
-
}
|
|
5817
|
-
};
|
|
5818
|
-
|
|
5819
5833
|
// pkgs/@akanjs/cli/src/page/page.command.ts
|
|
5820
5834
|
var PageCommand = class {
|
|
5821
5835
|
pageScript = new PageScript();
|
|
5822
|
-
async
|
|
5836
|
+
async createCrudPage(app, module2, basePath2, single) {
|
|
5837
|
+
await this.pageScript.createCrudPage(module2, { app, basePath: basePath2, single });
|
|
5823
5838
|
}
|
|
5824
5839
|
};
|
|
5825
5840
|
__decorateClass([
|
|
5826
5841
|
Target.Public(),
|
|
5827
5842
|
__decorateParam(0, App()),
|
|
5828
|
-
__decorateParam(1,
|
|
5829
|
-
|
|
5843
|
+
__decorateParam(1, Module()),
|
|
5844
|
+
__decorateParam(2, Option("basePath", { desc: "base path", nullable: true })),
|
|
5845
|
+
__decorateParam(3, Option("single", { desc: "single page", default: false }))
|
|
5846
|
+
], PageCommand.prototype, "createCrudPage", 1);
|
|
5830
5847
|
PageCommand = __decorateClass([
|
|
5831
5848
|
Commands()
|
|
5832
5849
|
], PageCommand);
|
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// pkgs/@akanjs/cli/src/templates/app/app/[lang]/
|
|
19
|
+
// pkgs/@akanjs/cli/src/templates/app/app/[lang]/layout.tsx
|
|
20
20
|
var layout_exports = {};
|
|
21
21
|
__export(layout_exports, {
|
|
22
22
|
default: () => getContent
|
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// pkgs/@akanjs/cli/src/templates/app/app/[lang]/
|
|
19
|
+
// pkgs/@akanjs/cli/src/templates/app/app/[lang]/page.tsx
|
|
20
20
|
var page_exports = {};
|
|
21
21
|
__export(page_exports, {
|
|
22
22
|
default: () => getContent
|
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// pkgs/@akanjs/cli/src/templates/app/app/[lang]/
|
|
19
|
+
// pkgs/@akanjs/cli/src/templates/app/app/[lang]/unknown/page.tsx
|
|
20
20
|
var page_exports = {};
|
|
21
21
|
__export(page_exports, {
|
|
22
22
|
default: () => getContent
|
|
@@ -26,7 +26,6 @@ function getContent(scanResult, dict) {
|
|
|
26
26
|
return {
|
|
27
27
|
filename: "page.tsx",
|
|
28
28
|
content: `
|
|
29
|
-
import { AiOutlineTeam } from "react-icons/ai";
|
|
30
29
|
import { Load } from "@akanjs/ui";
|
|
31
30
|
import { fetch, usePage, ${dict.Model} } from "${dict.appName}/client";
|
|
32
31
|
import type { CsrConfig } from "@akanjs/client";
|
|
@@ -49,7 +48,7 @@ export default function Page({ params }: PageProps) {
|
|
|
49
48
|
<div className="container">
|
|
50
49
|
<div className="flex justify-between m-4 mt-8">
|
|
51
50
|
<div className="text-xl text-primary flex gap-2 items-center">
|
|
52
|
-
|
|
51
|
+
{l("shared.updateModel", { model: l("${dict.model}.modelName") })}
|
|
53
52
|
</div>
|
|
54
53
|
</div>
|
|
55
54
|
<Load.Edit
|
|
@@ -60,7 +59,7 @@ export default function Page({ params }: PageProps) {
|
|
|
60
59
|
onCancel="back"
|
|
61
60
|
onSubmit="/${dict.model}"
|
|
62
61
|
>
|
|
63
|
-
|
|
62
|
+
<${dict.Model}.Template.General />
|
|
64
63
|
</Load.Edit>
|
|
65
64
|
</div>
|
|
66
65
|
)}
|
|
@@ -27,10 +27,7 @@ function getContent(scanResult, dict) {
|
|
|
27
27
|
filename: "page.tsx",
|
|
28
28
|
content: `
|
|
29
29
|
import { ${dict.Model}, fetch, usePage } from "${dict.appName}/client";
|
|
30
|
-
import { Link } from "@akanjs/ui";
|
|
31
|
-
import { Load } from "@akanjs/ui";
|
|
32
|
-
import { getSelf } from "@akanjs/client";
|
|
33
|
-
import { AiOutlineEdit } from "react-icons/ai";
|
|
30
|
+
import { Link, Load } from "@akanjs/ui";
|
|
34
31
|
import type { CsrConfig } from "@akanjs/client";
|
|
35
32
|
|
|
36
33
|
interface PageProps {
|
|
@@ -52,7 +49,6 @@ export async function generateMetadata({ params }: PageProps) {
|
|
|
52
49
|
}
|
|
53
50
|
export default function Page({ params }: PageProps) {
|
|
54
51
|
const { l } = usePage();
|
|
55
|
-
const self = getSelf({ unauthorize: "/signin" });
|
|
56
52
|
return (
|
|
57
53
|
<Load.Page
|
|
58
54
|
of={Page}
|
|
@@ -64,10 +60,9 @@ export default function Page({ params }: PageProps) {
|
|
|
64
60
|
render={({ ${dict.model}, ${dict.model}View }) => (
|
|
65
61
|
<div className="container flex flex-col gap-4">
|
|
66
62
|
<div className="flex gap-4 font-bold text-lg items-center">
|
|
67
|
-
|
|
63
|
+
<${dict.Model}.Zone.View view={${dict.model}View} />
|
|
68
64
|
<Link href={\`/${dict.model}/\${${dict.model}.id}/edit\`}>
|
|
69
65
|
<button className="btn">
|
|
70
|
-
<AiOutlineEdit />
|
|
71
66
|
{l("shared.updateModel", { model: l("${dict.model}.modelName") })}
|
|
72
67
|
</button>
|
|
73
68
|
</Link>
|
|
@@ -26,15 +26,12 @@ function getContent(scanResult, dict) {
|
|
|
26
26
|
return {
|
|
27
27
|
filename: "page.tsx",
|
|
28
28
|
content: `
|
|
29
|
-
import { AiOutlineTeam } from "react-icons/ai";
|
|
30
29
|
import { Load } from "@akanjs/ui";
|
|
31
|
-
import { cnst, fetch, usePage, ${dict.Model} } from "
|
|
32
|
-
import { getSelf } from "@akanjs/client";
|
|
30
|
+
import { cnst, fetch, usePage, ${dict.Model} } from "@${dict.appName}/client";
|
|
33
31
|
import type { CsrConfig } from "@akanjs/client";
|
|
34
32
|
|
|
35
33
|
export default function Page() {
|
|
36
34
|
const { l } = usePage();
|
|
37
|
-
const self = getSelf({ unauthorize: "/signin" });
|
|
38
35
|
return (
|
|
39
36
|
<Load.Page
|
|
40
37
|
of={Page}
|
|
@@ -46,7 +43,7 @@ export default function Page() {
|
|
|
46
43
|
<div className="container">
|
|
47
44
|
<div className="flex justify-between m-4 mt-8">
|
|
48
45
|
<div className="text-xl text-primary flex gap-2 items-center">
|
|
49
|
-
|
|
46
|
+
+ {l("shared.createModel", { model: l("${dict.model}.modelName") })}
|
|
50
47
|
</div>
|
|
51
48
|
</div>
|
|
52
49
|
<Load.Edit
|
|
@@ -57,7 +54,7 @@ export default function Page() {
|
|
|
57
54
|
onCancel="back"
|
|
58
55
|
onSubmit="/${dict.model}"
|
|
59
56
|
>
|
|
60
|
-
|
|
57
|
+
<${dict.Model}.Template.General />
|
|
61
58
|
</Load.Edit>
|
|
62
59
|
</div>
|
|
63
60
|
)}
|
|
@@ -26,15 +26,12 @@ function getContent(scanResult, dict) {
|
|
|
26
26
|
return {
|
|
27
27
|
filename: "page.tsx",
|
|
28
28
|
content: `
|
|
29
|
-
import { ${dict.Model}, fetch, usePage } from "
|
|
30
|
-
import { Link } from "@akanjs/ui";
|
|
31
|
-
import { Load } from "@akanjs/ui";
|
|
32
|
-
import { getSelf } from "@akanjs/client";
|
|
29
|
+
import { ${dict.Model}, fetch, usePage } from "@${dict.appName}/client";
|
|
30
|
+
import { Link, Load } from "@akanjs/ui";
|
|
33
31
|
import type { CsrConfig } from "@akanjs/client";
|
|
34
32
|
|
|
35
33
|
export default function Page() {
|
|
36
34
|
const { l } = usePage();
|
|
37
|
-
const self = getSelf({ unauthorize: "/signin" });
|
|
38
35
|
return (
|
|
39
36
|
<Load.Page
|
|
40
37
|
of={Page}
|
|
@@ -54,7 +51,7 @@ export default function Page() {
|
|
|
54
51
|
</div>
|
|
55
52
|
<div>{l("${dict.model}.modelDesc")}</div>
|
|
56
53
|
<div className="flex px-6 mt-3 gap-4">
|
|
57
|
-
|
|
54
|
+
<${dict.Model}.Zone.Card
|
|
58
55
|
className="animate-fadeIn grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 justify-center gap-4 w-full"
|
|
59
56
|
init={${dict.model}InitInPublic}
|
|
60
57
|
/>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// pkgs/@akanjs/cli/src/templates/crudSinglePage/page.tsx
|
|
20
|
+
var page_exports = {};
|
|
21
|
+
__export(page_exports, {
|
|
22
|
+
default: () => getContent
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(page_exports);
|
|
25
|
+
function getContent(scanResult, dict) {
|
|
26
|
+
return {
|
|
27
|
+
filename: "page.tsx",
|
|
28
|
+
content: `
|
|
29
|
+
import type { CsrConfig } from "@akanjs/client";
|
|
30
|
+
import { Load, Model } from "@akanjs/ui";
|
|
31
|
+
import { ${dict.Model}, type cnst, fetch, usePage } from "@${dict.appName}/client";
|
|
32
|
+
|
|
33
|
+
export default function Page() {
|
|
34
|
+
const { l } = usePage();
|
|
35
|
+
return (
|
|
36
|
+
<Load.Page
|
|
37
|
+
of={Page}
|
|
38
|
+
loader={async () => {
|
|
39
|
+
const { ${dict.model}InitInPublic } = await fetch.init${dict.Model}InPublic();
|
|
40
|
+
return { ${dict.model}InitInPublic } as const;
|
|
41
|
+
}}
|
|
42
|
+
render={({ ${dict.model}InitInPublic }) => (
|
|
43
|
+
<>
|
|
44
|
+
<div className="animate-fadeIn flex items-center gap-4 px-4 pt-4">
|
|
45
|
+
<div className="text-lg font-bold md:text-4xl">{l("${dict.model}.modelName")}</div>
|
|
46
|
+
<Model.New className="btn btn-ghost" sliceName="${dict.model}InPublic" renderTitle="id">
|
|
47
|
+
<${dict.Model}.Template.General />
|
|
48
|
+
</Model.New>
|
|
49
|
+
</div>
|
|
50
|
+
<${dict.Model}.Zone.Card
|
|
51
|
+
className="animate-fadeIn mt-2 grid w-full grid-cols-1 justify-center gap-4 md:grid-cols-2 xl:grid-cols-3"
|
|
52
|
+
init={${dict.model}InitInPublic}
|
|
53
|
+
/>
|
|
54
|
+
</>
|
|
55
|
+
)}
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
Page.csrConfig = { transition: "none" } satisfies CsrConfig;
|
|
60
|
+
`
|
|
61
|
+
};
|
|
62
|
+
}
|
|
@@ -27,13 +27,14 @@ function getContent(scanResult, dict) {
|
|
|
27
27
|
filename: `${dict.Model}.Unit.tsx`,
|
|
28
28
|
content: `
|
|
29
29
|
import { ModelProps } from "@akanjs/client";
|
|
30
|
-
import { cnst,
|
|
30
|
+
import { cnst, usePage } from "@${dict.sysName}/client";
|
|
31
31
|
import { Link } from "@akanjs/ui";
|
|
32
32
|
|
|
33
33
|
export const Card = ({ ${dict.model}, href }: ModelProps<"${dict.model}", cnst.Light${dict.Model}>) => {
|
|
34
|
+
const { l } = usePage();
|
|
34
35
|
return (
|
|
35
36
|
<Link href={href} className="animate-fadeIn w-full h-36 flex rounded-lg shadow-sm hover:shadow-lg duration-300">
|
|
36
|
-
<div>{${dict.model}.id}</div>
|
|
37
|
+
<div>{l("${dict.model}.id")}:{${dict.model}.id}</div>
|
|
37
38
|
</Link>
|
|
38
39
|
);
|
|
39
40
|
};
|
package/esm/index.js
CHANGED
|
@@ -3531,6 +3531,7 @@ import { Box, Newline, Text, useInput } from "ink";
|
|
|
3531
3531
|
import React, { useEffect as useEffect2, useState as useState2 } from "react";
|
|
3532
3532
|
var HEADER_HEIGHT = 1;
|
|
3533
3533
|
var FOOTER_HEIGHT = 5;
|
|
3534
|
+
var OUTER_BORDER_HEIGHT = 2;
|
|
3534
3535
|
var BORDER_HEIGHT = 2;
|
|
3535
3536
|
var MultiScrollList = ({ logList, maxLength = 100 }) => {
|
|
3536
3537
|
const [width, height] = useStdoutDimensions();
|
|
@@ -3539,7 +3540,9 @@ var MultiScrollList = ({ logList, maxLength = 100 }) => {
|
|
|
3539
3540
|
const [scrollPos, setScrollPos] = useState2(0);
|
|
3540
3541
|
const [tabIndex, setTabIndex] = useState2(0);
|
|
3541
3542
|
const [isRunning, setIsRunning] = useState2(false);
|
|
3542
|
-
const [boxHeight, setBoxHeight] = useState2(
|
|
3543
|
+
const [boxHeight, setBoxHeight] = useState2(
|
|
3544
|
+
height - HEADER_HEIGHT - OUTER_BORDER_HEIGHT - FOOTER_HEIGHT - BORDER_HEIGHT
|
|
3545
|
+
);
|
|
3543
3546
|
const getLimitedLogs = (logs) => {
|
|
3544
3547
|
return logs.length > maxLength ? logs.slice(logs.length - maxLength) : logs;
|
|
3545
3548
|
};
|
|
@@ -3614,14 +3617,14 @@ var MultiScrollList = ({ logList, maxLength = 100 }) => {
|
|
|
3614
3617
|
}
|
|
3615
3618
|
}, [logList, isRunning, scrollPos, tabIndex, boxHeight, maxLength]);
|
|
3616
3619
|
useEffect2(() => {
|
|
3617
|
-
setBoxHeight(height - HEADER_HEIGHT - FOOTER_HEIGHT - BORDER_HEIGHT);
|
|
3620
|
+
setBoxHeight(height - HEADER_HEIGHT - OUTER_BORDER_HEIGHT - FOOTER_HEIGHT - BORDER_HEIGHT);
|
|
3618
3621
|
}, [height]);
|
|
3619
3622
|
useEffect2(() => {
|
|
3620
3623
|
setLengthMap(new Map(logList.map((log, index) => [index, Math.min(log.logs.length, maxLength)])));
|
|
3621
3624
|
}, [logList, maxLength]);
|
|
3622
|
-
return /* @__PURE__ */ React.createElement(Box, { width, height, flexDirection: "column" }, /* @__PURE__ */ React.createElement(Box, { width
|
|
3625
|
+
return /* @__PURE__ */ React.createElement(Box, { width, height, borderStyle: "round", borderColor: "blackBright", flexDirection: "column" }, /* @__PURE__ */ React.createElement(Box, { width: "100%", height: boxHeight + BORDER_HEIGHT + HEADER_HEIGHT, flexDirection: "row" }, /* @__PURE__ */ React.createElement(Box, { width: 30, height: "100%", flexDirection: "column" }, /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Text, null, "List ", tabIndex + 1, "/", logList.length)), /* @__PURE__ */ React.createElement(Box, { borderStyle: "round", borderColor: "blackBright", width: "100%", height: "100%", flexDirection: "column" }, logList.map((log, index) => {
|
|
3623
3626
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Text, { color: index === tabIndex ? "green" : "white" }, /* @__PURE__ */ React.createElement(Text, null, "\u25CF"), "\xA0", log.title.length > 25 ? log.title.slice(0, 25) + "..." : log.title));
|
|
3624
|
-
}))), /* @__PURE__ */ React.createElement(Box, { width, height:
|
|
3627
|
+
}))), /* @__PURE__ */ React.createElement(Box, { width: "100%", height: "100%", flexDirection: "column" }, /* @__PURE__ */ React.createElement(Box, { height: 1 }, /* @__PURE__ */ React.createElement(Text, { color: logList[tabIndex].color }, logList[tabIndex].title)), /* @__PURE__ */ React.createElement(
|
|
3625
3628
|
Box,
|
|
3626
3629
|
{
|
|
3627
3630
|
borderStyle: isRunning ? "double" : "round",
|
|
@@ -3631,11 +3634,11 @@ var MultiScrollList = ({ logList, maxLength = 100 }) => {
|
|
|
3631
3634
|
height: "100%"
|
|
3632
3635
|
},
|
|
3633
3636
|
scrollPos > 0 ? /* @__PURE__ */ React.createElement(React.Fragment, null, focusLog.slice(0, focusLog.length - 1).map((log, index) => {
|
|
3634
|
-
return /* @__PURE__ */ React.createElement(
|
|
3637
|
+
return /* @__PURE__ */ React.createElement(Text, { key: index }, log);
|
|
3635
3638
|
}), /* @__PURE__ */ React.createElement(Text, { backgroundColor: "green" }, "Scrolling... +", scrollPos)) : focusLog.map((log, index) => {
|
|
3636
|
-
return /* @__PURE__ */ React.createElement(
|
|
3639
|
+
return /* @__PURE__ */ React.createElement(Text, { key: index }, log);
|
|
3637
3640
|
})
|
|
3638
|
-
))), /* @__PURE__ */ React.createElement(Box, { width }, /* @__PURE__ */ React.createElement(Text, { dimColor: true }, /* @__PURE__ */ React.createElement(Text, null, "You can use the following shortcuts:"), /* @__PURE__ */ React.createElement(Newline, null), "* ", /* @__PURE__ */ React.createElement(Text, { backgroundColor: "green" }, "tab"), " to switch tab.", /* @__PURE__ */ React.createElement(Newline, null), "* ", /* @__PURE__ */ React.createElement(Text, { backgroundColor: "green" }, "up"), " and ", /* @__PURE__ */ React.createElement(Text, { backgroundColor: "green" }, "down"), " to scroll.", " ", /* @__PURE__ */ React.createElement(Text, { backgroundColor: "green" }, "shift"), " to scroll faster.", /* @__PURE__ */ React.createElement(Newline, null), "* ", /* @__PURE__ */ React.createElement(Text, { backgroundColor: "green" }, "space"), " to scroll.", /* @__PURE__ */ React.createElement(Newline, null), "* ", /* @__PURE__ */ React.createElement(Text, { backgroundColor: "green" }, "escape"), " to stop scrolling.")));
|
|
3641
|
+
))), /* @__PURE__ */ React.createElement(Box, { width: "100%", height: FOOTER_HEIGHT }, /* @__PURE__ */ React.createElement(Text, { dimColor: true }, /* @__PURE__ */ React.createElement(Text, null, "You can use the following shortcuts:"), /* @__PURE__ */ React.createElement(Newline, null), "* ", /* @__PURE__ */ React.createElement(Text, { backgroundColor: "green" }, "tab"), " to switch tab.", /* @__PURE__ */ React.createElement(Newline, null), "* ", /* @__PURE__ */ React.createElement(Text, { backgroundColor: "green" }, "up"), " and ", /* @__PURE__ */ React.createElement(Text, { backgroundColor: "green" }, "down"), " to scroll.", " ", /* @__PURE__ */ React.createElement(Text, { backgroundColor: "green" }, "shift"), " to scroll faster. (x10)", /* @__PURE__ */ React.createElement(Newline, null), "* ", /* @__PURE__ */ React.createElement(Text, { backgroundColor: "green" }, "space"), " to scroll.", /* @__PURE__ */ React.createElement(Newline, null), "* ", /* @__PURE__ */ React.createElement(Text, { backgroundColor: "green" }, "escape"), " to stop scrolling.")));
|
|
3639
3642
|
};
|
|
3640
3643
|
|
|
3641
3644
|
// pkgs/@akanjs/cli/src/application/application.interface.tsx
|
|
@@ -5197,6 +5200,25 @@ LibraryCommand = __decorateClass([
|
|
|
5197
5200
|
// pkgs/@akanjs/cli/src/module/module.script.ts
|
|
5198
5201
|
import fs15 from "fs";
|
|
5199
5202
|
|
|
5203
|
+
// pkgs/@akanjs/cli/src/page/page.runner.ts
|
|
5204
|
+
var PageRunner = class {
|
|
5205
|
+
async createCrudPage(module, { app, basePath: basePath2, single = false }) {
|
|
5206
|
+
await app.applyTemplate({
|
|
5207
|
+
basePath: basePath2 ?? `app/[lang]/(${app.name})/(public)/${module.name}`,
|
|
5208
|
+
template: single ? "crudSinglePage" : "crudPages",
|
|
5209
|
+
dict: { model: module.name, appName: module.sys.name }
|
|
5210
|
+
});
|
|
5211
|
+
}
|
|
5212
|
+
};
|
|
5213
|
+
|
|
5214
|
+
// pkgs/@akanjs/cli/src/page/page.script.ts
|
|
5215
|
+
var PageScript = class {
|
|
5216
|
+
#runner = new PageRunner();
|
|
5217
|
+
async createCrudPage(module, { app, basePath: basePath2, single = false }) {
|
|
5218
|
+
await this.#runner.createCrudPage(module, { app, basePath: basePath2, single });
|
|
5219
|
+
}
|
|
5220
|
+
};
|
|
5221
|
+
|
|
5200
5222
|
// pkgs/@akanjs/cli/src/module/module.prompt.ts
|
|
5201
5223
|
var componentDefaultDescription = ({
|
|
5202
5224
|
modelName,
|
|
@@ -5571,10 +5593,15 @@ var ModuleRunner = class {
|
|
|
5571
5593
|
|
|
5572
5594
|
// pkgs/@akanjs/cli/src/module/module.script.ts
|
|
5573
5595
|
var ModuleScript = class {
|
|
5596
|
+
pageScript = new PageScript();
|
|
5574
5597
|
#runner = new ModuleRunner();
|
|
5575
|
-
async createModuleTemplate(sys3, name) {
|
|
5576
|
-
const
|
|
5577
|
-
await this.#runner.createModuleTemplate(
|
|
5598
|
+
async createModuleTemplate(sys3, name, { page = false } = {}) {
|
|
5599
|
+
const mod = ModuleExecutor.from(sys3, name);
|
|
5600
|
+
await this.#runner.createModuleTemplate(mod);
|
|
5601
|
+
if (page && sys3.type === "app")
|
|
5602
|
+
await this.pageScript.createCrudPage(mod, { app: sys3, basePath: null, single: false });
|
|
5603
|
+
const akanConfig = await sys3.getConfig();
|
|
5604
|
+
await sys3.scan({ akanConfig });
|
|
5578
5605
|
}
|
|
5579
5606
|
async createModule(sys3, name, description, schemaDescription) {
|
|
5580
5607
|
const session = new AiSession("createModule", { workspace: sys3.workspace, cacheKey: name });
|
|
@@ -5623,25 +5650,25 @@ var ModuleScript = class {
|
|
|
5623
5650
|
await this.createTemplate(executor);
|
|
5624
5651
|
sys3.log(`Module ${name} created in ${sys3.type}s/${sys3.name}/lib/${name}`);
|
|
5625
5652
|
}
|
|
5626
|
-
removeModule(
|
|
5627
|
-
this.#runner.removeModule(
|
|
5653
|
+
removeModule(mod) {
|
|
5654
|
+
this.#runner.removeModule(mod);
|
|
5628
5655
|
}
|
|
5629
5656
|
async createService(workspace, name) {
|
|
5630
5657
|
}
|
|
5631
5658
|
async createTest(workspace, name) {
|
|
5632
5659
|
}
|
|
5633
|
-
async createTemplate(
|
|
5634
|
-
const { component: template } = await this.#runner.createComponentTemplate(
|
|
5635
|
-
const templateExampleFiles = (await
|
|
5636
|
-
(f) => !f.filePath.includes(`${
|
|
5660
|
+
async createTemplate(mod) {
|
|
5661
|
+
const { component: template } = await this.#runner.createComponentTemplate(mod, "template");
|
|
5662
|
+
const templateExampleFiles = (await mod.sys.getTemplatesSourceCode()).filter(
|
|
5663
|
+
(f) => !f.filePath.includes(`${mod.name}.Template.tsx`)
|
|
5637
5664
|
);
|
|
5638
|
-
const Name = capitalize(
|
|
5639
|
-
const relatedCnsts = getRelatedCnsts(`${
|
|
5640
|
-
const constant = fs15.readFileSync(`${
|
|
5641
|
-
const session = new AiSession("createTemplate", { workspace:
|
|
5665
|
+
const Name = capitalize(mod.name);
|
|
5666
|
+
const relatedCnsts = getRelatedCnsts(`${mod.sys.cwdPath}/lib/${mod.name}/${mod.name}.constant.ts`);
|
|
5667
|
+
const constant = fs15.readFileSync(`${mod.sys.cwdPath}/lib/${mod.name}/${mod.name}.constant.ts`, "utf-8");
|
|
5668
|
+
const session = new AiSession("createTemplate", { workspace: mod.sys.workspace, cacheKey: mod.name });
|
|
5642
5669
|
const promptRst = requestTemplate({
|
|
5643
|
-
sysName:
|
|
5644
|
-
modelName:
|
|
5670
|
+
sysName: mod.sys.name,
|
|
5671
|
+
modelName: mod.name,
|
|
5645
5672
|
ModelName: Name,
|
|
5646
5673
|
constant,
|
|
5647
5674
|
boilerplate: template.content,
|
|
@@ -5649,20 +5676,20 @@ var ModuleScript = class {
|
|
|
5649
5676
|
exampleFiles: randomPicks(templateExampleFiles, Math.min(20, templateExampleFiles.length))
|
|
5650
5677
|
});
|
|
5651
5678
|
const content = await session.editTypescript(promptRst);
|
|
5652
|
-
|
|
5679
|
+
mod.writeFile(`${Name}.Template.tsx`, content);
|
|
5653
5680
|
}
|
|
5654
|
-
async createUnit(
|
|
5655
|
-
const { component: unit } = await this.#runner.createComponentTemplate(
|
|
5656
|
-
const Name = capitalize(
|
|
5657
|
-
const unitExampleFiles = (await
|
|
5658
|
-
(f) => !f.filePath.includes(`${
|
|
5681
|
+
async createUnit(mod) {
|
|
5682
|
+
const { component: unit } = await this.#runner.createComponentTemplate(mod, "unit");
|
|
5683
|
+
const Name = capitalize(mod.name);
|
|
5684
|
+
const unitExampleFiles = (await mod.sys.getUnitsSourceCode()).filter(
|
|
5685
|
+
(f) => !f.filePath.includes(`${mod.name}.Unit.tsx`)
|
|
5659
5686
|
);
|
|
5660
|
-
const relatedCnsts = getRelatedCnsts(`${
|
|
5661
|
-
const constant = fs15.readFileSync(`${
|
|
5662
|
-
const session = new AiSession("createUnit", { workspace:
|
|
5687
|
+
const relatedCnsts = getRelatedCnsts(`${mod.sys.cwdPath}/lib/${mod.name}/${mod.name}.constant.ts`);
|
|
5688
|
+
const constant = fs15.readFileSync(`${mod.sys.cwdPath}/lib/${mod.name}/${mod.name}.constant.ts`, "utf-8");
|
|
5689
|
+
const session = new AiSession("createUnit", { workspace: mod.sys.workspace, cacheKey: mod.name });
|
|
5663
5690
|
const promptRst = requestUnit({
|
|
5664
|
-
sysName:
|
|
5665
|
-
modelName:
|
|
5691
|
+
sysName: mod.sys.name,
|
|
5692
|
+
modelName: mod.name,
|
|
5666
5693
|
ModelName: Name,
|
|
5667
5694
|
constant,
|
|
5668
5695
|
properties: relatedCnsts.map((r) => ({ key: r.key, source: r.source })),
|
|
@@ -5670,20 +5697,20 @@ var ModuleScript = class {
|
|
|
5670
5697
|
boilerplate: unit.content
|
|
5671
5698
|
});
|
|
5672
5699
|
const content = await session.editTypescript(promptRst);
|
|
5673
|
-
|
|
5700
|
+
mod.writeFile(`${Name}.Unit.tsx`, content);
|
|
5674
5701
|
}
|
|
5675
|
-
async createView(
|
|
5676
|
-
const { component: view } = await this.#runner.createComponentTemplate(
|
|
5677
|
-
const viewExampleFiles = (await
|
|
5678
|
-
(f) => !f.filePath.includes(`${
|
|
5702
|
+
async createView(mod) {
|
|
5703
|
+
const { component: view } = await this.#runner.createComponentTemplate(mod, "view");
|
|
5704
|
+
const viewExampleFiles = (await mod.sys.getViewsSourceCode()).filter(
|
|
5705
|
+
(f) => !f.filePath.includes(`${mod.name}.View.tsx`)
|
|
5679
5706
|
);
|
|
5680
|
-
const Name = capitalize(
|
|
5681
|
-
const relatedCnsts = getRelatedCnsts(`${
|
|
5682
|
-
const constant = fs15.readFileSync(`${
|
|
5683
|
-
const session = new AiSession("createView", { workspace:
|
|
5707
|
+
const Name = capitalize(mod.name);
|
|
5708
|
+
const relatedCnsts = getRelatedCnsts(`${mod.sys.cwdPath}/lib/${mod.name}/${mod.name}.constant.ts`);
|
|
5709
|
+
const constant = fs15.readFileSync(`${mod.sys.cwdPath}/lib/${mod.name}/${mod.name}.constant.ts`, "utf-8");
|
|
5710
|
+
const session = new AiSession("createView", { workspace: mod.sys.workspace, cacheKey: mod.name });
|
|
5684
5711
|
const promptRst = requestView({
|
|
5685
|
-
sysName:
|
|
5686
|
-
modelName:
|
|
5712
|
+
sysName: mod.sys.name,
|
|
5713
|
+
modelName: mod.name,
|
|
5687
5714
|
ModelName: Name,
|
|
5688
5715
|
constant,
|
|
5689
5716
|
boilerplate: view.content,
|
|
@@ -5691,16 +5718,16 @@ var ModuleScript = class {
|
|
|
5691
5718
|
exampleFiles: randomPicks(viewExampleFiles, Math.min(20, viewExampleFiles.length))
|
|
5692
5719
|
});
|
|
5693
5720
|
const content = await session.editTypescript(promptRst);
|
|
5694
|
-
|
|
5721
|
+
mod.writeFile(`${Name}.View.tsx`, content);
|
|
5695
5722
|
}
|
|
5696
5723
|
};
|
|
5697
5724
|
|
|
5698
5725
|
// pkgs/@akanjs/cli/src/module/module.command.ts
|
|
5699
5726
|
var ModuleCommand = class {
|
|
5700
5727
|
moduleScript = new ModuleScript();
|
|
5701
|
-
async createModule(moduleName, sys3) {
|
|
5728
|
+
async createModule(moduleName, sys3, page) {
|
|
5702
5729
|
const name = lowerlize(moduleName.replace(/ /g, ""));
|
|
5703
|
-
await this.moduleScript.createModuleTemplate(sys3, name);
|
|
5730
|
+
await this.moduleScript.createModuleTemplate(sys3, name, { page });
|
|
5704
5731
|
}
|
|
5705
5732
|
removeModule(module) {
|
|
5706
5733
|
this.moduleScript.removeModule(module);
|
|
@@ -5718,7 +5745,8 @@ var ModuleCommand = class {
|
|
|
5718
5745
|
__decorateClass([
|
|
5719
5746
|
Target.Public(),
|
|
5720
5747
|
__decorateParam(0, Argument("moduleName", { desc: "name of module" })),
|
|
5721
|
-
__decorateParam(1, Sys())
|
|
5748
|
+
__decorateParam(1, Sys()),
|
|
5749
|
+
__decorateParam(2, Option("page", { type: "boolean", desc: "create page", default: false }))
|
|
5722
5750
|
], ModuleCommand.prototype, "createModule", 1);
|
|
5723
5751
|
__decorateClass([
|
|
5724
5752
|
Target.Public(),
|
|
@@ -5784,31 +5812,20 @@ PackageCommand = __decorateClass([
|
|
|
5784
5812
|
Commands()
|
|
5785
5813
|
], PackageCommand);
|
|
5786
5814
|
|
|
5787
|
-
// pkgs/@akanjs/cli/src/page/page.runner.ts
|
|
5788
|
-
var PageRunner = class {
|
|
5789
|
-
async createPage(app, name) {
|
|
5790
|
-
}
|
|
5791
|
-
};
|
|
5792
|
-
|
|
5793
|
-
// pkgs/@akanjs/cli/src/page/page.script.ts
|
|
5794
|
-
var PageScript = class {
|
|
5795
|
-
#runner = new PageRunner();
|
|
5796
|
-
async createPage(app, name) {
|
|
5797
|
-
await this.#runner.createPage(app, name);
|
|
5798
|
-
}
|
|
5799
|
-
};
|
|
5800
|
-
|
|
5801
5815
|
// pkgs/@akanjs/cli/src/page/page.command.ts
|
|
5802
5816
|
var PageCommand = class {
|
|
5803
5817
|
pageScript = new PageScript();
|
|
5804
|
-
async
|
|
5818
|
+
async createCrudPage(app, module, basePath2, single) {
|
|
5819
|
+
await this.pageScript.createCrudPage(module, { app, basePath: basePath2, single });
|
|
5805
5820
|
}
|
|
5806
5821
|
};
|
|
5807
5822
|
__decorateClass([
|
|
5808
5823
|
Target.Public(),
|
|
5809
5824
|
__decorateParam(0, App()),
|
|
5810
|
-
__decorateParam(1,
|
|
5811
|
-
|
|
5825
|
+
__decorateParam(1, Module()),
|
|
5826
|
+
__decorateParam(2, Option("basePath", { desc: "base path", nullable: true })),
|
|
5827
|
+
__decorateParam(3, Option("single", { desc: "single page", default: false }))
|
|
5828
|
+
], PageCommand.prototype, "createCrudPage", 1);
|
|
5812
5829
|
PageCommand = __decorateClass([
|
|
5813
5830
|
Commands()
|
|
5814
5831
|
], PageCommand);
|
|
@@ -3,7 +3,6 @@ function getContent(scanResult, dict) {
|
|
|
3
3
|
return {
|
|
4
4
|
filename: "page.tsx",
|
|
5
5
|
content: `
|
|
6
|
-
import { AiOutlineTeam } from "react-icons/ai";
|
|
7
6
|
import { Load } from "@akanjs/ui";
|
|
8
7
|
import { fetch, usePage, ${dict.Model} } from "${dict.appName}/client";
|
|
9
8
|
import type { CsrConfig } from "@akanjs/client";
|
|
@@ -26,7 +25,7 @@ export default function Page({ params }: PageProps) {
|
|
|
26
25
|
<div className="container">
|
|
27
26
|
<div className="flex justify-between m-4 mt-8">
|
|
28
27
|
<div className="text-xl text-primary flex gap-2 items-center">
|
|
29
|
-
|
|
28
|
+
{l("shared.updateModel", { model: l("${dict.model}.modelName") })}
|
|
30
29
|
</div>
|
|
31
30
|
</div>
|
|
32
31
|
<Load.Edit
|
|
@@ -37,7 +36,7 @@ export default function Page({ params }: PageProps) {
|
|
|
37
36
|
onCancel="back"
|
|
38
37
|
onSubmit="/${dict.model}"
|
|
39
38
|
>
|
|
40
|
-
|
|
39
|
+
<${dict.Model}.Template.General />
|
|
41
40
|
</Load.Edit>
|
|
42
41
|
</div>
|
|
43
42
|
)}
|
|
@@ -4,10 +4,7 @@ function getContent(scanResult, dict) {
|
|
|
4
4
|
filename: "page.tsx",
|
|
5
5
|
content: `
|
|
6
6
|
import { ${dict.Model}, fetch, usePage } from "${dict.appName}/client";
|
|
7
|
-
import { Link } from "@akanjs/ui";
|
|
8
|
-
import { Load } from "@akanjs/ui";
|
|
9
|
-
import { getSelf } from "@akanjs/client";
|
|
10
|
-
import { AiOutlineEdit } from "react-icons/ai";
|
|
7
|
+
import { Link, Load } from "@akanjs/ui";
|
|
11
8
|
import type { CsrConfig } from "@akanjs/client";
|
|
12
9
|
|
|
13
10
|
interface PageProps {
|
|
@@ -29,7 +26,6 @@ export async function generateMetadata({ params }: PageProps) {
|
|
|
29
26
|
}
|
|
30
27
|
export default function Page({ params }: PageProps) {
|
|
31
28
|
const { l } = usePage();
|
|
32
|
-
const self = getSelf({ unauthorize: "/signin" });
|
|
33
29
|
return (
|
|
34
30
|
<Load.Page
|
|
35
31
|
of={Page}
|
|
@@ -41,10 +37,9 @@ export default function Page({ params }: PageProps) {
|
|
|
41
37
|
render={({ ${dict.model}, ${dict.model}View }) => (
|
|
42
38
|
<div className="container flex flex-col gap-4">
|
|
43
39
|
<div className="flex gap-4 font-bold text-lg items-center">
|
|
44
|
-
|
|
40
|
+
<${dict.Model}.Zone.View view={${dict.model}View} />
|
|
45
41
|
<Link href={\`/${dict.model}/\${${dict.model}.id}/edit\`}>
|
|
46
42
|
<button className="btn">
|
|
47
|
-
<AiOutlineEdit />
|
|
48
43
|
{l("shared.updateModel", { model: l("${dict.model}.modelName") })}
|
|
49
44
|
</button>
|
|
50
45
|
</Link>
|
|
@@ -3,15 +3,12 @@ function getContent(scanResult, dict) {
|
|
|
3
3
|
return {
|
|
4
4
|
filename: "page.tsx",
|
|
5
5
|
content: `
|
|
6
|
-
import { AiOutlineTeam } from "react-icons/ai";
|
|
7
6
|
import { Load } from "@akanjs/ui";
|
|
8
|
-
import { cnst, fetch, usePage, ${dict.Model} } from "
|
|
9
|
-
import { getSelf } from "@akanjs/client";
|
|
7
|
+
import { cnst, fetch, usePage, ${dict.Model} } from "@${dict.appName}/client";
|
|
10
8
|
import type { CsrConfig } from "@akanjs/client";
|
|
11
9
|
|
|
12
10
|
export default function Page() {
|
|
13
11
|
const { l } = usePage();
|
|
14
|
-
const self = getSelf({ unauthorize: "/signin" });
|
|
15
12
|
return (
|
|
16
13
|
<Load.Page
|
|
17
14
|
of={Page}
|
|
@@ -23,7 +20,7 @@ export default function Page() {
|
|
|
23
20
|
<div className="container">
|
|
24
21
|
<div className="flex justify-between m-4 mt-8">
|
|
25
22
|
<div className="text-xl text-primary flex gap-2 items-center">
|
|
26
|
-
|
|
23
|
+
+ {l("shared.createModel", { model: l("${dict.model}.modelName") })}
|
|
27
24
|
</div>
|
|
28
25
|
</div>
|
|
29
26
|
<Load.Edit
|
|
@@ -34,7 +31,7 @@ export default function Page() {
|
|
|
34
31
|
onCancel="back"
|
|
35
32
|
onSubmit="/${dict.model}"
|
|
36
33
|
>
|
|
37
|
-
|
|
34
|
+
<${dict.Model}.Template.General />
|
|
38
35
|
</Load.Edit>
|
|
39
36
|
</div>
|
|
40
37
|
)}
|
|
@@ -3,15 +3,12 @@ function getContent(scanResult, dict) {
|
|
|
3
3
|
return {
|
|
4
4
|
filename: "page.tsx",
|
|
5
5
|
content: `
|
|
6
|
-
import { ${dict.Model}, fetch, usePage } from "
|
|
7
|
-
import { Link } from "@akanjs/ui";
|
|
8
|
-
import { Load } from "@akanjs/ui";
|
|
9
|
-
import { getSelf } from "@akanjs/client";
|
|
6
|
+
import { ${dict.Model}, fetch, usePage } from "@${dict.appName}/client";
|
|
7
|
+
import { Link, Load } from "@akanjs/ui";
|
|
10
8
|
import type { CsrConfig } from "@akanjs/client";
|
|
11
9
|
|
|
12
10
|
export default function Page() {
|
|
13
11
|
const { l } = usePage();
|
|
14
|
-
const self = getSelf({ unauthorize: "/signin" });
|
|
15
12
|
return (
|
|
16
13
|
<Load.Page
|
|
17
14
|
of={Page}
|
|
@@ -31,7 +28,7 @@ export default function Page() {
|
|
|
31
28
|
</div>
|
|
32
29
|
<div>{l("${dict.model}.modelDesc")}</div>
|
|
33
30
|
<div className="flex px-6 mt-3 gap-4">
|
|
34
|
-
|
|
31
|
+
<${dict.Model}.Zone.Card
|
|
35
32
|
className="animate-fadeIn grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 justify-center gap-4 w-full"
|
|
36
33
|
init={${dict.model}InitInPublic}
|
|
37
34
|
/>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// pkgs/@akanjs/cli/src/templates/crudSinglePage/page.tsx
|
|
2
|
+
function getContent(scanResult, dict) {
|
|
3
|
+
return {
|
|
4
|
+
filename: "page.tsx",
|
|
5
|
+
content: `
|
|
6
|
+
import type { CsrConfig } from "@akanjs/client";
|
|
7
|
+
import { Load, Model } from "@akanjs/ui";
|
|
8
|
+
import { ${dict.Model}, type cnst, fetch, usePage } from "@${dict.appName}/client";
|
|
9
|
+
|
|
10
|
+
export default function Page() {
|
|
11
|
+
const { l } = usePage();
|
|
12
|
+
return (
|
|
13
|
+
<Load.Page
|
|
14
|
+
of={Page}
|
|
15
|
+
loader={async () => {
|
|
16
|
+
const { ${dict.model}InitInPublic } = await fetch.init${dict.Model}InPublic();
|
|
17
|
+
return { ${dict.model}InitInPublic } as const;
|
|
18
|
+
}}
|
|
19
|
+
render={({ ${dict.model}InitInPublic }) => (
|
|
20
|
+
<>
|
|
21
|
+
<div className="animate-fadeIn flex items-center gap-4 px-4 pt-4">
|
|
22
|
+
<div className="text-lg font-bold md:text-4xl">{l("${dict.model}.modelName")}</div>
|
|
23
|
+
<Model.New className="btn btn-ghost" sliceName="${dict.model}InPublic" renderTitle="id">
|
|
24
|
+
<${dict.Model}.Template.General />
|
|
25
|
+
</Model.New>
|
|
26
|
+
</div>
|
|
27
|
+
<${dict.Model}.Zone.Card
|
|
28
|
+
className="animate-fadeIn mt-2 grid w-full grid-cols-1 justify-center gap-4 md:grid-cols-2 xl:grid-cols-3"
|
|
29
|
+
init={${dict.model}InitInPublic}
|
|
30
|
+
/>
|
|
31
|
+
</>
|
|
32
|
+
)}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
Page.csrConfig = { transition: "none" } satisfies CsrConfig;
|
|
37
|
+
`
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
getContent as default
|
|
42
|
+
};
|
|
@@ -4,13 +4,14 @@ function getContent(scanResult, dict) {
|
|
|
4
4
|
filename: `${dict.Model}.Unit.tsx`,
|
|
5
5
|
content: `
|
|
6
6
|
import { ModelProps } from "@akanjs/client";
|
|
7
|
-
import { cnst,
|
|
7
|
+
import { cnst, usePage } from "@${dict.sysName}/client";
|
|
8
8
|
import { Link } from "@akanjs/ui";
|
|
9
9
|
|
|
10
10
|
export const Card = ({ ${dict.model}, href }: ModelProps<"${dict.model}", cnst.Light${dict.Model}>) => {
|
|
11
|
+
const { l } = usePage();
|
|
11
12
|
return (
|
|
12
13
|
<Link href={href} className="animate-fadeIn w-full h-36 flex rounded-lg shadow-sm hover:shadow-lg duration-300">
|
|
13
|
-
<div>{${dict.model}.id}</div>
|
|
14
|
+
<div>{l("${dict.model}.id")}:{${dict.model}.id}</div>
|
|
14
15
|
</Link>
|
|
15
16
|
);
|
|
16
17
|
};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import { Module, Sys } from "@akanjs/devkit";
|
|
|
2
2
|
import { ModuleScript } from "./module.script";
|
|
3
3
|
export declare class ModuleCommand {
|
|
4
4
|
moduleScript: ModuleScript;
|
|
5
|
-
createModule(moduleName: string, sys: Sys): Promise<void>;
|
|
5
|
+
createModule(moduleName: string, sys: Sys, page: boolean): Promise<void>;
|
|
6
6
|
removeModule(module: Module): void;
|
|
7
7
|
createView(module: Module): Promise<void>;
|
|
8
8
|
createUnit(module: Module): Promise<void>;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { type Module, type Sys, Workspace } from "@akanjs/devkit";
|
|
2
|
+
import { PageScript } from "../page/page.script";
|
|
2
3
|
export declare class ModuleScript {
|
|
3
4
|
#private;
|
|
4
|
-
|
|
5
|
+
pageScript: PageScript;
|
|
6
|
+
createModuleTemplate(sys: Sys, name: string, { page }?: {
|
|
7
|
+
page?: boolean;
|
|
8
|
+
}): Promise<void>;
|
|
5
9
|
createModule(sys: Sys, name: string, description?: string, schemaDescription?: string): Promise<void>;
|
|
6
10
|
createModule_(sys: Sys, name: string, description: string, schemaDescription: string): Promise<void>;
|
|
7
|
-
removeModule(
|
|
11
|
+
removeModule(mod: Module): void;
|
|
8
12
|
createService(workspace: Workspace, name: string): Promise<void>;
|
|
9
13
|
createTest(workspace: Workspace, name: string): Promise<void>;
|
|
10
|
-
createTemplate(
|
|
11
|
-
createUnit(
|
|
12
|
-
createView(
|
|
14
|
+
createTemplate(mod: Module): Promise<void>;
|
|
15
|
+
createUnit(mod: Module): Promise<void>;
|
|
16
|
+
createView(mod: Module): Promise<void>;
|
|
13
17
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { App } from "@akanjs/devkit";
|
|
1
|
+
import { App, Module } from "@akanjs/devkit";
|
|
2
2
|
import { PageScript } from "./page.script";
|
|
3
3
|
export declare class PageCommand {
|
|
4
4
|
pageScript: PageScript;
|
|
5
|
-
|
|
5
|
+
createCrudPage(app: App, module: Module, basePath: string | null, single: boolean): Promise<void>;
|
|
6
6
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import { App } from "@akanjs/devkit";
|
|
1
|
+
import { App, Module } from "@akanjs/devkit";
|
|
2
2
|
export declare class PageRunner {
|
|
3
|
-
|
|
3
|
+
createCrudPage(module: Module, { app, basePath, single }: {
|
|
4
|
+
app: App;
|
|
5
|
+
basePath: string | null;
|
|
6
|
+
single: boolean;
|
|
7
|
+
}): Promise<void>;
|
|
4
8
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { App } from "@akanjs/devkit";
|
|
1
|
+
import { App, Module } from "@akanjs/devkit";
|
|
2
2
|
export declare class PageScript {
|
|
3
3
|
#private;
|
|
4
|
-
|
|
4
|
+
createCrudPage(module: Module, { app, basePath, single }: {
|
|
5
|
+
app: App;
|
|
6
|
+
basePath: string | null;
|
|
7
|
+
single: boolean;
|
|
8
|
+
}): Promise<void>;
|
|
5
9
|
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// pkgs/@akanjs/cli/src/templates/app/app/[lang]/admin/layout.tsx
|
|
20
|
-
var layout_exports = {};
|
|
21
|
-
__export(layout_exports, {
|
|
22
|
-
default: () => getContent
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(layout_exports);
|
|
25
|
-
function getContent(scanResult, dict) {
|
|
26
|
-
return {
|
|
27
|
-
filename: "layout.tsx",
|
|
28
|
-
content: `
|
|
29
|
-
import "../(${dict.appName})/styles.css";
|
|
30
|
-
import { System } from "@akanjs/ui";
|
|
31
|
-
import { env } from "@${dict.appName}/env/env.client";
|
|
32
|
-
import { fetch } from "@${dict.appName}/client";
|
|
33
|
-
import type { RootLayoutProps } from "@akanjs/client";
|
|
34
|
-
|
|
35
|
-
export const metadata = { title: "${dict.appName}" };
|
|
36
|
-
|
|
37
|
-
export default function Layout({ children, params }: RootLayoutProps) {
|
|
38
|
-
return (
|
|
39
|
-
<System.Provider
|
|
40
|
-
of={Layout}
|
|
41
|
-
appName="${dict.appName}"
|
|
42
|
-
params={params}
|
|
43
|
-
head={<link rel="icon" href="/favicon.ico" />}
|
|
44
|
-
// className="bg-base-100"
|
|
45
|
-
env={env}
|
|
46
|
-
fetch={fetch}
|
|
47
|
-
>
|
|
48
|
-
{children}
|
|
49
|
-
</System.Provider>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
`
|
|
53
|
-
};
|
|
54
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// pkgs/@akanjs/cli/src/templates/app/app/[lang]/admin/layout.tsx
|
|
2
|
-
function getContent(scanResult, dict) {
|
|
3
|
-
return {
|
|
4
|
-
filename: "layout.tsx",
|
|
5
|
-
content: `
|
|
6
|
-
import "../(${dict.appName})/styles.css";
|
|
7
|
-
import { System } from "@akanjs/ui";
|
|
8
|
-
import { env } from "@${dict.appName}/env/env.client";
|
|
9
|
-
import { fetch } from "@${dict.appName}/client";
|
|
10
|
-
import type { RootLayoutProps } from "@akanjs/client";
|
|
11
|
-
|
|
12
|
-
export const metadata = { title: "${dict.appName}" };
|
|
13
|
-
|
|
14
|
-
export default function Layout({ children, params }: RootLayoutProps) {
|
|
15
|
-
return (
|
|
16
|
-
<System.Provider
|
|
17
|
-
of={Layout}
|
|
18
|
-
appName="${dict.appName}"
|
|
19
|
-
params={params}
|
|
20
|
-
head={<link rel="icon" href="/favicon.ico" />}
|
|
21
|
-
// className="bg-base-100"
|
|
22
|
-
env={env}
|
|
23
|
-
fetch={fetch}
|
|
24
|
-
>
|
|
25
|
-
{children}
|
|
26
|
-
</System.Provider>
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
`
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
export {
|
|
33
|
-
getContent as default
|
|
34
|
-
};
|
/package/cjs/src/templates/app/app/[lang]/{(__appName__)/styles.css.template → styles.css.template}
RENAMED
|
File without changes
|
/package/esm/src/templates/app/app/[lang]/{(__appName__)/styles.css.template → styles.css.template}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|