@earlyseo/blog 1.0.4 → 1.0.5

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 (2) hide show
  1. package/package.json +1 -5
  2. package/src/cli/init.mjs +22 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@earlyseo/blog",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Drop-in blog integration for React & Next.js — powered by EarlySEO. Articles are served from EarlySEO's CDN. Just add your site ID and render.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -13,25 +13,21 @@
13
13
  ".": {
14
14
  "types": "./dist/index.d.ts",
15
15
  "import": "./dist/index.js",
16
- "require": "./dist/index.js",
17
16
  "default": "./dist/index.js"
18
17
  },
19
18
  "./react": {
20
19
  "types": "./dist/react/index.d.ts",
21
20
  "import": "./dist/react/index.js",
22
- "require": "./dist/react/index.js",
23
21
  "default": "./dist/react/index.js"
24
22
  },
25
23
  "./next": {
26
24
  "types": "./dist/next/index.d.ts",
27
25
  "import": "./dist/next/index.js",
28
- "require": "./dist/next/index.js",
29
26
  "default": "./dist/next/index.js"
30
27
  },
31
28
  "./css": {
32
29
  "types": "./dist/css.d.ts",
33
30
  "import": "./dist/css.js",
34
- "require": "./dist/css.js",
35
31
  "default": "./dist/css.js"
36
32
  }
37
33
  },
package/src/cli/init.mjs CHANGED
@@ -9,6 +9,7 @@
9
9
  import fs from "node:fs";
10
10
  import path from "node:path";
11
11
  import readline from "node:readline";
12
+ import { execSync } from "node:child_process";
12
13
 
13
14
  const cwd = process.cwd();
14
15
 
@@ -147,6 +148,27 @@ async function main() {
147
148
 
148
149
  console.log();
149
150
 
151
+ // 4. Install @earlyseo/blog as a project dependency
152
+ const pkgJsonPath = path.join(cwd, "package.json");
153
+ if (fs.existsSync(pkgJsonPath)) {
154
+ const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
155
+ const deps = pkgJson.dependencies || {};
156
+ const alreadyInstalled = "@earlyseo/blog" in deps;
157
+ if (!alreadyInstalled) {
158
+ console.log(" 📦 Installing @earlyseo/blog...");
159
+ try {
160
+ execSync("npm install @earlyseo/blog@latest", { cwd, stdio: "ignore" });
161
+ console.log(" ✅ Installed @earlyseo/blog");
162
+ } catch {
163
+ console.log(" ⚠ Could not auto-install. Run manually: npm install @earlyseo/blog");
164
+ }
165
+ } else {
166
+ console.log(" ✓ @earlyseo/blog already in dependencies");
167
+ }
168
+ }
169
+
170
+ console.log();
171
+
150
172
  // 5. Generate pages
151
173
  const blogDir = `${appDir}/blog`;
152
174
  const listPagePath = `${blogDir}/page.tsx`;