diff --git a/build/pack-scripts/pack-compat.ts b/build/pack-scripts/pack-compat.ts index 0667e0e05..d332e8770 100644 --- a/build/pack-scripts/pack-compat.ts +++ b/build/pack-scripts/pack-compat.ts @@ -4,6 +4,7 @@ import { execSync } from "child_process"; // var myArgs = process.argv.slice(2); var scopedVersion = process.argv[2]; +var skipInstall = process.argv[3]; console.log(`Packing nativescript-angular package with @nativescript/angular: ${scopedVersion}`); const distFolderPath = path.resolve("../../dist"); @@ -15,7 +16,8 @@ const packageJsonPath = path.resolve(`${nsAngularPackagePath}/package.json`); console.log("Getting package.json from", packageJsonPath); let npmInstallParams = ""; -if (scopedVersion.indexOf(".tgz") > 0) { + +if (scopedVersion.indexOf(".tgz") > 0 || skipInstall === "no-save-exact") { // rewrite dependency in package.json const packageJsonObject = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: "utf8" })); packageJsonObject.dependencies["@nativescript/angular"] = scopedVersion; @@ -24,14 +26,21 @@ if (scopedVersion.indexOf(".tgz") > 0) { npmInstallParams = `@nativescript/angular@${scopedVersion}`; } -execSync(`npm install --save-exact ${npmInstallParams}`, { - cwd: nsAngularPackagePath -}); +if (skipInstall !== "no-save-exact") { + execSync(`npm install --save-exact ${npmInstallParams}`, { + cwd: nsAngularPackagePath + }); +} // ensure empty temp and existing dist folders fs.emptyDirSync(tempFolderPath); fs.ensureDirSync(distFolderPath); +// Install, run tsc and run ngc +execSync(`npm i && tsc && npm run ngc`, { + cwd: nsAngularPackagePath +}); + // create .tgz in temp folder execSync(`npm pack ${nsAngularPackagePath}`, { cwd: tempFolderPath diff --git a/nativescript-angular-package/package.json b/nativescript-angular-package/package.json index 9dbef3146..83eb60e08 100644 --- a/nativescript-angular-package/package.json +++ b/nativescript-angular-package/package.json @@ -46,6 +46,6 @@ }, "scripts": { "ngc": "ngc -p tsconfig.json", - "pack-with-scoped-version": "npm i && tsc && npm run ngc && cd ../build/pack-scripts && npm i && npx ts-node pack-compat.ts" + "pack-with-scoped-version": "cd ../build/pack-scripts && npm i && npx ts-node pack-compat.ts" } }