@kithinji/pod 1.0.2 → 1.0.4

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
@@ -3925,7 +3925,16 @@ function addNew(name) {
3925
3925
  dirs: [
3926
3926
  {
3927
3927
  name: "src",
3928
- files: [{ name: "main.ts", content: genMainTs() }]
3928
+ files: [{ name: "main.ts", content: genMainTs() }],
3929
+ dirs: [
3930
+ {
3931
+ name: "client",
3932
+ files: [
3933
+ { name: "index.html", content: genIndexHtml(name) },
3934
+ { name: "client.ts", content: genClientTs() }
3935
+ ]
3936
+ }
3937
+ ]
3929
3938
  }
3930
3939
  ]
3931
3940
  };
@@ -4012,6 +4021,57 @@ function genEnv() {
4012
4021
  return `NODE_ENV=development
4013
4022
  `;
4014
4023
  }
4024
+ function genIndexHtml(name) {
4025
+ return `<!DOCTYPE html>
4026
+ <html lang="en">
4027
+ <head>
4028
+ <meta charset="UTF-8" />
4029
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
4030
+ <title>${name} app</title>
4031
+ <link rel="stylesheet" href="index.css" />
4032
+ </head>
4033
+ <body>
4034
+ <div id="root"></div>
4035
+ <script type="module" src="/src/client/client.js"></script>
4036
+ </body>
4037
+ </html>
4038
+ `;
4039
+ }
4040
+ function genClientTs() {
4041
+ return `"use interactive";
4042
+
4043
+ import {
4044
+ Module,
4045
+ BrowserFactory,
4046
+ Component,
4047
+ RouterModule,
4048
+ RouterOutlet,
4049
+ HttpClientModule,
4050
+ } from "@kithinji/orca";
4051
+
4052
+ @Component({
4053
+ deps: [RouterOutlet],
4054
+ })
4055
+ class AppComponent {
4056
+ build() {
4057
+ return <RouterOutlet />;
4058
+ }
4059
+ }
4060
+
4061
+ @Module({
4062
+ imports: [RouterModule.forRoot(), HttpClientModule],
4063
+ declarations: [AppComponent],
4064
+ bootstrap: AppComponent,
4065
+ })
4066
+ class AppModule {}
4067
+
4068
+ export function bootstrap() {
4069
+ BrowserFactory.create(AppModule, document.getElementById("root")!);
4070
+ }
4071
+
4072
+ bootstrap();
4073
+ `;
4074
+ }
4015
4075
  function genMainTs() {
4016
4076
  return `import { NodeFactory } from "@kithinji/orca";
4017
4077
  import { AppModule } from "./app/app.module";
@@ -4408,14 +4468,15 @@ function printNextSteps(projectName, env, services) {
4408
4468
 
4409
4469
  // src/main.ts
4410
4470
  var program = new Command();
4411
- program.name("pod").description("Pod cli tool").version("0.0.0");
4471
+ program.name("pod").description("Pod cli tool").version("1.0.4");
4412
4472
  program.command("new <name>").description("Start a new Pod Project").action(async (name) => {
4413
4473
  await addNew(name);
4414
4474
  const appDir = path13.resolve(process.cwd(), name);
4475
+ const shell = process.platform === "win32" ? process.env.ComSpec || "cmd.exe" : "/bin/sh";
4415
4476
  console.log("Installing dependencies...");
4416
- execSync("npm install", { stdio: "inherit", cwd: appDir });
4477
+ execSync("npm install", { stdio: "inherit", cwd: appDir, shell });
4417
4478
  console.log("Starting development server...");
4418
- execSync("npm run dev", { stdio: "inherit", cwd: appDir });
4479
+ execSync("npm run dev", { stdio: "inherit", cwd: appDir, shell });
4419
4480
  console.log(`All done! Your app "${name}" is running in development mode.`);
4420
4481
  });
4421
4482
  program.command("dev").description("Start Pod development server").action(async (opts) => {