spine-framework 0.3.1 → 0.3.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.
@@ -18,7 +18,7 @@
18
18
  */
19
19
 
20
20
  import type { Command } from 'commander'
21
- import { existsSync, mkdirSync, writeFileSync, cpSync } from 'fs'
21
+ import { existsSync, mkdirSync, writeFileSync, cpSync, readFileSync } from 'fs'
22
22
  import { resolve, dirname } from 'path'
23
23
  import { fileURLToPath } from 'url'
24
24
  import { execSync } from 'child_process'
@@ -106,11 +106,18 @@ function copyFrameworkFiles(dryRun: boolean): void {
106
106
  { src: 'netlify.toml', dest: 'netlify.toml' },
107
107
  { src: 'vitest.config.ts', dest: 'vitest.config.ts' },
108
108
  { src: 'index.html', dest: 'index.html' },
109
- { src: 'package-project.json', dest: 'package.json' },
109
+ { src: 'package-project.json', dest: 'package.json', template: true },
110
110
  { src: 'STRUCTURE.md', dest: 'STRUCTURE.md' },
111
111
  ]
112
112
 
113
- for (const item of items) {
113
+ // Resolve current framework version from the installed package
114
+ let frameworkVersion = '0.1.0'
115
+ try {
116
+ const fwPkg = JSON.parse(readFileSync(resolve(PACKAGE_ROOT, 'package.json'), 'utf8'))
117
+ frameworkVersion = fwPkg.version || frameworkVersion
118
+ } catch { /* fall through */ }
119
+
120
+ for (const item of items as Array<{ src: string; dest: string; template?: boolean }>) {
114
121
  const src = resolve(PACKAGE_ROOT, item.src)
115
122
  const dest = resolve(PROJECT_ROOT, item.dest)
116
123
 
@@ -119,8 +126,7 @@ function copyFrameworkFiles(dryRun: boolean): void {
119
126
  continue
120
127
  }
121
128
 
122
- // Always overwrite package.json (npm creates a minimal one during install)
123
- if (existsSync(dest) && item.dest !== 'package.json') {
129
+ if (existsSync(dest)) {
124
130
  console.log(` ⏭️ ${item.dest} already exists, skipping`)
125
131
  continue
126
132
  }
@@ -130,7 +136,16 @@ function copyFrameworkFiles(dryRun: boolean): void {
130
136
  continue
131
137
  }
132
138
 
133
- cpSync(src, dest, { recursive: true })
139
+ if (item.template) {
140
+ // Stamp the current framework version into the project package.json
141
+ const templateContent = JSON.parse(readFileSync(src, 'utf8'))
142
+ if (templateContent.dependencies?.['spine-framework']) {
143
+ templateContent.dependencies['spine-framework'] = `^${frameworkVersion}`
144
+ }
145
+ writeFileSync(dest, JSON.stringify(templateContent, null, 2) + '\n', 'utf8')
146
+ } else {
147
+ cpSync(src, dest, { recursive: true })
148
+ }
134
149
  console.log(` ✓ Copied ${item.dest}`)
135
150
  }
136
151
  }
package/bin/welcome.cjs CHANGED
@@ -3,6 +3,17 @@
3
3
  // Tells the agent (or developer) exactly what to do next.
4
4
  // Uses only Node built-ins — no dependencies.
5
5
 
6
+ const path = require('path')
7
+ const fs = require('fs')
8
+
9
+ let version = '0.x'
10
+ try {
11
+ const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8'))
12
+ version = pkg.version || version
13
+ } catch { /* ignore */ }
14
+
15
+ const versionLabel = ('Framework v' + version).padEnd(14)
16
+
6
17
  const lines = [
7
18
  '',
8
19
  '╭──────────────────────────────────────────────────────────────╮',
@@ -12,31 +23,33 @@ const lines = [
12
23
  '│ ███████╗██████╔╝██║██╔██╗ ██║█████╗ │',
13
24
  '│ ╚════██║██╔═══╝ ██║██║╚██╗██║██╔══╝ │',
14
25
  '│ ███████║██║ ██║██║ ╚████║███████╗ │',
15
- '│ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝ Framework v0.2 │',
26
+ `│ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝ ${versionLabel}│`,
16
27
  '│ │',
17
28
  '╰──────────────────────────────────────────────────────────────╯',
18
29
  '',
19
30
  ' Spine Framework installed successfully!',
20
31
  '',
21
- ' To complete setup you need a Supabase project.',
32
+ ' Next steps:',
22
33
  ' ─────────────────────────────────────────────',
23
- ' If you have one already, run:',
34
+ ' 1. Run init to scaffold the project:',
24
35
  '',
25
- ' spine-framework init \\',
26
- ' --url https://<project>.supabase.co \\',
27
- ' --anon-key <anon-key> \\',
28
- ' --service-role-key <service-role-key>',
36
+ ' npx spine-framework init',
29
37
  '',
30
- ' Your credentials are at:',
31
- ' Supabase Dashboard → Your Project → Settings → API',
38
+ ' 2. Fill in your Supabase credentials in .env',
39
+ ' (get them from Supabase Dashboard → Project → Settings → API)',
32
40
  '',
33
- ' ─────────────────────────────────────────────',
34
- ' If you need a Supabase project, create one at:',
35
- ' https://supabase.com/dashboard → New project',
41
+ ' 3. Apply database migrations:',
42
+ '',
43
+ ' npx spine-framework migrate',
44
+ '',
45
+ ' 4. Install apps (optional):',
46
+ '',
47
+ ' npx spine-framework install-app spine-framework-cortex@latest',
48
+ ' npx spine-framework install-app spine-framework-portal@latest',
49
+ '',
50
+ ' 5. Start the dev server:',
36
51
  '',
37
- ' After init:',
38
- ' spine-framework install-app <app-slug> # optional apps',
39
- ' npm run assemble && netlify dev # start dev server',
52
+ ' npm run assemble && netlify dev',
40
53
  '',
41
54
  ' Docs: https://github.com/spine-framework/spine-framework',
42
55
  '',
@@ -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;AAwJxC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QAcpD"}
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;AAuKxC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QAcpD"}
@@ -9,7 +9,7 @@
9
9
  "preview": "netlify dev"
10
10
  },
11
11
  "dependencies": {
12
- "spine-framework": "^0.2.0",
12
+ "spine-framework": "^0.3.1",
13
13
  "@tanstack/react-query": "^5.0.0",
14
14
  "react": "^18.3.0",
15
15
  "react-dom": "^18.3.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spine-framework",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "private": false,
5
5
  "description": "Spine — enterprise application framework built on Supabase + Netlify + React",
6
6
  "type": "module",