Skip to content

Commit cb0292f

Browse files
committed
fix: update compat build script to work correctly with save-exact
1 parent 916bc85 commit cb0292f

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

Diff for: build/pack-scripts/pack-compat.ts

+11-6
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,17 @@ const nsAngularPackagePath = path.resolve("../../nativescript-angular-package");
1414
const packageJsonPath = path.resolve(`${nsAngularPackagePath}/package.json`);
1515
console.log("Getting package.json from", packageJsonPath);
1616

17-
// rewrite dependency in package.json
18-
const packageJsonObject = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: "utf8" }));
19-
packageJsonObject.dependencies["@nativescript/angular"] = scopedVersion;
20-
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJsonObject, null, 4));
21-
22-
execSync(`npm install --save-exact`, {
17+
let npmInstallParams = "";
18+
if (scopedVersion.indexOf(".tgz") > 0) {
19+
// rewrite dependency in package.json
20+
const packageJsonObject = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: "utf8" }));
21+
packageJsonObject.dependencies["@nativescript/angular"] = scopedVersion;
22+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJsonObject, null, 4));
23+
} else {
24+
npmInstallParams = `@nativescript/angular@${scopedVersion}`;
25+
}
26+
27+
execSync(`npm install --save-exact ${npmInstallParams}`, {
2328
cwd: nsAngularPackagePath
2429
});
2530

0 commit comments

Comments
 (0)