@pure-ds/core 0.5.34 → 0.5.38
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.
package/package.json
CHANGED
|
@@ -107,18 +107,36 @@ async function copyTemplateDirectory(sourceDir, targetDir, options) {
|
|
|
107
107
|
async function copyBootstrapTemplate({ version, generatedAt, isModule }) {
|
|
108
108
|
await copyTemplateDirectory(templateRoot, projectRoot, { version, generatedAt });
|
|
109
109
|
|
|
110
|
-
const
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
const esbuildCjsSource = path.join(templateRoot, 'esbuild-dev.cjs');
|
|
111
|
+
const esbuildCjsTarget = path.join(projectRoot, 'esbuild-dev.cjs');
|
|
112
|
+
await copyFileIfMissing(esbuildCjsSource, esbuildCjsTarget);
|
|
113
|
+
|
|
114
|
+
const esbuildMjsSource = path.join(templateRoot, 'esbuild-dev.mjs');
|
|
115
|
+
const esbuildMjsTarget = path.join(projectRoot, 'esbuild-dev.mjs');
|
|
116
|
+
await copyFileIfMissing(esbuildMjsSource, esbuildMjsTarget);
|
|
117
|
+
|
|
118
|
+
const esbuildJsTarget = path.join(projectRoot, 'esbuild-dev.js');
|
|
119
|
+
const esbuildJsSource = isModule ? esbuildMjsSource : esbuildCjsSource;
|
|
120
|
+
await copyFileIfMissing(esbuildJsSource, esbuildJsTarget);
|
|
114
121
|
}
|
|
115
122
|
|
|
116
123
|
async function ensurePackageScripts(pkg, pkgPath) {
|
|
117
124
|
pkg.scripts = pkg.scripts || {};
|
|
118
125
|
let changed = false;
|
|
119
126
|
|
|
120
|
-
|
|
121
|
-
|
|
127
|
+
const devScript = pkg.scripts.dev;
|
|
128
|
+
const devScriptMatch = typeof devScript === 'string'
|
|
129
|
+
? devScript.match(/esbuild-dev\.(mjs|cjs|js)/)
|
|
130
|
+
: null;
|
|
131
|
+
const devScriptFile = devScriptMatch?.[0];
|
|
132
|
+
const devScriptMissing = devScriptFile
|
|
133
|
+
? !existsSync(path.join(projectRoot, devScriptFile))
|
|
134
|
+
: false;
|
|
135
|
+
|
|
136
|
+
if (!devScript || devScriptMissing) {
|
|
137
|
+
const candidates = ['esbuild-dev.js', 'esbuild-dev.mjs', 'esbuild-dev.cjs'];
|
|
138
|
+
const available = candidates.find((file) => existsSync(path.join(projectRoot, file)));
|
|
139
|
+
pkg.scripts.dev = `node ${available || 'esbuild-dev.cjs'}`;
|
|
122
140
|
changed = true;
|
|
123
141
|
}
|
|
124
142
|
|
|
@@ -264,7 +282,6 @@ async function main() {
|
|
|
264
282
|
const { pkgPath, pkg } = await readPackageJson();
|
|
265
283
|
const isModule = pkg.type === 'module';
|
|
266
284
|
|
|
267
|
-
await ensurePackageScripts(pkg, pkgPath);
|
|
268
285
|
await ensureEsbuildDependency(pkg, pkgPath);
|
|
269
286
|
|
|
270
287
|
const version = await getPdsCoreVersion();
|
|
@@ -272,6 +289,8 @@ async function main() {
|
|
|
272
289
|
|
|
273
290
|
await copyBootstrapTemplate({ version, generatedAt, isModule });
|
|
274
291
|
|
|
292
|
+
await ensurePackageScripts(pkg, pkgPath);
|
|
293
|
+
|
|
275
294
|
await ensurePdsAssets();
|
|
276
295
|
|
|
277
296
|
log('\n✅ Bootstrap files ready.\n');
|