create-nxpress-app 1.0.3 → 1.0.5
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/index.js +8 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10,6 +10,8 @@ const commander_1 = require("commander");
|
|
|
10
10
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
11
11
|
const path_1 = __importDefault(require("path"));
|
|
12
12
|
const child_process_1 = require("child_process");
|
|
13
|
+
const util_1 = require("util");
|
|
14
|
+
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
13
15
|
const program = new commander_1.Command();
|
|
14
16
|
program
|
|
15
17
|
.name("create-nxpress-app")
|
|
@@ -85,9 +87,9 @@ program
|
|
|
85
87
|
}
|
|
86
88
|
port = parseInt(portRes, 10);
|
|
87
89
|
}
|
|
88
|
-
let appDirName = options.appDir;
|
|
89
|
-
let componentsDirName = options.componentsDir;
|
|
90
|
-
let publicDirName = options.publicDir;
|
|
90
|
+
let appDirName = options.appDir || "app";
|
|
91
|
+
let componentsDirName = options.componentsDir || "components";
|
|
92
|
+
let publicDirName = options.publicDir || "public";
|
|
91
93
|
if (process.stdin.isTTY &&
|
|
92
94
|
!options.appDir &&
|
|
93
95
|
!options.componentsDir &&
|
|
@@ -164,7 +166,6 @@ program
|
|
|
164
166
|
<meta charset="UTF-8">
|
|
165
167
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
166
168
|
<title>{{title}}</title>
|
|
167
|
-
<link rel="stylesheet" href="/app.css">
|
|
168
169
|
</head>
|
|
169
170
|
<body class="bg-slate-900 text-white min-h-screen">
|
|
170
171
|
{{{body}}}
|
|
@@ -177,7 +178,6 @@ program
|
|
|
177
178
|
<meta charset="UTF-8">
|
|
178
179
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
179
180
|
<title><%= title %></title>
|
|
180
|
-
<link rel="stylesheet" href="/app.css">
|
|
181
181
|
</head>
|
|
182
182
|
<body class="bg-slate-900 text-white min-h-screen">
|
|
183
183
|
<%- body %>
|
|
@@ -189,7 +189,6 @@ program
|
|
|
189
189
|
<meta charset="UTF-8">
|
|
190
190
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
191
191
|
<title>Nxpress App</title>
|
|
192
|
-
<link rel="stylesheet" href="/app.css">
|
|
193
192
|
</head>
|
|
194
193
|
<body class="bg-slate-900 text-white min-h-screen">
|
|
195
194
|
<!-- Content -->
|
|
@@ -225,7 +224,7 @@ program
|
|
|
225
224
|
</div>`;
|
|
226
225
|
fs_extra_1.default.writeFileSync(path_1.default.join(appDir, `index.${ext}`), indexPageContent);
|
|
227
226
|
// Data loader for index page
|
|
228
|
-
const indexTsContent = `import { Request, Response } from '
|
|
227
|
+
const indexTsContent = `import type { Request, Response } from '@nxpress/core';
|
|
229
228
|
|
|
230
229
|
export async function props(req: Request, res: Response) {
|
|
231
230
|
return {
|
|
@@ -250,7 +249,7 @@ app.listen(PORT, () => {
|
|
|
250
249
|
});
|
|
251
250
|
`;
|
|
252
251
|
fs_extra_1.default.writeFileSync(path_1.default.join(targetPath, "server.ts"), serverTsContent);
|
|
253
|
-
const pkgVersion = "1.0.
|
|
252
|
+
const pkgVersion = "1.0.4";
|
|
254
253
|
// nxpress.config.json
|
|
255
254
|
const nxConfig = {
|
|
256
255
|
$schema: `https://unpkg.com/@nxpress/core@${pkgVersion}/schema.json`,
|
|
@@ -273,13 +272,10 @@ app.listen(PORT, () => {
|
|
|
273
272
|
},
|
|
274
273
|
dependencies: {
|
|
275
274
|
"@nxpress/core": `^${pkgVersion}`,
|
|
276
|
-
...(engine === "handlebars" ? { hbs: "^4.2.0" } : {}),
|
|
277
|
-
...(engine === "ejs" ? { ejs: "^3.1.10" } : {}),
|
|
278
275
|
},
|
|
279
276
|
devDependencies: {
|
|
280
277
|
typescript: "^5.3.3",
|
|
281
278
|
"@types/node": "^20.11.24",
|
|
282
|
-
"@types/express": "^4.17.21",
|
|
283
279
|
},
|
|
284
280
|
};
|
|
285
281
|
fs_extra_1.default.writeFileSync(path_1.default.join(targetPath, "package.json"), JSON.stringify(projectPkgJson, null, 2));
|
|
@@ -308,7 +304,7 @@ dist
|
|
|
308
304
|
const instSpinner = (0, prompts_1.spinner)();
|
|
309
305
|
instSpinner.start("Installing dependencies with pnpm...");
|
|
310
306
|
try {
|
|
311
|
-
|
|
307
|
+
await execAsync("pnpm install", { cwd: targetPath });
|
|
312
308
|
instSpinner.stop("Dependencies installed successfully.");
|
|
313
309
|
}
|
|
314
310
|
catch (err) {
|