spine-framework 0.3.21 → 0.3.24

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.
File without changes
@@ -37,10 +37,18 @@ export function registerInitCommands(program: Command) {
37
37
  .action(async (opts) => {
38
38
  console.log('\nInitializing Spine Framework project...\n')
39
39
 
40
- // Guard: don't overwrite an existing project unless --force
41
- if (existsSync(join(PROJECT_ROOT, 'package.json')) && !opts.force) {
42
- console.error('Error: package.json already exists. Use --force to overwrite.')
43
- process.exit(1)
40
+ // Warn if this looks like an existing non-Spine project
41
+ const existingPkg = join(PROJECT_ROOT, 'package.json')
42
+ if (existsSync(existingPkg) && !opts.force) {
43
+ try {
44
+ const pkg = JSON.parse(readFileSync(existingPkg, 'utf8'))
45
+ const hasSpine = pkg.dependencies?.['spine-framework'] || pkg.devDependencies?.['spine-framework']
46
+ const hasFramework = existsSync(join(PROJECT_ROOT, '.framework'))
47
+ if (!hasSpine && !hasFramework && pkg.name !== 'spine-framework') {
48
+ console.warn('Warning: package.json exists but does not appear to be a Spine project.')
49
+ console.warn('Use --force to overwrite. Continuing with scaffold...\n')
50
+ }
51
+ } catch {}
44
52
  }
45
53
 
46
54
  try {
@@ -124,13 +132,25 @@ export function registerInitCommands(program: Command) {
124
132
  'spine-framework': `^${getPackageVersion()}`,
125
133
  },
126
134
  }
127
- if (!existsSync(join(PROJECT_ROOT, 'package.json')) || opts.force) {
128
- writeFileSync(
129
- join(PROJECT_ROOT, 'package.json'),
130
- JSON.stringify(pkgJson, null, 2) + '\n'
131
- )
132
- console.log(' ✓ package.json written')
135
+ // Merge with existing package.json if present (preserve name, version, existing deps)
136
+ let finalPkg = pkgJson
137
+ if (existsSync(join(PROJECT_ROOT, 'package.json'))) {
138
+ try {
139
+ const existing = JSON.parse(readFileSync(join(PROJECT_ROOT, 'package.json'), 'utf8'))
140
+ finalPkg = {
141
+ ...pkgJson,
142
+ name: existing.name || pkgJson.name,
143
+ version: existing.version || pkgJson.version,
144
+ dependencies: { ...existing.dependencies, ...pkgJson.dependencies },
145
+ devDependencies: existing.devDependencies || {},
146
+ }
147
+ } catch {}
133
148
  }
149
+ writeFileSync(
150
+ join(PROJECT_ROOT, 'package.json'),
151
+ JSON.stringify(finalPkg, null, 2) + '\n'
152
+ )
153
+ console.log(' ✓ package.json written')
134
154
 
135
155
  // 7. Write .env template
136
156
  console.log(' Writing .env template...')
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "spine-framework",
3
- "version": "0.3.21",
3
+ "version": "0.3.24",
4
4
  "description": "Multi-tenant, modular application platform for modern SaaS systems",
5
- "type": "module",
6
- "bin": "./.framework/cli/bin.mjs",
5
+ "bin": {
6
+ "spine-framework": ".framework/cli/bin.mjs"
7
+ },
7
8
  "files": [
8
9
  ".framework/cli/bin.mjs",
9
10
  ".framework/cli/",