Skip to content

Commit 9e0f59b

Browse files
authored
Merge pull request #2014 from NativeScript/tbozhikov/scoped-package
chore: add scoped package
2 parents e1b9328 + f82e9aa commit 9e0f59b

File tree

81 files changed

+377
-111
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+377
-111
lines changed

Diff for: .gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ node_modules
22
platforms
33
hooks
44
tags
5+
dist
56
**/*.js.map
67
**/*.metadata.json
78

@@ -14,6 +15,15 @@ tags
1415
!/nativescript-angular/gulpfile.js
1516
!/nativescript-angular/zone-js/dist/*.js
1617

18+
/nativescript-angular-package/**/*.d.ts
19+
/nativescript-angular-package/**/*.js
20+
21+
!/nativescript-angular-package/global.d.ts
22+
!/nativescript-angular-package/postinstall.js
23+
!/nativescript-angular-package/hooks/**/*.js
24+
!/nativescript-angular-package/gulpfile.js
25+
!/nativescript-angular-package/zone-js/dist/*.js
26+
1727
.tscache
1828
.nvm
1929
.vscode
@@ -46,3 +56,4 @@ tsconfig.tns.json
4656
!.vscode/tasks.json
4757
!.vscode/launch.json
4858
!.vscode/extensions.json
59+

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

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import * as path from "path";
2+
import * as fs from "fs-extra";
3+
import { execSync } from "child_process";
4+
5+
// var myArgs = process.argv.slice(2);
6+
var scopedVersion = process.argv[2];
7+
console.log(`Packing nativescript-angular package with @nativescript/angular: ${scopedVersion}`);
8+
9+
const distFolderPath = path.resolve("../../dist");
10+
const tempFolderPath = path.resolve("./temp-compat");
11+
const outFileName = "nativescript-angular-compat.tgz";
12+
13+
const nsAngularPackagePath = path.resolve("../../nativescript-angular-package");
14+
const packageJsonPath = path.resolve(`${nsAngularPackagePath}/package.json`);
15+
console.log("Getting package.json from", packageJsonPath);
16+
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}`, {
28+
cwd: nsAngularPackagePath
29+
});
30+
31+
// ensure empty temp and existing dist folders
32+
fs.emptyDirSync(tempFolderPath);
33+
fs.ensureDirSync(distFolderPath);
34+
35+
// create .tgz in temp folder
36+
execSync(`npm pack ${nsAngularPackagePath}`, {
37+
cwd: tempFolderPath
38+
});
39+
40+
// assume we have a single file built in temp folder, take its name
41+
const currentFileName = fs.readdirSync(tempFolderPath)[0];
42+
43+
// move built file and remove temp folder
44+
fs.moveSync(`${tempFolderPath}/${currentFileName}`, `${distFolderPath}/${outFileName}`, { overwrite: true });
45+
fs.removeSync(`${tempFolderPath}`);

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

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import * as path from "path";
2+
import * as fs from "fs-extra";
3+
import { execSync } from "child_process";
4+
5+
console.log(`Packing @nativescript/angular package`);
6+
7+
const distFolderPath = path.resolve("../../dist");
8+
const tempFolderPath = path.resolve("./temp-scoped");
9+
const outFileName = "nativescript-angular-scoped.tgz";
10+
11+
const nsAngularPackagePath = path.resolve("../../nativescript-angular");
12+
13+
execSync(`npm install --save-exact`, {
14+
cwd: nsAngularPackagePath
15+
});
16+
17+
// ensure empty temp and dist folders
18+
fs.emptyDirSync(tempFolderPath);
19+
fs.ensureDirSync(distFolderPath);
20+
21+
// create .tgz in temp folder
22+
execSync(`npm pack ${nsAngularPackagePath}`, {
23+
cwd: tempFolderPath
24+
});
25+
26+
// assume we have a single file built in temp folder, take its name
27+
const currentFileName = fs.readdirSync(tempFolderPath)[0];
28+
29+
// move built file and remove temp folder
30+
fs.moveSync(`${tempFolderPath}/${currentFileName}`, `${distFolderPath}/${outFileName}`, { overwrite: true });
31+
fs.removeSync(`${tempFolderPath}`);

Diff for: build/pack-scripts/package.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "build",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "prepublish-next.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"author": "",
10+
"license": "ISC",
11+
"devDependencies": {
12+
"@types/node": "^12.7.12",
13+
"fs-extra": "^8.1.0",
14+
"rimraf": "^3.0.0",
15+
"ts-node": "^8.4.1",
16+
"typescript": "^3.6.4"
17+
}
18+
}

Diff for: build/pack-scripts/tsconfig.json

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"compilerOptions": {
3+
"module": "commonjs",
4+
"target": "es5",
5+
"experimentalDecorators": true,
6+
"emitDecoratorMetadata": true,
7+
"noEmitHelpers": true,
8+
"noEmitOnError": true,
9+
"lib": [
10+
"es6",
11+
"dom",
12+
"es2015.iterable"
13+
],
14+
"types": [
15+
"node"
16+
],
17+
"typeRoots": [ "./node_modules/@types" ]
18+
},
19+
"include": [
20+
"./**/*.ts"
21+
],
22+
"exclude": [
23+
"node_modules"
24+
]
25+
}

Diff for: e2e/animation-examples/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-theme-core": "~1.0.2",
2626
"reflect-metadata": "~0.1.8",
2727
"rxjs": "^6.4.0",

Diff for: e2e/animation-examples/tsconfig.json

+3
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@
2323
}
2424
},
2525
"include": [
26+
"../../nativescript-angular-package",
2627
"../../nativescript-angular",
2728
"**/*"
2829
],
2930
"exclude": [
31+
"../../nativescript-angular-package/node_modules",
32+
"../../nativescript-angular-package/**/*.d.ts",
3033
"../../nativescript-angular/node_modules",
3134
"../../nativescript-angular/**/*.d.ts",
3235
"node_modules",

Diff for: e2e/modal-navigation-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-theme-core": "~1.0.4",
2626
"reflect-metadata": "~0.1.8",
2727
"rxjs": "^6.4.0",

Diff for: e2e/modal-navigation-ng/tsconfig.json

+3
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@
2323
}
2424
},
2525
"include": [
26+
"../../nativescript-angular-package",
2627
"../../nativescript-angular",
2728
"**/*"
2829
],
2930
"exclude": [
31+
"../../nativescript-angular-package/node_modules",
32+
"../../nativescript-angular-package/**/*.d.ts",
3033
"../../nativescript-angular/node_modules",
3134
"../../nativescript-angular/**/*.d.ts",
3235
"node_modules",

Diff for: e2e/nested-router-tab-view/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"@angular/platform-browser": "~8.2.0",
1616
"@angular/platform-browser-dynamic": "~8.2.0",
1717
"@angular/router": "~8.2.0",
18-
"nativescript-angular": "file:../../nativescript-angular",
18+
"nativescript-angular": "file:../../nativescript-angular-package",
1919
"nativescript-theme-core": "~1.0.4",
2020
"reflect-metadata": "~0.1.8",
2121
"rxjs": "^6.4.0",

Diff for: e2e/nested-router-tab-view/tsconfig.json

+3
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@
2323
}
2424
},
2525
"include": [
26+
"../../nativescript-angular-package",
2627
"../../nativescript-angular",
2728
"**/*"
2829
],
2930
"exclude": [
31+
"../../nativescript-angular-package/node_modules",
32+
"../../nativescript-angular-package/**/*.d.ts",
3033
"../../nativescript-angular/node_modules",
3134
"../../nativescript-angular/**/*.d.ts",
3235
"node_modules",

Diff for: e2e/renderer/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"@angular/platform-browser": "~8.2.0",
1616
"@angular/platform-browser-dynamic": "~8.2.0",
1717
"@angular/router": "~8.2.0",
18-
"nativescript-angular": "file:../../nativescript-angular",
18+
"nativescript-angular": "file:../../nativescript-angular-package",
1919
"nativescript-theme-core": "~1.0.4",
2020
"reflect-metadata": "~0.1.8",
2121
"rxjs": "^6.4.0",

Diff for: e2e/renderer/tsconfig.json

+3
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@
2323
}
2424
},
2525
"include": [
26+
"../../nativescript-angular-package",
2627
"../../nativescript-angular",
2728
"**/*"
2829
],
2930
"exclude": [
31+
"../../nativescript-angular-package/node_modules",
32+
"../../nativescript-angular-package/**/*.d.ts",
3033
"../../nativescript-angular/node_modules",
3134
"../../nativescript-angular/**/*.d.ts",
3235
"node_modules",

Diff for: e2e/routable-animations/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"@angular/platform-browser": "~8.2.0",
1616
"@angular/platform-browser-dynamic": "~8.2.0",
1717
"@angular/router": "~8.2.0",
18-
"nativescript-angular": "next",
18+
"nativescript-angular": "file:../../nativescript-angular-package",
1919
"nativescript-theme-core": "~1.0.2",
2020
"reflect-metadata": "~0.1.8",
2121
"rxjs": "^6.4.0",

Diff for: e2e/routable-animations/tsconfig.json

+3
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@
2323
}
2424
},
2525
"include": [
26+
"../../nativescript-angular-package",
2627
"../../nativescript-angular",
2728
"**/*"
2829
],
2930
"exclude": [
31+
"../../nativescript-angular-package/node_modules",
32+
"../../nativescript-angular-package/**/*.d.ts",
3033
"../../nativescript-angular/node_modules",
3134
"../../nativescript-angular/**/*.d.ts",
3235
"node_modules",

Diff for: e2e/router-tab-view/app/app.component.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { Component, OnInit, AfterViewInit, AfterContentInit, ViewChild } from "@angular/core";
1+
import { Component, ViewChild } from "@angular/core";
22
import { TabViewDirective } from "nativescript-angular/directives";
33
import { Router, NavigationEnd } from "@angular/router";
44
import { NSLocationStrategy } from "nativescript-angular/router/ns-location-strategy";
55

6-
76
@Component({
87
selector: "ns-app",
98
templateUrl: "app.component.html",

Diff for: e2e/router-tab-view/app/app.module.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import { AppComponent } from "./app.component";
55

66
import { DataService } from "./data.service";
77

8-
import { enable as traceEnable, addCategories } from "tns-core-modules/trace";
9-
import { routerTraceCategory } from "nativescript-angular/trace";
8+
import { enable as traceEnable } from "tns-core-modules/trace";
109

1110
// addCategories(routerTraceCategory);
1211
traceEnable();

Diff for: e2e/router-tab-view/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"@angular/platform-browser": "~8.2.0",
1616
"@angular/platform-browser-dynamic": "~8.2.0",
1717
"@angular/router": "~8.2.0",
18-
"nativescript-angular": "file:../../nativescript-angular",
18+
"nativescript-angular": "file:../../nativescript-angular-package",
1919
"nativescript-theme-core": "~1.0.4",
2020
"reflect-metadata": "~0.1.8",
2121
"rxjs": "^6.4.0",

Diff for: e2e/router-tab-view/tsconfig.json

+3
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@
2323
}
2424
},
2525
"include": [
26+
"../../nativescript-angular-package",
2627
"../../nativescript-angular",
2728
"**/*"
2829
],
2930
"exclude": [
31+
"../../nativescript-angular-package/node_modules",
32+
"../../nativescript-angular-package/**/*.d.ts",
3033
"../../nativescript-angular/node_modules",
3134
"../../nativescript-angular/**/*.d.ts",
3235
"node_modules",

Diff for: e2e/router/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"@angular/platform-browser": "~8.2.0",
1616
"@angular/platform-browser-dynamic": "~8.2.0",
1717
"@angular/router": "~8.2.0",
18-
"nativescript-angular": "file:../../nativescript-angular",
18+
"nativescript-angular": "file:../../nativescript-angular-package",
1919
"nativescript-intl": "^3.0.0",
2020
"reflect-metadata": "~0.1.8",
2121
"rxjs": "^6.4.0",

Diff for: e2e/router/tsconfig.json

+3
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@
2323
}
2424
},
2525
"include": [
26+
"../../nativescript-angular-package",
2627
"../../nativescript-angular",
2728
"**/*"
2829
],
2930
"exclude": [
31+
"../../nativescript-angular-package/node_modules",
32+
"../../nativescript-angular-package/**/*.d.ts",
3033
"../../nativescript-angular/node_modules",
3134
"../../nativescript-angular/**/*.d.ts",
3235
"node_modules",

Diff for: e2e/single-page/app/app.module.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { NgModule, NgModuleFactoryLoader, NO_ERRORS_SCHEMA } from "@angular/core";
22
import { NativeScriptModule } from "nativescript-angular/nativescript.module";
33
import { NSModuleFactoryLoader } from "nativescript-angular/router";
4+
import { isNavigationButton } from "nativescript-angular/directives/action-bar";
45

56
import {
67
AppRoutingModule,
@@ -9,7 +10,7 @@ import {
910

1011
import { AppComponent } from "./app.component";
1112

12-
import { rendererTraceCategory, viewUtilCategory, routeReuseStrategyTraceCategory, routerTraceCategory } from "nativescript-angular/trace";
13+
import { routeReuseStrategyTraceCategory, routerTraceCategory } from "nativescript-angular/trace";
1314
import { setCategories, enable } from "tns-core-modules/trace";
1415
import { ModalComponent } from "./second/modal/modal.component";
1516
setCategories(routerTraceCategory + "," + routeReuseStrategyTraceCategory);

Diff for: e2e/single-page/app/first/first.component.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
import { Component, OnInit, OnDestroy, OnChanges } from "@angular/core";
2-
import { ActivatedRoute, Router, Route } from "@angular/router";
3-
import { Location } from "@angular/common";
1+
import { Component, OnInit, OnDestroy } from "@angular/core";
42

53
import { Page } from "tns-core-modules/ui/page";
6-
import { Observable } from "rxjs";
7-
import { FrameService } from "nativescript-angular/platform-providers";
84

95
@Component({
106
selector: "first",

Diff for: e2e/single-page/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"@angular/platform-browser": "~8.2.0",
1616
"@angular/platform-browser-dynamic": "~8.2.0",
1717
"@angular/router": "~8.2.0",
18-
"nativescript-angular": "file:../../nativescript-angular",
18+
"nativescript-angular": "file:../../nativescript-angular-package",
1919
"nativescript-intl": "^3.0.0",
2020
"reflect-metadata": "~0.1.8",
2121
"rxjs": "^6.4.0",

Diff for: e2e/single-page/tsconfig.json

+3
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@
2323
}
2424
},
2525
"include": [
26+
"../../nativescript-angular-package",
2627
"../../nativescript-angular",
2728
"**/*"
2829
],
2930
"exclude": [
31+
"../../nativescript-angular-package/node_modules",
32+
"../../nativescript-angular-package/**/*.d.ts",
3033
"../../nativescript-angular/node_modules",
3134
"../../nativescript-angular/**/*.d.ts",
3235
"node_modules",

Diff for: nativescript-angular-package/.npmignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
*.tgz
2+
3+
*.ts
4+
!*.d.ts
5+
6+
*.js.map
7+
8+
tsconfig.json
9+
global.d.ts
10+
.npmignore
11+
gulpfile.js
12+
tslint.json

0 commit comments

Comments
 (0)