Skip to content

Commit e4dc301

Browse files
committed
feat(angular): update to 9 official
1 parent 182ce2e commit e4dc301

File tree

9 files changed

+103
-77
lines changed

9 files changed

+103
-77
lines changed

Diff for: e2e/ivy-sample/package.json

+15-14
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,30 @@
55
"version": "6.2.0"
66
},
77
"tns-ios": {
8-
"version": "6.2.0"
8+
"version": "6.3.0-2020-01-07-173547-01"
99
}
1010
},
1111
"description": "NativeScript Application",
1212
"license": "SEE LICENSE IN <your-license-filename>",
1313
"repository": "<fill-your-repository-here>",
1414
"dependencies": {
15-
"@angular/animations": "9.0.0-rc.3",
16-
"@angular/common": "9.0.0-rc.3",
17-
"@angular/compiler": "9.0.0-rc.3",
18-
"@angular/core": "9.0.0-rc.3",
19-
"@angular/forms": "9.0.0-rc.3",
20-
"@angular/platform-browser": "9.0.0-rc.3",
21-
"@angular/platform-browser-dynamic": "9.0.0-rc.3",
22-
"@angular/router": "9.0.0-rc.3",
15+
"@angular/animations": "~9.0.1",
16+
"@angular/common": "~9.0.1",
17+
"@angular/compiler": "~9.0.1",
18+
"@angular/compiler-cli": "~9.0.1",
19+
"@angular/core": "~9.0.1",
20+
"@angular/forms": "~9.0.1",
21+
"@angular/platform-browser": "~9.0.1",
22+
"@angular/platform-browser-dynamic": "~9.0.1",
23+
"@angular/router": "~9.0.1",
2324
"@nativescript/theme": "~2.2.0",
2425
"kinvey-nativescript-sdk": "~4.2.5",
25-
"nativescript-angular": "file:../../dist/nativescript-angular-compat.tgz",
26+
"@nativescript/angular": "file:../../nativescript-angular/nativescript-angular-9.0.0.tgz",
2627
"nativescript-background-http": "~4.2.1",
2728
"nativescript-bottom-navigation": "~2.0.5",
2829
"nativescript-brightness": "~1.0.1",
2930
"nativescript-camera": "~4.5.0",
30-
"nativescript-cloud": "~1.19.3",
31+
"nativescript-cloud": "~1.20.0",
3132
"nativescript-directions": "~1.3.1",
3233
"nativescript-downloader": "~2.1.5",
3334
"nativescript-drop-down": "~5.0.4",
@@ -51,14 +52,14 @@
5152
"nativescript-ui-listview": "~8.0.1",
5253
"nativescript-ui-sidedrawer": "~8.0.0",
5354
"reflect-metadata": "~0.1.12",
54-
"rxjs": "^6.4.0",
55+
"rxjs": "^6.5.0",
5556
"tns-core-modules": "~6.3.0",
5657
"tslib": "~1.10.0",
5758
"zone.js": "~0.10.2"
5859
},
5960
"devDependencies": {
60-
"@angular/compiler-cli": "next",
61-
"@ngtools/webpack": "next",
61+
"@angular/compiler-cli": "~9.0.1",
62+
"@ngtools/webpack": "~9.0.1",
6263
"nativescript-dev-webpack": "~1.4.0",
6364
"typescript": "~3.6.4"
6465
},

Diff for: e2e/ivy-sample/src/app/app-routing.module.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { NgModule } from "@angular/core";
2-
import { NativeScriptRouterModule } from "nativescript-angular/router";
2+
import { NativeScriptRouterModule } from "@nativescript/angular";
33
import { Routes } from "@angular/router";
44

55
import { ItemsComponent } from "./item/items.component";

Diff for: e2e/ivy-sample/src/app/app.module.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
2-
import { NativeScriptModule } from "nativescript-angular/nativescript.module";
2+
import { NativeScriptModule } from "@nativescript/angular";
33

44
import { AppRoutingModule } from "./app-routing.module";
55
import { AppComponent } from "./app.component";

Diff for: e2e/ivy-sample/src/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// this import should be first in order to load some required settings (like globals and reflect-metadata)
2-
import { platformNativeScriptDynamic } from "nativescript-angular/platform";
2+
import { platformNativeScriptDynamic } from '@nativescript/angular/platform';
33

44
import { AppModule } from "./app/app.module";
55

Diff for: e2e/ivy-sample/webpack.config.js

+28-9
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const { nsReplaceBootstrap } = require("nativescript-dev-webpack/transformers/ns
77
const { nsReplaceLazyLoader } = require("nativescript-dev-webpack/transformers/ns-replace-lazy-loader");
88
const { nsSupportHmrNg } = require("nativescript-dev-webpack/transformers/ns-support-hmr-ng");
99
const { getMainModulePath } = require("nativescript-dev-webpack/utils/ast-utils");
10-
const { getNoEmitOnErrorFromTSConfig } = require("nativescript-dev-webpack/utils/tsconfig-utils");
10+
const { getNoEmitOnErrorFromTSConfig, getCompilerOptionsFromTSConfig } = require("nativescript-dev-webpack/utils/tsconfig-utils");
1111
const CleanWebpackPlugin = require("clean-webpack-plugin");
1212
const CopyWebpackPlugin = require("copy-webpack-plugin");
1313
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
@@ -60,8 +60,28 @@ module.exports = env => {
6060
const isAnySourceMapEnabled = !!sourceMap || !!hiddenSourceMap;
6161
const externals = nsWebpack.getConvertedExternals(env.externals);
6262
const appFullPath = resolve(projectRoot, appPath);
63-
const appResourcesFullPath = resolve(projectRoot, appResourcesPath);
6463
const tsConfigName = "tsconfig.tns.json";
64+
const tsConfigPath = join(__dirname, tsConfigName);
65+
const hasRootLevelScopedModules = nsWebpack.hasRootLevelScopedModules({ projectDir: projectRoot });
66+
const hasRootLevelScopedAngular = nsWebpack.hasRootLevelScopedAngular({ projectDir: projectRoot });
67+
let coreModulesPackageName = "tns-core-modules";
68+
const alias = {
69+
'~': appFullPath
70+
};
71+
72+
const compilerOptions = getCompilerOptionsFromTSConfig(tsConfigPath);
73+
if (hasRootLevelScopedModules) {
74+
coreModulesPackageName = "@nativescript/core";
75+
alias["tns-core-modules"] = coreModulesPackageName;
76+
nsWebpack.processTsPathsForScopedModules({ compilerOptions });
77+
}
78+
79+
if (hasRootLevelScopedAngular) {
80+
alias["nativescript-angular"] = "@nativescript/angular";
81+
nsWebpack.processTsPathsForScopedAngular({ compilerOptions });
82+
}
83+
84+
const appResourcesFullPath = resolve(projectRoot, appResourcesPath);
6585
const entryModule = `${nsWebpack.getEntryModule(appFullPath, platform)}.ts`;
6686
const entryPath = `.${sep}${entryModule}`;
6787
const entries = { bundle: entryPath };
@@ -98,10 +118,11 @@ module.exports = env => {
98118
hostReplacementPaths: nsWebpack.getResolver([platform, "tns"]),
99119
platformTransformers: ngCompilerTransformers.map(t => t(() => ngCompilerPlugin, resolve(appFullPath, entryModule), projectRoot)),
100120
mainPath: join(appFullPath, entryModule),
101-
tsConfigPath: join(__dirname, tsConfigName),
121+
tsConfigPath,
102122
skipCodeGeneration: !aot,
103123
sourceMap: !!isAnySourceMapEnabled,
104-
additionalLazyModuleResources: additionalLazyModuleResources
124+
additionalLazyModuleResources: additionalLazyModuleResources,
125+
compilerOptions: { paths: compilerOptions.paths }
105126
});
106127

107128
let sourceMapFilename = nsWebpack.getSourceMapFilename(hiddenSourceMap, __dirname, dist);
@@ -141,14 +162,12 @@ module.exports = env => {
141162
extensions: [".ts", ".js", ".scss", ".css"],
142163
// Resolve {N} system modules from tns-core-modules
143164
modules: [
144-
resolve(__dirname, "node_modules/tns-core-modules"),
165+
resolve(__dirname, `node_modules/${coreModulesPackageName}`),
145166
resolve(__dirname, "node_modules"),
146-
"node_modules/tns-core-modules",
167+
`node_modules/${coreModulesPackageName}`,
147168
"node_modules",
148169
],
149-
alias: {
150-
'~': appFullPath
151-
},
170+
alias,
152171
symlinks: true
153172
},
154173
resolveLoader: {

Diff for: nativescript-angular-package/package.json

+11-11
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@
2626
"@nativescript/angular": "../dist/nativescript-angular-scoped.tgz"
2727
},
2828
"devDependencies": {
29-
"@angular/animations": "9.0.0-rc.3",
30-
"@angular/common": "9.0.0-rc.3",
31-
"@angular/compiler": "9.0.0-rc.3",
32-
"@angular/compiler-cli": "9.0.0-rc.3",
33-
"@angular/core": "9.0.0-rc.3",
34-
"@angular/forms": "9.0.0-rc.3",
35-
"@angular/platform-browser": "9.0.0-rc.3",
36-
"@angular/platform-browser-dynamic": "9.0.0-rc.3",
37-
"@angular/router": "9.0.0-rc.3",
38-
"rxjs": "^6.4.0",
39-
"tns-core-modules": "next",
29+
"@angular/animations": "~9.0.1",
30+
"@angular/common": "~9.0.1",
31+
"@angular/compiler": "~9.0.1",
32+
"@angular/compiler-cli": "~9.0.1",
33+
"@angular/core": "~9.0.1",
34+
"@angular/forms": "~9.0.1",
35+
"@angular/platform-browser": "~9.0.1",
36+
"@angular/platform-browser-dynamic": "~9.0.1",
37+
"@angular/router": "~9.0.1",
38+
"rxjs": "^6.5.0",
39+
"tns-core-modules": "~6.3.0",
4040
"typescript": "~3.6.4",
4141
"zone.js": "~0.10.2"
4242
},

Diff for: nativescript-angular/package.json

+19-19
Original file line numberDiff line numberDiff line change
@@ -42,33 +42,33 @@
4242
"reflect-metadata": "^0.1.8"
4343
},
4444
"peerDependencies": {
45-
"@angular/platform-browser-dynamic": "9.0.0-rc.3",
46-
"@angular/common": "9.0.0-rc.3",
47-
"@angular/compiler": "9.0.0-rc.3",
48-
"@angular/core": "9.0.0-rc.3",
49-
"@angular/forms": "9.0.0-rc.3",
50-
"@angular/platform-browser": "9.0.0-rc.3",
51-
"@angular/router": "9.0.0-rc.3",
45+
"@angular/platform-browser-dynamic": "~9.0.0",
46+
"@angular/common": "~9.0.0",
47+
"@angular/compiler": "~9.0.0",
48+
"@angular/core": "~9.0.0",
49+
"@angular/forms": "~9.0.0",
50+
"@angular/platform-browser": "~9.0.0",
51+
"@angular/router": "~9.0.0",
5252
"rxjs": "^6.4.0",
5353
"tns-core-modules": "^6.2.0 || >6.3.0-",
5454
"typescript": "~3.6.4",
5555
"tslib": "~1.10.0",
5656
"zone.js": "~0.10.2"
5757
},
5858
"devDependencies": {
59-
"@angular/animations": "9.0.0-rc.3",
60-
"@angular/common": "9.0.0-rc.3",
61-
"@angular/compiler": "9.0.0-rc.3",
62-
"@angular/compiler-cli": "9.0.0-rc.3",
63-
"@angular/core": "9.0.0-rc.3",
64-
"@angular/forms": "9.0.0-rc.3",
65-
"@angular/platform-browser": "9.0.0-rc.3",
66-
"@angular/platform-browser-dynamic": "9.0.0-rc.3",
67-
"@angular/router": "9.0.0-rc.3",
68-
"codelyzer": "^5.1.0",
59+
"@angular/animations": "~9.0.1",
60+
"@angular/common": "~9.0.1",
61+
"@angular/compiler": "~9.0.1",
62+
"@angular/compiler-cli": "~9.0.1",
63+
"@angular/core": "~9.0.1",
64+
"@angular/forms": "~9.0.1",
65+
"@angular/platform-browser": "~9.0.1",
66+
"@angular/platform-browser-dynamic": "~9.0.1",
67+
"@angular/router": "~9.0.1",
68+
"codelyzer": "^5.2.0",
6969
"conventional-changelog-cli": "^1.3.22",
70-
"rxjs": "^6.4.0",
71-
"tns-core-modules": "next",
70+
"rxjs": "^6.5.0",
71+
"tns-core-modules": "~6.3.0",
7272
"tslint": "^5.5.0",
7373
"typescript": "~3.6.4",
7474
"zone.js": "~0.10.2",

Diff for: nativescript-angular/testing/src/util.ts

+14-8
Original file line numberDiff line numberDiff line change
@@ -91,23 +91,29 @@ export function nsTestBedBeforeEach(
9191
entryComponents: any[] = []) {
9292
return (done) => {
9393
activeTestFixtures.push([]);
94+
imports.unshift(NativeScriptModule);
9495
// If there are no entry components we can take the simple path.
9596
if (entryComponents.length === 0) {
9697
TestBed.configureTestingModule({
97-
declarations: [...components],
98-
providers: [...providers],
99-
imports: [NativeScriptModule, ...imports]
98+
declarations: components,
99+
providers: providers,
100+
imports: imports
100101
});
101102
} else {
102103
// If there are entry components, we have to reset the testing platform.
103104
//
104105
// There's got to be a better way... (o_O)
105106
TestBed.resetTestEnvironment();
106-
@NgModule({
107-
declarations: entryComponents,
108-
exports: entryComponents,
109-
entryComponents: entryComponents
110-
})
107+
// TODO: this currently causes:
108+
/**
109+
* ../nativescript-angular/testing/src/util.ts:108:31 - error NG1010: Expected array when reading the NgModule.declarations of EntryComponentsTestModule
110+
declarations: entryComponents,
111+
*/
112+
// @NgModule({
113+
// declarations: entryComponents,
114+
// exports: entryComponents,
115+
// entryComponents: entryComponents
116+
// })
111117
class EntryComponentsTestModule {
112118
}
113119
TestBed.initTestEnvironment(

Diff for: tests/package.json

+13-13
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,24 @@
1919
],
2020
"homepage": "http://nativescript.org",
2121
"dependencies": {
22-
"@angular/animations": "~8.2.0",
23-
"@angular/common": "~8.2.0",
24-
"@angular/compiler": "~8.2.0",
25-
"@angular/core": "~8.2.0",
26-
"@angular/forms": "~8.2.0",
27-
"@angular/platform-browser": "~8.2.0",
28-
"@angular/platform-browser-dynamic": "~8.2.0",
29-
"@angular/router": "~8.2.0",
22+
"@angular/animations": "~9.0.1",
23+
"@angular/common": "~9.0.1",
24+
"@angular/compiler": "~9.0.1",
25+
"@angular/core": "~9.0.1",
26+
"@angular/forms": "~9.0.1",
27+
"@angular/platform-browser": "~9.0.1",
28+
"@angular/platform-browser-dynamic": "~9.0.1",
29+
"@angular/router": "~9.0.1",
3030
"nativescript-angular": "../nativescript-angular-package",
3131
"nativescript-unit-test-runner": "0.7.0",
32-
"rxjs": "^6.4.0",
33-
"tns-core-modules": "next",
32+
"rxjs": "^6.5.0",
33+
"tns-core-modules": "~6.3.0",
3434
"tslib": "~1.10.0",
3535
"zone.js": "~0.10.2"
3636
},
3737
"devDependencies": {
38-
"@angular/compiler-cli": "8.0.0",
39-
"@ngtools/webpack": "8.0.0",
38+
"@angular/compiler-cli": "~9.0.1",
39+
"@ngtools/webpack": "~9.0.1",
4040
"@types/chai": "^4.1.4",
4141
"@types/karma-chai": "0.1.1",
4242
"@types/mocha": "5.2.7",
@@ -54,7 +54,7 @@
5454
"karma-webpack": "3.0.5",
5555
"lazy": "1.0.11",
5656
"mocha": "6.1.4",
57-
"nativescript-dev-webpack": "next",
57+
"nativescript-dev-webpack": "~1.4.0",
5858
"remove-strict-webpack-plugin": "~0.1.2",
5959
"sinon": "^7.3.2",
6060
"tslint": "^4.5.1",

0 commit comments

Comments
 (0)