create-nxpress-app 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.
- package/dist/index.js +19 -17
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -6,10 +6,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
const prompts_1 = require("@clack/prompts");
|
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const child_process_1 = require("child_process");
|
|
9
10
|
const commander_1 = require("commander");
|
|
10
11
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
11
12
|
const path_1 = __importDefault(require("path"));
|
|
12
|
-
const
|
|
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")
|
|
@@ -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 -->
|
|
@@ -199,7 +198,7 @@ program
|
|
|
199
198
|
// Index page
|
|
200
199
|
const indexPageContent = engine === "handlebars"
|
|
201
200
|
? `<div class="max-w-4xl mx-auto px-4 py-16 text-center">
|
|
202
|
-
<h1 class="text-5xl font-bold mb-4 bg-
|
|
201
|
+
<h1 class="text-5xl font-bold mb-4 bg-linear-to-r from-blue-400 to-indigo-500 bg-clip-text text-transparent">
|
|
203
202
|
Welcome to {{title}}
|
|
204
203
|
</h1>
|
|
205
204
|
<p class="text-xl text-slate-400 mb-8">{{description}}</p>
|
|
@@ -209,7 +208,7 @@ program
|
|
|
209
208
|
</div>`
|
|
210
209
|
: engine === "ejs"
|
|
211
210
|
? `<div class="max-w-4xl mx-auto px-4 py-16 text-center">
|
|
212
|
-
<h1 class="text-5xl font-bold mb-4 bg-
|
|
211
|
+
<h1 class="text-5xl font-bold mb-4 bg-linear-to-r from-blue-400 to-indigo-500 bg-clip-text text-transparent">
|
|
213
212
|
Welcome to <%= title %>
|
|
214
213
|
</h1>
|
|
215
214
|
<p class="text-xl text-slate-400 mb-8"><%= description %></p>
|
|
@@ -218,14 +217,14 @@ program
|
|
|
218
217
|
</div>
|
|
219
218
|
</div>`
|
|
220
219
|
: `<div class="max-w-4xl mx-auto px-4 py-16 text-center">
|
|
221
|
-
<h1 class="text-5xl font-bold mb-4 bg-
|
|
220
|
+
<h1 class="text-5xl font-bold mb-4 bg-linear-to-r from-blue-400 to-indigo-500 bg-clip-text text-transparent">
|
|
222
221
|
Welcome to Nxpress
|
|
223
222
|
</h1>
|
|
224
223
|
<p class="text-xl text-slate-400 mb-8">Express.js with Next.js developer experience</p>
|
|
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
|
|
227
|
+
const indexTsContent = `import { Request, Response } from "express";
|
|
229
228
|
|
|
230
229
|
export async function props(req: Request, res: Response) {
|
|
231
230
|
return {
|
|
@@ -236,7 +235,7 @@ export async function props(req: Request, res: Response) {
|
|
|
236
235
|
`;
|
|
237
236
|
fs_extra_1.default.writeFileSync(path_1.default.join(appDir, "index.ts"), indexTsContent);
|
|
238
237
|
// App CSS for Tailwind v4
|
|
239
|
-
fs_extra_1.default.writeFileSync(path_1.default.join(targetPath, "app.css"), `@import "tailwindcss";\n`);
|
|
238
|
+
fs_extra_1.default.writeFileSync(path_1.default.join(targetPath, "app.css"), `@import "tailwindcss";\n@import "tailwindcss/preflight";\n@tailwind utilities;\n`);
|
|
240
239
|
// Server file
|
|
241
240
|
const serverTsContent = `import { nxpress } from '@nxpress/core';
|
|
242
241
|
|
|
@@ -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.5";
|
|
254
253
|
// nxpress.config.json
|
|
255
254
|
const nxConfig = {
|
|
256
255
|
$schema: `https://unpkg.com/@nxpress/core@${pkgVersion}/schema.json`,
|
|
@@ -275,22 +274,25 @@ app.listen(PORT, () => {
|
|
|
275
274
|
"@nxpress/core": `^${pkgVersion}`,
|
|
276
275
|
},
|
|
277
276
|
devDependencies: {
|
|
278
|
-
|
|
279
|
-
"@types/node": "^
|
|
277
|
+
"@types/express": "^5.0.6",
|
|
278
|
+
"@types/node": "^26.1.1",
|
|
279
|
+
typescript: "^7.0.2",
|
|
280
280
|
},
|
|
281
281
|
};
|
|
282
282
|
fs_extra_1.default.writeFileSync(path_1.default.join(targetPath, "package.json"), JSON.stringify(projectPkgJson, null, 2));
|
|
283
283
|
// tsconfig.json for target project
|
|
284
284
|
const projectTsConfig = {
|
|
285
285
|
compilerOptions: {
|
|
286
|
-
target: "
|
|
287
|
-
module: "
|
|
288
|
-
moduleResolution: "
|
|
286
|
+
target: "esnext",
|
|
287
|
+
module: "nodenext",
|
|
288
|
+
moduleResolution: "nodenext",
|
|
289
289
|
strict: true,
|
|
290
290
|
esModuleInterop: true,
|
|
291
291
|
skipLibCheck: true,
|
|
292
|
+
types: ["node", "express"],
|
|
292
293
|
},
|
|
293
|
-
include: ["
|
|
294
|
+
include: ["**/*.ts"],
|
|
295
|
+
exclude: ["node_modules", "dist"],
|
|
294
296
|
};
|
|
295
297
|
fs_extra_1.default.writeFileSync(path_1.default.join(targetPath, "tsconfig.json"), JSON.stringify(projectTsConfig, null, 2));
|
|
296
298
|
// .gitignore
|
|
@@ -305,7 +307,7 @@ dist
|
|
|
305
307
|
const instSpinner = (0, prompts_1.spinner)();
|
|
306
308
|
instSpinner.start("Installing dependencies with pnpm...");
|
|
307
309
|
try {
|
|
308
|
-
|
|
310
|
+
await execAsync("pnpm install", { cwd: targetPath });
|
|
309
311
|
instSpinner.stop("Dependencies installed successfully.");
|
|
310
312
|
}
|
|
311
313
|
catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-nxpress-app",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "CLI tool to create Nxpress applications",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
],
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@clack/prompts": "^
|
|
26
|
-
"chalk": "^
|
|
27
|
-
"commander": "^
|
|
28
|
-
"fs-extra": "^11.
|
|
25
|
+
"@clack/prompts": "^1.7.0",
|
|
26
|
+
"chalk": "^6.0.0",
|
|
27
|
+
"commander": "^15.0.0",
|
|
28
|
+
"fs-extra": "^11.4.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/fs-extra": "^11.0.4",
|
|
32
|
-
"@types/node": "^
|
|
33
|
-
"typescript": "^
|
|
32
|
+
"@types/node": "^26.1.1",
|
|
33
|
+
"typescript": "^7.0.2"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "tsc",
|