Skip to content

Commit cb56a03

Browse files
N6 bump
1 parent ea463e3 commit cb56a03

File tree

5 files changed

+49
-34
lines changed

5 files changed

+49
-34
lines changed

demo/app/App_Resources/Android/app.gradle

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
// Add your native dependencies here:
2-
3-
// Uncomment to add recyclerview-v7 dependency
4-
//dependencies {
5-
// compile 'com.android.support:recyclerview-v7:+'
6-
//}
7-
81
android {
92
defaultConfig {
103
generatedDensities = []

demo/app/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@
2727
"homepage": "https://github.com/NativeScript/template-hello-world-ts",
2828
"android": {
2929
"v8Flags": "--expose_gc",
30-
"requireModules": ["nativescript-https"]
30+
"requireModules": [
31+
"nativescript-https"
32+
],
33+
"markingMode": "none"
3134
},
3235
"devDependencies": {
3336
"nativescript-dev-typescript": "^0.3.0"

demo/nsconfig.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

demo/package.json

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,24 @@
22
"nativescript": {
33
"id": "org.nativescript.plugindemo.https",
44
"tns-android": {
5-
"version": "6.1.1"
5+
"version": "6.4.1"
66
},
77
"tns-ios": {
8-
"version": "6.1.1"
8+
"version": "6.4.0"
99
}
1010
},
1111
"dependencies": {
1212
"nativescript-https": "file:../src",
1313
"nativescript-theme-core": "^1.0.4",
1414
"nativescript-unit-test-runner": "0.7.0",
15-
"tns-core-modules": "~6.1.1"
15+
"tns-core-modules": "~6.4.0"
1616
},
1717
"devDependencies": {
18-
"jasmine-core": "^2.5.2",
19-
"karma": "4.1.0",
20-
"karma-jasmine": "2.0.1",
21-
"karma-nativescript-launcher": "^0.4.0",
2218
"nativescript-css-loader": "~0.26.1",
23-
"nativescript-dev-webpack": "1.0.1",
24-
"tns-platform-declarations": "~6.1.1",
19+
"nativescript-dev-webpack": "~1.5.0",
20+
"tns-platform-declarations": "~6.4.0",
2521
"tslint": "~5.11.0",
26-
"typescript": "3.4.5",
27-
"karma-webpack": "3.0.5"
22+
"typescript": "3.4.5"
2823
},
2924
"scripts": {
3025
"build.plugin": "cd ../src && npm run build",

demo/webpack.config.js

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const { join, relative, resolve, sep } = require("path");
33
const webpack = require("webpack");
44
const nsWebpack = require("nativescript-dev-webpack");
55
const nativescriptTarget = require("nativescript-dev-webpack/nativescript-target");
6+
const { getNoEmitOnErrorFromTSConfig } = require("nativescript-dev-webpack/utils/tsconfig-utils");
67
const CleanWebpackPlugin = require("clean-webpack-plugin");
78
const CopyWebpackPlugin = require("copy-webpack-plugin");
89
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
@@ -13,26 +14,30 @@ const hashSalt = Date.now().toString();
1314

1415
module.exports = env => {
1516
// Add your custom Activities, Services and other Android app components here.
16-
const appComponents = [
17+
const appComponents = env.appComponents || [];
18+
appComponents.push(...[
1719
"tns-core-modules/ui/frame",
1820
"tns-core-modules/ui/frame/activity",
19-
];
21+
]);
2022

21-
const platform = env && (env.android && "android" || env.ios && "ios");
23+
const platform = env && (env.android && "android" || env.ios && "ios" || env.platform);
2224
if (!platform) {
2325
throw new Error("You need to provide a target platform!");
2426
}
2527

2628
const platforms = ["ios", "android"];
2729
const projectRoot = __dirname;
2830

31+
if (env.platform) {
32+
platforms.push(env.platform);
33+
}
34+
2935
// Default destination inside platforms/<platform>/...
3036
const dist = resolve(projectRoot, nsWebpack.getAppPath(platform, projectRoot));
3137

3238
const {
3339
// The 'appPath' and 'appResourcesPath' values are fetched from
34-
// the nsconfig.json configuration file
35-
// when bundling with `tns run android|ios --bundle`.
40+
// the nsconfig.json configuration file.
3641
appPath = "app",
3742
appResourcesPath = "app/App_Resources",
3843

@@ -46,16 +51,31 @@ module.exports = env => {
4651
hmr, // --env.hmr,
4752
unitTesting, // --env.unitTesting,
4853
verbose, // --env.verbose
54+
snapshotInDocker, // --env.snapshotInDocker
55+
skipSnapshotTools, // --env.skipSnapshotTools
56+
compileSnapshot // --env.compileSnapshot
4957
} = env;
58+
59+
const useLibs = compileSnapshot;
5060
const isAnySourceMapEnabled = !!sourceMap || !!hiddenSourceMap;
5161
const externals = nsWebpack.getConvertedExternals(env.externals);
5262

5363
const appFullPath = resolve(projectRoot, appPath);
64+
const hasRootLevelScopedModules = nsWebpack.hasRootLevelScopedModules({ projectDir: projectRoot });
65+
let coreModulesPackageName = "tns-core-modules";
66+
const alias = env.alias || {};
67+
alias['~'] = appFullPath;
68+
69+
if (hasRootLevelScopedModules) {
70+
coreModulesPackageName = "@nativescript/core";
71+
alias["tns-core-modules"] = coreModulesPackageName;
72+
}
5473
const appResourcesFullPath = resolve(projectRoot, appResourcesPath);
5574

5675
const entryModule = nsWebpack.getEntryModule(appFullPath, platform);
5776
const entryPath = `.${sep}${entryModule}.ts`;
58-
const entries = { bundle: entryPath };
77+
const entries = env.entries || {};
78+
entries.bundle = entryPath;
5979

6080
const tsConfigPath = resolve(projectRoot, "tsconfig.tns.json");
6181

@@ -72,6 +92,8 @@ module.exports = env => {
7292
itemsToClean.push(`${join(projectRoot, "platforms", "android", "app", "build", "configurations", "nativescript-android-snapshot")}`);
7393
}
7494

95+
const noEmitOnErrorFromTSConfig = getNoEmitOnErrorFromTSConfig(tsConfigPath);
96+
7597
nsWebpack.processAppComponents(appComponents, platform);
7698
const config = {
7799
mode: production ? "production" : "development",
@@ -99,14 +121,12 @@ module.exports = env => {
99121
extensions: [".ts", ".js", ".scss", ".css"],
100122
// Resolve {N} system modules from tns-core-modules
101123
modules: [
102-
resolve(__dirname, "node_modules/tns-core-modules"),
124+
resolve(__dirname, `node_modules/${coreModulesPackageName}`),
103125
resolve(__dirname, "node_modules"),
104-
"node_modules/tns-core-modules",
126+
`node_modules/${coreModulesPackageName}`,
105127
"node_modules",
106128
],
107-
alias: {
108-
'~': appFullPath
109-
},
129+
alias,
110130
// resolve symlinks to symlinked modules
111131
symlinks: true
112132
},
@@ -125,6 +145,7 @@ module.exports = env => {
125145
devtool: hiddenSourceMap ? "hidden-source-map" : (sourceMap ? "inline-source-map" : "none"),
126146
optimization: {
127147
runtimeChunk: "single",
148+
noEmitOnErrors: noEmitOnErrorFromTSConfig,
128149
splitChunks: {
129150
cacheGroups: {
130151
vendor: {
@@ -164,7 +185,7 @@ module.exports = env => {
164185
module: {
165186
rules: [
166187
{
167-
test: nsWebpack.getEntryPathRegExp(appFullPath, entryPath),
188+
include: join(appFullPath, entryPath),
168189
use: [
169190
// Require all Android app components
170191
platform === "android" && {
@@ -194,13 +215,13 @@ module.exports = env => {
194215

195216
{
196217
test: /\.css$/,
197-
use: { loader: "css-loader", options: { url: false } }
218+
use: "nativescript-dev-webpack/css2json-loader"
198219
},
199220

200221
{
201222
test: /\.scss$/,
202223
use: [
203-
{ loader: "css-loader", options: { url: false } },
224+
"nativescript-dev-webpack/css2json-loader",
204225
"sass-loader"
205226
]
206227
},
@@ -255,6 +276,7 @@ module.exports = env => {
255276
tsconfig: tsConfigPath,
256277
async: false,
257278
useTypescriptIncrementalApi: true,
279+
checkSyntacticErrors: true,
258280
memoryLimit: 4096
259281
})
260282
],
@@ -279,6 +301,9 @@ module.exports = env => {
279301
],
280302
projectRoot,
281303
webpackConfig: config,
304+
snapshotInDocker,
305+
skipSnapshotTools,
306+
useLibs
282307
}));
283308
}
284309

0 commit comments

Comments
 (0)