From 0bedefcdf93d30ba06297af77cf87639f8ef9f99 Mon Sep 17 00:00:00 2001 From: Kristian Dimitrov Date: Mon, 20 May 2019 18:09:19 +0300 Subject: [PATCH 1/2] fix: clean up snpashot tool on download fail (#893) --- snapshot/android/snapshot-generator.js | 18 ++++++++++++++++-- snapshot/android/utils.js | 8 ++++---- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/snapshot/android/snapshot-generator.js b/snapshot/android/snapshot-generator.js index f845ecee..2bb1a7eb 100644 --- a/snapshot/android/snapshot-generator.js +++ b/snapshot/android/snapshot-generator.js @@ -1,5 +1,5 @@ const fs = require("fs"); -const { dirname, join } = require("path"); +const { dirname, join, EOL } = require("path"); const os = require("os"); const child_process = require("child_process"); @@ -12,6 +12,7 @@ const BUNDLE_PREAMBLE_PATH = join(__dirname, "snapshot-generator-tools/bundle-pr const BUNDLE_ENDING_PATH = join(__dirname, "snapshot-generator-tools/bundle-ending.js"); const INCLUDE_GRADLE_PATH = join(__dirname, "snapshot-generator-tools/include.gradle"); const MKSNAPSHOT_TOOLS_DOWNLOAD_ROOT_URL = "https://raw.githubusercontent.com/NativeScript/mksnapshot-tools/production/"; +const MKSNAPSHOT_TOOLS_DOWNLOAD_TIMEOUT = 60000; const SNAPSHOT_BLOB_NAME = "TNSSnapshot"; function shellJsExecuteInDir(dir, action) { @@ -66,7 +67,20 @@ SnapshotGenerator.prototype.downloadMksnapshotTool = function(snapshotToolsPath, const downloadUrl = MKSNAPSHOT_TOOLS_DOWNLOAD_ROOT_URL + mksnapshotToolRelativePath; createDirectory(dirname(mksnapshotToolPath)); - snapshotToolsDownloads[mksnapshotToolPath] = downloadFile(downloadUrl, mksnapshotToolPath); + snapshotToolsDownloads[mksnapshotToolPath] = downloadFile(downloadUrl, mksnapshotToolPath, MKSNAPSHOT_TOOLS_DOWNLOAD_TIMEOUT); + snapshotToolsDownloads[mksnapshotToolPath].catch(err => { + const errorMessage = err && err.message ? err.message : ""; + let cleanupError = ""; + try { + fs.unlinkSync(mksnapshotToolPath); + } catch (unlinkErr) { + if (unlinkErr && unlinkErr.code !== "ENOENT") { + cleanupError = `${EOL}Failed to cleanup mksnapshot tool.`; + } + } + + throw new Error(`Failed to download mksnapshot tool. Error: ${errorMessage}.${cleanupError}`); + }); return snapshotToolsDownloads[mksnapshotToolPath]; } diff --git a/snapshot/android/utils.js b/snapshot/android/utils.js index bf59ddd2..2b63ae28 100644 --- a/snapshot/android/utils.js +++ b/snapshot/android/utils.js @@ -12,9 +12,9 @@ const CONSTANTS = { const createDirectory = dir => mkdir('-p', dir); -const downloadFile = (url, destinationFilePath) => +const downloadFile = (url, destinationFilePath, timeout) => new Promise((resolve, reject) => { - getRequestOptions(url) + getRequestOptions(url, timeout) .then(options => get(options) .on("error", reject) @@ -49,9 +49,9 @@ const getJsonFile = url => ).catch(reject); }); -const getRequestOptions = (url) => +const getRequestOptions = (url, timeout) => new Promise((resolve, reject) => { - const options = { url }; + const options = { url, timeout }; getProxySettings() .then(proxySettings => { const allOptions = Object.assign(options, proxySettings); From 172acb937c379aec0a2cdfc5e30b5f1d274edc15 Mon Sep 17 00:00:00 2001 From: Rosen Vladimirov Date: Tue, 21 May 2019 18:26:38 +0300 Subject: [PATCH 2/2] release: cut the 0.22.0 release (#889) --- CHANGELOG.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 845a7224..c9ab3fa2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,23 @@ + +# [0.22.0](https://github.com/NativeScript/nativescript-dev-webpack/compare/0.21.0...0.22.0) (2019-05-15) + + +### Bug Fixes + +* ignore the Webpack runtime chunks when sending HMR updates ([be82ab7](https://github.com/NativeScript/nativescript-dev-webpack/commit/be82ab7)) +* show proper stack traces from uglified code (split by new line instead of semicolon) ([0ae6030](https://github.com/NativeScript/nativescript-dev-webpack/commit/0ae6030)) +* sourceMap not generated with Uglify ([#819](https://github.com/NativeScript/nativescript-dev-webpack/issues/819)) ([b5fd066](https://github.com/NativeScript/nativescript-dev-webpack/commit/b5fd066)) +* support platform specific files that are not directly imported anywhere in the app ([#843](https://github.com/NativeScript/nativescript-dev-webpack/issues/843)) ([e1e9463](https://github.com/NativeScript/nativescript-dev-webpack/commit/e1e9463)) +* update the css loader in order to fix a bug with leading dashes of css classes ([#847](https://github.com/NativeScript/nativescript-dev-webpack/issues/847)) ([7670e33](https://github.com/NativeScript/nativescript-dev-webpack/commit/7670e33)) +* **hmr:** run ts-loader in transpileOnly mode ([#878](https://github.com/NativeScript/nativescript-dev-webpack/issues/878)) ([0317729](https://github.com/NativeScript/nativescript-dev-webpack/commit/0317729)) + + +### Features + +* replace UglifyJs with Terser ([621090a](https://github.com/NativeScript/nativescript-dev-webpack/commit/621090a)) +* support hidden source maps to map error stack traces from crash reports ([#854](https://github.com/NativeScript/nativescript-dev-webpack/issues/854)) ([dbcfbc2](https://github.com/NativeScript/nativescript-dev-webpack/commit/dbcfbc2)) + + ## [0.21.2](https://github.com/NativeScript/nativescript-dev-webpack/compare/0.21.0...0.21.2) (2019-04-22) @@ -531,7 +551,7 @@ module.exports = env => { nsWebpack.loadAdditionalPlugins({ projectDir: projectRoot }); // <----- Add this line // ... -``` +``` * The `getAppPath` method expects two arguments now - `platform` and `projectRoot`. The usage inside the project's `webpack.config.js` should be changed in the following way: