@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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pure-ds/core",
3
3
  "shortname": "pds",
4
- "version": "0.5.34",
4
+ "version": "0.5.38",
5
5
  "description": "Pure Design System - Why develop a Design System when you can generate one?",
6
6
  "repository": {
7
7
  "type": "git",
@@ -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 esbuildTemplate = isModule ? 'esbuild-dev.mjs' : 'esbuild-dev.cjs';
111
- const esbuildSource = path.join(templateRoot, esbuildTemplate);
112
- const esbuildTarget = path.join(projectRoot, 'esbuild-dev.js');
113
- await copyFileIfMissing(esbuildSource, esbuildTarget);
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
- if (!pkg.scripts.dev) {
121
- pkg.scripts.dev = 'node esbuild-dev.js';
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');