Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit e0d0c32

Browse files
committed
Merge branch 'master' into sis0k0/webpack4
2 parents 1dd2000 + 0b0fe4e commit e0d0c32

28 files changed

+342
-68
lines changed

Diff for: CHANGELOG.md

+48-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,51 @@
1+
<a name="0.10.1"></a>
2+
## [0.10.1](https://github.com/NativeScript/nativescript-dev-webpack/compare/0.10.0...0.10.1) (2018-04-11)
3+
4+
5+
### Bug Fixes
6+
7+
* **configs/angular:** use path relative to the appDir for the root ([8e7aa0c](https://github.com/NativeScript/nativescript-dev-webpack/commit/8e7aa0c))
8+
9+
<a name="0.10.0"></a>
10+
# [0.10.0](https://github.com/NativeScript/nativescript-dev-webpack/compare/0.9.1...0.10.0) (2018-04-05)
11+
12+
> You need NativeScript 4.0 for using the new features from this version.
13+
14+
### Bug Fixes
15+
16+
* **hooks:** `after-watch` hook is not executed ([#483](https://github.com/NativeScript/nativescript-dev-webpack/issues/483)) ([a61cff4](https://github.com/NativeScript/nativescript-dev-webpack/commit/a61cff4))
17+
* allow snapshot only in release ([#448](https://github.com/NativeScript/nativescript-dev-webpack/issues/448)) ([2dd9adc](https://github.com/NativeScript/nativescript-dev-webpack/commit/2dd9adc))
18+
* clean snapshot artifacts on cleanApp hook ([#423](https://github.com/NativeScript/nativescript-dev-webpack/issues/423)) ([50c3ab9](https://github.com/NativeScript/nativescript-dev-webpack/commit/50c3ab9))
19+
* remove progress indication ([#468](https://github.com/NativeScript/nativescript-dev-webpack/issues/468)) ([8961a93](https://github.com/NativeScript/nativescript-dev-webpack/commit/8961a93)), closes [/github.com/webpack/webpack/blob/4428efe48e1c5ff4cadb79e13f0fa48c12bdac35/lib/ProgressPlugin.js#L50](https://github.com//github.com/webpack/webpack/blob/4428efe48e1c5ff4cadb79e13f0fa48c12bdac35/lib/ProgressPlugin.js/issues/L50)
20+
* remove unnecessary comma ([#472](https://github.com/NativeScript/nativescript-dev-webpack/issues/472)) ([ce60606](https://github.com/NativeScript/nativescript-dev-webpack/commit/ce60606))
21+
* send arguments in watchPatterns hook ([#449](https://github.com/NativeScript/nativescript-dev-webpack/issues/449)) ([aa255bb](https://github.com/NativeScript/nativescript-dev-webpack/commit/aa255bb))
22+
* Set INIT_CWD env in all before-* hooks ([#480](https://github.com/NativeScript/nativescript-dev-webpack/issues/480)) ([b7ef84f](https://github.com/NativeScript/nativescript-dev-webpack/commit/b7ef84f))
23+
* **hooks:** Hooks not executed correctly when CLI is used as a library ([#479](https://github.com/NativeScript/nativescript-dev-webpack/issues/479)) ([87dd53d](https://github.com/NativeScript/nativescript-dev-webpack/commit/87dd53d))
24+
* **prepare:** clean platforms/.../app/ when running webpack ([#465](https://github.com/NativeScript/nativescript-dev-webpack/issues/465)) ([cb2f51b](https://github.com/NativeScript/nativescript-dev-webpack/commit/cb2f51b))
25+
* **snapshot:** use request module for http requests ([#428](https://github.com/NativeScript/nativescript-dev-webpack/issues/428)) ([01933e0](https://github.com/NativeScript/nativescript-dev-webpack/commit/01933e0)), closes [#389](https://github.com/NativeScript/nativescript-dev-webpack/issues/389)
26+
* **uglify:** prevent SideDrawer transition class names from being renamed ([#426](https://github.com/NativeScript/nativescript-dev-webpack/issues/426)) ([0120329](https://github.com/NativeScript/nativescript-dev-webpack/commit/0120329)), closes [/github.com/telerik/nativescript-ui-feedback/issues/477#issuecomment-360772046](https://github.com//github.com/telerik/nativescript-ui-feedback/issues/477/issues/issuecomment-360772046) [#258](https://github.com/NativeScript/nativescript-dev-webpack/issues/258)
27+
28+
29+
### Features
30+
31+
* **livesync:** enable webpack with watch ([#433](https://github.com/NativeScript/nativescript-dev-webpack/issues/433)) ([847a56f](https://github.com/NativeScript/nativescript-dev-webpack/commit/847a56f))
32+
* consume shouldprepare hook ([#447](https://github.com/NativeScript/nativescript-dev-webpack/issues/447)) ([adb896c](https://github.com/NativeScript/nativescript-dev-webpack/commit/adb896c))
33+
34+
35+
### BREAKING CHANGES
36+
37+
* The snapshot plugin is applied only when building for release.
38+
39+
Before:
40+
```
41+
tns run android --bundle --env.snapshot
42+
```
43+
44+
After:
45+
```
46+
tns run android --bundle --env.snapshot --release --keyStorePath ~/path/to/keystore/my.keystore --keyStorePassword password --keyStoreAlias alias --keyStoreAliasPassword aliasPassword
47+
```
48+
149
<a name="0.9.2"></a>
250
## [0.9.2](https://github.com/NativeScript/nativescript-dev-webpack/compare/0.9.1...0.9.2) (2018-02-15)
351

@@ -335,4 +383,3 @@ the project: `webpack.common.js`, `webpack.android.js`,
335383
* use the nativescript fork of css-loader ([3b6a1c8](https://github.com/NativeScript/nativescript-dev-webpack/commit/3b6a1c8))
336384

337385

338-

Diff for: CONTRIBUTING.md

+40
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- [Reporting Bugs](#reporting-bugs)
1111
- [Requesting Features](#requesting-features)
1212
- [Submitting PR](#submitting-pr)
13+
- [Publishing new versions](#publishing-new-versions)
1314

1415
<!-- /TOC -->
1516

@@ -144,3 +145,42 @@ NOTE: There are three test apps in the repository, located in the `/demo` direct
144145
```
145146
146147
Thank you for your contribution!
148+
149+
## Publishing new versions
150+
151+
1. Run `npm install` to install the dependencies and prepare the package for publishing.
152+
```bash
153+
npm install
154+
```
155+
156+
2. Remove the `package-lock.json` file if it was generated.
157+
```bash
158+
rm package-lock.json
159+
```
160+
161+
3. Add the following to your `.npmrc`.
162+
```
163+
tag-version-prefix=""
164+
message="release: cut the %s release"
165+
```
166+
167+
4. Create new branch for the release:
168+
```
169+
git checkout -b username/release-version
170+
```
171+
172+
5. Run `npm version` to bump the version in the `package.json`, tag the release and update the CHANGELOG.md:
173+
```
174+
npm version [patch|minor|major]
175+
```
176+
177+
6. Push all changes to your branch and create a PR.
178+
```bash
179+
git push --set-upstream origin username/release-version --tags
180+
```
181+
182+
7. Publish the package to npm after the PR is merged.
183+
```bash
184+
npm publish
185+
```
186+

Diff for: demo/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
node_modules
22
platforms
3+
testapp
4+
*-report.*
5+
36
hooks
47
report
58

Diff for: demo/AngularApp/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"build-ios-bundle": "npm run ns-bundle --ios --build-app",
7171
"publish-ios-bundle": "npm run ns-bundle --ios --publish-app",
7272
"generate-android-snapshot": "generate-android-snapshot --targetArchs arm,arm64,ia32 --install",
73-
"e2e": "tsc -p e2e && mocha --opts ./e2e/config/mocha.opts",
73+
"e2e": "tsc -p e2e && mocha --opts ../config/mocha.opts --recursive e2e --appiumCapsLocation ../config/appium.capabilities.json",
7474
"compile-tests": "tsc -p e2e --watch"
7575
}
7676
}

Diff for: demo/JavaScriptApp/e2e/config/appium.capabilities.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,15 @@
8181
},
8282
"sim.iPhone8.iOS110": {
8383
"platformName": "iOS",
84-
"platformVersion": "11.0",
84+
"platformVersion": "11.2",
8585
"deviceName": "iPhone 8 110",
8686
"noReset": true,
8787
"fullReset": false,
8888
"app": ""
8989
},
9090
"sim.iPhoneX.iOS110": {
9191
"platformName": "iOS",
92-
"platformVersion": "11.0",
92+
"platformVersion": "11.2",
9393
"deviceName": "iPhone X",
9494
"noReset": true,
9595
"fullReset": false,

Diff for: demo/JavaScriptApp/e2e/config/mocha.opts

-4
This file was deleted.

Diff for: demo/JavaScriptApp/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
"build-ios-bundle": "npm run ns-bundle --ios --build-app",
5454
"publish-ios-bundle": "npm run ns-bundle --ios --publish-app",
5555
"generate-android-snapshot": "generate-android-snapshot --targetArchs arm,arm64,ia32 --install",
56-
"e2e": "mocha --opts ./e2e/config/mocha.opts"
56+
"e2e": "mocha --opts ../config/mocha.opts --recursive e2e --appiumCapsLocation ../config/appium.capabilities.json"
5757
}
5858
}

Diff for: demo/TypeScriptApp/e2e/config/appium.capabilities.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,15 @@
8181
},
8282
"sim.iPhone8.iOS110": {
8383
"platformName": "iOS",
84-
"platformVersion": "11.0",
84+
"platformVersion": "11.2",
8585
"deviceName": "iPhone 8 110",
8686
"noReset": true,
8787
"fullReset": false,
8888
"app": ""
8989
},
9090
"sim.iPhoneX.iOS110": {
9191
"platformName": "iOS",
92-
"platformVersion": "11.0",
92+
"platformVersion": "11.2",
9393
"deviceName": "iPhone X",
9494
"noReset": true,
9595
"fullReset": false,

Diff for: demo/TypeScriptApp/e2e/config/mocha.opts

-4
This file was deleted.

Diff for: demo/TypeScriptApp/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"build-ios-bundle": "npm run ns-bundle --ios --build-app",
5656
"publish-ios-bundle": "npm run ns-bundle --ios --publish-app",
5757
"generate-android-snapshot": "generate-android-snapshot --targetArchs arm,arm64,ia32 --install",
58-
"e2e": "tsc -p e2e && mocha --opts ./e2e/config/mocha.opts",
58+
"e2e": "tsc -p e2e && mocha --opts ../config/mocha.opts --recursive e2e --appiumCapsLocation ../config/appium.capabilities.json",
5959
"compile-tests": "tsc -p e2e --watch"
6060
}
6161
}

Diff for: demo/AngularApp/e2e/config/appium.capabilities.json renamed to demo/config/appium.capabilities.json

+25-5
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,18 @@
7171
"fullReset": false,
7272
"app": ""
7373
},
74+
"android27": {
75+
"platformName": "Android",
76+
"platformVersion": "27",
77+
"deviceName": "Emulator-Api27-Google",
78+
"avd": "Emulator-Api27-Google",
79+
"lt": 60000,
80+
"appActivity": "com.tns.NativeScriptActivity",
81+
"newCommandTimeout": 720,
82+
"noReset": true,
83+
"fullReset": false,
84+
"app": ""
85+
},
7486
"sim.iPhone7.iOS100": {
7587
"platformName": "iOS",
7688
"platformVersion": "10.0",
@@ -79,28 +91,36 @@
7991
"fullReset": false,
8092
"app": ""
8193
},
94+
"sim.iPhone7.iOS110": {
95+
"platformName": "iOS",
96+
"platformVersion": "11.2",
97+
"deviceName": "iPhone 7 110",
98+
"noReset": true,
99+
"fullReset": false,
100+
"app": ""
101+
},
82102
"sim.iPhone8.iOS110": {
83103
"platformName": "iOS",
84-
"platformVersion": "11.0",
104+
"platformVersion": "11.2",
85105
"deviceName": "iPhone 8 110",
86106
"noReset": true,
87107
"fullReset": false,
88108
"app": ""
89109
},
90110
"sim.iPhoneX.iOS110": {
91111
"platformName": "iOS",
92-
"platformVersion": "11.0",
93-
"deviceName": "iPhone X",
112+
"platformVersion": "11.2",
113+
"deviceName": "iPhone X 110",
94114
"noReset": true,
95115
"fullReset": false,
96116
"app": ""
97117
},
98118
"sim.iPhoneX.iOS111": {
99119
"platformName": "iOS",
100120
"platformVersion": "11.1",
101-
"deviceName": "iPhone X",
121+
"deviceName": "iPhone X 111",
102122
"noReset": true,
103123
"fullReset": false,
104124
"app": ""
105125
}
106-
}
126+
}
File renamed without changes.

Diff for: index.js

+3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ exports.getAotEntryModule = function (appDirectory = APP_PATH) {
3333
return aotEntry;
3434
}
3535

36+
// Exported for backwards compatibility with {N} 3
37+
exports.uglifyMangleExcludes = require("./mangle-excludes");
38+
3639
exports.getEntryModule = function (appDirectory = APP_PATH) {
3740
const entry = getPackageJsonEntry(appDirectory);
3841

Diff for: lib/after-prepare.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const { installSnapshotArtefacts } = require("../snapshot/android/project-snapshot-generator");
22
const { shouldSnapshot } = require("./utils");
33

4-
module.exports = function ($projectData, hookArgs) {
4+
module.exports = function (hookArgs) {
55
const env = hookArgs.env || {};
66
const shouldSnapshotOptions = {
77
platform: hookArgs.platform,
@@ -10,6 +10,6 @@ module.exports = function ($projectData, hookArgs) {
1010
};
1111

1212
if (env.snapshot && shouldSnapshot(shouldSnapshotOptions)) {
13-
installSnapshotArtefacts($projectData.projectDir);
13+
installSnapshotArtefacts(hookArgs.projectData.projectDir);
1414
}
1515
}

Diff for: lib/after-watch.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ module.exports = function($logger) {
33
const webpackProcess = compiler.getWebpackProcess();
44
if (webpackProcess) {
55
$logger.info("Stopping webpack watch");
6-
webpack.kill("SIGINT");
6+
webpackProcess.kill("SIGINT");
77
}
88
}

Diff for: lib/before-cleanApp.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
const { cleanSnapshotArtefacts } = require("../snapshot/android/project-snapshot-generator");
22
const { isAndroid } = require("../projectHelpers");
3+
const { setProcessInitDirectory } = require("./utils");
34

45
module.exports = function (hookArgs) {
56
if (isAndroid(hookArgs.platformInfo.platform)) {
6-
cleanSnapshotArtefacts(hookArgs.platformInfo.projectData.projectDir);
7+
const projectDir = hookArgs.platformInfo.projectData.projectDir;
8+
setProcessInitDirectory(projectDir);
9+
cleanSnapshotArtefacts(projectDir);
710
}
811
}

Diff for: lib/before-prepareJS.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const { runWebpackCompiler } = require("./compiler");
2+
const { setProcessInitDirectory } = require("./utils");
23

3-
module.exports = function ($projectData, $logger, hookArgs) {
4+
module.exports = function ($logger, hookArgs) {
45
const env = hookArgs.config.env || {};
56
const platform = hookArgs.config.platform;
67
const appFilesUpdaterOptions = hookArgs.config.appFilesUpdaterOptions;
@@ -10,6 +11,10 @@ module.exports = function ($projectData, $logger, hookArgs) {
1011
bundle: appFilesUpdaterOptions.bundle,
1112
release: appFilesUpdaterOptions.release,
1213
};
13-
const result = config.bundle && runWebpackCompiler.bind(runWebpackCompiler, config, $projectData, $logger, hookArgs);
14+
15+
const projectData = hookArgs.config.projectData;
16+
setProcessInitDirectory(projectData.projectDir);
17+
18+
const result = config.bundle && runWebpackCompiler.bind(runWebpackCompiler, config, projectData, $logger, hookArgs);
1419
return result;
1520
}

Diff for: lib/before-shouldPrepare.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
const { join } = require("path");
22
const { readFileSync, existsSync, writeFileSync } = require("fs");
3+
const { setProcessInitDirectory } = require("./utils");
34
const envOptionsCacheFileLocation = join(__dirname, "env.cache.json");
45

56
module.exports = function (hookArgs) {
67
const platformInfo = hookArgs.shouldPrepareInfo && hookArgs.shouldPrepareInfo.platformInfo;
78
if (platformInfo && platformInfo.appFilesUpdaterOptions && platformInfo.appFilesUpdaterOptions.bundle) {
9+
setProcessInitDirectory(platformInfo.projectData.projectDir);
10+
811
return (args, originalMethod) => {
912
return originalMethod(...args).then(originalShouldPrepare => {
1013
const currentEnvString = JSON.stringify(platformInfo.env || {});

Diff for: lib/before-watch.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const { runWebpackCompiler } = require("./compiler");
2+
const { setProcessInitDirectory } = require("./utils");
23

3-
module.exports = function ($projectData, $logger, hookArgs) {
4+
module.exports = function ($logger, hookArgs) {
45
if (hookArgs.config) {
56
const appFilesUpdaterOptions = hookArgs.config.appFilesUpdaterOptions;
67
if (appFilesUpdaterOptions.bundle) {
@@ -15,7 +16,9 @@ module.exports = function ($projectData, $logger, hookArgs) {
1516
watch: true
1617
};
1718

18-
return runWebpackCompiler(config, $projectData, $logger, hookArgs);
19+
const projectData = hookArgs.projectData;
20+
setProcessInitDirectory(projectData.projectDir);
21+
return runWebpackCompiler(config, projectData, $logger, hookArgs);
1922
}));
2023
}
2124
}

Diff for: lib/before-watchPatterns.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ const {
55
setProcessInitDirectory,
66
} = require("./utils");
77

8-
module.exports = function ($projectData, hookArgs) {
8+
module.exports = function (hookArgs) {
99
const { liveSyncData } = hookArgs;
1010
if (!liveSyncData || !liveSyncData.bundle) {
1111
return;
1212
}
1313

14-
setProcessInitDirectory($projectData.projectDir);
14+
setProcessInitDirectory(hookArgs.projectData.projectDir);
1515
const { platforms } = hookArgs;
1616
const { env } = liveSyncData;
1717
return (args, originalMethod) => {
@@ -21,7 +21,7 @@ module.exports = function ($projectData, hookArgs) {
2121
}
2222

2323
const compilationContexts = platforms.map(platform =>
24-
getContext($projectData, platform, env));
24+
getContext(hookArgs.projectData, platform, env));
2525

2626
const ignorePatterns = compilationContexts.map(
2727
context => `!${context}`
@@ -32,7 +32,7 @@ module.exports = function ($projectData, hookArgs) {
3232
};
3333
}
3434

35-
function getContext($projectData, platform, env) {
36-
const fullEnvData = buildEnvData($projectData, platform, env);
37-
return getCompilationContext($projectData.projectDir, fullEnvData);
35+
function getContext(projectData, platform, env) {
36+
const fullEnvData = buildEnvData(projectData, platform, env);
37+
return getCompilationContext(projectData.projectDir, fullEnvData);
3838
}

Diff for: lib/compiler.js

-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ exports.runWebpackCompiler = function runWebpackCompiler(config, $projectData, $
5858
...sourceMapSupportArgs,
5959
pathResolve(projectDir, "node_modules", "webpack", "bin", "webpack.js"),
6060
`--config=${pathResolve(projectDir, "webpack.config.js")}`,
61-
"--progress",
6261
...(config.watch ? ["--watch"] : []),
6362
...envParams,
6463
].filter(a => !!a);

0 commit comments

Comments
 (0)