From 1c3b314c6e6d7804d9383d9fbc7d550fa425ba6d Mon Sep 17 00:00:00 2001 From: VladimirAmiorkov Date: Thu, 24 Oct 2019 15:00:58 +0300 Subject: [PATCH 1/4] chore: change script to pack compat package for release --- build/pack-scripts/pack-compat.ts | 17 +++++++++++++---- nativescript-angular-package/package.json | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) 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" } } From 5cd0905e776d075f88a04c46634f4d30578be09a Mon Sep 17 00:00:00 2001 From: tbozhikov Date: Thu, 24 Oct 2019 17:04:47 +0300 Subject: [PATCH 2/4] chore: rework build script for release to get automatically the version from scoped package --- build/pack-scripts/pack-compat.ts | 37 +++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/build/pack-scripts/pack-compat.ts b/build/pack-scripts/pack-compat.ts index d332e8770..61cde5c88 100644 --- a/build/pack-scripts/pack-compat.ts +++ b/build/pack-scripts/pack-compat.ts @@ -2,35 +2,54 @@ import * as path from "path"; import * as fs from "fs-extra"; import { execSync } from "child_process"; -// var myArgs = process.argv.slice(2); +/** + * Use this script to pack .tgz for nativescript-angular package. The first passed param can be: + * 1. Path to .tgz file - in this case the script replaces the scoped dependency (@nativescript/angular) with it in the package.json file. Then packs. + * 2. Tag or exact version - in this case the script does `npm install --save-exact` to save the exact version (in case if tag). Then packs. + * 3. `auto-version` - this is interpreted by getting version from the scoped package.json file (nativescript-angular folder). + */ + 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"); const tempFolderPath = path.resolve("./temp-compat"); const outFileName = "nativescript-angular-compat.tgz"; +const nsAngularScopedPackageJSONPath = path.resolve("../../nativescript-angular/package.json"); const nsAngularPackagePath = path.resolve("../../nativescript-angular-package"); const packageJsonPath = path.resolve(`${nsAngularPackagePath}/package.json`); console.log("Getting package.json from", packageJsonPath); -let npmInstallParams = ""; -if (scopedVersion.indexOf(".tgz") > 0 || skipInstall === "no-save-exact") { - // rewrite dependency in package.json +function prepareCompatPackageJSON(scopedVersion: string) { const packageJsonObject = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: "utf8" })); packageJsonObject.dependencies["@nativescript/angular"] = scopedVersion; fs.writeFileSync(packageJsonPath, JSON.stringify(packageJsonObject, null, 4)); -} else { - npmInstallParams = `@nativescript/angular@${scopedVersion}`; } -if (skipInstall !== "no-save-exact") { +if (scopedVersion === "auto-version") { + // We use this when build for release. In this case we need to get version from scoped package (nativescript-angular) + // and use it in the compat package. + + scopedVersion = JSON.parse(fs.readFileSync(nsAngularScopedPackageJSONPath, { encoding: "utf8" })).version; + prepareCompatPackageJSON(scopedVersion) +} else { + let npmInstallParams = ""; + + if (scopedVersion.indexOf(".tgz") > 0) { + // If building with .tgz, we need to update the package.json of the compat package + prepareCompatPackageJSON(scopedVersion) + } else { + // If building with tag or exact version, just install it with --save-exact + npmInstallParams = `@nativescript/angular@${scopedVersion}`; + } + execSync(`npm install --save-exact ${npmInstallParams}`, { cwd: nsAngularPackagePath }); -} +} // ensure empty temp and existing dist folders fs.emptyDirSync(tempFolderPath); From 064f71f9bef4eac63ad34bd34cb39252c40a7790 Mon Sep 17 00:00:00 2001 From: Vladimir Amiorkov Date: Thu, 24 Oct 2019 17:45:20 +0300 Subject: [PATCH 3/4] chore: add background color to modal in example (#2034) * chore: add background color to modal in example * chore: revert the change tothe version of nativescript-dev-webpack in test-app-ng --- e2e/tests-app-ng/app/lazy/lazy.component.css | 8 ++++++++ e2e/tests-app-ng/app/lazy/lazy.component.html | 2 +- e2e/tests-app-ng/app/lazy/lazy.component.ts | 1 + e2e/tests-app-ng/package.json | 2 +- e2e/tests-app-ng/tsconfig.json | 3 +++ 5 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 e2e/tests-app-ng/app/lazy/lazy.component.css diff --git a/e2e/tests-app-ng/app/lazy/lazy.component.css b/e2e/tests-app-ng/app/lazy/lazy.component.css new file mode 100644 index 000000000..eec6173f7 --- /dev/null +++ b/e2e/tests-app-ng/app/lazy/lazy.component.css @@ -0,0 +1,8 @@ + +.system-background-color-stack-layout { + background-color: white; +} + +.ns-dark .system-background-color-stack-layout { + background-color: gray; +} diff --git a/e2e/tests-app-ng/app/lazy/lazy.component.html b/e2e/tests-app-ng/app/lazy/lazy.component.html index 6ffd7d2a6..82d691f92 100644 --- a/e2e/tests-app-ng/app/lazy/lazy.component.html +++ b/e2e/tests-app-ng/app/lazy/lazy.component.html @@ -1,4 +1,4 @@ - +