create-nxpage-app 0.1.1 → 0.1.12

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.
Files changed (3) hide show
  1. package/dist/index.cjs +65 -0
  2. package/package.json +49 -4
  3. package/index.js +0 -77
package/dist/index.cjs ADDED
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
+ // If the importer is in node compatibility mode or this is not an ESM
19
+ // file that has been converted to a CommonJS file using a Babel-
20
+ // compatible transform (i.e. "__esModule" has not been set), then set
21
+ // "default" to the CommonJS "module.exports" for node compatibility.
22
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
+ mod
24
+ ));
25
+
26
+ // src/index.ts
27
+ var import_cross_spawn = __toESM(require("cross-spawn"));
28
+ var import_fs = __toESM(require("fs"));
29
+ var import_path = __toESM(require("path"));
30
+ var appName = process.argv[2];
31
+ if (!appName) {
32
+ console.error("Please provide a project name.");
33
+ process.exit(1);
34
+ }
35
+ var root = import_path.default.resolve(process.cwd(), appName);
36
+ var templateDir = import_path.default.join(__dirname, "../templates");
37
+ import_cross_spawn.default.sync(
38
+ "npx",
39
+ [
40
+ "create-next-app@latest",
41
+ appName,
42
+ "--ts",
43
+ "--use-npm",
44
+ "--eslint",
45
+ "--app"
46
+ ],
47
+ { stdio: "inherit" }
48
+ );
49
+ import_cross_spawn.default.sync(
50
+ "npm",
51
+ ["install", "nxpage"],
52
+ { cwd: root, stdio: "inherit" }
53
+ );
54
+ import_fs.default.copyFileSync(
55
+ import_path.default.join(templateDir, "server.ts"),
56
+ import_path.default.join(root, "server.ts")
57
+ );
58
+ var pkgPath = import_path.default.join(root, "package.json");
59
+ var pkg = JSON.parse(import_fs.default.readFileSync(pkgPath, "utf-8"));
60
+ pkg.scripts.dev = "next dev";
61
+ pkg.scripts.build = "next build && nxpage build";
62
+ pkg.scripts.start = "NODE_ENV=production node server.js";
63
+ import_fs.default.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
64
+ import_fs.default.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
65
+ console.log("NxPage app created successfully.");
package/package.json CHANGED
@@ -1,8 +1,53 @@
1
1
  {
2
2
  "name": "create-nxpage-app",
3
- "version": "0.1.001",
4
- "type": "module",
3
+ "description": "A CLI to scaffold a production-ready Next.js app with NxPage bot-optimized server setup and Turbopack-safe build pipeline.",
4
+ "version": "0.1.12",
5
5
  "bin": {
6
- "create-nxpage-app": "./index.js"
6
+ "create-nxpage-app": "./dist/index.cjs"
7
+ },
8
+ "homepage": "https://github.com/NiteshSingh17/nxpage",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/NiteshSingh17/nxpage.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/NiteshSingh17/nxpage/issues"
15
+ },
16
+ "keywords": [
17
+ "nextjs",
18
+ "next.js",
19
+ "nextjs seo",
20
+ "nextjs performance",
21
+ "nextjs bot optimization",
22
+ "nextjs server",
23
+ "nextjs turbopack",
24
+ "turbopack compatible",
25
+ "ssr optimization",
26
+ "seo optimization",
27
+ "bot rendering",
28
+ "search engine optimization",
29
+ "googlebot",
30
+ "crawler optimization",
31
+ "nextjs build tool",
32
+ "nextjs self hosted",
33
+ "node server",
34
+ "static html cache",
35
+ "nextjs manifest",
36
+ "nextjs app router",
37
+ "chatgpt bot optimizer"
38
+ ],
39
+ "files": [
40
+ "dist"
41
+ ],
42
+ "scripts": {
43
+ "build": "tsup",
44
+ "dev": "tsup --watch"
45
+ },
46
+ "dependencies": {
47
+ "cross-spawn": "^7.0.3",
48
+ "nxpage": "workspace:*"
49
+ },
50
+ "devDependencies": {
51
+ "@types/cross-spawn": "^6.0.6"
7
52
  }
8
- }
53
+ }
package/index.js DELETED
@@ -1,77 +0,0 @@
1
- #!/usr/bin/env node
2
- import { spawnSync } from "child_process";
3
- import fs from "fs";
4
- import path from "path";
5
-
6
- const args = process.argv.slice(2);
7
- const project = args[0];
8
-
9
- if (!project || project === "--help" || project === "-h") {
10
- console.log(`
11
- Create a new NxPage app
12
-
13
- Usage:
14
- create-nxpage-app <project-name>
15
-
16
- Example:
17
- create-nxpage-app my-site
18
- `);
19
- process.exit(0);
20
- }
21
-
22
- if (fs.existsSync(project)) {
23
- console.error(`Error: folder "${project}" already exists`);
24
- process.exit(1);
25
- }
26
-
27
- console.log(`\nCreating NxPage.js project "${project}"...\n`);
28
-
29
- const createResult = spawnSync(
30
- "npx",
31
- ["create-next-app@latest", project, "--use-pnpm"],
32
- { stdio: "inherit" }
33
- );
34
-
35
- if (createResult.status !== 0) {
36
- console.error("Failed to create Next.js app");
37
- process.exit(1);
38
- }
39
-
40
- console.log("\nInstalling NxPage...\n");
41
-
42
- const installResult = spawnSync(
43
- "pnpm",
44
- ["add", "nxpage"],
45
- { cwd: project, stdio: "inherit" }
46
- );
47
-
48
- if (installResult.status !== 0) {
49
- console.error("Failed to install nxpage");
50
- process.exit(1);
51
- }
52
-
53
- const pkgPath = path.join(project, "package.json");
54
-
55
- if (!fs.existsSync(pkgPath)) {
56
- console.error("package.json not found");
57
- process.exit(1);
58
- }
59
-
60
- const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
61
-
62
- pkg.scripts = {
63
- ...pkg.scripts,
64
- dev: "nxpage dev",
65
- build: "nxpage build",
66
- start: "nxpage start"
67
- };
68
-
69
- fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
70
-
71
- console.log(`
72
- NxPage project ready!
73
-
74
- Next steps:
75
- cd ${project}
76
- pnpm dev
77
- `);