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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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;
|
|
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"}
|
package/package-project.json
CHANGED