create-better-system 1.0.1 → 1.0.3
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 +13 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import inquirer from 'inquirer'
|
|
|
4
4
|
import { execa } from 'execa'
|
|
5
5
|
import fs from 'fs-extra'
|
|
6
6
|
import path from 'path'
|
|
7
|
+
import crypto from 'crypto'
|
|
7
8
|
|
|
8
9
|
const THEME_PRESETS = {
|
|
9
10
|
dark: {
|
|
@@ -236,8 +237,7 @@ const envPath = path.join(backendPath, '.env')
|
|
|
236
237
|
|
|
237
238
|
await fs.copy(envExamplePath, envPath)
|
|
238
239
|
|
|
239
|
-
const
|
|
240
|
-
const generatedKey = appKey.trim().split('\n').pop().trim()
|
|
240
|
+
const generatedKey = crypto.randomBytes(32).toString('base64url')
|
|
241
241
|
|
|
242
242
|
let envContent = await fs.readFile(envPath, 'utf-8')
|
|
243
243
|
envContent = envContent.replace('APP_KEY=', `APP_KEY=${generatedKey}`)
|
|
@@ -252,6 +252,14 @@ const rootPkg = await fs.readJson(rootPkgPath)
|
|
|
252
252
|
rootPkg.name = projectName
|
|
253
253
|
await fs.writeJson(rootPkgPath, rootPkg, { spaces: 2 })
|
|
254
254
|
|
|
255
|
+
// ─── Git init ─────────────────────────────────────────────────────────────────
|
|
256
|
+
|
|
257
|
+
console.log('🗂️ Initializing git repository...')
|
|
258
|
+
|
|
259
|
+
await execa('git', ['init'], { cwd: projectPath })
|
|
260
|
+
await execa('git', ['add', '.'], { cwd: projectPath })
|
|
261
|
+
await execa('git', ['commit', '-m', 'init: better system'], { cwd: projectPath })
|
|
262
|
+
|
|
255
263
|
// ─── Done ─────────────────────────────────────────────────────────────────────
|
|
256
264
|
|
|
257
265
|
console.log(`\n✅ Project "${projectName}" created!`)
|
|
@@ -264,4 +272,6 @@ if (isBoth) {
|
|
|
264
272
|
console.log(`\nNext steps:`)
|
|
265
273
|
console.log(` cd ${projectName}`)
|
|
266
274
|
console.log(` pnpm install`)
|
|
267
|
-
console.log(` pnpm dev
|
|
275
|
+
console.log(` pnpm dev`)
|
|
276
|
+
console.log(`\nTo push to GitHub:`)
|
|
277
|
+
console.log(` gh repo create ${projectName} --private --source=. --push\n`)
|