@ng-shangjc/cli 1.0.2-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.
- package/dist/commands/install.js +13 -4
- package/package.json +1 -1
- package/src/commands/install.ts +17 -5
package/dist/commands/install.js
CHANGED
|
@@ -171,7 +171,9 @@ async function installComponent(componentName, options) {
|
|
|
171
171
|
return;
|
|
172
172
|
}
|
|
173
173
|
try {
|
|
174
|
-
// Install
|
|
174
|
+
// Install the component package itself first
|
|
175
|
+
await installComponentPackage(componentName);
|
|
176
|
+
// Install dependencies after component package is available
|
|
175
177
|
if (dependencies.includes('utils')) {
|
|
176
178
|
await installUtils();
|
|
177
179
|
}
|
|
@@ -180,13 +182,15 @@ async function installComponent(componentName, options) {
|
|
|
180
182
|
if (externalDeps.length > 0) {
|
|
181
183
|
await installExternalDependencies(externalDeps, componentName);
|
|
182
184
|
}
|
|
183
|
-
// Install the component package itself
|
|
184
|
-
await installComponentPackage(componentName);
|
|
185
185
|
// Create destination directory
|
|
186
186
|
const destDir = path.join(process.cwd(), componentsPath, componentName);
|
|
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.
|
|
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
package/src/commands/install.ts
CHANGED
|
@@ -163,7 +163,10 @@ export async function installComponent(
|
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
try {
|
|
166
|
-
// Install
|
|
166
|
+
// Install the component package itself first
|
|
167
|
+
await installComponentPackage(componentName);
|
|
168
|
+
|
|
169
|
+
// Install dependencies after component package is available
|
|
167
170
|
if (dependencies.includes('utils')) {
|
|
168
171
|
await installUtils();
|
|
169
172
|
}
|
|
@@ -174,9 +177,6 @@ export async function installComponent(
|
|
|
174
177
|
await installExternalDependencies(externalDeps, componentName);
|
|
175
178
|
}
|
|
176
179
|
|
|
177
|
-
// Install the component package itself
|
|
178
|
-
await installComponentPackage(componentName);
|
|
179
|
-
|
|
180
180
|
// Create destination directory
|
|
181
181
|
const destDir = path.join(process.cwd(), componentsPath, componentName);
|
|
182
182
|
await fs.ensureDir(destDir);
|
|
@@ -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.
|
|
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
|