create-better-system 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.
- package/index.js +34 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -7,6 +7,15 @@ import path from 'path'
|
|
|
7
7
|
import crypto from 'crypto'
|
|
8
8
|
import ora from 'ora'
|
|
9
9
|
|
|
10
|
+
// ─── Node version check ───────────────────────────────────────────────────────
|
|
11
|
+
|
|
12
|
+
const MIN_NODE = 20
|
|
13
|
+
const currentMajor = parseInt(process.versions.node.split('.')[0], 10)
|
|
14
|
+
if (currentMajor < MIN_NODE) {
|
|
15
|
+
console.error(`\n❌ Node.js ${MIN_NODE}+ required. You are running ${process.versions.node}.\n`)
|
|
16
|
+
process.exit(1)
|
|
17
|
+
}
|
|
18
|
+
|
|
10
19
|
const THEME_PRESETS = {
|
|
11
20
|
dark: {
|
|
12
21
|
bgPrimary: '#0a0e16',
|
|
@@ -268,6 +277,31 @@ await execa('git', ['add', '.'], { cwd: projectPath })
|
|
|
268
277
|
await execa('git', ['commit', '-m', 'init: better system'], { cwd: projectPath })
|
|
269
278
|
spinnerGit.succeed('Git repository initialized')
|
|
270
279
|
|
|
280
|
+
// ─── Ensure pnpm is available ─────────────────────────────────────────────────
|
|
281
|
+
|
|
282
|
+
try {
|
|
283
|
+
await execa('pnpm', ['--version'], { stdio: 'pipe' })
|
|
284
|
+
} catch {
|
|
285
|
+
const spinnerPnpm = ora('pnpm not found — installing via npm...').start()
|
|
286
|
+
try {
|
|
287
|
+
await execa('npm', ['install', '-g', 'pnpm'], { stdio: 'pipe' })
|
|
288
|
+
spinnerPnpm.succeed('pnpm installed')
|
|
289
|
+
} catch {
|
|
290
|
+
spinnerPnpm.fail('Could not install pnpm. Install it manually: npm install -g pnpm')
|
|
291
|
+
process.exit(1)
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// ─── pnpm install ─────────────────────────────────────────────────────────────
|
|
296
|
+
|
|
297
|
+
const spinnerInstall = ora('Installing dependencies...').start()
|
|
298
|
+
try {
|
|
299
|
+
await execa('pnpm', ['install'], { cwd: projectPath, stdio: 'pipe' })
|
|
300
|
+
spinnerInstall.succeed('Dependencies installed')
|
|
301
|
+
} catch {
|
|
302
|
+
spinnerInstall.fail('pnpm install failed — run it manually: cd ' + projectName + ' && pnpm install')
|
|
303
|
+
}
|
|
304
|
+
|
|
271
305
|
// ─── Done ─────────────────────────────────────────────────────────────────────
|
|
272
306
|
|
|
273
307
|
console.log(`\n✅ Project "${projectName}" created!`)
|
|
@@ -279,7 +313,6 @@ if (isBoth) {
|
|
|
279
313
|
|
|
280
314
|
console.log(`\nNext steps:`)
|
|
281
315
|
console.log(` cd ${projectName}`)
|
|
282
|
-
console.log(` pnpm install`)
|
|
283
316
|
console.log(` pnpm dev`)
|
|
284
317
|
console.log(`\nTo push to GitHub:`)
|
|
285
318
|
console.log(` gh repo create ${projectName} --private --source=. --push\n`)
|