@projitect/blueprint-next 0.0.0-stage → 1.0.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kapil Easwar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@projitect/blueprint-next",
3
+ "version": "1.0.1",
4
+ "description": "Next.js App Router + TypeScript app blueprint for projitect — composes tsconfig, gitignore and vitest, owns next.config.ts and the package.json scaffolding, seeds the starter source.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/projitect/projitect.git",
8
+ "directory": "packages/blueprint-next"
9
+ },
10
+ "license": "MIT",
11
+ "type": "module",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/src/index.d.ts",
15
+ "import": "./dist/src/index.js"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "src",
21
+ "!**/*.tsbuildinfo"
22
+ ],
23
+ "scripts": {
24
+ "build": "tsc --build",
25
+ "build:clean": "tsc --build --clean",
26
+ "tc": "tsc --build"
27
+ },
28
+ "devDependencies": {
29
+ "@projitect/blueprint": "workspace:*",
30
+ "@projitect/blueprint-gitignore": "workspace:*",
31
+ "@projitect/blueprint-tsconfig": "workspace:*",
32
+ "@projitect/blueprint-vitest": "workspace:*",
33
+ "@projitect/core": "workspace:*",
34
+ "@projitect/test-kit": "workspace:*",
35
+ "effect": "4.0.0-rc.111",
36
+ "typescript": "5.9.3"
37
+ },
38
+ "peerDependencies": {
39
+ "@projitect/blueprint": "workspace:*",
40
+ "@projitect/blueprint-gitignore": "workspace:*",
41
+ "@projitect/blueprint-tsconfig": "workspace:*",
42
+ "@projitect/blueprint-vitest": "workspace:*",
43
+ "@projitect/core": "workspace:*",
44
+ "effect": "4.0.0-rc.111"
45
+ },
46
+ "engines": {
47
+ "node": ">=22.12.0"
48
+ },
49
+ "projitect": {
50
+ "type": "blueprint",
51
+ "import": "import { next } from \"@projitect/blueprint-next\"",
52
+ "call": "next()",
53
+ "supports": {
54
+ "next": "^16.4.0",
55
+ "react": "^19.2.0"
56
+ }
57
+ }
58
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @projitect/blueprint-next
3
+ *
4
+ * One composite blueprint that scaffolds a Next.js (App Router) + TypeScript app:
5
+ *
6
+ * 1. Composes the existing `tsconfig` (type-check only, DOM lib, `react-jsx`, the keys Next.js
7
+ * wants in `tsconfig.json`), `gitignore` (`node`, `next` and `tsbuildinfo` sections) and
8
+ * `vitest` (jsdom) blueprints, so each stays the single owner of its files.
9
+ * 2. Owns `next.config.ts`. Owned mode — projitect rewrites it on every `remodel`.
10
+ * 3. Merges the `dev` / `build` / `start` / `lint` scripts, the Next.js and React dependencies
11
+ * and the TypeScript / ESLint / testing devDependencies into `package.json`. Merge mode —
12
+ * user keys survive.
13
+ * 4. Seeds the starter source (`src/app/layout.tsx`, `src/app/page.tsx`, `src/app/globals.css`,
14
+ * `src/app/page.test.tsx`) and `eslint.config.mjs`, which extends `eslint-config-next`. Seed
15
+ * mode — written once, never enforced, so the app is yours to edit.
16
+ */
17
+ import type { Blueprint } from "@projitect/core";
18
+ /**
19
+ * Build the composite Next.js blueprint. Every operation is attributed to its own sub-blueprint
20
+ * (`pjt:tsconfig`, `pjt:vitest`, `pjt:next`, …); removing `next()` from `.pjt.ts` removes the
21
+ * maintained scaffolding and managed keys but leaves the seeded source and the user's own
22
+ * `package.json` keys in place.
23
+ */
24
+ export declare const next: () => Blueprint.Blueprint;
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAOH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AA8BhD;;;;;GAKG;AACH,eAAO,MAAM,IAAI,QAAO,SAAS,CAAC,SAiGjC,CAAA"}
@@ -0,0 +1,143 @@
1
+ /**
2
+ * @projitect/blueprint-next
3
+ *
4
+ * One composite blueprint that scaffolds a Next.js (App Router) + TypeScript app:
5
+ *
6
+ * 1. Composes the existing `tsconfig` (type-check only, DOM lib, `react-jsx`, the keys Next.js
7
+ * wants in `tsconfig.json`), `gitignore` (`node`, `next` and `tsbuildinfo` sections) and
8
+ * `vitest` (jsdom) blueprints, so each stays the single owner of its files.
9
+ * 2. Owns `next.config.ts`. Owned mode — projitect rewrites it on every `remodel`.
10
+ * 3. Merges the `dev` / `build` / `start` / `lint` scripts, the Next.js and React dependencies
11
+ * and the TypeScript / ESLint / testing devDependencies into `package.json`. Merge mode —
12
+ * user keys survive.
13
+ * 4. Seeds the starter source (`src/app/layout.tsx`, `src/app/page.tsx`, `src/app/globals.css`,
14
+ * `src/app/page.test.tsx`) and `eslint.config.mjs`, which extends `eslint-config-next`. Seed
15
+ * mode — written once, never enforced, so the app is yours to edit.
16
+ */
17
+ import { Effect } from "effect";
18
+ import { jsonMerge, ownFile, seedFile } from "@projitect/blueprint";
19
+ import { gitignores } from "@projitect/blueprint-gitignore";
20
+ import { tsconfig } from "@projitect/blueprint-tsconfig";
21
+ import { vitest } from "@projitect/blueprint-vitest";
22
+ import { ChangeSet as CS } from "@projitect/core";
23
+ import manifest from "../package.json" with { type: "json" };
24
+ import * as templates from "./templates.js";
25
+ // Read the version from the package manifest (emitted next to `dist/src`) so a release bump
26
+ // reaches `.pjt.lock` and `pjt inspect` can report a real upgrade.
27
+ const PACKAGE_VERSION = manifest.version;
28
+ // The supported Next.js and React ranges. Keep `projitect.supports` in `package.json` in step.
29
+ const NEXT_DEP_RANGE = "^16.4.0";
30
+ const REACT_DEP_RANGE = "^19.2.0";
31
+ const ESLINT_DEP_RANGE = "^9.39.0";
32
+ const ESLINT_CONFIG_NEXT_DEP_RANGE = "^16.4.0";
33
+ const TYPESCRIPT_DEP_RANGE = "^5.9.0";
34
+ const TYPES_NODE_DEP_RANGE = "^22.19.0";
35
+ const TYPES_REACT_DEP_RANGE = "^19.2.0";
36
+ const JSDOM_DEP_RANGE = "^27.4.0";
37
+ const TESTING_LIBRARY_REACT_DEP_RANGE = "^16.3.0";
38
+ const TESTING_LIBRARY_DOM_DEP_RANGE = "^10.4.0";
39
+ /** Starter files, written once and never enforced. */
40
+ const STARTER_FILES = {
41
+ "src/app/layout.tsx": templates.layoutTsx,
42
+ "src/app/page.tsx": templates.pageTsx,
43
+ "src/app/globals.css": templates.globalsCss,
44
+ "src/app/page.test.tsx": templates.pageTestTsx,
45
+ "eslint.config.mjs": templates.eslintConfig,
46
+ };
47
+ /**
48
+ * Build the composite Next.js blueprint. Every operation is attributed to its own sub-blueprint
49
+ * (`pjt:tsconfig`, `pjt:vitest`, `pjt:next`, …); removing `next()` from `.pjt.ts` removes the
50
+ * maintained scaffolding and managed keys but leaves the seeded source and the user's own
51
+ * `package.json` keys in place.
52
+ */
53
+ export const next = () => {
54
+ const id = "pjt:next";
55
+ const packageJsonMerge = jsonMerge({
56
+ id,
57
+ version: PACKAGE_VERSION,
58
+ description: "Next.js scripts, dependencies and TypeScript / ESLint devDependencies",
59
+ path: "package.json",
60
+ ownedKeys: [
61
+ "scripts.dev",
62
+ "scripts.build",
63
+ "scripts.start",
64
+ "scripts.lint",
65
+ "dependencies.next",
66
+ "dependencies.react",
67
+ "dependencies.react-dom",
68
+ "devDependencies.@testing-library/dom",
69
+ "devDependencies.@testing-library/react",
70
+ "devDependencies.@types/node",
71
+ "devDependencies.@types/react",
72
+ "devDependencies.@types/react-dom",
73
+ "devDependencies.eslint",
74
+ "devDependencies.eslint-config-next",
75
+ "devDependencies.jsdom",
76
+ "devDependencies.typescript",
77
+ ],
78
+ value: {
79
+ scripts: {
80
+ dev: "next dev",
81
+ build: "next build",
82
+ start: "next start",
83
+ lint: "eslint .",
84
+ },
85
+ dependencies: {
86
+ next: NEXT_DEP_RANGE,
87
+ react: REACT_DEP_RANGE,
88
+ "react-dom": REACT_DEP_RANGE,
89
+ },
90
+ devDependencies: {
91
+ "@testing-library/dom": TESTING_LIBRARY_DOM_DEP_RANGE,
92
+ "@testing-library/react": TESTING_LIBRARY_REACT_DEP_RANGE,
93
+ "@types/node": TYPES_NODE_DEP_RANGE,
94
+ "@types/react": TYPES_REACT_DEP_RANGE,
95
+ "@types/react-dom": TYPES_REACT_DEP_RANGE,
96
+ eslint: ESLINT_DEP_RANGE,
97
+ "eslint-config-next": ESLINT_CONFIG_NEXT_DEP_RANGE,
98
+ jsdom: JSDOM_DEP_RANGE,
99
+ typescript: TYPESCRIPT_DEP_RANGE,
100
+ },
101
+ },
102
+ });
103
+ const nextConfig = ownFile({
104
+ id,
105
+ version: PACKAGE_VERSION,
106
+ description: "Next.js configuration",
107
+ path: "next.config.ts",
108
+ content: templates.nextConfig,
109
+ });
110
+ const starter = Object.entries(STARTER_FILES).map(([path, content]) => seedFile({ id, version: PACKAGE_VERSION, description: `starter ${path}`, path, content }));
111
+ const parts = [
112
+ // `next build` adds these keys to `tsconfig.json` when they are missing, and it requires the
113
+ // automatic JSX runtime. Declaring them keeps the build from rewriting the owned file.
114
+ tsconfig({
115
+ module: "ESNext",
116
+ dom: true,
117
+ jsx: "react-jsx",
118
+ noEmit: true,
119
+ allowJs: true,
120
+ incremental: true,
121
+ plugins: ["next"],
122
+ include: ["next-env.d.ts", ".next/types/**/*.ts", ".next/dev/types/**/*.ts"],
123
+ }),
124
+ gitignores.node(),
125
+ gitignores.next(),
126
+ gitignores.tsbuildinfo(),
127
+ vitest({ environment: "jsdom" }),
128
+ packageJsonMerge,
129
+ nextConfig,
130
+ ...starter,
131
+ ];
132
+ return {
133
+ id,
134
+ version: PACKAGE_VERSION,
135
+ description: "Next.js App Router + TypeScript app (config, scripts, dependencies and starter source)",
136
+ permissions: parts.flatMap((part) => part.permissions),
137
+ plan: Effect.gen(function* () {
138
+ const changeSets = yield* Effect.forEach(parts, (part) => part.plan);
139
+ return CS.Reducer.combineAll(changeSets);
140
+ }),
141
+ };
142
+ };
143
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAA;AAEpD,OAAO,EAAE,SAAS,IAAI,EAAE,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,QAAQ,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AAC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AAC;YACjB,OAAO,EAAE,CAAC,eAAe,EAAE,qBAAqB,EAAE,yBAAyB,CAAC;SAC7E,CAAC;QACF,UAAU,CAAC,IAAI,EAAE;QACjB,UAAU,CAAC,IAAI,EAAE;QACjB,UAAU,CAAC,WAAW,EAAE;QACxB,MAAM,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;QAChC,gBAAgB;QAChB,UAAU;QACV,GAAG,OAAO;KACX,CAAA;IAED,OAAO;QACL,EAAE;QACF,OAAO,EAAE,eAAe;QACxB,WAAW,EACT,wFAAwF;QAC1F,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC;QACtD,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;YACxB,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACpE,OAAO,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;QAC1C,CAAC,CAAC;KACH,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Starter source and config for the Next.js app. The seeded files are written once and never
3
+ * enforced; `nextConfig` is owned and rewritten on every `remodel`.
4
+ */
5
+ export declare const layoutTsx = "import type { Metadata } from \"next\"\nimport type { ReactNode } from \"react\"\nimport \"./globals.css\"\n\nexport const metadata: Metadata = {\n title: \"Next app\",\n description: \"Scaffolded by projitect\",\n}\n\nexport default function RootLayout({ children }: { readonly children: ReactNode }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n}\n";
6
+ export declare const pageTsx = "export default function Page() {\n return (\n <main>\n <h1>Hello from projitect</h1>\n <p>\n Edit <code>src/app/page.tsx</code> to get started.\n </p>\n </main>\n )\n}\n";
7
+ export declare const pageTestTsx = "import { cleanup, render, screen } from \"@testing-library/react\"\nimport { afterEach, describe, expect, it } from \"vitest\"\nimport Page from \"./page\"\n\nafterEach(cleanup)\n\ndescribe(\"Page\", () => {\n it(\"renders the starter heading\", () => {\n render(<Page />)\n expect(screen.getByRole(\"heading\", { name: \"Hello from projitect\" })).toBeTruthy()\n })\n})\n";
8
+ export declare const globalsCss = ":root {\n font-family: system-ui, sans-serif;\n color-scheme: light dark;\n}\n\nbody {\n margin: 0;\n display: grid;\n min-height: 100vh;\n place-items: center;\n}\n";
9
+ export declare const eslintConfig = "import { defineConfig, globalIgnores } from \"eslint/config\"\nimport nextVitals from \"eslint-config-next/core-web-vitals\"\nimport nextTs from \"eslint-config-next/typescript\"\n\nexport default defineConfig([\n ...nextVitals,\n ...nextTs,\n globalIgnores([\".next/**\", \"out/**\", \"next-env.d.ts\"]),\n])\n";
10
+ export declare const nextConfig = "import type { NextConfig } from \"next\"\n\n/**\n * Next.js configuration scaffolded by `@projitect/blueprint-next`.\n *\n * Owned mode \u2014 projitect rewrites this file on every `pjt remodel`.\n */\nconst nextConfig: NextConfig = {\n reactStrictMode: true,\n}\n\nexport default nextConfig\n";
11
+ //# sourceMappingURL=templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/templates.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,SAAS,gZAgBrB,CAAA;AAED,eAAO,MAAM,OAAO,4MAUnB,CAAA;AAED,eAAO,MAAM,WAAW,iYAYvB,CAAA;AAED,eAAO,MAAM,UAAU,gLAWtB,CAAA;AAED,eAAO,MAAM,YAAY,+TASxB,CAAA;AAED,eAAO,MAAM,UAAU,2SAYtB,CAAA"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Starter source and config for the Next.js app. The seeded files are written once and never
3
+ * enforced; `nextConfig` is owned and rewritten on every `remodel`.
4
+ */
5
+ export const layoutTsx = `import type { Metadata } from "next"
6
+ import type { ReactNode } from "react"
7
+ import "./globals.css"
8
+
9
+ export const metadata: Metadata = {
10
+ title: "Next app",
11
+ description: "Scaffolded by projitect",
12
+ }
13
+
14
+ export default function RootLayout({ children }: { readonly children: ReactNode }) {
15
+ return (
16
+ <html lang="en">
17
+ <body>{children}</body>
18
+ </html>
19
+ )
20
+ }
21
+ `;
22
+ export const pageTsx = `export default function Page() {
23
+ return (
24
+ <main>
25
+ <h1>Hello from projitect</h1>
26
+ <p>
27
+ Edit <code>src/app/page.tsx</code> to get started.
28
+ </p>
29
+ </main>
30
+ )
31
+ }
32
+ `;
33
+ export const pageTestTsx = `import { cleanup, render, screen } from "@testing-library/react"
34
+ import { afterEach, describe, expect, it } from "vitest"
35
+ import Page from "./page"
36
+
37
+ afterEach(cleanup)
38
+
39
+ describe("Page", () => {
40
+ it("renders the starter heading", () => {
41
+ render(<Page />)
42
+ expect(screen.getByRole("heading", { name: "Hello from projitect" })).toBeTruthy()
43
+ })
44
+ })
45
+ `;
46
+ export const globalsCss = `:root {
47
+ font-family: system-ui, sans-serif;
48
+ color-scheme: light dark;
49
+ }
50
+
51
+ body {
52
+ margin: 0;
53
+ display: grid;
54
+ min-height: 100vh;
55
+ place-items: center;
56
+ }
57
+ `;
58
+ export const eslintConfig = `import { defineConfig, globalIgnores } from "eslint/config"
59
+ import nextVitals from "eslint-config-next/core-web-vitals"
60
+ import nextTs from "eslint-config-next/typescript"
61
+
62
+ export default defineConfig([
63
+ ...nextVitals,
64
+ ...nextTs,
65
+ globalIgnores([".next/**", "out/**", "next-env.d.ts"]),
66
+ ])
67
+ `;
68
+ export const nextConfig = `import type { NextConfig } from "next"
69
+
70
+ /**
71
+ * Next.js configuration scaffolded by \`@projitect/blueprint-next\`.
72
+ *
73
+ * Owned mode — projitect rewrites this file on every \`pjt remodel\`.
74
+ */
75
+ const nextConfig: NextConfig = {
76
+ reactStrictMode: true,
77
+ }
78
+
79
+ export default nextConfig
80
+ `;
81
+ //# sourceMappingURL=templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/templates.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;CAgBxB,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG;;;;;;;;;;CAUtB,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;CAY1B,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAG;;;;;;;;;;;CAWzB,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;CAS3B,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAG;;;;;;;;;;;;CAYzB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,58 @@
1
1
  {
2
2
  "name": "@projitect/blueprint-next",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.1",
4
+ "description": "Next.js App Router + TypeScript app blueprint for projitect — composes tsconfig, gitignore and vitest, owns next.config.ts and the package.json scaffolding, seeds the starter source.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/projitect/projitect.git",
8
+ "directory": "packages/blueprint-next"
9
+ },
10
+ "license": "MIT",
11
+ "type": "module",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/src/index.d.ts",
15
+ "import": "./dist/src/index.js"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "src",
21
+ "!**/*.tsbuildinfo"
22
+ ],
23
+ "devDependencies": {
24
+ "effect": "4.0.0-rc.111",
25
+ "typescript": "5.9.3",
26
+ "@projitect/blueprint": "1.0.1",
27
+ "@projitect/blueprint-gitignore": "1.0.1",
28
+ "@projitect/blueprint-tsconfig": "1.0.1",
29
+ "@projitect/blueprint-vitest": "1.0.1",
30
+ "@projitect/core": "1.0.1",
31
+ "@projitect/test-kit": "1.0.1"
32
+ },
33
+ "peerDependencies": {
34
+ "effect": "4.0.0-rc.111",
35
+ "@projitect/blueprint": "1.0.1",
36
+ "@projitect/blueprint-gitignore": "1.0.1",
37
+ "@projitect/blueprint-tsconfig": "1.0.1",
38
+ "@projitect/blueprint-vitest": "1.0.1",
39
+ "@projitect/core": "1.0.1"
40
+ },
41
+ "engines": {
42
+ "node": ">=22.12.0"
43
+ },
44
+ "projitect": {
45
+ "type": "blueprint",
46
+ "import": "import { next } from \"@projitect/blueprint-next\"",
47
+ "call": "next()",
48
+ "supports": {
49
+ "next": "^16.4.0",
50
+ "react": "^19.2.0"
51
+ }
52
+ },
53
+ "scripts": {
54
+ "build": "tsc --build",
55
+ "build:clean": "tsc --build --clean",
56
+ "tc": "tsc --build"
57
+ }
6
58
  }
package/src/index.ts ADDED
@@ -0,0 +1,156 @@
1
+ /**
2
+ * @projitect/blueprint-next
3
+ *
4
+ * One composite blueprint that scaffolds a Next.js (App Router) + TypeScript app:
5
+ *
6
+ * 1. Composes the existing `tsconfig` (type-check only, DOM lib, `react-jsx`, the keys Next.js
7
+ * wants in `tsconfig.json`), `gitignore` (`node`, `next` and `tsbuildinfo` sections) and
8
+ * `vitest` (jsdom) blueprints, so each stays the single owner of its files.
9
+ * 2. Owns `next.config.ts`. Owned mode — projitect rewrites it on every `remodel`.
10
+ * 3. Merges the `dev` / `build` / `start` / `lint` scripts, the Next.js and React dependencies
11
+ * and the TypeScript / ESLint / testing devDependencies into `package.json`. Merge mode —
12
+ * user keys survive.
13
+ * 4. Seeds the starter source (`src/app/layout.tsx`, `src/app/page.tsx`, `src/app/globals.css`,
14
+ * `src/app/page.test.tsx`) and `eslint.config.mjs`, which extends `eslint-config-next`. Seed
15
+ * mode — written once, never enforced, so the app is yours to edit.
16
+ */
17
+
18
+ import { Effect } from "effect"
19
+ import { jsonMerge, ownFile, seedFile } from "@projitect/blueprint"
20
+ import { gitignores } from "@projitect/blueprint-gitignore"
21
+ import { tsconfig } from "@projitect/blueprint-tsconfig"
22
+ import { vitest } from "@projitect/blueprint-vitest"
23
+ import type { Blueprint } from "@projitect/core"
24
+ import { ChangeSet as CS } from "@projitect/core"
25
+ import manifest from "../package.json" with { type: "json" }
26
+ import * as templates from "./templates.js"
27
+
28
+ // Read the version from the package manifest (emitted next to `dist/src`) so a release bump
29
+ // reaches `.pjt.lock` and `pjt inspect` can report a real upgrade.
30
+ const PACKAGE_VERSION = manifest.version
31
+
32
+ // The supported Next.js and React ranges. Keep `projitect.supports` in `package.json` in step.
33
+ const NEXT_DEP_RANGE = "^16.4.0"
34
+ const REACT_DEP_RANGE = "^19.2.0"
35
+ const ESLINT_DEP_RANGE = "^9.39.0"
36
+ const ESLINT_CONFIG_NEXT_DEP_RANGE = "^16.4.0"
37
+ const TYPESCRIPT_DEP_RANGE = "^5.9.0"
38
+ const TYPES_NODE_DEP_RANGE = "^22.19.0"
39
+ const TYPES_REACT_DEP_RANGE = "^19.2.0"
40
+ const JSDOM_DEP_RANGE = "^27.4.0"
41
+ const TESTING_LIBRARY_REACT_DEP_RANGE = "^16.3.0"
42
+ const TESTING_LIBRARY_DOM_DEP_RANGE = "^10.4.0"
43
+
44
+ /** Starter files, written once and never enforced. */
45
+ const STARTER_FILES = {
46
+ "src/app/layout.tsx": templates.layoutTsx,
47
+ "src/app/page.tsx": templates.pageTsx,
48
+ "src/app/globals.css": templates.globalsCss,
49
+ "src/app/page.test.tsx": templates.pageTestTsx,
50
+ "eslint.config.mjs": templates.eslintConfig,
51
+ } as const
52
+
53
+ /**
54
+ * Build the composite Next.js blueprint. Every operation is attributed to its own sub-blueprint
55
+ * (`pjt:tsconfig`, `pjt:vitest`, `pjt:next`, …); removing `next()` from `.pjt.ts` removes the
56
+ * maintained scaffolding and managed keys but leaves the seeded source and the user's own
57
+ * `package.json` keys in place.
58
+ */
59
+ export const next = (): Blueprint.Blueprint => {
60
+ const id = "pjt:next"
61
+
62
+ const packageJsonMerge = jsonMerge({
63
+ id,
64
+ version: PACKAGE_VERSION,
65
+ description: "Next.js scripts, dependencies and TypeScript / ESLint devDependencies",
66
+ path: "package.json",
67
+ ownedKeys: [
68
+ "scripts.dev",
69
+ "scripts.build",
70
+ "scripts.start",
71
+ "scripts.lint",
72
+ "dependencies.next",
73
+ "dependencies.react",
74
+ "dependencies.react-dom",
75
+ "devDependencies.@testing-library/dom",
76
+ "devDependencies.@testing-library/react",
77
+ "devDependencies.@types/node",
78
+ "devDependencies.@types/react",
79
+ "devDependencies.@types/react-dom",
80
+ "devDependencies.eslint",
81
+ "devDependencies.eslint-config-next",
82
+ "devDependencies.jsdom",
83
+ "devDependencies.typescript",
84
+ ],
85
+ value: {
86
+ scripts: {
87
+ dev: "next dev",
88
+ build: "next build",
89
+ start: "next start",
90
+ lint: "eslint .",
91
+ },
92
+ dependencies: {
93
+ next: NEXT_DEP_RANGE,
94
+ react: REACT_DEP_RANGE,
95
+ "react-dom": REACT_DEP_RANGE,
96
+ },
97
+ devDependencies: {
98
+ "@testing-library/dom": TESTING_LIBRARY_DOM_DEP_RANGE,
99
+ "@testing-library/react": TESTING_LIBRARY_REACT_DEP_RANGE,
100
+ "@types/node": TYPES_NODE_DEP_RANGE,
101
+ "@types/react": TYPES_REACT_DEP_RANGE,
102
+ "@types/react-dom": TYPES_REACT_DEP_RANGE,
103
+ eslint: ESLINT_DEP_RANGE,
104
+ "eslint-config-next": ESLINT_CONFIG_NEXT_DEP_RANGE,
105
+ jsdom: JSDOM_DEP_RANGE,
106
+ typescript: TYPESCRIPT_DEP_RANGE,
107
+ },
108
+ },
109
+ })
110
+
111
+ const nextConfig = ownFile({
112
+ id,
113
+ version: PACKAGE_VERSION,
114
+ description: "Next.js configuration",
115
+ path: "next.config.ts",
116
+ content: templates.nextConfig,
117
+ })
118
+
119
+ const starter = Object.entries(STARTER_FILES).map(([path, content]) =>
120
+ seedFile({ id, version: PACKAGE_VERSION, description: `starter ${path}`, path, content }),
121
+ )
122
+
123
+ const parts = [
124
+ // `next build` adds these keys to `tsconfig.json` when they are missing, and it requires the
125
+ // automatic JSX runtime. Declaring them keeps the build from rewriting the owned file.
126
+ tsconfig({
127
+ module: "ESNext",
128
+ dom: true,
129
+ jsx: "react-jsx",
130
+ noEmit: true,
131
+ allowJs: true,
132
+ incremental: true,
133
+ plugins: ["next"],
134
+ include: ["next-env.d.ts", ".next/types/**/*.ts", ".next/dev/types/**/*.ts"],
135
+ }),
136
+ gitignores.node(),
137
+ gitignores.next(),
138
+ gitignores.tsbuildinfo(),
139
+ vitest({ environment: "jsdom" }),
140
+ packageJsonMerge,
141
+ nextConfig,
142
+ ...starter,
143
+ ]
144
+
145
+ return {
146
+ id,
147
+ version: PACKAGE_VERSION,
148
+ description:
149
+ "Next.js App Router + TypeScript app (config, scripts, dependencies and starter source)",
150
+ permissions: parts.flatMap((part) => part.permissions),
151
+ plan: Effect.gen(function* () {
152
+ const changeSets = yield* Effect.forEach(parts, (part) => part.plan)
153
+ return CS.Reducer.combineAll(changeSets)
154
+ }),
155
+ }
156
+ }
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Starter source and config for the Next.js app. The seeded files are written once and never
3
+ * enforced; `nextConfig` is owned and rewritten on every `remodel`.
4
+ */
5
+
6
+ export const layoutTsx = `import type { Metadata } from "next"
7
+ import type { ReactNode } from "react"
8
+ import "./globals.css"
9
+
10
+ export const metadata: Metadata = {
11
+ title: "Next app",
12
+ description: "Scaffolded by projitect",
13
+ }
14
+
15
+ export default function RootLayout({ children }: { readonly children: ReactNode }) {
16
+ return (
17
+ <html lang="en">
18
+ <body>{children}</body>
19
+ </html>
20
+ )
21
+ }
22
+ `
23
+
24
+ export const pageTsx = `export default function Page() {
25
+ return (
26
+ <main>
27
+ <h1>Hello from projitect</h1>
28
+ <p>
29
+ Edit <code>src/app/page.tsx</code> to get started.
30
+ </p>
31
+ </main>
32
+ )
33
+ }
34
+ `
35
+
36
+ export const pageTestTsx = `import { cleanup, render, screen } from "@testing-library/react"
37
+ import { afterEach, describe, expect, it } from "vitest"
38
+ import Page from "./page"
39
+
40
+ afterEach(cleanup)
41
+
42
+ describe("Page", () => {
43
+ it("renders the starter heading", () => {
44
+ render(<Page />)
45
+ expect(screen.getByRole("heading", { name: "Hello from projitect" })).toBeTruthy()
46
+ })
47
+ })
48
+ `
49
+
50
+ export const globalsCss = `:root {
51
+ font-family: system-ui, sans-serif;
52
+ color-scheme: light dark;
53
+ }
54
+
55
+ body {
56
+ margin: 0;
57
+ display: grid;
58
+ min-height: 100vh;
59
+ place-items: center;
60
+ }
61
+ `
62
+
63
+ export const eslintConfig = `import { defineConfig, globalIgnores } from "eslint/config"
64
+ import nextVitals from "eslint-config-next/core-web-vitals"
65
+ import nextTs from "eslint-config-next/typescript"
66
+
67
+ export default defineConfig([
68
+ ...nextVitals,
69
+ ...nextTs,
70
+ globalIgnores([".next/**", "out/**", "next-env.d.ts"]),
71
+ ])
72
+ `
73
+
74
+ export const nextConfig = `import type { NextConfig } from "next"
75
+
76
+ /**
77
+ * Next.js configuration scaffolded by \`@projitect/blueprint-next\`.
78
+ *
79
+ * Owned mode — projitect rewrites this file on every \`pjt remodel\`.
80
+ */
81
+ const nextConfig: NextConfig = {
82
+ reactStrictMode: true,
83
+ }
84
+
85
+ export default nextConfig
86
+ `
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.