spine-framework 0.1.15 → 0.1.17
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.
|
@@ -18,13 +18,15 @@
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import type { Command } from 'commander'
|
|
21
|
-
import { existsSync, mkdirSync, writeFileSync } from 'fs'
|
|
21
|
+
import { existsSync, mkdirSync, writeFileSync, cpSync } from 'fs'
|
|
22
22
|
import { resolve, dirname } from 'path'
|
|
23
23
|
import { fileURLToPath } from 'url'
|
|
24
24
|
|
|
25
25
|
const __filename = fileURLToPath(import.meta.url)
|
|
26
26
|
const __dirname = dirname(__filename)
|
|
27
|
-
const PROJECT_ROOT =
|
|
27
|
+
const PROJECT_ROOT = process.cwd()
|
|
28
|
+
// The package root is 4 levels up from .framework/cli/commands/
|
|
29
|
+
const PACKAGE_ROOT = resolve(__dirname, '../../../../')
|
|
28
30
|
|
|
29
31
|
interface InitOptions {
|
|
30
32
|
dryRun: boolean
|
|
@@ -85,6 +87,40 @@ function writeEnvFile(url: string, anonKey: string, serviceRoleKey: string, dryR
|
|
|
85
87
|
process.env.VITE_SUPABASE_ANON_KEY = anonKey
|
|
86
88
|
}
|
|
87
89
|
|
|
90
|
+
function copyFrameworkFiles(dryRun: boolean): void {
|
|
91
|
+
// Directories and files to copy from the package root into the consumer project root
|
|
92
|
+
const items = [
|
|
93
|
+
{ src: '.framework', dest: '.framework' },
|
|
94
|
+
{ src: 'bin', dest: 'bin' },
|
|
95
|
+
{ src: 'config', dest: 'config' },
|
|
96
|
+
{ src: 'scripts', dest: 'scripts' },
|
|
97
|
+
{ src: 'STRUCTURE.md', dest: 'STRUCTURE.md' },
|
|
98
|
+
]
|
|
99
|
+
|
|
100
|
+
for (const item of items) {
|
|
101
|
+
const src = resolve(PACKAGE_ROOT, item.src)
|
|
102
|
+
const dest = resolve(PROJECT_ROOT, item.dest)
|
|
103
|
+
|
|
104
|
+
if (!existsSync(src)) {
|
|
105
|
+
console.log(` ⏭️ ${item.src} not found in package, skipping`)
|
|
106
|
+
continue
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (existsSync(dest)) {
|
|
110
|
+
console.log(` ⏭️ ${item.dest} already exists, skipping`)
|
|
111
|
+
continue
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (dryRun) {
|
|
115
|
+
console.log(` [dry-run] Would copy: ${item.src} → ./${item.dest}`)
|
|
116
|
+
continue
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
cpSync(src, dest, { recursive: true })
|
|
120
|
+
console.log(` ✓ Copied ${item.dest}`)
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
88
124
|
async function initCommand(options: InitOptions): Promise<void> {
|
|
89
125
|
console.log('\n🚀 Spine Framework — Init\n')
|
|
90
126
|
|
|
@@ -100,13 +136,17 @@ async function initCommand(options: InitOptions): Promise<void> {
|
|
|
100
136
|
console.log(' ✓ Using existing .env credentials')
|
|
101
137
|
}
|
|
102
138
|
|
|
103
|
-
// Step 2:
|
|
104
|
-
console.log('\n
|
|
139
|
+
// Step 2: Copy framework files to project root
|
|
140
|
+
console.log('\n📦 Step 2: Installing framework files...')
|
|
141
|
+
copyFrameworkFiles(options.dryRun)
|
|
142
|
+
|
|
143
|
+
// Step 3: Scaffold custom workspace
|
|
144
|
+
console.log('\n📁 Step 3: Scaffolding custom workspace...')
|
|
105
145
|
scaffoldCustomWorkspace(options.dryRun)
|
|
106
146
|
|
|
107
147
|
console.log('\n✅ Project initialized!')
|
|
108
148
|
console.log('\n Next: apply database migrations:')
|
|
109
|
-
console.log(' spine-framework migrate --db-password <your-db-password>')
|
|
149
|
+
console.log(' npx spine-framework migrate --db-password <your-db-password>')
|
|
110
150
|
console.log('\n Find your DB password at:')
|
|
111
151
|
console.log(' https://supabase.com/dashboard/project/_/settings/database')
|
|
112
152
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../.framework/cli/commands/init.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../.framework/cli/commands/init.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAsIxC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QAiBpD"}
|