@soloworks/smking-next 0.12.1 → 0.12.2
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/CHANGELOG.md +9 -0
- package/bin/install.mjs +36 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @soloworks/smking-next
|
|
2
2
|
|
|
3
|
+
## 0.12.2 — 2026-05-21
|
|
4
|
+
|
|
5
|
+
**Fix: `doctor` now auto-loads `.env.local` + `.env` matching Next.js convention.**
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- `npx @soloworks/smking-next doctor` was reporting `SMKING_API_KEY not set` even when the wizard had just written keys to `.env.local`. Cause: standalone Node bin script doesn't get Next.js framework env loading — only `next dev` / `next build` parse `.env.local`. Customer mental model expected doctor to mirror `next dev`.
|
|
10
|
+
- `runDoctor` now calls `process.loadEnvFile()` (Node 20.6+ native, zero deps) for `.env` then `.env.local`. Existing shell env wins (Next.js precedence). Falls through silently if files don't exist or Node is too old — doctor still reports `not set` as it would have anyway.
|
|
11
|
+
|
|
3
12
|
## 0.12.1 — 2026-05-21
|
|
4
13
|
|
|
5
14
|
**Fix: `npx @soloworks/smking-next doctor` failed for all customers.**
|
package/bin/install.mjs
CHANGED
|
@@ -94,6 +94,37 @@ function runInstall() {
|
|
|
94
94
|
|
|
95
95
|
// ── doctor (self-check) ─────────────────────────────────────────
|
|
96
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Load `.env.local` + `.env` from cwd into `process.env`, matching the
|
|
99
|
+
* Next.js convention so `npx @soloworks/smking-next doctor` sees the same
|
|
100
|
+
* env vars the customer's `next dev` / `next build` would. Standalone
|
|
101
|
+
* Node bin scripts don't get framework env loading for free — without
|
|
102
|
+
* this, doctor would fail "SMKING_API_KEY not set" on every install where
|
|
103
|
+
* the wizard wrote to `.env.local` instead of shell env.
|
|
104
|
+
*
|
|
105
|
+
* `process.loadEnvFile` is available Node 20.6+ (experimental → stable
|
|
106
|
+
* in 21.7+). Next.js 16 requires Node 20+ so the customer environment is
|
|
107
|
+
* guaranteed to have it. Existing process env wins (we don't overwrite —
|
|
108
|
+
* matches Next.js precedence: shell env > .env.local > .env).
|
|
109
|
+
*
|
|
110
|
+
* Files load in reverse-precedence order (lowest first) so later files
|
|
111
|
+
* win when both define the same key. Next.js's actual order: .env.local
|
|
112
|
+
* > .env.development.local > .env.development > .env. We do the minimal
|
|
113
|
+
* pair customers actually use.
|
|
114
|
+
*/
|
|
115
|
+
function loadEnvFiles() {
|
|
116
|
+
for (const file of [".env", ".env.local"]) {
|
|
117
|
+
if (!existsSync(file)) continue;
|
|
118
|
+
try {
|
|
119
|
+
process.loadEnvFile(file);
|
|
120
|
+
} catch {
|
|
121
|
+
// Older Node fallback or unreadable file — silently skip; doctor
|
|
122
|
+
// will report SMKING_API_KEY not set as it would have anyway.
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
|
|
97
128
|
/**
|
|
98
129
|
* @typedef {{ name: string, status: "pass" | "fail" | "info", detail: string }} DoctorCheck
|
|
99
130
|
*/
|
|
@@ -236,6 +267,11 @@ async function checkApiReachable() {
|
|
|
236
267
|
* @returns {Promise<number>}
|
|
237
268
|
*/
|
|
238
269
|
async function runDoctor(jsonOutput) {
|
|
270
|
+
// Mirror Next.js env loading so doctor sees what `next dev` would.
|
|
271
|
+
// Customers run this from project root; .env.local is the wizard's
|
|
272
|
+
// write target for SMKING_API_KEY + SMKING_BASE_URL.
|
|
273
|
+
loadEnvFiles();
|
|
274
|
+
|
|
239
275
|
const appDir = detectAppDir();
|
|
240
276
|
/** @type {DoctorCheck[]} */
|
|
241
277
|
const checks = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soloworks/smking-next",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.2",
|
|
4
4
|
"description": "AI-native SEO (AEO) for Next.js — auto-inject JSON-LD, FAQ, AI summary, and SEO metadata so AI crawlers (ChatGPT, Perplexity, Google AI) can cite your pages.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/sillyleo/smking/tree/main/packages/smking-next",
|