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

Commit 6ca74d0

Browse files
Merge pull request #733 from NativeScript/release-0.18.3
Release 0.18.3
2 parents a6da3d6 + ba479a8 commit 6ca74d0

17 files changed

+244
-65
lines changed

Diff for: .gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,5 @@ jasmine-config/reporter.js.map
3232

3333
hooks
3434
.DS_Store
35+
36+
!projectHelpers.spec.js

Diff for: .npmignore

+9
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,12 @@ demo
44
*.ts
55
!*.d.ts
66

7+
*.spec.*
8+
.vscode/
9+
.github/
10+
jasmine-config/
11+
CONTRIBUTING.md
12+
CODE_OF_CONDUCT.md
13+
PULL_REQUEST_TESTS.md
14+
15+
*.tgz

Diff for: CHANGELOG.md

+35
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,38 @@
1+
<a name="0.18.3"></a>
2+
## [0.18.3](https://github.com/NativeScript/nativescript-dev-webpack/compare/0.18.2...0.18.3) (2018-12-10)
3+
4+
5+
### Bug Fixes
6+
7+
* project's package.json indentation is not persisted ([#727](https://github.com/NativeScript/nativescript-dev-webpack/issues/727)) ([a45a45c](https://github.com/NativeScript/nativescript-dev-webpack/commit/a45a45c))
8+
9+
10+
11+
<a name="0.18.2"></a>
12+
## [0.18.2](https://github.com/NativeScript/nativescript-dev-webpack/compare/0.18.1...0.18.2) (2018-12-06)
13+
14+
15+
### Bug Fixes
16+
17+
* avoid getting `js` template in a `ts` project ([#717](https://github.com/NativeScript/nativescript-dev-webpack/issues/717)) ([c121c24](https://github.com/NativeScript/nativescript-dev-webpack/commit/c121c24))
18+
19+
20+
### Features
21+
22+
* **HMR:** expose context ([#724](https://github.com/NativeScript/nativescript-dev-webpack/issues/724)) ([c14110c](https://github.com/NativeScript/nativescript-dev-webpack/commit/c14110c))
23+
24+
25+
26+
<a name="0.18.1"></a>
27+
## [0.18.1](https://github.com/NativeScript/nativescript-dev-webpack/compare/0.18.0...0.18.1) (2018-12-03)
28+
29+
30+
### Bug Fixes
31+
32+
* avoid getting `js` template in a `ts` project ([#717](https://github.com/NativeScript/nativescript-dev-webpack/issues/717)) ([c121c24](https://github.com/NativeScript/nativescript-dev-webpack/commit/c121c24))
33+
34+
35+
136
<a name="0.18.0"></a>
237
# [0.18.0](https://github.com/NativeScript/nativescript-dev-webpack/compare/0.17.0...0.18.0) (2018-11-13)
338

Diff for: LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright (c) 2015-2018 Telerik EAD
189+
Copyright (c) 2015-2018 Progress Software Corporation
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

Diff for: bundle-config-loader.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ module.exports = function (source) {
1919
require("nativescript-dev-webpack/hot")(__webpack_require__.h(), (fileName) => applicationFiles.getFile(fileName));
2020
};
2121
22-
global.__hmrRefresh = function(type) {
22+
global.__hmrRefresh = function({ type, module }) {
2323
global.__hmrNeedReload = true;
2424
setTimeout(() => {
2525
if(global.__hmrNeedReload) {
2626
global.__hmrNeedReload = false;
27-
global.__hmrLivesyncBackup();
27+
global.__hmrLivesyncBackup({ type, module });
2828
}
2929
});
3030
}
@@ -45,9 +45,9 @@ module.exports = function (source) {
4545
if (loadCss) {
4646
source = `
4747
require("${
48-
angular ?
49-
'nativescript-dev-webpack/load-application-css-angular' :
50-
'nativescript-dev-webpack/load-application-css-regular'
48+
angular ?
49+
'nativescript-dev-webpack/load-application-css-angular' :
50+
'nativescript-dev-webpack/load-application-css-regular'
5151
}")();
5252
${source}
5353
`;

Diff for: demo/AngularApp/package.json

+20-20
Original file line numberDiff line numberDiff line change
@@ -13,45 +13,45 @@
1313
}
1414
},
1515
"dependencies": {
16-
"@angular/common": "~6.1.0",
17-
"@angular/compiler": "~6.1.0",
18-
"@angular/core": "~6.1.0",
19-
"@angular/forms": "~6.1.0",
20-
"@angular/http": "~6.1.0",
21-
"@angular/platform-browser": "~6.1.0",
22-
"@angular/platform-browser-dynamic": "~6.1.0",
23-
"@angular/router": "~6.1.0",
16+
"@angular/common": "~7.1.0",
17+
"@angular/compiler": "~7.1.0",
18+
"@angular/core": "~7.1.0",
19+
"@angular/forms": "~7.1.0",
20+
"@angular/http": "~7.1.0",
21+
"@angular/platform-browser": "~7.1.0",
22+
"@angular/platform-browser-dynamic": "~7.1.0",
23+
"@angular/router": "~7.1.0",
2424
"nativescript-angular": "next",
2525
"nativescript-theme-core": "~1.0.2",
2626
"reflect-metadata": "~0.1.8",
27-
"rxjs": "^6.0.0",
27+
"rxjs": "~6.3.3",
2828
"tns-core-modules": "next",
29-
"zone.js": "^0.8.26"
29+
"zone.js": "~0.8.26"
3030
},
3131
"devDependencies": {
32-
"@angular/compiler-cli": "~6.1.0",
33-
"@ngtools/webpack": "~6.2.0",
34-
"@types/chai": "^4.0.2",
35-
"@types/mocha": "^2.2.41",
36-
"@types/node": "^7.0.5",
32+
"@angular/compiler-cli": "~7.1.0",
33+
"@ngtools/webpack": "~7.1.2",
34+
"@types/chai": "~4.1.7",
35+
"@types/mocha": "~5.2.5",
36+
"@types/node": "~10.12.12",
3737
"babel-traverse": "6.26.0",
3838
"babel-types": "6.26.0",
3939
"babylon": "6.18.0",
4040
"chai": "~4.1.1",
4141
"chai-as-promised": "~7.1.1",
4242
"lazy": "1.0.11",
43-
"mocha": "~3.5.0",
44-
"mocha-junit-reporter": "^1.13.0",
45-
"mocha-multi": "^0.11.0",
43+
"mocha": "~5.2.0",
44+
"mocha-junit-reporter": "~1.18.0",
45+
"mocha-multi": "~1.0.1",
4646
"nativescript-dev-appium": "next",
4747
"nativescript-dev-sass": "next",
4848
"nativescript-dev-typescript": "next",
4949
"nativescript-dev-webpack": "next",
50-
"typescript": "~2.7.2"
50+
"typescript": "~3.1.1"
5151
},
5252
"scripts": {
5353
"setup": "npm pack ../../ && npm i -D nativescript-dev-webpack*.tgz",
5454
"e2e": "tsc -p e2e && mocha --opts ../config/mocha.opts --recursive e2e --appiumCapsLocation ../config/appium.capabilities.json",
5555
"compile-tests": "tsc -p e2e --watch"
5656
}
57-
}
57+
}

Diff for: demo/JavaScriptApp/package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717
"tns-core-modules": "next"
1818
},
1919
"devDependencies": {
20-
"@types/chai": "^4.0.2",
21-
"@types/mocha": "^2.2.41",
22-
"@types/node": "^7.0.5",
20+
"@types/chai": "~4.1.7",
21+
"@types/mocha": "~5.2.5",
22+
"@types/node": "~10.12.12",
2323
"babel-traverse": "6.26.0",
2424
"babel-types": "6.26.0",
2525
"babylon": "6.18.0",
2626
"lazy": "1.0.11",
27-
"mocha": "~3.5.0",
28-
"mocha-junit-reporter": "^1.13.0",
29-
"mocha-multi": "^0.11.0",
27+
"mocha": "~5.2.0",
28+
"mocha-junit-reporter":"~1.18.0",
29+
"mocha-multi":"~1.0.1",
3030
"nativescript-dev-appium": "next",
3131
"nativescript-dev-sass": "next",
3232
"nativescript-dev-webpack": "next",
@@ -36,4 +36,4 @@
3636
"setup": "npm pack ../../ && npm i -D nativescript-dev-webpack*.tgz",
3737
"e2e": "mocha --opts ../config/mocha.opts --recursive e2e --appiumCapsLocation ../config/appium.capabilities.json"
3838
}
39-
}
39+
}

Diff for: demo/TypeScriptApp/package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@
1717
"tns-core-modules": "next"
1818
},
1919
"devDependencies": {
20-
"@types/chai": "^4.0.2",
21-
"@types/mocha": "^2.2.41",
22-
"@types/node": "^7.0.5",
20+
"@types/chai": "~4.1.7",
21+
"@types/mocha": "~5.2.5",
22+
"@types/node": "~10.12.12",
2323
"babel-traverse": "6.26.0",
2424
"babel-types": "6.26.0",
2525
"babylon": "6.18.0",
2626
"lazy": "1.0.11",
27-
"mocha": "~3.5.0",
28-
"mocha-junit-reporter": "^1.13.0",
29-
"mocha-multi": "^0.11.0",
27+
"mocha": "~5.2.0",
28+
"mocha-junit-reporter": "~1.18.0",
29+
"mocha-multi": "~1.0.1",
3030
"nativescript-dev-appium": "next",
3131
"nativescript-dev-sass": "next",
3232
"nativescript-dev-typescript": "next",
3333
"nativescript-dev-webpack": "next",
34-
"typescript": "~2.7.2"
34+
"typescript": "~3.2.2"
3535
},
3636
"scripts": {
3737
"setup": "npm pack ../../ && npm i -D nativescript-dev-webpack*.tgz",

Diff for: dependencyManager.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ function getRequiredDeps(packageJson) {
8686
}
8787

8888
const deps = {
89-
"@angular/compiler-cli": "~7.0.0",
89+
"@angular/compiler-cli": "~7.1.0",
9090
};
9191

9292
if (!dependsOn(packageJson, "@angular-devkit/build-angular")) {
93-
deps["@ngtools/webpack"] = "~7.0.0";
93+
deps["@ngtools/webpack"] = "~7.1.0";
9494
}
9595

9696
return deps;

Diff for: hot-loader-helper.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
module.exports.reload = function(type) { return `
1+
module.exports.reload = function ({ type, module }) {
2+
return `
23
if (module.hot) {
34
module.hot.accept();
45
module.hot.dispose(() => {
5-
global.__hmrRefresh('${type}');
6+
global.__hmrRefresh({ type: '${type}', module: '${module}' });
67
})
78
}
89
`};
9-

Diff for: jasmine-config/jasmine.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"spec_dir": ".",
33
"spec_files": [
4-
"./!(node_modules)/**/*.spec.js"
4+
"./!(node_modules)/**/*.spec.js",
5+
"./*.spec.js"
56
],
67
"helpers": [
78
"jasmine-config/**/*.js"

Diff for: markup-hot-loader.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
const { reload } = require("./hot-loader-helper");
22

33
module.exports = function (source) {
4-
return `${source};${reload('markup')}`;
4+
const typeMarkup = "markup";
5+
const modulePath = this.resourcePath.replace(this.context, ".");
6+
return `${source};${reload({ type: typeMarkup, module: modulePath })}`;
57
};

Diff for: package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-dev-webpack",
3-
"version": "0.18.0",
3+
"version": "0.18.3",
44
"main": "index",
55
"description": "",
66
"homepage": "http://www.telerik.com",
@@ -60,7 +60,7 @@
6060
"scripts": {
6161
"postinstall": "node postinstall.js",
6262
"postpack": "rm -rf node_modules",
63-
"prepare": "tsc",
63+
"prepare": "tsc && npm run jasmine",
6464
"test": "npm run prepare && npm run jasmine",
6565
"jasmine": "jasmine --config=jasmine-config/jasmine.json",
6666
"version": "rm package-lock.json && conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md"
@@ -83,26 +83,26 @@
8383
"semver": "5.4.1",
8484
"shelljs": "0.6.0",
8585
"tapable": "1.0.0",
86-
"webpack": "~4.24.0",
86+
"webpack": "~4.27.0",
8787
"webpack-cli": "~3.1.1",
8888
"webpack-bundle-analyzer": "~3.0.2",
8989
"webpack-sources": "~1.3.0",
90-
"clean-webpack-plugin": "~0.1.19",
90+
"clean-webpack-plugin": "~1.0.0",
9191
"copy-webpack-plugin": "~4.6.0",
9292
"raw-loader": "~0.5.1",
9393
"css-loader": "~1.0.0",
9494
"nativescript-worker-loader": "~0.9.0",
9595
"extract-text-webpack-plugin": "~3.0.2",
9696
"uglifyjs-webpack-plugin": "~1.2.5",
97-
"@angular-devkit/core": "~7.0.0",
97+
"@angular-devkit/core": "~7.1.0",
9898
"resolve-url-loader": "~3.0.0",
9999
"awesome-typescript-loader": "~5.2.1",
100100
"sass-loader": "~7.1.0"
101101
},
102102
"devDependencies": {
103-
"@ngtools/webpack": "~7.0.0",
104-
"@types/jasmine": "^2.8.8",
105-
"@types/node": "^8.0.0",
103+
"@ngtools/webpack": "~7.1.0",
104+
"@types/jasmine": "^3.3.1",
105+
"@types/node": "^10.12.12",
106106
"conventional-changelog-cli": "^1.3.22",
107107
"jasmine": "^3.2.0",
108108
"jasmine-spec-reporter": "^4.2.1",

Diff for: projectHelpers.js

+24-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { resolve } = require("path");
2-
const { readFileSync, writeFileSync } = require("fs");
2+
const fs = require("fs");
33

44
const hook = require("nativescript-hook")(__dirname);
55

@@ -13,11 +13,13 @@ const isTypeScript = ({ projectDir, packageJson } = {}) => {
1313

1414
return (
1515
packageJson.dependencies &&
16-
packageJson.dependencies.hasOwnProperty("typescript")
16+
(packageJson.dependencies.hasOwnProperty("nativescript-dev-typescript") ||
17+
packageJson.dependencies.hasOwnProperty("typescript"))
1718
) || (
18-
packageJson.devDependencies &&
19-
packageJson.devDependencies.hasOwnProperty("typescript")
20-
) || isAngular({ packageJson });
19+
packageJson.devDependencies &&
20+
(packageJson.devDependencies.hasOwnProperty("nativescript-dev-typescript") ||
21+
packageJson.devDependencies.hasOwnProperty("typescript"))
22+
) || isAngular({ packageJson });
2123
};
2224

2325
const isAngular = ({ projectDir, packageJson } = {}) => {
@@ -36,13 +38,26 @@ const isVue = ({ projectDir, packageJson } = {}) => {
3638

3739
const getPackageJson = projectDir => {
3840
const packageJsonPath = getPackageJsonPath(projectDir);
39-
return JSON.parse(readFileSync(packageJsonPath, "utf8"));
41+
return JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
4042
};
4143

4244
const writePackageJson = (content, projectDir) => {
4345
const packageJsonPath = getPackageJsonPath(projectDir);
44-
writeFileSync(packageJsonPath, JSON.stringify(content, null, 2))
46+
const currentJsonContent = fs.readFileSync(packageJsonPath);
47+
const indentation = getIndentationCharacter(currentJsonContent);
48+
const stringifiedContent = JSON.stringify(content, null, indentation);
49+
const currentPackageJsonContent = JSON.parse(currentJsonContent);
50+
51+
if (JSON.stringify(currentPackageJsonContent, null, indentation) !== stringifiedContent) {
52+
fs.writeFileSync(packageJsonPath, stringifiedContent)
53+
}
4554
}
55+
56+
const getIndentationCharacter = (jsonContent) => {
57+
const matches = jsonContent && jsonContent.toString().match(/{\r*\n*(\W*)"/m);
58+
return matches && matches[1];
59+
}
60+
4661
const getProjectDir = hook.findProjectDir;
4762

4863
const getPackageJsonPath = projectDir => resolve(projectDir, "package.json");
@@ -94,5 +109,6 @@ module.exports = {
94109
isVue,
95110
isTypeScript,
96111
writePackageJson,
97-
convertSlashesInPath
112+
convertSlashesInPath,
113+
getIndentationCharacter
98114
};

0 commit comments

Comments
 (0)