@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 +65 -4
- package/dist/main.js.map +2 -2
- package/dist/types/add/new/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/add/new/index.ts +62 -0
- package/src/main.ts +8 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/add/new/index.ts"],"names":[],"mappings":"AAKA,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/add/new/index.ts"],"names":[],"mappings":"AAKA,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,QAwClC"}
|
package/package.json
CHANGED
package/src/add/new/index.ts
CHANGED
|
@@ -19,6 +19,15 @@ export function addNew(name: string) {
|
|
|
19
19
|
{
|
|
20
20
|
name: "src",
|
|
21
21
|
files: [{ name: "main.ts", content: genMainTs() }],
|
|
22
|
+
dirs: [
|
|
23
|
+
{
|
|
24
|
+
name: "client",
|
|
25
|
+
files: [
|
|
26
|
+
{ name: "index.html", content: genIndexHtml(name) },
|
|
27
|
+
{ name: "client.ts", content: genClientTs() },
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
],
|
|
22
31
|
},
|
|
23
32
|
],
|
|
24
33
|
};
|
|
@@ -120,6 +129,59 @@ function genEnv() {
|
|
|
120
129
|
`;
|
|
121
130
|
}
|
|
122
131
|
|
|
132
|
+
function genIndexHtml(name: string) {
|
|
133
|
+
return `<!DOCTYPE html>
|
|
134
|
+
<html lang="en">
|
|
135
|
+
<head>
|
|
136
|
+
<meta charset="UTF-8" />
|
|
137
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
138
|
+
<title>${name} app</title>
|
|
139
|
+
<link rel="stylesheet" href="index.css" />
|
|
140
|
+
</head>
|
|
141
|
+
<body>
|
|
142
|
+
<div id="root"></div>
|
|
143
|
+
<script type="module" src="/src/client/client.js"></script>
|
|
144
|
+
</body>
|
|
145
|
+
</html>
|
|
146
|
+
`;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function genClientTs() {
|
|
150
|
+
return `"use interactive";
|
|
151
|
+
|
|
152
|
+
import {
|
|
153
|
+
Module,
|
|
154
|
+
BrowserFactory,
|
|
155
|
+
Component,
|
|
156
|
+
RouterModule,
|
|
157
|
+
RouterOutlet,
|
|
158
|
+
HttpClientModule,
|
|
159
|
+
} from "@kithinji/orca";
|
|
160
|
+
|
|
161
|
+
@Component({
|
|
162
|
+
deps: [RouterOutlet],
|
|
163
|
+
})
|
|
164
|
+
class AppComponent {
|
|
165
|
+
build() {
|
|
166
|
+
return <RouterOutlet />;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@Module({
|
|
171
|
+
imports: [RouterModule.forRoot(), HttpClientModule],
|
|
172
|
+
declarations: [AppComponent],
|
|
173
|
+
bootstrap: AppComponent,
|
|
174
|
+
})
|
|
175
|
+
class AppModule {}
|
|
176
|
+
|
|
177
|
+
export function bootstrap() {
|
|
178
|
+
BrowserFactory.create(AppModule, document.getElementById("root")!);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
bootstrap();
|
|
182
|
+
`;
|
|
183
|
+
}
|
|
184
|
+
|
|
123
185
|
function genMainTs() {
|
|
124
186
|
return `import { NodeFactory } from "@kithinji/orca";
|
|
125
187
|
import { AppModule } from "./app/app.module";
|
package/src/main.ts
CHANGED
|
@@ -28,7 +28,7 @@ import { dockerize } from "./docker";
|
|
|
28
28
|
|
|
29
29
|
const program = new Command();
|
|
30
30
|
|
|
31
|
-
program.name("pod").description("Pod cli tool").version("
|
|
31
|
+
program.name("pod").description("Pod cli tool").version("1.0.4");
|
|
32
32
|
|
|
33
33
|
program
|
|
34
34
|
.command("new <name>")
|
|
@@ -38,11 +38,16 @@ program
|
|
|
38
38
|
|
|
39
39
|
const appDir = path.resolve(process.cwd(), name);
|
|
40
40
|
|
|
41
|
+
const shell =
|
|
42
|
+
process.platform === "win32"
|
|
43
|
+
? process.env.ComSpec || "cmd.exe"
|
|
44
|
+
: "/bin/sh";
|
|
45
|
+
|
|
41
46
|
console.log("Installing dependencies...");
|
|
42
|
-
execSync("npm install", { stdio: "inherit", cwd: appDir });
|
|
47
|
+
execSync("npm install", { stdio: "inherit", cwd: appDir, shell });
|
|
43
48
|
|
|
44
49
|
console.log("Starting development server...");
|
|
45
|
-
execSync("npm run dev", { stdio: "inherit", cwd: appDir });
|
|
50
|
+
execSync("npm run dev", { stdio: "inherit", cwd: appDir, shell });
|
|
46
51
|
|
|
47
52
|
console.log(`All done! Your app "${name}" is running in development mode.`);
|
|
48
53
|
});
|