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

Release 0.18.3 #733

Merged
merged 13 commits into from
Dec 10, 2018
Merged
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ jasmine-config/reporter.js.map

hooks
.DS_Store

!projectHelpers.spec.js
9 changes: 9 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,12 @@ demo
*.ts
!*.d.ts

*.spec.*
.vscode/
.github/
jasmine-config/
CONTRIBUTING.md
CODE_OF_CONDUCT.md
PULL_REQUEST_TESTS.md

*.tgz
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
<a name="0.18.3"></a>
## [0.18.3](https://github.com/NativeScript/nativescript-dev-webpack/compare/0.18.2...0.18.3) (2018-12-10)


### Bug Fixes

* 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))



<a name="0.18.2"></a>
## [0.18.2](https://github.com/NativeScript/nativescript-dev-webpack/compare/0.18.1...0.18.2) (2018-12-06)


### Bug Fixes

* 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))


### Features

* **HMR:** expose context ([#724](https://github.com/NativeScript/nativescript-dev-webpack/issues/724)) ([c14110c](https://github.com/NativeScript/nativescript-dev-webpack/commit/c14110c))



<a name="0.18.1"></a>
## [0.18.1](https://github.com/NativeScript/nativescript-dev-webpack/compare/0.18.0...0.18.1) (2018-12-03)


### Bug Fixes

* 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))



<a name="0.18.0"></a>
# [0.18.0](https://github.com/NativeScript/nativescript-dev-webpack/compare/0.17.0...0.18.0) (2018-11-13)

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

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

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
10 changes: 5 additions & 5 deletions bundle-config-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ module.exports = function (source) {
require("nativescript-dev-webpack/hot")(__webpack_require__.h(), (fileName) => applicationFiles.getFile(fileName));
};

global.__hmrRefresh = function(type) {
global.__hmrRefresh = function({ type, module }) {
global.__hmrNeedReload = true;
setTimeout(() => {
if(global.__hmrNeedReload) {
global.__hmrNeedReload = false;
global.__hmrLivesyncBackup();
global.__hmrLivesyncBackup({ type, module });
}
});
}
Expand All @@ -45,9 +45,9 @@ module.exports = function (source) {
if (loadCss) {
source = `
require("${
angular ?
'nativescript-dev-webpack/load-application-css-angular' :
'nativescript-dev-webpack/load-application-css-regular'
angular ?
'nativescript-dev-webpack/load-application-css-angular' :
'nativescript-dev-webpack/load-application-css-regular'
}")();
${source}
`;
Expand Down
40 changes: 20 additions & 20 deletions demo/AngularApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,45 +13,45 @@
}
},
"dependencies": {
"@angular/common": "~6.1.0",
"@angular/compiler": "~6.1.0",
"@angular/core": "~6.1.0",
"@angular/forms": "~6.1.0",
"@angular/http": "~6.1.0",
"@angular/platform-browser": "~6.1.0",
"@angular/platform-browser-dynamic": "~6.1.0",
"@angular/router": "~6.1.0",
"@angular/common": "~7.1.0",
"@angular/compiler": "~7.1.0",
"@angular/core": "~7.1.0",
"@angular/forms": "~7.1.0",
"@angular/http": "~7.1.0",
"@angular/platform-browser": "~7.1.0",
"@angular/platform-browser-dynamic": "~7.1.0",
"@angular/router": "~7.1.0",
"nativescript-angular": "next",
"nativescript-theme-core": "~1.0.2",
"reflect-metadata": "~0.1.8",
"rxjs": "^6.0.0",
"rxjs": "~6.3.3",
"tns-core-modules": "next",
"zone.js": "^0.8.26"
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular/compiler-cli": "~6.1.0",
"@ngtools/webpack": "~6.2.0",
"@types/chai": "^4.0.2",
"@types/mocha": "^2.2.41",
"@types/node": "^7.0.5",
"@angular/compiler-cli": "~7.1.0",
"@ngtools/webpack": "~7.1.2",
"@types/chai": "~4.1.7",
"@types/mocha": "~5.2.5",
"@types/node": "~10.12.12",
"babel-traverse": "6.26.0",
"babel-types": "6.26.0",
"babylon": "6.18.0",
"chai": "~4.1.1",
"chai-as-promised": "~7.1.1",
"lazy": "1.0.11",
"mocha": "~3.5.0",
"mocha-junit-reporter": "^1.13.0",
"mocha-multi": "^0.11.0",
"mocha": "~5.2.0",
"mocha-junit-reporter": "~1.18.0",
"mocha-multi": "~1.0.1",
"nativescript-dev-appium": "next",
"nativescript-dev-sass": "next",
"nativescript-dev-typescript": "next",
"nativescript-dev-webpack": "next",
"typescript": "~2.7.2"
"typescript": "~3.1.1"
},
"scripts": {
"setup": "npm pack ../../ && npm i -D nativescript-dev-webpack*.tgz",
"e2e": "tsc -p e2e && mocha --opts ../config/mocha.opts --recursive e2e --appiumCapsLocation ../config/appium.capabilities.json",
"compile-tests": "tsc -p e2e --watch"
}
}
}
14 changes: 7 additions & 7 deletions demo/JavaScriptApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@
"tns-core-modules": "next"
},
"devDependencies": {
"@types/chai": "^4.0.2",
"@types/mocha": "^2.2.41",
"@types/node": "^7.0.5",
"@types/chai": "~4.1.7",
"@types/mocha": "~5.2.5",
"@types/node": "~10.12.12",
"babel-traverse": "6.26.0",
"babel-types": "6.26.0",
"babylon": "6.18.0",
"lazy": "1.0.11",
"mocha": "~3.5.0",
"mocha-junit-reporter": "^1.13.0",
"mocha-multi": "^0.11.0",
"mocha": "~5.2.0",
"mocha-junit-reporter":"~1.18.0",
"mocha-multi":"~1.0.1",
"nativescript-dev-appium": "next",
"nativescript-dev-sass": "next",
"nativescript-dev-webpack": "next",
Expand All @@ -36,4 +36,4 @@
"setup": "npm pack ../../ && npm i -D nativescript-dev-webpack*.tgz",
"e2e": "mocha --opts ../config/mocha.opts --recursive e2e --appiumCapsLocation ../config/appium.capabilities.json"
}
}
}
14 changes: 7 additions & 7 deletions demo/TypeScriptApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@
"tns-core-modules": "next"
},
"devDependencies": {
"@types/chai": "^4.0.2",
"@types/mocha": "^2.2.41",
"@types/node": "^7.0.5",
"@types/chai": "~4.1.7",
"@types/mocha": "~5.2.5",
"@types/node": "~10.12.12",
"babel-traverse": "6.26.0",
"babel-types": "6.26.0",
"babylon": "6.18.0",
"lazy": "1.0.11",
"mocha": "~3.5.0",
"mocha-junit-reporter": "^1.13.0",
"mocha-multi": "^0.11.0",
"mocha": "~5.2.0",
"mocha-junit-reporter": "~1.18.0",
"mocha-multi": "~1.0.1",
"nativescript-dev-appium": "next",
"nativescript-dev-sass": "next",
"nativescript-dev-typescript": "next",
"nativescript-dev-webpack": "next",
"typescript": "~2.7.2"
"typescript": "~3.2.2"
},
"scripts": {
"setup": "npm pack ../../ && npm i -D nativescript-dev-webpack*.tgz",
Expand Down
4 changes: 2 additions & 2 deletions dependencyManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ function getRequiredDeps(packageJson) {
}

const deps = {
"@angular/compiler-cli": "~7.0.0",
"@angular/compiler-cli": "~7.1.0",
};

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

return deps;
Expand Down
6 changes: 3 additions & 3 deletions hot-loader-helper.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module.exports.reload = function(type) { return `
module.exports.reload = function ({ type, module }) {
return `
if (module.hot) {
module.hot.accept();
module.hot.dispose(() => {
global.__hmrRefresh('${type}');
global.__hmrRefresh({ type: '${type}', module: '${module}' });
})
}
`};

3 changes: 2 additions & 1 deletion jasmine-config/jasmine.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"spec_dir": ".",
"spec_files": [
"./!(node_modules)/**/*.spec.js"
"./!(node_modules)/**/*.spec.js",
"./*.spec.js"
],
"helpers": [
"jasmine-config/**/*.js"
Expand Down
4 changes: 3 additions & 1 deletion markup-hot-loader.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const { reload } = require("./hot-loader-helper");

module.exports = function (source) {
return `${source};${reload('markup')}`;
const typeMarkup = "markup";
const modulePath = this.resourcePath.replace(this.context, ".");
return `${source};${reload({ type: typeMarkup, module: modulePath })}`;
};
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nativescript-dev-webpack",
"version": "0.18.0",
"version": "0.18.3",
"main": "index",
"description": "",
"homepage": "http://www.telerik.com",
Expand Down Expand Up @@ -60,7 +60,7 @@
"scripts": {
"postinstall": "node postinstall.js",
"postpack": "rm -rf node_modules",
"prepare": "tsc",
"prepare": "tsc && npm run jasmine",
"test": "npm run prepare && npm run jasmine",
"jasmine": "jasmine --config=jasmine-config/jasmine.json",
"version": "rm package-lock.json && conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md"
Expand All @@ -83,26 +83,26 @@
"semver": "5.4.1",
"shelljs": "0.6.0",
"tapable": "1.0.0",
"webpack": "~4.24.0",
"webpack": "~4.27.0",
"webpack-cli": "~3.1.1",
"webpack-bundle-analyzer": "~3.0.2",
"webpack-sources": "~1.3.0",
"clean-webpack-plugin": "~0.1.19",
"clean-webpack-plugin": "~1.0.0",
"copy-webpack-plugin": "~4.6.0",
"raw-loader": "~0.5.1",
"css-loader": "~1.0.0",
"nativescript-worker-loader": "~0.9.0",
"extract-text-webpack-plugin": "~3.0.2",
"uglifyjs-webpack-plugin": "~1.2.5",
"@angular-devkit/core": "~7.0.0",
"@angular-devkit/core": "~7.1.0",
"resolve-url-loader": "~3.0.0",
"awesome-typescript-loader": "~5.2.1",
"sass-loader": "~7.1.0"
},
"devDependencies": {
"@ngtools/webpack": "~7.0.0",
"@types/jasmine": "^2.8.8",
"@types/node": "^8.0.0",
"@ngtools/webpack": "~7.1.0",
"@types/jasmine": "^3.3.1",
"@types/node": "^10.12.12",
"conventional-changelog-cli": "^1.3.22",
"jasmine": "^3.2.0",
"jasmine-spec-reporter": "^4.2.1",
Expand Down
32 changes: 24 additions & 8 deletions projectHelpers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { resolve } = require("path");
const { readFileSync, writeFileSync } = require("fs");
const fs = require("fs");

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

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

return (
packageJson.dependencies &&
packageJson.dependencies.hasOwnProperty("typescript")
(packageJson.dependencies.hasOwnProperty("nativescript-dev-typescript") ||
packageJson.dependencies.hasOwnProperty("typescript"))
) || (
packageJson.devDependencies &&
packageJson.devDependencies.hasOwnProperty("typescript")
) || isAngular({ packageJson });
packageJson.devDependencies &&
(packageJson.devDependencies.hasOwnProperty("nativescript-dev-typescript") ||
packageJson.devDependencies.hasOwnProperty("typescript"))
) || isAngular({ packageJson });
};

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

const getPackageJson = projectDir => {
const packageJsonPath = getPackageJsonPath(projectDir);
return JSON.parse(readFileSync(packageJsonPath, "utf8"));
return JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
};

const writePackageJson = (content, projectDir) => {
const packageJsonPath = getPackageJsonPath(projectDir);
writeFileSync(packageJsonPath, JSON.stringify(content, null, 2))
const currentJsonContent = fs.readFileSync(packageJsonPath);
const indentation = getIndentationCharacter(currentJsonContent);
const stringifiedContent = JSON.stringify(content, null, indentation);
const currentPackageJsonContent = JSON.parse(currentJsonContent);

if (JSON.stringify(currentPackageJsonContent, null, indentation) !== stringifiedContent) {
fs.writeFileSync(packageJsonPath, stringifiedContent)
}
}

const getIndentationCharacter = (jsonContent) => {
const matches = jsonContent && jsonContent.toString().match(/{\r*\n*(\W*)"/m);
return matches && matches[1];
}

const getProjectDir = hook.findProjectDir;

const getPackageJsonPath = projectDir => resolve(projectDir, "package.json");
Expand Down Expand Up @@ -94,5 +109,6 @@ module.exports = {
isVue,
isTypeScript,
writePackageJson,
convertSlashesInPath
convertSlashesInPath,
getIndentationCharacter
};
Loading