spine-framework 0.3.1 → 0.3.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.
@@ -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
  }
@@ -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.2",
4
4
  "private": false,
5
5
  "description": "Spine — enterprise application framework built on Supabase + Netlify + React",
6
6
  "type": "module",