@kithinji/pod 1.0.4 → 1.0.6
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../src/add/module/module.ts"],"names":[],"mappings":"AAKA,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,QAQtC;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../src/add/module/module.ts"],"names":[],"mappings":"AAKA,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,QAQtC;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,QA8CtE"}
|
package/package.json
CHANGED
package/src/add/module/module.ts
CHANGED
|
@@ -13,10 +13,10 @@ export function addFeature(name: string) {
|
|
|
13
13
|
updateAppModule(name);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export function addModule(name: string, baseDir: string) {
|
|
16
|
+
export function addModule(name: string, baseDir: string, root?: boolean) {
|
|
17
17
|
const structure: DirEntry = {
|
|
18
18
|
files: [
|
|
19
|
-
{ name: `${name}.module.ts`, content: createModule(name) },
|
|
19
|
+
{ name: `${name}.module.ts`, content: createModule(name, root) },
|
|
20
20
|
{ name: `${name}.service.ts`, content: createService(name) },
|
|
21
21
|
{ name: `${name}.page.tsx`, content: createPage(name) },
|
|
22
22
|
],
|
|
@@ -266,12 +266,36 @@ function addToModuleImportsArray(
|
|
|
266
266
|
);
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
-
function createModule(name: string) {
|
|
269
|
+
function createModule(name: string, root?: boolean) {
|
|
270
270
|
const serviceName = toPascalCase(name + "_" + "Service");
|
|
271
271
|
const pageName = toPascalCase(name + "_" + "Page");
|
|
272
272
|
const moduleName = toPascalCase(name + "_" + "Module");
|
|
273
273
|
const componentName = toPascalCase(name + "_" + "List");
|
|
274
274
|
|
|
275
|
+
if (root) {
|
|
276
|
+
return `import { Module, RouterModule, ServeStaticModule } from "@kithinji/orca";
|
|
277
|
+
import { ComponentModule } from "@/component/component.module";
|
|
278
|
+
import { ${serviceName} } from "./${name}.service";
|
|
279
|
+
import { ${pageName} } from "./${name}.page";
|
|
280
|
+
import { ${componentName} } from "./components/${name}-list.component";
|
|
281
|
+
|
|
282
|
+
@Module({
|
|
283
|
+
imports: [
|
|
284
|
+
ServeStaticModule.forRoot({
|
|
285
|
+
rootPath: "./public",
|
|
286
|
+
}),
|
|
287
|
+
RouterModule.forRoot(),
|
|
288
|
+
ComponentModule
|
|
289
|
+
],
|
|
290
|
+
providers: [${serviceName}],
|
|
291
|
+
declarations: [${pageName}, ${componentName}],
|
|
292
|
+
exports: [${serviceName}, ${pageName}],
|
|
293
|
+
bootstrap: ${pageName}
|
|
294
|
+
})
|
|
295
|
+
export class ${moduleName} {}
|
|
296
|
+
`;
|
|
297
|
+
}
|
|
298
|
+
|
|
275
299
|
return `import { Module } from "@kithinji/orca";
|
|
276
300
|
import { ComponentModule } from "@/component/component.module";
|
|
277
301
|
import { ${serviceName} } from "./${name}.service";
|
|
@@ -282,7 +306,7 @@ import { ${componentName} } from "./components/${name}-list.component";
|
|
|
282
306
|
imports: [ComponentModule],
|
|
283
307
|
providers: [${serviceName}],
|
|
284
308
|
declarations: [${pageName}, ${componentName}],
|
|
285
|
-
exports: [${serviceName}, ${pageName}]
|
|
309
|
+
exports: [${serviceName}, ${pageName}],
|
|
286
310
|
})
|
|
287
311
|
export class ${moduleName} {}
|
|
288
312
|
`;
|
package/src/add/new/index.ts
CHANGED
|
@@ -24,7 +24,7 @@ export function addNew(name: string) {
|
|
|
24
24
|
name: "client",
|
|
25
25
|
files: [
|
|
26
26
|
{ name: "index.html", content: genIndexHtml(name) },
|
|
27
|
-
{ name: "client.
|
|
27
|
+
{ name: "client.tsx", content: genClientTsx() },
|
|
28
28
|
],
|
|
29
29
|
},
|
|
30
30
|
],
|
|
@@ -36,7 +36,7 @@ export function addNew(name: string) {
|
|
|
36
36
|
|
|
37
37
|
const appDir = path.join(process.cwd(), name, "src", "app");
|
|
38
38
|
|
|
39
|
-
addModule("app", appDir);
|
|
39
|
+
addModule("app", appDir, true);
|
|
40
40
|
|
|
41
41
|
process.chdir(baseDir);
|
|
42
42
|
|
|
@@ -146,7 +146,7 @@ function genIndexHtml(name: string) {
|
|
|
146
146
|
`;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
function
|
|
149
|
+
function genClientTsx() {
|
|
150
150
|
return `"use interactive";
|
|
151
151
|
|
|
152
152
|
import {
|
package/src/main.ts
CHANGED