@shadospace/editor 1.0.8 → 1.0.9

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 -1
  2. package/scripts/init.js +30 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shadospace/editor",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "bin": "./scripts/init.js",
package/scripts/init.js CHANGED
@@ -3,6 +3,7 @@
3
3
  import fs from "fs"
4
4
  import path from "path"
5
5
  import { fileURLToPath } from "url"
6
+ import { execSync } from "child_process"
6
7
 
7
8
  const __filename = fileURLToPath(import.meta.url)
8
9
  const __dirname = path.dirname(__filename)
@@ -214,6 +215,35 @@ try {
214
215
  `[tiptap-starter] globals.css not found. Please add \`@import "../components/editor/styles.css";\` manually to your CSS file.`
215
216
  )
216
217
  }
218
+
219
+ // Install lucide-react if missing
220
+ console.log("[tiptap-starter] Checking for lucide-react...")
221
+
222
+ let hasLucide = false
223
+ if (pkg.dependencies?.["lucide-react"] || pkg.devDependencies?.["lucide-react"]) {
224
+ hasLucide = true
225
+ }
226
+
227
+ if (!hasLucide) {
228
+ let command = "npm install lucide-react"
229
+ if (fs.existsSync(path.join(targetDir, "bun.lock"))) {
230
+ command = "bun add lucide-react"
231
+ } else if (fs.existsSync(path.join(targetDir, "pnpm-lock.yaml"))) {
232
+ command = "pnpm add lucide-react"
233
+ } else if (fs.existsSync(path.join(targetDir, "yarn.lock"))) {
234
+ command = "yarn add lucide-react"
235
+ }
236
+
237
+ console.log(`[tiptap-starter] Installing lucide-react with command: ${command}`)
238
+ try {
239
+ execSync(command, { cwd: targetDir, stdio: "inherit" })
240
+ console.log("[tiptap-starter] Successfully installed lucide-react")
241
+ } catch (error) {
242
+ console.error("[tiptap-starter] Failed to install lucide-react:", error)
243
+ }
244
+ } else {
245
+ console.log("[tiptap-starter] lucide-react is already installed.")
246
+ }
217
247
  } catch (error) {
218
248
  console.error(`[tiptap-starter] Error during initialization:`, error)
219
249
  }