spine-framework 0.1.16 → 0.1.18

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
27
  const PROJECT_ROOT = process.cwd()
28
+ // Package root: node_modules/spine-framework/ — 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,45 @@ 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
+ console.log(` package: ${PACKAGE_ROOT}`)
92
+ console.log(` project: ${PROJECT_ROOT}`)
93
+ // Directories and files to copy from the package root into the consumer project root
94
+ const items = [
95
+ { src: '.framework', dest: '.framework' },
96
+ { src: 'bin', dest: 'bin' },
97
+ { src: 'config', dest: 'config' },
98
+ { src: 'scripts', dest: 'scripts' },
99
+ { src: 'netlify.toml', dest: 'netlify.toml' },
100
+ { src: 'vitest.config.ts', dest: 'vitest.config.ts' },
101
+ { src: 'index.html', dest: 'index.html' },
102
+ { src: 'STRUCTURE.md', dest: 'STRUCTURE.md' },
103
+ ]
104
+
105
+ for (const item of items) {
106
+ const src = resolve(PACKAGE_ROOT, item.src)
107
+ const dest = resolve(PROJECT_ROOT, item.dest)
108
+
109
+ if (!existsSync(src)) {
110
+ console.log(` ⏭️ ${item.src} not found in package, skipping`)
111
+ continue
112
+ }
113
+
114
+ if (existsSync(dest)) {
115
+ console.log(` ⏭️ ${item.dest} already exists, skipping`)
116
+ continue
117
+ }
118
+
119
+ if (dryRun) {
120
+ console.log(` [dry-run] Would copy: ${item.src} → ./${item.dest}`)
121
+ continue
122
+ }
123
+
124
+ cpSync(src, dest, { recursive: true })
125
+ console.log(` ✓ Copied ${item.dest}`)
126
+ }
127
+ }
128
+
88
129
  async function initCommand(options: InitOptions): Promise<void> {
89
130
  console.log('\n🚀 Spine Framework — Init\n')
90
131
 
@@ -100,13 +141,17 @@ async function initCommand(options: InitOptions): Promise<void> {
100
141
  console.log(' ✓ Using existing .env credentials')
101
142
  }
102
143
 
103
- // Step 2: Scaffold custom workspace
104
- console.log('\n📁 Step 2: Scaffolding custom workspace...')
144
+ // Step 2: Copy framework files to project root
145
+ console.log('\n📦 Step 2: Installing framework files...')
146
+ copyFrameworkFiles(options.dryRun)
147
+
148
+ // Step 3: Scaffold custom workspace
149
+ console.log('\n📁 Step 3: Scaffolding custom workspace...')
105
150
  scaffoldCustomWorkspace(options.dryRun)
106
151
 
107
152
  console.log('\n✅ Project initialized!')
108
153
  console.log('\n Next: apply database migrations:')
109
- console.log(' spine-framework migrate --db-password <your-db-password>')
154
+ console.log(' npx spine-framework migrate --db-password <your-db-password>')
110
155
  console.log('\n Find your DB password at:')
111
156
  console.log(' https://supabase.com/dashboard/project/_/settings/database')
112
157
  }
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/spine-logo.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <link rel="preconnect" href="https://fonts.googleapis.com">
8
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
9
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
10
+ <title>Spine Framework</title>
11
+ </head>
12
+ <body>
13
+ <div id="root"></div>
14
+ <script type="module" src="/src/main.tsx"></script>
15
+ </body>
16
+ </html>
@@ -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;AA8FxC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QAiBpD"}
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;AA2IxC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QAiBpD"}
package/netlify.toml ADDED
@@ -0,0 +1,36 @@
1
+ [build]
2
+ command = "npm run build"
3
+ publish = "dist"
4
+ functions = ".assembled/netlify/functions"
5
+
6
+ [build.environment]
7
+ # Supabase VITE variables are meant to be public in the browser
8
+ SECRETS_SCAN_OMIT_KEYS = "VITE_SUPABASE_URL,VITE_SUPABASE_ANON_KEY,VITE_DB_SCHEMA,VITE_APP_NAME,SUPABASE_URL,DB_SCHEMA"
9
+ SECRETS_SCAN_OMIT_PATHS = ".framework/.xenv,.framework/.xenv.test"
10
+
11
+ # Spine functions configuration - assembled from .framework + custom
12
+ [functions]
13
+ directory = ".assembled/netlify/functions"
14
+ included_files = [".assembled/netlify/functions/**"]
15
+ node_bundler = "esbuild"
16
+
17
+ [dev]
18
+ command = "bash scripts/netlify-dev-wrapper.sh"
19
+ framework = "#custom"
20
+ port = 8888
21
+ targetPort = 3001
22
+ autoLaunch = false
23
+ startTimeout = 60
24
+
25
+ [functions."trigger-scheduler"]
26
+ schedule = "* * * * *"
27
+
28
+ [[headers]]
29
+ for = "/*"
30
+ [headers.values]
31
+ X-Frame-Options = "DENY"
32
+ X-Content-Type-Options = "nosniff"
33
+ Strict-Transport-Security = "max-age=31536000; includeSubDomains"
34
+ Referrer-Policy = "strict-origin-when-cross-origin"
35
+ Permissions-Policy = "camera=(), microphone=(), geolocation=()"
36
+ X-XSS-Protection = "1; mode=block"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spine-framework",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "private": false,
5
5
  "description": "Spine — enterprise application framework built on Supabase + Netlify + React",
6
6
  "type": "module",
@@ -56,6 +56,9 @@
56
56
  ".framework/src/",
57
57
  "scripts/",
58
58
  "config/",
59
+ "netlify.toml",
60
+ "vitest.config.ts",
61
+ "index.html",
59
62
  "STRUCTURE.md",
60
63
  "README.md"
61
64
  ],
@@ -0,0 +1,45 @@
1
+ import { defineConfig } from 'vitest/config'
2
+ import { readFileSync, existsSync } from 'fs'
3
+ import { resolve } from 'path'
4
+
5
+ // Load .xenv.test so integration tests get real DB credentials before any
6
+ // worker module graph (db.ts, principal.ts) evaluates createClient() calls.
7
+ const xenvTest = resolve(__dirname, '.framework/.xenv.test')
8
+ if (existsSync(xenvTest)) {
9
+ for (const line of readFileSync(xenvTest, 'utf8').split('\n')) {
10
+ const t = line.trim()
11
+ if (!t || t.startsWith('#')) continue
12
+ const eq = t.indexOf('=')
13
+ if (eq === -1) continue
14
+ const k = t.slice(0, eq).trim()
15
+ const v = t.slice(eq + 1).trim().replace(/^["']|["']$/g, '')
16
+ if (!process.env[k]) process.env[k] = v
17
+ }
18
+ }
19
+
20
+ export default defineConfig({
21
+ test: {
22
+ // Stub SUPABASE_URL etc. before any module is imported
23
+ setupFiles: ['.framework/tests/setup.ts'],
24
+ // Each test file gets its own module instance (important for vi.mock isolation)
25
+ isolate: true,
26
+ // Allow .ts extension imports (tsx-style)
27
+ environment: 'node',
28
+ // Resolve .ts imports as themselves (no .js→.ts rewriting needed in tests)
29
+ include: [
30
+ '.framework/tests/unit/**/*.test.ts',
31
+ '.framework/tests/integration/**/*.test.ts',
32
+ '.framework/tests/api/**/*.test.ts'
33
+ ],
34
+ // Global test timeout — integration + API tests may hit Supabase / local server
35
+ testTimeout: 20000,
36
+ // Don't fail the suite on integration tests if env isn't configured
37
+ passWithNoTests: true,
38
+ // Persist results to public.test_runs after every run
39
+ reporters: ['default', './.framework/tests/reporter.ts']
40
+ },
41
+ resolve: {
42
+ // Allow bare .ts imports (the CLI + shared code uses these)
43
+ extensions: ['.ts', '.js', '.json']
44
+ }
45
+ })