@electroplix/adapter 0.0.1 → 0.1.0
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/README.md +177 -5
- package/bin/cli.mjs +29 -0
- package/dist/README.md +26 -3
- package/dist/index.esm.js +64 -14
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/lib/detect.d.ts +26 -0
- package/dist/src/lib/detect.d.ts.map +1 -1
- package/dist/src/lib/logger.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,183 @@
|
|
|
1
|
-
# adapter
|
|
1
|
+
# ⚡ @electroplix/adapter
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**CLI for setting up Cloudflare Workers deploy pipelines in Next.js projects via OpenNext.**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Zero-config setup — run one command inside any Next.js project to get a production-ready Cloudflare Workers deployment pipeline with optional GitHub Actions CI/CD.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
---
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Quick Start
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# npx (no install required)
|
|
13
|
+
npx @electroplix/adapter
|
|
14
|
+
|
|
15
|
+
# or with pnpm
|
|
16
|
+
pnpm dlx @electroplix/adapter
|
|
17
|
+
|
|
18
|
+
# or install globally
|
|
19
|
+
npm i -g @electroplix/adapter
|
|
20
|
+
electroplix-adapter
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Run the command inside your Next.js project root. The CLI will walk you through setup interactively.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## What It Does
|
|
28
|
+
|
|
29
|
+
When you run `electroplix-adapter`, the CLI will:
|
|
30
|
+
|
|
31
|
+
### 1. Detect Your Project
|
|
32
|
+
- Validates you're inside a Next.js project
|
|
33
|
+
- Auto-detects your package manager (npm, pnpm, yarn, bun)
|
|
34
|
+
- Checks for existing OpenNext / Wrangler configuration
|
|
35
|
+
|
|
36
|
+
### 2. Install Dependencies
|
|
37
|
+
|
|
38
|
+
| Package | Type | Purpose |
|
|
39
|
+
|---------|------|---------|
|
|
40
|
+
| `@opennextjs/cloudflare` | dependency | OpenNext adapter for Cloudflare Workers |
|
|
41
|
+
| `wrangler` | devDependency | Cloudflare Workers CLI |
|
|
42
|
+
|
|
43
|
+
### 3. Inject Scripts into `package.json`
|
|
44
|
+
|
|
45
|
+
The following scripts are added (existing scripts with the same name are preserved unless you choose to overwrite):
|
|
46
|
+
|
|
47
|
+
| Script | Command | Description |
|
|
48
|
+
|--------|---------|-------------|
|
|
49
|
+
| `build` | `next build` | Standard Next.js build |
|
|
50
|
+
| `dev` | `next dev` | Start local dev server |
|
|
51
|
+
| `start` | `next start` | Start production server |
|
|
52
|
+
| `preview` | `opennextjs-cloudflare build && opennextjs-cloudflare preview` | Build & preview locally on Workers |
|
|
53
|
+
| `deploy` | `opennextjs-cloudflare build && opennextjs-cloudflare deploy` | Build & deploy to Cloudflare Workers |
|
|
54
|
+
| `cf-typegen` | `wrangler types --env-interface CloudflareEnv env.d.ts` | Generate Cloudflare env types |
|
|
55
|
+
|
|
56
|
+
### 4. Generate Configuration Files
|
|
57
|
+
|
|
58
|
+
| File | Purpose |
|
|
59
|
+
|------|---------|
|
|
60
|
+
| `open-next.config.ts` | OpenNext Cloudflare configuration (with R2 cache comments) |
|
|
61
|
+
| `wrangler.jsonc` | Cloudflare Workers config (worker name, assets, compatibility flags) |
|
|
62
|
+
| `env.d.ts` | TypeScript interface for Cloudflare environment bindings |
|
|
63
|
+
|
|
64
|
+
### 5. (Optional) GitHub Actions Deploy Pipeline
|
|
65
|
+
|
|
66
|
+
If you say **yes** when prompted, a `.github/workflows/deploy.yml` is generated that:
|
|
67
|
+
|
|
68
|
+
- Triggers on push to `main` or manual dispatch
|
|
69
|
+
- Installs dependencies using your detected package manager
|
|
70
|
+
- Builds with OpenNext and deploys to Cloudflare Workers
|
|
71
|
+
- Uses `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID` secrets
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Generated Files
|
|
76
|
+
|
|
77
|
+
After running the CLI, your project will have:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
your-nextjs-project/
|
|
81
|
+
├── open-next.config.ts ← OpenNext Cloudflare config
|
|
82
|
+
├── wrangler.jsonc ← Cloudflare Workers config
|
|
83
|
+
├── env.d.ts ← CloudflareEnv type interface
|
|
84
|
+
├── .github/
|
|
85
|
+
│ └── workflows/
|
|
86
|
+
│ └── deploy.yml ← CI/CD pipeline (optional)
|
|
87
|
+
└── package.json ← Updated with deploy scripts
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Usage After Setup
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Local development
|
|
96
|
+
npm run dev
|
|
97
|
+
|
|
98
|
+
# Build & preview on Workers locally
|
|
99
|
+
npm run preview
|
|
100
|
+
|
|
101
|
+
# Build & deploy to Cloudflare Workers
|
|
102
|
+
npm run deploy
|
|
103
|
+
|
|
104
|
+
# Generate Cloudflare env types
|
|
105
|
+
npm run cf-typegen
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## GitHub Actions Setup
|
|
111
|
+
|
|
112
|
+
If you opted into the CI/CD pipeline, add these secrets to your GitHub repository:
|
|
113
|
+
|
|
114
|
+
| Secret | Description |
|
|
115
|
+
|--------|-------------|
|
|
116
|
+
| `CLOUDFLARE_API_TOKEN` | API token from Cloudflare dashboard (Workers:Edit permission) |
|
|
117
|
+
| `CLOUDFLARE_ACCOUNT_ID` | Your Cloudflare account ID |
|
|
118
|
+
|
|
119
|
+
The pipeline will automatically deploy on every push to `main`.
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Programmatic API
|
|
124
|
+
|
|
125
|
+
You can also use the adapter programmatically in your own tooling:
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
import {
|
|
129
|
+
detectProject,
|
|
130
|
+
installPackages,
|
|
131
|
+
injectScripts,
|
|
132
|
+
writeConfigFiles,
|
|
133
|
+
writeGitHubActions,
|
|
134
|
+
} from '@electroplix/adapter';
|
|
135
|
+
|
|
136
|
+
const info = detectProject(process.cwd());
|
|
137
|
+
|
|
138
|
+
// Install @opennextjs/cloudflare + wrangler
|
|
139
|
+
installPackages(info.packageManager, info.root);
|
|
140
|
+
|
|
141
|
+
// Add deploy/preview/build scripts to package.json
|
|
142
|
+
injectScripts(info.root);
|
|
143
|
+
|
|
144
|
+
// Generate open-next.config.ts, wrangler.jsonc, env.d.ts
|
|
145
|
+
writeConfigFiles(info.root, 'my-worker-name');
|
|
146
|
+
|
|
147
|
+
// Generate .github/workflows/deploy.yml
|
|
148
|
+
writeGitHubActions(info.root, info.packageManager);
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Exported Functions
|
|
152
|
+
|
|
153
|
+
| Function | Description |
|
|
154
|
+
|----------|-------------|
|
|
155
|
+
| `detectProject(root)` | Detect Next.js project, package manager, existing config |
|
|
156
|
+
| `detectPackageManager(root)` | Detect npm / pnpm / yarn / bun |
|
|
157
|
+
| `installPackages(pm, cwd)` | Install required dependencies |
|
|
158
|
+
| `injectScripts(root, overwrite?)` | Merge deploy scripts into package.json |
|
|
159
|
+
| `writeConfigFiles(root, name, overwrite?)` | Generate OpenNext + Wrangler config files |
|
|
160
|
+
| `writeGitHubActions(root, pm, overwrite?)` | Generate GitHub Actions deploy workflow |
|
|
161
|
+
| `openNextConfigContent()` | Get open-next.config.ts content as string |
|
|
162
|
+
| `wranglerConfigContent(name)` | Get wrangler.jsonc content as string |
|
|
163
|
+
| `envDtsContent()` | Get env.d.ts content as string |
|
|
164
|
+
| `deployWorkflowContent(pm)` | Get deploy.yml content as string |
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Requirements
|
|
169
|
+
|
|
170
|
+
- **Node.js** 18+
|
|
171
|
+
- **Next.js** project (any version 13+)
|
|
172
|
+
- **Cloudflare account** (for deployment)
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Links
|
|
177
|
+
|
|
178
|
+
- [Electroplix](https://electroplix.com)
|
|
179
|
+
- [OpenNext Cloudflare Docs](https://opennext.js.org/cloudflare)
|
|
180
|
+
- [Cloudflare Workers Docs](https://developers.cloudflare.com/workers/)
|
|
181
|
+
- [Wrangler CLI](https://developers.cloudflare.com/workers/wrangler/)
|
|
10
182
|
|
|
11
183
|
Run `nx test adapter` to execute the unit tests via [Jest](https://jestjs.io).
|
package/bin/cli.mjs
CHANGED
|
@@ -9,6 +9,9 @@ import { resolve } from 'node:path';
|
|
|
9
9
|
import { createInterface } from 'node:readline';
|
|
10
10
|
import {
|
|
11
11
|
detectProject,
|
|
12
|
+
isNext16OrAbove,
|
|
13
|
+
checkVersionStability,
|
|
14
|
+
STABLE_NEXT_VERSIONS,
|
|
12
15
|
installPackages,
|
|
13
16
|
injectScripts,
|
|
14
17
|
writeConfigFiles,
|
|
@@ -68,6 +71,32 @@ async function run() {
|
|
|
68
71
|
|
|
69
72
|
logger.success(`Detected Next.js ${info.nextVersion ?? '(unknown version)'}`);
|
|
70
73
|
|
|
74
|
+
/* ── Block Next.js 16+ (not supported by OpenNext yet) ──────────── */
|
|
75
|
+
if (isNext16OrAbove(info.nextVersion)) {
|
|
76
|
+
logger.error('OpenNext does not support Next.js 16 yet.');
|
|
77
|
+
logger.info('Please downgrade to a supported Next.js 15.x version.');
|
|
78
|
+
logger.info('');
|
|
79
|
+
logger.info('Stable versions (CVE-patched):');
|
|
80
|
+
for (const v of STABLE_NEXT_VERSIONS) {
|
|
81
|
+
logger.success(` next@${v}`);
|
|
82
|
+
}
|
|
83
|
+
logger.info('');
|
|
84
|
+
logger.info(`Run: ${info.packageManager === 'npm' ? 'npm install' : info.packageManager + ' add'} next@${STABLE_NEXT_VERSIONS[STABLE_NEXT_VERSIONS.length - 1]}`);
|
|
85
|
+
process.exit(1);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* ── Warn if version is not a known-stable CVE-patched version ───── */
|
|
89
|
+
const stability = checkVersionStability(info.nextVersion);
|
|
90
|
+
if (stability === 'unknown') {
|
|
91
|
+
logger.warn('Your Next.js version is not one of the verified stable releases.');
|
|
92
|
+
logger.info('Stable versions (CVE-patched):');
|
|
93
|
+
for (const v of STABLE_NEXT_VERSIONS) {
|
|
94
|
+
logger.success(` next@${v}`);
|
|
95
|
+
}
|
|
96
|
+
const proceed = await confirm('Continue anyway?', true);
|
|
97
|
+
if (!proceed) process.exit(0);
|
|
98
|
+
}
|
|
99
|
+
|
|
71
100
|
const defaultName = root.split(/[\\/]/).pop() ?? 'my-nextjs-app';
|
|
72
101
|
const projectName = await input('Worker name for Cloudflare', defaultName);
|
|
73
102
|
|
package/dist/README.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
-
# @electroplix/adapter
|
|
2
|
-
|
|
3
|
-
CLI for setting up
|
|
1
|
+
# ⚡ @electroplix/adapter
|
|
2
|
+
|
|
3
|
+
**CLI for setting up Cloudflare Workers deploy pipelines in Next.js projects via OpenNext.**
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx @electroplix/adapter
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Run inside your Next.js project root. The CLI will:
|
|
12
|
+
|
|
13
|
+
1. Install `@opennextjs/cloudflare` and `wrangler`
|
|
14
|
+
2. Add `build`, `dev`, `preview`, `deploy`, `cf-typegen` scripts to package.json
|
|
15
|
+
3. Generate `open-next.config.ts`, `wrangler.jsonc`, and `env.d.ts`
|
|
16
|
+
4. Optionally generate a GitHub Actions CI/CD deploy pipeline
|
|
17
|
+
|
|
18
|
+
## Usage After Setup
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm run dev # Local development
|
|
22
|
+
npm run preview # Build & preview on Workers locally
|
|
23
|
+
npm run deploy # Build & deploy to Cloudflare Workers
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Full documentation: https://electroplix.com
|
package/dist/index.esm.js
CHANGED
|
@@ -12,6 +12,11 @@ function _extends() {
|
|
|
12
12
|
}, _extends.apply(null, arguments);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Stable Next.js versions verified after CVE patches.
|
|
17
|
+
* Only these patch versions are considered safe/supported.
|
|
18
|
+
*/
|
|
19
|
+
const STABLE_NEXT_VERSIONS = ['15.0.5', '15.1.9', '15.2.6', '15.3.6', '15.4.8', '15.5.7'];
|
|
15
20
|
/**
|
|
16
21
|
* Detect the package manager used by the project.
|
|
17
22
|
*/
|
|
@@ -56,6 +61,46 @@ function detectProject(root) {
|
|
|
56
61
|
};
|
|
57
62
|
}
|
|
58
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Parse a version string like "^15.3.6", "~15.3.6", "15.3.6", etc.
|
|
66
|
+
* into a clean semver triple. Returns null if unparseable.
|
|
67
|
+
*/
|
|
68
|
+
function parseVersion(raw) {
|
|
69
|
+
const match = raw.replace(/^[\^~>=<]+/, '').match(/(\d+)\.(\d+)\.(\d+)/);
|
|
70
|
+
if (!match) return null;
|
|
71
|
+
return {
|
|
72
|
+
major: Number(match[1]),
|
|
73
|
+
minor: Number(match[2]),
|
|
74
|
+
patch: Number(match[3])
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Check if the detected Next.js version is v16+ (unsupported by OpenNext).
|
|
80
|
+
*/
|
|
81
|
+
function isNext16OrAbove(version) {
|
|
82
|
+
if (!version) return false;
|
|
83
|
+
const v = parseVersion(version);
|
|
84
|
+
return v !== null && v.major >= 16;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Check whether the detected Next.js version is one of the known-stable
|
|
89
|
+
* CVE-patched versions.
|
|
90
|
+
*
|
|
91
|
+
* Returns `'stable'` if it matches exactly, `'unknown'` if it's a v15
|
|
92
|
+
* version not in the list, or `'unsupported'` if it's v16+.
|
|
93
|
+
*/
|
|
94
|
+
function checkVersionStability(version) {
|
|
95
|
+
if (!version) return 'unknown';
|
|
96
|
+
if (isNext16OrAbove(version)) return 'unsupported';
|
|
97
|
+
const v = parseVersion(version);
|
|
98
|
+
if (!v) return 'unknown';
|
|
99
|
+
const exact = `${v.major}.${v.minor}.${v.patch}`;
|
|
100
|
+
if (STABLE_NEXT_VERSIONS.includes(exact)) return 'stable';
|
|
101
|
+
return 'unknown';
|
|
102
|
+
}
|
|
103
|
+
|
|
59
104
|
/* ------------------------------------------------------------------ */
|
|
60
105
|
/* Simple coloured logger – zero dependencies */
|
|
61
106
|
/* ------------------------------------------------------------------ */
|
|
@@ -67,6 +112,7 @@ const YELLOW = '\x1b[33m';
|
|
|
67
112
|
const RED = '\x1b[31m';
|
|
68
113
|
const CYAN = '\x1b[36m';
|
|
69
114
|
const DIM = '\x1b[2m';
|
|
115
|
+
const ORANGE = '\x1b[38;5;208m';
|
|
70
116
|
const logger = {
|
|
71
117
|
info(msg) {
|
|
72
118
|
console.log(`${CYAN}ℹ${RESET} ${msg}`);
|
|
@@ -88,19 +134,23 @@ const logger = {
|
|
|
88
134
|
},
|
|
89
135
|
banner() {
|
|
90
136
|
console.log('');
|
|
91
|
-
console.log(`${BOLD}${CYAN}
|
|
92
|
-
console.log(`${BOLD}${CYAN}
|
|
93
|
-
console.log(`${BOLD}${CYAN}
|
|
94
|
-
console.log(`${BOLD}${CYAN}
|
|
95
|
-
console.log(`${BOLD}${CYAN}
|
|
96
|
-
console.log(`${BOLD}${CYAN}
|
|
97
|
-
console.log(`${BOLD}${CYAN}
|
|
98
|
-
console.log(`${BOLD}${CYAN}
|
|
99
|
-
console.log(`${BOLD}${CYAN}
|
|
100
|
-
console.log(`${BOLD}${CYAN}
|
|
101
|
-
console.log(`${BOLD}${CYAN}
|
|
102
|
-
console.log(`${BOLD}${CYAN}
|
|
103
|
-
console.log(`${BOLD}${CYAN}
|
|
137
|
+
console.log(`${BOLD}${CYAN} ╔═══════════════════════════════════════════════════════════╗${RESET}`);
|
|
138
|
+
console.log(`${BOLD}${CYAN} ║${RESET} ${BOLD}${CYAN}║${RESET}`);
|
|
139
|
+
console.log(`${BOLD}${CYAN} ║${RESET} ${YELLOW}⚡${RESET} ${CYAN}╲│╱${RESET} ${YELLOW}⚡${RESET} ${BOLD}${CYAN}║${RESET}`);
|
|
140
|
+
console.log(`${BOLD}${CYAN} ║${RESET} ${CYAN}┌──┤├──┐${RESET} ${BOLD}${CYAN}║${RESET}`);
|
|
141
|
+
console.log(`${BOLD}${CYAN} ║${RESET} ${CYAN}│${RESET} ${YELLOW}■${RESET} ${YELLOW}■${RESET} ${CYAN}│${RESET} ${CYAN}┌───────────┐${RESET} ${BOLD}${CYAN}║${RESET}`);
|
|
142
|
+
console.log(`${BOLD}${CYAN} ║${RESET} ${CYAN}│ └──┘ │${RESET} ${CYAN}┌┤${RESET}${ORANGE} ░●░ ░●░ ${RESET}${CYAN}├┐${RESET} ${BOLD}${CYAN}║${RESET}`);
|
|
143
|
+
console.log(`${BOLD}${CYAN} ║${RESET} ${CYAN}└─┤ ├─┘─────────┤│${RESET}${ORANGE} ░●░ ░●░ ${RESET}${CYAN}│├${RESET} ${BOLD}${CYAN}║${RESET}`);
|
|
144
|
+
console.log(`${BOLD}${CYAN} ║${RESET} ${CYAN}┌──┤${RESET}${YELLOW}⚡${RESET}${CYAN}├──┐${RESET} ${CYAN}├┤${RESET}${ORANGE} ░●░ ░●░ ${RESET}${CYAN}├┤${RESET} ${BOLD}${CYAN}║${RESET}`);
|
|
145
|
+
console.log(`${BOLD}${CYAN} ║${RESET} ${CYAN}╘╗ │ │ ╔╛${RESET} ${CYAN}└┤${RESET}${ORANGE} ░●░ ░●░ ${RESET}${CYAN}├┘${RESET} ${BOLD}${CYAN}║${RESET}`);
|
|
146
|
+
console.log(`${BOLD}${CYAN} ║${RESET} ${CYAN}└─┬┬─┘${RESET} ${CYAN}└───────────┘${RESET} ${BOLD}${CYAN}║${RESET}`);
|
|
147
|
+
console.log(`${BOLD}${CYAN} ║${RESET} ${CYAN}┌──┘└──┐${RESET} ${BOLD}${CYAN}║${RESET}`);
|
|
148
|
+
console.log(`${BOLD}${CYAN} ║${RESET} ${CYAN}└──────┘${RESET} ${BOLD}${CYAN}║${RESET}`);
|
|
149
|
+
console.log(`${BOLD}${CYAN} ║${RESET} ${BOLD}${CYAN}║${RESET}`);
|
|
150
|
+
console.log(`${BOLD}${CYAN} ║${RESET} ${BOLD}${YELLOW}⚡ Electroplix Deploy Adapter${RESET} ${BOLD}${CYAN}║${RESET}`);
|
|
151
|
+
console.log(`${BOLD}${CYAN} ║${RESET} ${DIM}Cloudflare Workers deploy for Next.js${RESET} ${BOLD}${CYAN}║${RESET}`);
|
|
152
|
+
console.log(`${BOLD}${CYAN} ║${RESET} ${BOLD}${CYAN}║${RESET}`);
|
|
153
|
+
console.log(`${BOLD}${CYAN} ╚═══════════════════════════════════════════════════════════╝${RESET}`);
|
|
104
154
|
console.log('');
|
|
105
155
|
}
|
|
106
156
|
};
|
|
@@ -394,4 +444,4 @@ function writeGitHubActions(root, pm, overwrite = false) {
|
|
|
394
444
|
return true;
|
|
395
445
|
}
|
|
396
446
|
|
|
397
|
-
export { ADAPTER_SCRIPTS, REQUIRED_DEPS, REQUIRED_DEV_DEPS, deployWorkflowContent, detectPackageManager, detectProject, envDtsContent, injectScripts, installPackages, logger, openNextConfigContent, wranglerConfigContent, writeConfigFiles, writeGitHubActions };
|
|
447
|
+
export { ADAPTER_SCRIPTS, REQUIRED_DEPS, REQUIRED_DEV_DEPS, STABLE_NEXT_VERSIONS, checkVersionStability, deployWorkflowContent, detectPackageManager, detectProject, envDtsContent, injectScripts, installPackages, isNext16OrAbove, logger, openNextConfigContent, parseVersion, wranglerConfigContent, writeConfigFiles, writeGitHubActions };
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { detectProject, detectPackageManager, type ProjectInfo, type PackageManager } from './lib/detect.js';
|
|
1
|
+
export { detectProject, detectPackageManager, parseVersion, isNext16OrAbove, checkVersionStability, STABLE_NEXT_VERSIONS, type ProjectInfo, type PackageManager, } from './lib/detect.js';
|
|
2
2
|
export { installPackages, REQUIRED_DEPS, REQUIRED_DEV_DEPS } from './lib/packages.js';
|
|
3
3
|
export { injectScripts, ADAPTER_SCRIPTS, type ScriptsResult } from './lib/scripts.js';
|
|
4
4
|
export { writeConfigFiles, openNextConfigContent, wranglerConfigContent, envDtsContent, type ConfigResult, } from './lib/configs.js';
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/adapter/src/index.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/adapter/src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,KAAK,WAAW,EAChB,KAAK,cAAc,GACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,aAAa,EACb,KAAK,YAAY,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/src/lib/detect.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
export type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun';
|
|
2
|
+
/**
|
|
3
|
+
* Stable Next.js versions verified after CVE patches.
|
|
4
|
+
* Only these patch versions are considered safe/supported.
|
|
5
|
+
*/
|
|
6
|
+
export declare const STABLE_NEXT_VERSIONS: readonly ["15.0.5", "15.1.9", "15.2.6", "15.3.6", "15.4.8", "15.5.7"];
|
|
2
7
|
export interface ProjectInfo {
|
|
3
8
|
/** Absolute path to the project root */
|
|
4
9
|
root: string;
|
|
@@ -30,4 +35,25 @@ export declare function readPackageJson(root: string): Record<string, any> | nul
|
|
|
30
35
|
* Gather information about the target project.
|
|
31
36
|
*/
|
|
32
37
|
export declare function detectProject(root: string): ProjectInfo;
|
|
38
|
+
/**
|
|
39
|
+
* Parse a version string like "^15.3.6", "~15.3.6", "15.3.6", etc.
|
|
40
|
+
* into a clean semver triple. Returns null if unparseable.
|
|
41
|
+
*/
|
|
42
|
+
export declare function parseVersion(raw: string): {
|
|
43
|
+
major: number;
|
|
44
|
+
minor: number;
|
|
45
|
+
patch: number;
|
|
46
|
+
} | null;
|
|
47
|
+
/**
|
|
48
|
+
* Check if the detected Next.js version is v16+ (unsupported by OpenNext).
|
|
49
|
+
*/
|
|
50
|
+
export declare function isNext16OrAbove(version: string | null): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Check whether the detected Next.js version is one of the known-stable
|
|
53
|
+
* CVE-patched versions.
|
|
54
|
+
*
|
|
55
|
+
* Returns `'stable'` if it matches exactly, `'unknown'` if it's a v15
|
|
56
|
+
* version not in the list, or `'unsupported'` if it's v16+.
|
|
57
|
+
*/
|
|
58
|
+
export declare function checkVersionStability(version: string | null): 'stable' | 'unknown' | 'unsupported';
|
|
33
59
|
//# sourceMappingURL=detect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../../../../../packages/adapter/src/lib/detect.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;AAE7D,MAAM,WAAW,WAAW;IAC1B,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,cAAc,EAAE,cAAc,CAAC;IAC/B,uCAAuC;IACvC,cAAc,EAAE,OAAO,CAAC;IACxB,2CAA2C;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB,yCAAyC;IACzC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,0DAA0D;IAC1D,WAAW,EAAE,OAAO,CAAC;IACrB,4CAA4C;IAC5C,WAAW,EAAE,OAAO,CAAC;IACrB,iDAAiD;IACjD,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAKjE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAQxE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAmBvD"}
|
|
1
|
+
{"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../../../../../packages/adapter/src/lib/detect.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;AAE7D;;;GAGG;AACH,eAAO,MAAM,oBAAoB,uEAOvB,CAAC;AAEX,MAAM,WAAW,WAAW;IAC1B,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,cAAc,EAAE,cAAc,CAAC;IAC/B,uCAAuC;IACvC,cAAc,EAAE,OAAO,CAAC;IACxB,2CAA2C;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB,yCAAyC;IACzC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,0DAA0D;IAC1D,WAAW,EAAE,OAAO,CAAC;IACrB,4CAA4C;IAC5C,WAAW,EAAE,OAAO,CAAC;IACrB,iDAAiD;IACjD,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAKjE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAQxE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAmBvD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAIhG;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAI/D;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,GAAG,SAAS,GAAG,aAAa,CAUlG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../../packages/adapter/src/lib/logger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../../packages/adapter/src/lib/logger.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,MAAM;cACP,MAAM;iBAGH,MAAM;cAGT,MAAM;eAGL,MAAM;cAGP,MAAM;aAGP,MAAM;;CAwBhB,CAAC"}
|