Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9c729c7

Browse files
authoredApr 17, 2018
Merge branch 'master' into sis0k0/webpack4
2 parents 1dd2000 + 0b0fe4e commit 9c729c7

28 files changed

+350
-68
lines changed
 

‎CHANGELOG.md

Lines changed: 48 additions & 1 deletion
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-

‎CONTRIBUTING.md

Lines changed: 40 additions & 0 deletions
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+

‎demo/.gitignore

Lines changed: 3 additions & 0 deletions
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

‎demo/AngularApp/package.json

Lines changed: 1 addition & 1 deletion
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
}

‎demo/JavaScriptApp/e2e/config/appium.capabilities.json

Lines changed: 2 additions & 2 deletions
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,

‎demo/JavaScriptApp/e2e/config/mocha.opts

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

‎demo/JavaScriptApp/package.json

Lines changed: 1 addition & 1 deletion
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
}

‎demo/TypeScriptApp/e2e/config/appium.capabilities.json

Lines changed: 2 additions & 2 deletions
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,

‎demo/TypeScriptApp/e2e/config/mocha.opts

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

‎demo/TypeScriptApp/package.json

Lines changed: 1 addition & 1 deletion
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
}

‎demo/AngularApp/e2e/config/appium.capabilities.json renamed to ‎demo/config/appium.capabilities.json

Lines changed: 25 additions & 5 deletions
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.

‎index.js

Lines changed: 3 additions & 0 deletions
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

‎lib/after-prepare.js

Lines changed: 2 additions & 2 deletions
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
}

‎lib/after-watch.js

Lines changed: 1 addition & 1 deletion
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
}

‎lib/before-cleanApp.js

Lines changed: 4 additions & 1 deletion
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
}

‎lib/before-prepareJS.js

Lines changed: 7 additions & 2 deletions
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
}

‎lib/before-shouldPrepare.js

Lines changed: 3 additions & 0 deletions
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 || {});

‎lib/before-watch.js

Lines changed: 5 additions & 2 deletions
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
}

‎lib/before-watchPatterns.js

Lines changed: 6 additions & 6 deletions
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
}

‎lib/compiler.js

Lines changed: 0 additions & 1 deletion
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);

‎mangle-excludes.js

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
module.exports = [
2+
// Control names
3+
"AbsoluteLayout",
4+
"ActionBar",
5+
"ActivityIndicator",
6+
"Button",
7+
"DatePicker",
8+
"DockLayout",
9+
"EditableTextBase",
10+
"FlexboxLayout",
11+
"GridLayout",
12+
"Image",
13+
"Label",
14+
"Layout",
15+
"LayoutBase",
16+
"ListPicker",
17+
"ListView",
18+
"Page",
19+
"Progress",
20+
"SearchBar",
21+
"SegmentedBar",
22+
"Slider",
23+
"StackLayout",
24+
"Switch",
25+
"TabView",
26+
"TextBase",
27+
"TextField",
28+
"TextView",
29+
"TimePicker",
30+
"View",
31+
"WrapLayout",
32+
33+
// Android native class extenders
34+
"BroadcastReceiver",
35+
"CustomTypefaceSpan",
36+
"DialogFragmentClassInner",
37+
"FragmentClass",
38+
"ListViewAdapter",
39+
"LruBitmapCache",
40+
"NativeScriptActivity",
41+
"OurTabHost",
42+
"PageChangedListener",
43+
"PagerAdapterClassInner",
44+
"PinchGestureListener",
45+
"SegmentedBarColorDrawable",
46+
"SwipeGestureListener",
47+
"TapAndDoubleTapGestureListener",
48+
"WebViewClientClassInner",
49+
50+
// tns 3.0
51+
"DisableUserInteractionListener",
52+
"EditorActionListener",
53+
"FocusChangeListener",
54+
"TextWatcher",
55+
"ValueChangeListenerImpl",
56+
57+
"AnimationListnerImpl",
58+
"AnimationListenerImpl",
59+
"TransitionListenerImpl",
60+
"CheckedChangeListenerImpl",
61+
"ClickListenerImpl",
62+
"CompatCloseListenerImpl",
63+
"CloseListenerImpl",
64+
"DateChangedListenerImpl",
65+
"DialogFragmentImpl",
66+
"EditTextListenersImpl",
67+
"FormatterImpl",
68+
"ImageLoadedListenerImpl",
69+
"ItemClickListenerImpl",
70+
"MenuItemClickListenerImpl",
71+
"NSCacheDelegateImpl",
72+
"NativeViewGroupImpl",
73+
"PageChangedListenerImpl",
74+
"PagerAdapterImpl",
75+
"PinchGestureListenerImpl",
76+
"CompatQueryTextListenerImpl",
77+
"QueryTextListenerImpl",
78+
"SeekBarChangeListenerImpl",
79+
"SwipeGestureListenerImpl",
80+
"TabChangeListenerImpl",
81+
"TabContentFactoryImpl",
82+
"TabHostImpl",
83+
"TapAndDoubleTapGestureListenerImpl",
84+
"TextTransformationImpl",
85+
"TimeChangedListenerImpl",
86+
"TouchListenerImpl",
87+
"WebViewClientImpl",
88+
89+
// iOS native class extenders
90+
"AnimatedTransitioning",
91+
"AnimationDelegateImpl",
92+
"DataSource",
93+
"FrameHandlerImpl",
94+
"ListPickerDataSource",
95+
"ListPickerDelegateImpl",
96+
"ListViewCell",
97+
"LocationListenerImpl",
98+
"NSURLSessionTaskDelegateImpl",
99+
"NotificationObserver",
100+
"ObserverClass",
101+
"Responder",
102+
"SelectionHandlerImpl",
103+
"SliderChangeHandlerImpl",
104+
"SwitchChangeHandlerImpl",
105+
"TapBarItemHandlerImpl",
106+
"TapHandlerImpl",
107+
"TimerTargetImpl",
108+
"TouchGestureRecognizer",
109+
"TransitionDelegate",
110+
"UIActionSheetDelegateImpl",
111+
"UIAlertViewDelegateImpl",
112+
"UIDatePickerChangeHandlerImpl",
113+
"UIDocumentInteractionControllerDelegateImpl",
114+
"UIGestureRecognizerDelegateImpl",
115+
"UIGestureRecognizerImpl",
116+
"UIImagePickerControllerDelegateImpl",
117+
"UINavigationControllerAnimatedDelegate",
118+
"UINavigationControllerDelegateImpl",
119+
"UINavigationControllerImpl",
120+
"UIScrollViewDelegateImpl",
121+
"UISearchBarDelegateImpl",
122+
"UITabBarControllerDelegateImpl",
123+
"UITabBarControllerImpl",
124+
"UITableViewDelegateImpl",
125+
"UITableViewRowHeightDelegateImpl",
126+
"UITextFieldDelegateImpl",
127+
"UITextFieldImpl",
128+
"UITextViewDelegateImpl",
129+
"UITimePickerChangeHandlerImpl",
130+
"UIViewControllerImpl",
131+
"UIWebViewDelegateImpl",
132+
"Window",
133+
134+
// Sidedrawer transitions
135+
// Should be removed after {N} 4.0 is released
136+
// See: https://github.com/telerik/nativescript-ui-feedback/issues/477#issuecomment-360772046
137+
"PushTransition",
138+
"FadeTransition",
139+
"SlideInOnTopTransition",
140+
];

‎nsCliHelpers.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ const PROJECT_DATA_GETTERS = {
77

88
function getProjectData(projectDir) {
99
const cli = getNsCli();
10+
if (!cli) {
11+
return {};
12+
}
13+
1014
const projectDataService = cli.projectDataService;
1115
const projectData = safeGet(projectDataService, "getProjectData", projectDir);
1216

@@ -15,6 +19,10 @@ function getProjectData(projectDir) {
1519

1620
function getNsCli() {
1721
const cliPath = getPath("nativescript", "tns");
22+
if (!cliPath) {
23+
return;
24+
}
25+
1826
const cli = require(cliPath);
1927

2028
return cli;

‎package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-dev-webpack",
3-
"version": "0.9.2",
3+
"version": "0.10.1",
44
"main": "index",
55
"description": "",
66
"homepage": "http://www.telerik.com",
@@ -25,6 +25,11 @@
2525
"script": "lib/before-watch.js",
2626
"inject": true
2727
},
28+
{
29+
"type": "after-watch",
30+
"script": "lib/after-watch.js",
31+
"inject": true
32+
},
2833
{
2934
"type": "before-watchPatterns",
3035
"script": "lib/before-watchPatterns.js",
@@ -49,7 +54,8 @@
4954
},
5055
"scripts": {
5156
"postinstall": "node postinstall.js",
52-
"prepare": "tsc"
57+
"prepare": "tsc",
58+
"version": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md"
5359
},
5460
"bin": {
5561
"install-ns-webpack": "./bin/install-ns-webpack",
@@ -62,7 +68,7 @@
6268
"dependencies": {
6369
"global-modules-path": "2.0.0",
6470
"minimatch": "3.0.4",
65-
"nativescript-hook": "0.2.2",
71+
"nativescript-hook": "0.2.3",
6672
"proxy-lib": "0.4.0",
6773
"request": "2.83.0",
6874
"schema-utils": "0.4.3",

‎postinstall.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@
33
const { dirname } = require("path");
44
const hook = require("nativescript-hook")(__dirname);
55

6-
if (hook.findProjectDir() === __dirname) {
7-
// We are installing dev dependencies for the nativescript-dev-webpack plugin.
8-
console.log("Skipping postinstall artifacts! We assumed the nativescript-dev-webpack is installing devDependencies");
9-
} else {
6+
const { compareProjectFiles } = require("./projectFilesManager");
7+
const { getProjectDir } = require("./projectHelpers");
8+
9+
const projectDir = getProjectDir();
10+
11+
if (projectDir) {
12+
compareProjectFiles(projectDir);
13+
1014
hook.postinstall();
1115
const installer = require("./installer");
1216
installer.install();
17+
} else {
18+
// We are installing dev dependencies for the nativescript-dev-webpack plugin.
19+
console.log("Skipping postinstall artifacts! We assumed the nativescript-dev-webpack is installing devDependencies");
1320
}

‎projectFilesManager.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,21 @@ function forceUpdateProjectFiles(projectDir, appDir) {
3737
addProjectFiles(projectDir, appDir);
3838
}
3939

40+
function compareProjectFiles(projectDir) {
41+
const projectTemplates = getProjectTemplates(projectDir);
42+
Object.keys(projectTemplates).forEach(newTemplatePath => {
43+
const currentTemplatePath = projectTemplates[newTemplatePath];
44+
if (fs.existsSync(currentTemplatePath)) {
45+
const currentTemplate = fs.readFileSync(currentTemplatePath).toString();
46+
const newTemplate = fs.readFileSync(newTemplatePath).toString();
47+
if (newTemplate !== currentTemplate) {
48+
const message = `The current project contains a ${path.basename(currentTemplatePath)} file located at ${currentTemplatePath} that differs from the one in the new version of the nativescript-dev-webpack plugin located at ${newTemplatePath}. Some of the plugin features may not work as expected until you manually update the ${path.basename(currentTemplatePath)} file or automatically update it using "./node_modules/.bin/update-ns-webpack --configs" command.`;
49+
console.info(`\x1B[33;1m${message}\x1B[0m` );
50+
}
51+
}
52+
});
53+
}
54+
4055
function deleteFile(destinationPath) {
4156
if (fs.existsSync(destinationPath)) {
4257
console.info(`Deleting file: ${destinationPath}`);
@@ -105,5 +120,6 @@ module.exports = {
105120
addProjectFiles,
106121
removeProjectFiles,
107122
forceUpdateProjectFiles,
123+
compareProjectFiles,
108124
};
109125

‎projectHelpers.js

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ const path = require("path");
22
const fs = require("fs");
33
const semver = require("semver");
44
const { EOL } = require("os");
5+
const hook = require("nativescript-hook")(__dirname);
6+
7+
const {
8+
PROJECT_DATA_GETTERS,
9+
getProjectData,
10+
safeGet,
11+
} = require("./nsCliHelpers");
12+
13+
const APP_DIR = "app";
514

615
const {
716
PROJECT_DATA_GETTERS,
@@ -85,29 +94,7 @@ const writePackageJson = (content, projectDir) => {
8594
const packageJsonPath = getPackageJsonPath(projectDir);
8695
fs.writeFileSync(packageJsonPath, JSON.stringify(content, null, 2))
8796
}
88-
const getProjectDir = ({ nestingLvl } = { nestingLvl: 2 }) => {
89-
// INIT_CWD is available since npm 5.4
90-
const initCwd = process.env.INIT_CWD;
91-
const shouldUseInitCwd = (() => {
92-
if (!initCwd) {
93-
return false;
94-
}
95-
96-
const installedPackage = path.resolve(initCwd, "node_modules", "nativescript-dev-webpack");
97-
if (!fs.existsSync(installedPackage)) {
98-
return false;
99-
}
100-
101-
const stat = fs.lstatSync(installedPackage);
102-
return stat.isSymbolicLink();
103-
})();
104-
105-
return shouldUseInitCwd ?
106-
initCwd :
107-
Array
108-
.from(Array(nestingLvl))
109-
.reduce(dir => path.dirname(dir), __dirname);
110-
};
97+
const getProjectDir = hook.findProjectDir;
11198

11299
const toReleaseVersion = version =>
113100
version.replace(/-.*/, "");

‎templates/webpack.angular.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ module.exports = env => {
156156
"global.TNS_WEBPACK": "true",
157157
}),
158158
// Remove all files from the out dir.
159-
new CleanWebpackPlugin([`${dist}/**/*`]),
159+
new CleanWebpackPlugin([ `${dist}/**/*` ]),
160160
// Copy native app resources to out dir.
161161
new CopyWebpackPlugin([
162162
{
@@ -183,7 +183,7 @@ module.exports = env => {
183183
// AngularCompilerPlugin with augmented NativeScript filesystem to handle platform specific resource resolution.
184184
new nsWebpack.NativeScriptAngularCompilerPlugin(
185185
Object.assign({
186-
entryModule: resolve(__dirname, "app/app.module#AppModule"),
186+
entryModule: resolve(appPath, "app.module#AppModule"),
187187
skipCodeGeneration: !aot,
188188
platformOptions: {
189189
platform,

0 commit comments

Comments
 (0)
This repository has been archived.