diff --git a/packages/core/cli/src/commands/pkg.js b/packages/core/cli/src/commands/pkg.js index cd7272a3cd0..6e14551a403 100644 --- a/packages/core/cli/src/commands/pkg.js +++ b/packages/core/cli/src/commands/pkg.js @@ -93,10 +93,18 @@ class Package { if (await fs.exists(file)) { return true; } - file = path.resolve(process.cwd(), 'node_modules', this.packageName, 'package.json'); - if (await fs.exists(file)) { - console.log(chalk.yellowBright(`Skipped: ${this.packageName} is in node_modules`)); - return true; + return false; + } + + async isDepPackage() { + const pkg1 = path.resolve(process.cwd(), 'node_modules', this.packageName, 'package.json'); + const pkg2 = path.resolve(process.cwd(), process.env.PLUGIN_STORAGE_PATH, this.packageName, 'package.json'); + if (await fs.exists(pkg1) && await fs.exists(pkg2)) { + const readPath1 = fs.realpathSync(pkg1); + const readPath2 = fs.realpathSync(pkg2); + if (readPath1 !== readPath2) { + return true; + } } return false; } @@ -117,6 +125,10 @@ class Package { console.log(chalk.yellowBright(`Skipped: ${this.packageName} is dev package`)); return; } + if (await this.isDepPackage()) { + console.log(chalk.yellowBright(`Skipped: ${this.packageName} is dependency package`)); + return; + } if (await this.isDownloaded(options.version)) { return; }