create-better-system 1.0.0 → 1.0.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/index.js +23 -2
- package/package.json +6 -6
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: {
|
|
@@ -119,14 +120,18 @@ console.log('🔤 Configuring fonts...')
|
|
|
119
120
|
const layoutPath = path.join(projectPath, 'apps', 'frontend', 'app', 'layout.tsx')
|
|
120
121
|
let layout = await fs.readFile(layoutPath, 'utf-8')
|
|
121
122
|
|
|
123
|
+
const isInterHeading = headingFontNextName === 'Inter'
|
|
124
|
+
|
|
122
125
|
layout = layout
|
|
123
126
|
.replace(
|
|
124
127
|
'// __HEADING_FONT_IMPORT__',
|
|
125
|
-
`import { ${headingFontNextName} } from "next/font/google"`
|
|
128
|
+
isInterHeading ? '' : `import { ${headingFontNextName} } from "next/font/google"`
|
|
126
129
|
)
|
|
127
130
|
.replace(
|
|
128
131
|
'// __HEADING_FONT_DECLARATION__',
|
|
129
|
-
|
|
132
|
+
isInterHeading
|
|
133
|
+
? `const ${headingFontVarName} = Inter({\n variable: "--font-heading",\n subsets: ["latin"],\n weight: ["400", "500", "700"],\n})`
|
|
134
|
+
: `const ${headingFontVarName} = ${headingFontNextName}({\n variable: "--font-heading",\n subsets: ["latin"],\n weight: ["400", "500", "700"],\n})`
|
|
130
135
|
)
|
|
131
136
|
.replaceAll('__HEADING_FONT_CLASS__', `\${${headingFontVarName}.variable}`)
|
|
132
137
|
.replaceAll('__PROJECT_NAME__', projectName)
|
|
@@ -222,6 +227,22 @@ for (const [placeholder, value] of Object.entries(figmaReplacements)) {
|
|
|
222
227
|
|
|
223
228
|
await fs.writeFile(figmaRulesPath, figmaRules)
|
|
224
229
|
|
|
230
|
+
// ─── Setup backend .env ───────────────────────────────────────────────────────
|
|
231
|
+
|
|
232
|
+
console.log('🔑 Generating APP_KEY...')
|
|
233
|
+
|
|
234
|
+
const backendPath = path.join(projectPath, 'apps', 'backend')
|
|
235
|
+
const envExamplePath = path.join(backendPath, '.env.example')
|
|
236
|
+
const envPath = path.join(backendPath, '.env')
|
|
237
|
+
|
|
238
|
+
await fs.copy(envExamplePath, envPath)
|
|
239
|
+
|
|
240
|
+
const generatedKey = crypto.randomBytes(32).toString('base64url')
|
|
241
|
+
|
|
242
|
+
let envContent = await fs.readFile(envPath, 'utf-8')
|
|
243
|
+
envContent = envContent.replace('APP_KEY=', `APP_KEY=${generatedKey}`)
|
|
244
|
+
await fs.writeFile(envPath, envContent)
|
|
245
|
+
|
|
225
246
|
// ─── Update root package.json ─────────────────────────────────────────────────
|
|
226
247
|
|
|
227
248
|
console.log('📝 Updating package.json...')
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-better-system",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"bin": {
|
|
5
|
-
|
|
5
|
+
"create-better-system": "index.js"
|
|
6
6
|
},
|
|
7
7
|
"type": "module",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
"inquirer": "^9.0.0",
|
|
10
|
+
"execa": "^8.0.0",
|
|
11
|
+
"fs-extra": "^11.0.0"
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
}
|