Skip to content

Commit 55fa354

Browse files
authored
feat(angular): v10 support (#286)
1 parent b5678dd commit 55fa354

37 files changed

+211
-219
lines changed

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*.spec.js
88
*.js.map
99
tsconfig.json
10+
*.tgz
1011

1112
/jasmine-config
1213

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ This includes the following steps:
141141
In a code sharing project to build:
142142

143143
* a `web` app call: `ng serve`,
144-
* an `iOS` app call: `tns run ios --env.aot`,
145-
* an `Android` app call: `tns run android --env.aot`
144+
* an `iOS` app call: `tns run ios`,
145+
* an `Android` app call: `tns run android`
146146

147147
## Templates
148148

package.json

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"name": "@nativescript/schematics",
3-
"version": "9.0.0",
3+
"version": "10.0.1",
44
"description": "Schematics for NativeScript Angular apps.",
55
"scripts": {
6+
"clean": "npx rimraf node_modules package-lock.json && npm i",
67
"build": "tsc -p tsconfig.json",
78
"watch": "tsc -w -p tsconfig.json",
89
"test": "npm run build && npm run jasmine",
@@ -23,21 +24,23 @@
2324
},
2425
"schematics": "./src/collection.json",
2526
"dependencies": {
26-
"@angular-devkit/core": "~9.1.0",
27-
"@angular-devkit/schematics": "~9.1.0",
27+
"@angular-devkit/core": "~10.0.0",
28+
"@angular-devkit/schematics": "~10.0.0",
2829
"@nativescript/tslint-rules": "~0.0.5",
29-
"@phenomnomnominal/tsquery": "^4.1.0"
30+
"@phenomnomnominal/tsquery": "^4.1.0",
31+
"strip-json-comments": "~3.1.1"
3032
},
3133
"devDependencies": {
32-
"@schematics/angular": "~9.1.0",
34+
"@angular/cli": "~10.0.0",
35+
"@schematics/angular": "~10.0.0",
3336
"@types/jasmine": "~3.5.0",
3437
"@types/jasminewd2": "~2.0.3",
3538
"@types/node": "^12.11.1",
3639
"conventional-changelog-cli": "^2.0.1",
37-
"jasmine": "^2.8.0",
38-
"jasmine-spec-reporter": "^4.2.1",
40+
"jasmine": "^3.5.0",
41+
"jasmine-spec-reporter": "^5.0.2",
3942
"tslint": "~6.1.0",
40-
"typescript": "~3.8.3"
43+
"typescript": "~3.9.0"
4144
},
4245
"repository": {
4346
"type": "git",
@@ -60,7 +63,8 @@
6063
"contributors": [
6164
"Stanimira Vlaeva <Stanimira.Vlaeva@progress.com>",
6265
"Sebastian Witalec <Sebastian.Witalec@progress.com>",
63-
"Danny Koppenhagen <d-koppenhagen>"
66+
"Danny Koppenhagen <d-koppenhagen>",
67+
"NativeScript Team <oss@nativescript.org>"
6468
],
6569
"license": "Apache-2.0"
6670
}
Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
<!-- https://docs.nativescript.org/angular/core-concepts/angular-navigation.html#page-router-outlet -->
2-
<page-router-outlet></page-router-outlet>
3-
<% if (skipAutoGeneratedComponent && !sample) { %><Label text="Entry Component works" textWrap="true"></Label>
4-
<% } %>
1+
<GridLayout>
2+
<!-- This will contain any angular routes you setup -->
3+
<page-router-outlet></page-router-outlet>
4+
5+
<% if (skipAutoGeneratedComponent && !sample) { %>
6+
<!-- This is just a fun sample for you to play with :) -->
7+
<StackLayout verticalAlignment="center" (loaded)="loadedSuccess($event)" opacity="0">
8+
<Label text="Sweet!" textWrap="true" class="h2 text-center"></Label>
9+
<Label text="You should try adding some routes." class="h3 text-center"></Label>
10+
</StackLayout>
11+
<StackLayout verticalAlignment="center" (loaded)="loadedContainer($event)">
12+
<Label text="Congrats! It works" textWrap="true" class="h2 text-center"></Label>
13+
<Button text="Keep Tapping for a Surprise!" textWrap="true" class="-primary" (tap)="tapMe()"></Button>
14+
<Label [text]="'You have ' + cnt + ' taps left.'" class="h3 text-center"></Label>
15+
</StackLayout>
16+
<% } %>
17+
18+
</GridLayout>
Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,45 @@
1-
import { Component } from '@angular/core';
1+
import { Component } from '@angular/core';<% if (skipAutoGeneratedComponent && !sample) { %>
2+
import { StackLayout, Enums } from '@nativescript/core';<% } %>
23

34
@Component({
45
selector: '<%= indexAppRootTag %>',
56
templateUrl: '<%= entryComponentImportPath %>.html',
67
})
8+
export class <%= entryComponentClassName %> {
9+
<% if (skipAutoGeneratedComponent && !sample) { %>
10+
title = 'NativeScript';
11+
cnt = 3;
12+
private messageLayout: StackLayout;
13+
private successLayout: StackLayout;
714

8-
export class <%= entryComponentClassName %> { }
15+
tapMe() {
16+
this.cnt--;
17+
if (this.cnt === 0) {
18+
this.messageLayout
19+
.animate({
20+
translate: { x: 0, y: 150 },
21+
opacity: 0,
22+
duration: 400,
23+
curve: Enums.AnimationCurve.easeOut,
24+
})
25+
.then(() => {
26+
this.successLayout.translateY = 150;
27+
this.successLayout.animate({
28+
translate: { x: 0, y: 0 },
29+
opacity: 1,
30+
duration: 300,
31+
curve: Enums.AnimationCurve.easeInOut,
32+
});
33+
});
34+
}
35+
}
36+
37+
loadedContainer(args) {
38+
this.messageLayout = args.object;
39+
}
40+
41+
loadedSuccess(args) {
42+
this.successLayout = args.object;
43+
}
44+
<% } %>
45+
}

src/add-ns/_ns-files/__sourceDir__/main__nsext__.ts

Lines changed: 1 addition & 1 deletion
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';
33

44
import { <%= entryModuleClassName %> } from '<%= entryModuleImportPath %>';
55

src/add-ns/_ns-files/ngcc.config.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/add-ns/_ns-files/nsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@
33
"appPath": "<%= sourceDir %>",
44
"nsext": "<%= nsext %>",
55
"webext": "<%= webext %>",
6-
"shared": true,
7-
"useLegacyWorkflow": false
6+
"shared": true
87
}

src/add-ns/_ns-files/tsconfig__nsext__.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
"compilerOptions": {
44
"module": "ESNext",
55
"moduleResolution": "node",
6+
"experimentalDecorators": true,
67
"skipLibCheck": true,
8+
"baseUrl": ".",
79
"paths": {
810
"@src/*": [
911
"<%= sourceDir %>/*.tns.ts",

src/add-ns/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ const addRunScriptsToPackageJson = (tree: Tree, context: SchematicContext) => {
223223
const packageJson = getPackageJson(tree);
224224

225225
const scriptsToAdd = {
226-
android: 'tns run android --env.aot',
227-
ios: 'tns run ios --env.aot',
226+
android: 'tns run android --no-hmr',
227+
ios: 'tns run ios --no-hmr',
228228
mobile: 'tns run',
229229
preview: 'tns preview',
230230
ngcc: 'ngcc --properties es2015 module main --first-only',
@@ -364,16 +364,16 @@ const addDependencies = () => (tree: Tree, context: SchematicContext) => {
364364

365365
// @UPGRADE: Update all versions whenever {N} version updates
366366
const depsToAdd = {
367-
'@nativescript/angular': '~9.0.0',
368-
'@nativescript/core': '~6.5.5',
367+
'@nativescript/angular': '~10.0.0',
368+
'@nativescript/core': 'rc',
369369
'@nativescript/theme': '~2.2.1',
370370
'reflect-metadata': '~0.1.12',
371371
tslib: '1.10.0',
372372
};
373373
packageJson.dependencies = {...depsToAdd, ...packageJson.dependencies};
374374

375375
const devDepsToAdd = {
376-
'nativescript-dev-webpack': '~1.5.0',
376+
'@nativescript/webpack': '~2.0.0',
377377
'@nativescript/tslint-rules': '~0.0.5',
378378
};
379379
packageJson.devDependencies = {...devDepsToAdd, ...packageJson.devDependencies};

0 commit comments

Comments
 (0)