@ng-shangjc/cli 1.0.3-beta → 1.0.4-beta

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.
@@ -187,6 +187,10 @@ async function installComponent(componentName, options) {
187
187
  await fs.ensureDir(destDir);
188
188
  // Get source directory from installed npm package
189
189
  const sourceDir = path.join(process.cwd(), 'node_modules', '@ng-shangjc', componentName, 'src', 'lib');
190
+ // Check if source files exist (they should after download fallback)
191
+ if (!fs.existsSync(sourceDir)) {
192
+ throw new Error(`Component source files not found at ${sourceDir}. Installation may have failed.`);
193
+ }
190
194
  // Copy component files
191
195
  const files = COMPONENT_FILES[componentName];
192
196
  for (const file of files) {
@@ -341,7 +345,12 @@ async function downloadComponentFiles(componentName) {
341
345
  const packageSource = path.join(tempDir, 'package.json');
342
346
  const packageTarget = path.join(process.cwd(), 'node_modules', '@ng-shangjc', componentName, 'package.json');
343
347
  if (fs.existsSync(packageSource)) {
344
- fs.copySync(packageSource, packageTarget);
348
+ let packageJson = fs.readJsonSync(packageSource);
349
+ // Fix workspace:* dependencies for published packages
350
+ if (packageJson.peerDependencies && packageJson.peerDependencies['@ng-shangjc/utils'] === 'workspace:*') {
351
+ packageJson.peerDependencies['@ng-shangjc/utils'] = '^0.0.1';
352
+ }
353
+ fs.writeJsonSync(packageTarget, packageJson);
345
354
  }
346
355
  // Clean up temp files
347
356
  fs.removeSync(tempDir);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-shangjc/cli",
3
- "version": "1.0.3-beta",
3
+ "version": "1.0.4-beta",
4
4
  "bin": {
5
5
  "ng-shangjc": "./dist/index.js"
6
6
  },
@@ -184,6 +184,11 @@ export async function installComponent(
184
184
  // Get source directory from installed npm package
185
185
  const sourceDir = path.join(process.cwd(), 'node_modules', '@ng-shangjc', componentName, 'src', 'lib');
186
186
 
187
+ // Check if source files exist (they should after download fallback)
188
+ if (!fs.existsSync(sourceDir)) {
189
+ throw new Error(`Component source files not found at ${sourceDir}. Installation may have failed.`);
190
+ }
191
+
187
192
  // Copy component files
188
193
  const files = COMPONENT_FILES[componentName as keyof typeof COMPONENT_FILES];
189
194
 
@@ -360,7 +365,14 @@ async function downloadComponentFiles(componentName: string) {
360
365
  const packageTarget = path.join(process.cwd(), 'node_modules', '@ng-shangjc', componentName, 'package.json');
361
366
 
362
367
  if (fs.existsSync(packageSource)) {
363
- fs.copySync(packageSource, packageTarget);
368
+ let packageJson = fs.readJsonSync(packageSource);
369
+
370
+ // Fix workspace:* dependencies for published packages
371
+ if (packageJson.peerDependencies && packageJson.peerDependencies['@ng-shangjc/utils'] === 'workspace:*') {
372
+ packageJson.peerDependencies['@ng-shangjc/utils'] = '^0.0.1';
373
+ }
374
+
375
+ fs.writeJsonSync(packageTarget, packageJson);
364
376
  }
365
377
 
366
378
  // Clean up temp files