diff --git a/packages/blerf/src/commands/bundle.ts b/packages/blerf/src/commands/bundle.ts index 5b40f06..324ca58 100644 --- a/packages/blerf/src/commands/bundle.ts +++ b/packages/blerf/src/commands/bundle.ts @@ -27,7 +27,7 @@ export class BundleEnumerator extends PackageEnumerator { // NOTE: assuming file name of tarball; can also get it from the output of npm pack const tempPath = fs.mkdtempSync(path.join(os.tmpdir(), "blerf-")); - const artifactPackTarPath = path.join(this.artifactPackPath, packageJson.name + ".tgz"); + const artifactPackTarPath = path.join(this.artifactPackPath, packageJson.name + "-" + packageJson.version + ".tgz"); const artifactTarPath = path.join(this.artifactDeployPath, packageJson.name + "-" + packageJson.version + ".tgz"); fs.mkdirSync(this.artifactDeployPath, { recursive: true }); diff --git a/packages/blerf/src/commands/pack.ts b/packages/blerf/src/commands/pack.ts index d946a6e..5d690f2 100644 --- a/packages/blerf/src/commands/pack.ts +++ b/packages/blerf/src/commands/pack.ts @@ -32,7 +32,7 @@ export class PackEnumerator extends PackageEnumerator { const sourcePackageTarPath = path.join(packagePath, packageJson.name + "-" + packageJson.version + ".tgz"); const tempPath = fs.mkdtempSync(path.join(os.tmpdir(), "blerf-")); - const artifactPackTarPath = path.join(this.artifactPackPath, packageJson.name + ".tgz"); + const artifactPackTarPath = path.join(this.artifactPackPath, packageJson.name + "-" + packageJson.version + ".tgz"); fs.mkdirSync(this.artifactPackPath, { recursive: true }); @@ -53,8 +53,8 @@ export class PackEnumerator extends PackageEnumerator { // Resolve all file:-based dependencies to explicit versions const packageJson = this.readPackageJson(packageJsonPath); if (this.isDeploy) { - this.rewriteProjectReferencesFullPath(artifactPackFullPath, packageJson.dependencies, packages); - this.rewriteProjectReferencesFullPath(artifactPackFullPath, packageJson.devDependencies, packages); + this.rewriteProjectReferencesFullPathVersion(artifactPackFullPath, packageJson.dependencies, packages); + this.rewriteProjectReferencesFullPathVersion(artifactPackFullPath, packageJson.devDependencies, packages); } else { this.rewriteProjectReferencesVersion(packageJson.dependencies, packages); this.rewriteProjectReferencesVersion(packageJson.devDependencies, packages); diff --git a/packages/blerf/src/packageEnumerator.ts b/packages/blerf/src/packageEnumerator.ts index dba2398..832f16c 100644 --- a/packages/blerf/src/packageEnumerator.ts +++ b/packages/blerf/src/packageEnumerator.ts @@ -134,6 +134,22 @@ export abstract class PackageEnumerator { } } + protected rewriteProjectReferencesFullPathVersion(artifactPackFullPath: string, packageDependencies: any, packages: PackagesType) { + if (!packageDependencies) { + return; + } + + for (let dependencyName of Object.keys(packageDependencies)) { + const ref = packageDependencies[dependencyName]; + if (!ref.startsWith("file:")) { + continue; + } + + const dependencyPackageInfo = packages[dependencyName]; + packageDependencies[dependencyName] = path.join(artifactPackFullPath, dependencyPackageInfo.packageJson.name + "-" + dependencyPackageInfo.packageJson.version + ".tgz"); + } + } + protected rewriteProjectReferencesVersion(packageDependencies: any, packages: PackagesType) { if (!packageDependencies) { return;