@kithinji/pod 1.0.5 → 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.
package/dist/main.js
CHANGED
|
@@ -3466,10 +3466,10 @@ function addFeature(name) {
|
|
|
3466
3466
|
updateFeaturesIndex(name);
|
|
3467
3467
|
updateAppModule(name);
|
|
3468
3468
|
}
|
|
3469
|
-
function addModule(name, baseDir) {
|
|
3469
|
+
function addModule(name, baseDir, root) {
|
|
3470
3470
|
const structure = {
|
|
3471
3471
|
files: [
|
|
3472
|
-
{ name: `${name}.module.ts`, content: createModule2(name) },
|
|
3472
|
+
{ name: `${name}.module.ts`, content: createModule2(name, root) },
|
|
3473
3473
|
{ name: `${name}.service.ts`, content: createService(name) },
|
|
3474
3474
|
{ name: `${name}.page.tsx`, content: createPage(name) }
|
|
3475
3475
|
],
|
|
@@ -3668,11 +3668,34 @@ function addToModuleImportsArray(content, sourceFile, moduleName) {
|
|
|
3668
3668
|
const newElement = `, ${moduleName}`;
|
|
3669
3669
|
return content.substring(0, insertPos) + newElement + content.substring(insertPos);
|
|
3670
3670
|
}
|
|
3671
|
-
function createModule2(name) {
|
|
3671
|
+
function createModule2(name, root) {
|
|
3672
3672
|
const serviceName = toPascalCase(name + "_Service");
|
|
3673
3673
|
const pageName = toPascalCase(name + "_Page");
|
|
3674
3674
|
const moduleName = toPascalCase(name + "_Module");
|
|
3675
3675
|
const componentName = toPascalCase(name + "_List");
|
|
3676
|
+
if (root) {
|
|
3677
|
+
return `import { Module, RouterModule, ServeStaticModule } from "@kithinji/orca";
|
|
3678
|
+
import { ComponentModule } from "@/component/component.module";
|
|
3679
|
+
import { ${serviceName} } from "./${name}.service";
|
|
3680
|
+
import { ${pageName} } from "./${name}.page";
|
|
3681
|
+
import { ${componentName} } from "./components/${name}-list.component";
|
|
3682
|
+
|
|
3683
|
+
@Module({
|
|
3684
|
+
imports: [
|
|
3685
|
+
ServeStaticModule.forRoot({
|
|
3686
|
+
rootPath: "./public",
|
|
3687
|
+
}),
|
|
3688
|
+
RouterModule.forRoot(),
|
|
3689
|
+
ComponentModule
|
|
3690
|
+
],
|
|
3691
|
+
providers: [${serviceName}],
|
|
3692
|
+
declarations: [${pageName}, ${componentName}],
|
|
3693
|
+
exports: [${serviceName}, ${pageName}],
|
|
3694
|
+
bootstrap: ${pageName}
|
|
3695
|
+
})
|
|
3696
|
+
export class ${moduleName} {}
|
|
3697
|
+
`;
|
|
3698
|
+
}
|
|
3676
3699
|
return `import { Module } from "@kithinji/orca";
|
|
3677
3700
|
import { ComponentModule } from "@/component/component.module";
|
|
3678
3701
|
import { ${serviceName} } from "./${name}.service";
|
|
@@ -3683,7 +3706,7 @@ import { ${componentName} } from "./components/${name}-list.component";
|
|
|
3683
3706
|
imports: [ComponentModule],
|
|
3684
3707
|
providers: [${serviceName}],
|
|
3685
3708
|
declarations: [${pageName}, ${componentName}],
|
|
3686
|
-
exports: [${serviceName}, ${pageName}]
|
|
3709
|
+
exports: [${serviceName}, ${pageName}],
|
|
3687
3710
|
})
|
|
3688
3711
|
export class ${moduleName} {}
|
|
3689
3712
|
`;
|
|
@@ -3940,7 +3963,7 @@ function addNew(name) {
|
|
|
3940
3963
|
};
|
|
3941
3964
|
createStructure(baseDir, structure);
|
|
3942
3965
|
const appDir = path11.join(process.cwd(), name, "src", "app");
|
|
3943
|
-
addModule("app", appDir);
|
|
3966
|
+
addModule("app", appDir, true);
|
|
3944
3967
|
process.chdir(baseDir);
|
|
3945
3968
|
addComponent("button");
|
|
3946
3969
|
console.log(`App ${name} created successfully`);
|
|
@@ -4468,7 +4491,7 @@ function printNextSteps(projectName, env, services) {
|
|
|
4468
4491
|
|
|
4469
4492
|
// src/main.ts
|
|
4470
4493
|
var program = new Command();
|
|
4471
|
-
program.name("pod").description("Pod cli tool").version("1.0.
|
|
4494
|
+
program.name("pod").description("Pod cli tool").version("1.0.6");
|
|
4472
4495
|
program.command("new <name>").description("Start a new Pod Project").action(async (name) => {
|
|
4473
4496
|
await addNew(name);
|
|
4474
4497
|
const appDir = path13.resolve(process.cwd(), name);
|