Skip to content

Commit 8cc611e

Browse files
authored
Merge pull request #368 from NativeScript/niliev/bump
chore: version bump + minor info.plist update
2 parents 70d2f7b + 7e8b4d6 commit 8cc611e

File tree

3 files changed

+65
-35
lines changed

3 files changed

+65
-35
lines changed

app/App_Resources/iOS/Info.plist

+2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@
7272
<dict>
7373
<key>CFBundleURLName</key>
7474
<string><your org.nativescript.nativescriptsdkexamplesng></string>
75+
<key>CFBundleTypeRole</key>
76+
<string>None</string>
7577
<key>CFBundleURLSchemes</key>
7678
<array>
7779
<string>examplesgo</string>

package.json

+21-22
Original file line numberDiff line numberDiff line change
@@ -21,46 +21,43 @@
2121
"license": "Apache-2.0",
2222
"nativescript": {
2323
"id": "org.nativescript.nativescriptsdkexamplesng",
24-
"tns-android": {
25-
"version": "5.1.0"
26-
},
2724
"tns-ios": {
28-
"version": "5.1.0"
25+
"version": "5.3.0-rc-2019-03-25-101854-01"
2926
}
3027
},
3128
"dependencies": {
32-
"@angular/common": "~7.1.0",
33-
"@angular/compiler": "~7.1.0",
34-
"@angular/core": "~7.1.0",
35-
"@angular/forms": "~7.1.0",
36-
"@angular/http": "~7.1.0",
37-
"@angular/platform-browser": "~7.1.0",
38-
"@angular/platform-browser-dynamic": "~7.1.0",
39-
"@angular/router": "~7.1.0",
40-
"nativescript-angular": "^7.1.0",
41-
"nativescript-camera": "^4.1.1",
42-
"nativescript-geolocation": "^4.3.1",
29+
"@angular/common": "~7.2.0",
30+
"@angular/compiler": "~7.2.0",
31+
"@angular/core": "~7.2.0",
32+
"@angular/forms": "~7.2.0",
33+
"@angular/http": "~7.2.0",
34+
"@angular/platform-browser": "~7.2.0",
35+
"@angular/platform-browser-dynamic": "~7.2.0",
36+
"@angular/router": "~7.2.0",
37+
"nativescript-angular": "^7.2.3",
38+
"nativescript-camera": "^4.4.0",
39+
"nativescript-geolocation": "^5.0.0",
4340
"nativescript-intl": "~3.0.0",
4441
"nativescript-theme-core": "^1.0.4",
4542
"reflect-metadata": "~0.1.12",
4643
"rxjs": "^6.3.3",
47-
"tns-core-modules": "^5.1.1",
44+
"tns-core-modules": "^5.2.2",
4845
"zone.js": "^0.8.4"
4946
},
5047
"devDependencies": {
51-
"@angular/compiler-cli": "~7.1.0",
52-
"@ngtools/webpack": "~7.1.0",
48+
"@angular/compiler-cli": "~7.2.0",
49+
"@ngtools/webpack": "~7.2.0",
5350
"codelyzer": "^3.0.1",
5451
"fs-extra": "^0.30.0",
5552
"glob": "^7.1.3",
5653
"lazy": "1.0.11",
5754
"markdown-snippet-injector": "^0.2.2",
58-
"nativescript-dev-typescript": "^0.7.8",
59-
"nativescript-dev-webpack": "^0.18.5",
55+
"nativescript-dev-typescript": "^0.9.0",
56+
"nativescript-dev-webpack": "^0.20.3",
6057
"opener": "^1.4.1",
6158
"rimraf": "^2.5.3",
6259
"tar.gz": "^1.0.5",
63-
"tns-platform-declarations": "^5.1.1",
60+
"tns-platform-declarations": "^5.2.2",
6461
"tslint": "^5.11.0",
6562
"typescript": "~3.1.1"
6663
},
@@ -73,6 +70,8 @@
7370
"build": "node scripts/build.js",
7471
"postbuild": "npm run inject && npm run archive",
7572
"inject": "mdinject --root=app --docsroot=dist/code-samples --sourceext=\".ts|.css|.html\" --snippettitles=\"TypeScript|CSS|HTML\"",
76-
"archive": "node scripts/archive.js"
73+
"archive": "node scripts/archive.js",
74+
"update-webpack": "./node_modules/.bin/update-ns-webpack --deps --configs",
75+
"update-angular": "./node_modules/.bin/update-app-ng-deps"
7776
}
7877
}

webpack.config.js

+42-13
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
const { join, relative, resolve, sep } = require("path");
1+
const { join, relative, resolve, sep, dirname } = require("path");
22

33
const webpack = require("webpack");
44
const nsWebpack = require("nativescript-dev-webpack");
55
const nativescriptTarget = require("nativescript-dev-webpack/nativescript-target");
66
const { nsReplaceBootstrap } = require("nativescript-dev-webpack/transformers/ns-replace-bootstrap");
7+
const { nsReplaceLazyLoader } = require("nativescript-dev-webpack/transformers/ns-replace-lazy-loader");
8+
const { nsSupportHmrNg } = require("nativescript-dev-webpack/transformers/ns-support-hmr-ng");
9+
const { getMainModulePath } = require("nativescript-dev-webpack/utils/ast-utils");
710
const CleanWebpackPlugin = require("clean-webpack-plugin");
811
const CopyWebpackPlugin = require("copy-webpack-plugin");
912
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
1013
const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin");
1114
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
1215
const { AngularCompilerPlugin } = require("@ngtools/webpack");
16+
const hashSalt = Date.now().toString();
1317

1418
module.exports = env => {
1519
// Add your custom Activities, Services and other Android app components here.
@@ -33,8 +37,8 @@ module.exports = env => {
3337
// The 'appPath' and 'appResourcesPath' values are fetched from
3438
// the nsconfig.json configuration file
3539
// when bundling with `tns run android|ios --bundle`.
36-
appPath = "app",
37-
appResourcesPath = "app/App_Resources",
40+
appPath = "src",
41+
appResourcesPath = "App_Resources",
3842

3943
// You can provide the following flags when running 'tns run android|ios'
4044
aot, // --env.aot
@@ -44,23 +48,45 @@ module.exports = env => {
4448
sourceMap, // --env.sourceMap
4549
hmr, // --env.hmr,
4650
} = env;
47-
const externals = (env.externals || []).map((e) => { // --env.externals
48-
return new RegExp(e + ".*");
49-
});
5051

52+
const externals = nsWebpack.getConvertedExternals(env.externals);
5153
const appFullPath = resolve(projectRoot, appPath);
5254
const appResourcesFullPath = resolve(projectRoot, appResourcesPath);
53-
55+
const tsConfigName = "tsconfig.tns.json";
5456
const entryModule = `${nsWebpack.getEntryModule(appFullPath)}.ts`;
5557
const entryPath = `.${sep}${entryModule}`;
58+
const ngCompilerTransformers = [];
59+
const additionalLazyModuleResources = [];
60+
if (aot) {
61+
ngCompilerTransformers.push(nsReplaceBootstrap);
62+
}
63+
64+
if (hmr) {
65+
ngCompilerTransformers.push(nsSupportHmrNg);
66+
}
67+
68+
// when "@angular/core" is external, it's not included in the bundles. In this way, it will be used
69+
// directly from node_modules and the Angular modules loader won't be able to resolve the lazy routes
70+
// fixes https://github.com/NativeScript/nativescript-cli/issues/4024
71+
if (env.externals && env.externals.indexOf("@angular/core") > -1) {
72+
const appModuleRelativePath = getMainModulePath(resolve(appFullPath, entryModule), tsConfigName);
73+
if (appModuleRelativePath) {
74+
const appModuleFolderPath = dirname(resolve(appFullPath, appModuleRelativePath));
75+
// include the lazy loader inside app module
76+
ngCompilerTransformers.push(nsReplaceLazyLoader);
77+
// include the new lazy loader path in the allowed ones
78+
additionalLazyModuleResources.push(appModuleFolderPath);
79+
}
80+
}
5681

5782
const ngCompilerPlugin = new AngularCompilerPlugin({
5883
hostReplacementPaths: nsWebpack.getResolver([platform, "tns"]),
59-
platformTransformers: aot ? [nsReplaceBootstrap(() => ngCompilerPlugin)] : null,
84+
platformTransformers: ngCompilerTransformers.map(t => t(() => ngCompilerPlugin, resolve(appFullPath, entryModule))),
6085
mainPath: resolve(appPath, entryModule),
61-
tsConfigPath: join(__dirname, "tsconfig.tns.json"),
86+
tsConfigPath: join(__dirname, tsConfigName),
6287
skipCodeGeneration: !aot,
6388
sourceMap: !!sourceMap,
89+
additionalLazyModuleResources: additionalLazyModuleResources
6490
});
6591

6692
const config = {
@@ -84,6 +110,7 @@ module.exports = env => {
84110
libraryTarget: "commonjs2",
85111
filename: "[name].js",
86112
globalObject: "global",
113+
hashSalt
87114
},
88115
resolve: {
89116
extensions: [".ts", ".js", ".scss", ".css"],
@@ -171,14 +198,15 @@ module.exports = env => {
171198
// tns-core-modules reads the app.css and its imports using css-loader
172199
{
173200
test: /[\/|\\]app\.css$/,
174-
use: {
175-
loader: "css-loader",
176-
options: { minimize: false, url: false },
177-
}
201+
use: [
202+
"nativescript-dev-webpack/style-hot-loader",
203+
{ loader: "css-loader", options: { minimize: false, url: false } }
204+
]
178205
},
179206
{
180207
test: /[\/|\\]app\.scss$/,
181208
use: [
209+
"nativescript-dev-webpack/style-hot-loader",
182210
{ loader: "css-loader", options: { minimize: false, url: false } },
183211
"sass-loader"
184212
]
@@ -192,6 +220,7 @@ module.exports = env => {
192220
test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/,
193221
use: [
194222
"nativescript-dev-webpack/moduleid-compat-loader",
223+
"nativescript-dev-webpack/lazy-ngmodule-hot-loader",
195224
"@ngtools/webpack",
196225
]
197226
},

0 commit comments

Comments
 (0)