From 64f0c6b62168ef2666b8a8179137c331b2e8d19d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 26 Jan 2021 14:49:24 +0200 Subject: [PATCH 1/4] Improve deployment process --- app/index.html | 2 +- package.json | 2 ++ scripts/webpack.prod.config.js | 11 +++++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/index.html b/app/index.html index 958c8495..cbb7fe53 100755 --- a/app/index.html +++ b/app/index.html @@ -58,7 +58,7 @@ if (pathname[pathname.length - 1] !== '/') { pathname += '/'; } - link.href = pathname + 'themes/' + workspace + '-' + theme + '.css'; + link.href = pathname + 'themes/' + workspace + '.' + theme + '.min.css'; link.type = 'text/css'; link.rel = 'stylesheet'; document.getElementsByTagName('head')[0].appendChild(link); diff --git a/package.json b/package.json index 7de2f13c..7d551faf 100755 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "babel-plugin-redux-saga": "~1.1.2", "copy-webpack-plugin": "~7.0.0", "css-loader": "~5.0.1", + "css-minimizer-webpack-plugin": "^1.2.0", "eslint": "~7.18.0", "eslint-config-prettier": "~7.2.0", "eslint-import-resolver-webpack": "~0.13.0", @@ -68,6 +69,7 @@ "react-hot-loader": "~4.13.0", "redux-logger": "~3.0.6", "style-loader": "~2.0.0", + "terser-webpack-plugin": "^5.1.1", "url-loader": "~4.1.1", "webpack": "~5.17.0", "webpack-bundle-analyzer": "~3.9.0", diff --git a/scripts/webpack.prod.config.js b/scripts/webpack.prod.config.js index 4388c597..712f9560 100755 --- a/scripts/webpack.prod.config.js +++ b/scripts/webpack.prod.config.js @@ -15,9 +15,11 @@ const common = require('./webpack.common'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; const MiniCssExtractPlugin = require('mini-css-extract-plugin'); +const CssMinimizerPlugin = require('css-minimizer-webpack-plugin'); +const TerserPlugin = require('terser-webpack-plugin'); // Create multiple instances -const cssOutputFile = `themes/${common.workspace}-${common.theme}.css`; +const cssOutputFile = `themes/${common.workspace}.${common.theme}.min.css`; const extractThemeCSS = new MiniCssExtractPlugin({ filename: cssOutputFile, chunkFilename: cssOutputFile, // '[name].[contenthash].css', @@ -47,6 +49,10 @@ module.exports = { optimization: { concatenateModules: true, minimize: true, + minimizer: [ + new TerserPlugin(), + new CssMinimizerPlugin(), + ], moduleIds: 'hashed', nodeEnv: 'production', splitChunks: { @@ -66,7 +72,8 @@ module.exports = { output: { publicPath: './', path: common.outputDir, - filename: '[name].[contenthash].min.js' + // filename: '[name].[contenthash].min.js' + filename: '[name].min.js' }, resolve: { alias: common.resolve.alias, From e271403a00d4cb5a0fc7febece0ee9401bef538a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 26 Jan 2021 19:51:26 +0200 Subject: [PATCH 2/4] Handle more known issues --- app/modules/core/sagas.jsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/app/modules/core/sagas.jsx b/app/modules/core/sagas.jsx index 67939182..611c1dbd 100644 --- a/app/modules/core/sagas.jsx +++ b/app/modules/core/sagas.jsx @@ -73,7 +73,7 @@ function* watchNotifyError() { 'https://github.com/platformio/platform-linux_arm/issues/2' ], [ - /\[Error 2\] The system cannot find the file specified.*WindowsError/g, + /\[Error 2\]|\[WinError 2\]|\[Errno 13\]/g, 'https://github.com/platformio/platformio-core/issues/2321' ], [ @@ -85,7 +85,7 @@ function* watchNotifyError() { 'https://github.com/platformio/platformio-core/issues/2811' ], [ - /Error: You are not connected to the Internet/g, + /Error: You are not connected to the Internet|HTTPSConnectionPool/g, 'https://github.com/platformio/platformio-core/issues/1348' ], [ @@ -99,6 +99,18 @@ function* watchNotifyError() { [ /Error: Could not find the package/g, 'https://github.com/platformio/platformio-home/issues/2144' + ], + [ + /Error: Unknown development platform/g, + 'https://github.com/platformio/platformio-home/issues/2123' + ], + [ + /Error: Unknown board ID/g, + 'https://github.com/platformio/platformio-home/issues/1768' + ], + [ + /Error: Could not find one of .* manifest files/g, + 'https://github.com/platformio/platformio-home/issues/1785' ] ]; for (const [regex, url] of knownIssues) { From 5f878104161b3add6a70e9c2621d25fa0415849f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 26 Jan 2021 19:51:45 +0200 Subject: [PATCH 3/4] Add support for new library.json "examples" format --- .../containers/detail-examples-block.jsx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/app/modules/library/containers/detail-examples-block.jsx b/app/modules/library/containers/detail-examples-block.jsx index 59eef4c5..1b687eb1 100644 --- a/app/modules/library/containers/detail-examples-block.jsx +++ b/app/modules/library/containers/detail-examples-block.jsx @@ -35,11 +35,22 @@ class LibraryDetailExamplesBlock extends React.Component { osFsGlob: PropTypes.func.isRequired }; - static getGlobPatterns(custom) { - if (custom) { - return typeof custom === 'string' ? [custom] : custom; - } + static getGlobPatterns(examples) { const result = []; + if (examples) { + if (typeof examples === 'string') { + return [examples]; + } else if (typeof examples[0] === 'string') { + return examples; + } else if (examples[0].base && examples[0].files) { + examples.forEach(example => { + example.files.forEach(filename => { + result.push(path.join(example.base, filename)); + }); + }); + return result; + } + } for (const ext of ['*.ino', '*.pde', '*.c', '*.cpp', '*.h', '*.hpp']) { const exmDir = '[Ee]xamples'; result.push(path.join(exmDir, ext)); From 257c9fcc38b479de449fcfd1edee6fb317684821 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 26 Jan 2021 20:05:41 +0200 Subject: [PATCH 4/4] Bump version to 3.3.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7d551faf..36888284 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "platformio-home", - "version": "3.3.2", + "version": "3.3.3", "description": "PlatformIO Home", "repository": { "type": "git",