Skip to content

Commit d2fc41f

Browse files
authored
Merge pull request #2035 from NativeScript/amiorkov/pack-scripts-fix
chore: change script to pack compat package for release
2 parents e722877 + 1c3b314 commit d2fc41f

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

build/pack-scripts/pack-compat.ts

+13-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { execSync } from "child_process";
44

55
// var myArgs = process.argv.slice(2);
66
var scopedVersion = process.argv[2];
7+
var skipInstall = process.argv[3];
78
console.log(`Packing nativescript-angular package with @nativescript/angular: ${scopedVersion}`);
89

910
const distFolderPath = path.resolve("../../dist");
@@ -15,7 +16,8 @@ const packageJsonPath = path.resolve(`${nsAngularPackagePath}/package.json`);
1516
console.log("Getting package.json from", packageJsonPath);
1617

1718
let npmInstallParams = "";
18-
if (scopedVersion.indexOf(".tgz") > 0) {
19+
20+
if (scopedVersion.indexOf(".tgz") > 0 || skipInstall === "no-save-exact") {
1921
// rewrite dependency in package.json
2022
const packageJsonObject = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: "utf8" }));
2123
packageJsonObject.dependencies["@nativescript/angular"] = scopedVersion;
@@ -24,14 +26,21 @@ if (scopedVersion.indexOf(".tgz") > 0) {
2426
npmInstallParams = `@nativescript/angular@${scopedVersion}`;
2527
}
2628

27-
execSync(`npm install --save-exact ${npmInstallParams}`, {
28-
cwd: nsAngularPackagePath
29-
});
29+
if (skipInstall !== "no-save-exact") {
30+
execSync(`npm install --save-exact ${npmInstallParams}`, {
31+
cwd: nsAngularPackagePath
32+
});
33+
}
3034

3135
// ensure empty temp and existing dist folders
3236
fs.emptyDirSync(tempFolderPath);
3337
fs.ensureDirSync(distFolderPath);
3438

39+
// Install, run tsc and run ngc
40+
execSync(`npm i && tsc && npm run ngc`, {
41+
cwd: nsAngularPackagePath
42+
});
43+
3544
// create .tgz in temp folder
3645
execSync(`npm pack ${nsAngularPackagePath}`, {
3746
cwd: tempFolderPath

nativescript-angular-package/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@
4646
},
4747
"scripts": {
4848
"ngc": "ngc -p tsconfig.json",
49-
"pack-with-scoped-version": "npm i && tsc && npm run ngc && cd ../build/pack-scripts && npm i && npx ts-node pack-compat.ts"
49+
"pack-with-scoped-version": "cd ../build/pack-scripts && npm i && npx ts-node pack-compat.ts"
5050
}
5151
}

0 commit comments

Comments
 (0)