Skip to content

Commit 9568b80

Browse files
authored
Merge pull request #2039 from NativeScript/release-8.20.0
release: cut the 8.20.0 release
2 parents 9678eb0 + 8cd461d commit 9568b80

File tree

7 files changed

+52
-12
lines changed

7 files changed

+52
-12
lines changed

build/pack-scripts/pack-compat.ts

+37-9
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,64 @@ import * as path from "path";
22
import * as fs from "fs-extra";
33
import { execSync } from "child_process";
44

5-
// var myArgs = process.argv.slice(2);
5+
/**
6+
* Use this script to pack .tgz for nativescript-angular package. The first passed param can be:
7+
* 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.
8+
* 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.
9+
* 3. `auto-version` - this is interpreted by getting version from the scoped package.json file (nativescript-angular folder).
10+
*/
11+
612
var scopedVersion = process.argv[2];
13+
714
console.log(`Packing nativescript-angular package with @nativescript/angular: ${scopedVersion}`);
815

916
const distFolderPath = path.resolve("../../dist");
1017
const tempFolderPath = path.resolve("./temp-compat");
1118
const outFileName = "nativescript-angular-compat.tgz";
1219

20+
const nsAngularScopedPackageJSONPath = path.resolve("../../nativescript-angular/package.json");
1321
const nsAngularPackagePath = path.resolve("../../nativescript-angular-package");
1422
const packageJsonPath = path.resolve(`${nsAngularPackagePath}/package.json`);
1523
console.log("Getting package.json from", packageJsonPath);
1624

17-
let npmInstallParams = "";
18-
if (scopedVersion.indexOf(".tgz") > 0) {
19-
// rewrite dependency in package.json
25+
26+
function prepareCompatPackageJSON(scopedVersion: string) {
2027
const packageJsonObject = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: "utf8" }));
2128
packageJsonObject.dependencies["@nativescript/angular"] = scopedVersion;
2229
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJsonObject, null, 4));
23-
} else {
24-
npmInstallParams = `@nativescript/angular@${scopedVersion}`;
2530
}
2631

27-
execSync(`npm install --save-exact ${npmInstallParams}`, {
28-
cwd: nsAngularPackagePath
29-
});
32+
if (scopedVersion === "auto-version") {
33+
// We use this when build for release. In this case we need to get version from scoped package (nativescript-angular)
34+
// and use it in the compat package.
35+
36+
scopedVersion = JSON.parse(fs.readFileSync(nsAngularScopedPackageJSONPath, { encoding: "utf8" })).version;
37+
prepareCompatPackageJSON(scopedVersion)
38+
} else {
39+
let npmInstallParams = "";
40+
41+
if (scopedVersion.indexOf(".tgz") > 0) {
42+
// If building with .tgz, we need to update the package.json of the compat package
43+
prepareCompatPackageJSON(scopedVersion)
44+
} else {
45+
// If building with tag or exact version, just install it with --save-exact
46+
npmInstallParams = `@nativescript/angular@${scopedVersion}`;
47+
}
48+
49+
execSync(`npm install --save-exact ${npmInstallParams}`, {
50+
cwd: nsAngularPackagePath
51+
});
52+
}
3053

3154
// ensure empty temp and existing dist folders
3255
fs.emptyDirSync(tempFolderPath);
3356
fs.ensureDirSync(distFolderPath);
3457

58+
// Install, run tsc and run ngc
59+
execSync(`npm i && tsc && npm run ngc`, {
60+
cwd: nsAngularPackagePath
61+
});
62+
3563
// create .tgz in temp folder
3664
execSync(`npm pack ${nsAngularPackagePath}`, {
3765
cwd: tempFolderPath
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
.system-background-color-stack-layout {
3+
background-color: white;
4+
}
5+
6+
.ns-dark .system-background-color-stack-layout {
7+
background-color: gray;
8+
}

e2e/tests-app-ng/app/lazy/lazy.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<StackLayout>
1+
<StackLayout class="system-background-color-stack-layout">
22
<GridLayout rows="auto" columns="auto" [visibility]="isModal ? 'visible' : 'collapsed'">
33
<Button
44
automationText="closeModal"

e2e/tests-app-ng/app/lazy/lazy.component.ts

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { ModalDialogParams } from "nativescript-angular/directives/dialogs";
77
selector: "ns-lazy",
88
moduleId: module.id,
99
templateUrl: "./lazy.component.html",
10+
styleUrls: ["./lazy.component.css"]
1011
})
1112
export class LazyComponent {
1213
public isModal: boolean;

e2e/tests-app-ng/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"@angular/platform-browser": "~8.2.0",
2222
"@angular/platform-browser-dynamic": "~8.2.0",
2323
"@angular/router": "~8.2.0",
24-
"nativescript-angular": "file:../../nativescript-angular",
24+
"nativescript-angular": "file:../../nativescript-angular-package",
2525
"nativescript-intl": "~3.0.0",
2626
"nativescript-theme-core": "^1.0.4",
2727
"reflect-metadata": "~0.1.8",

e2e/tests-app-ng/tsconfig.json

+3
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@
2424
}
2525
},
2626
"include": [
27+
"../../nativescript-angular-package",
2728
"../../nativescript-angular",
2829
"**/*"
2930
],
3031
"exclude": [
32+
"../../nativescript-angular-package/node_modules",
33+
"../../nativescript-angular-package/**/*.d.ts",
3134
"../../nativescript-angular/node_modules",
3235
"../../nativescript-angular/**/*.d.ts",
3336
"node_modules",

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)