Skip to content

Commit

Permalink
Merge branch 'release/v3.3.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Mar 9, 2021
2 parents 7562546 + 1b3fe7d commit 9225640
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 78 deletions.
76 changes: 38 additions & 38 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,30 @@
<meta charset="utf-8">
<title>PlatformIO Home</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<script>
if (window.document.documentMode) {
window.alert('Your browser is not supported. Please use one of the modern browsers (Chrome, Firefox, Opera, Safari, etc).');
window.location = 'https://www.google.com/chrome/';
}

document.addEventListener('keydown', e => {
function getQueryVariable(variable) {
if (!window.location) {
return null;
}
var query = window.location.search.substring(1);
var vars = query.split('&');
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split('=');
if (decodeURIComponent(pair[0]) == variable) {
return decodeURIComponent(pair[1]);
}
}
return null;
}

function onDidKeyDown(e) {
const obj = {
altKey: e.altKey,
code: e.code,
Expand All @@ -25,46 +42,29 @@
try {
window.parent.postMessage({'command': 'kbd-event', 'data': obj}, '*');
} catch (err) {}
});

function getQueryVariable(variable) {
if (!window.location) {
return null;
}
var query = window.location.search.substring(1);
var vars = query.split('&');
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split('=');
if (decodeURIComponent(pair[0]) == variable) {
return decodeURIComponent(pair[1]);
}
}
return null;
}
</script>
</head>
document.addEventListener('keydown', onDidKeyDown);

<% if (process.env.NODE_ENV === 'production') { %>
<script>
var workspace = getQueryVariable('workspace');
var theme = getQueryVariable('theme');
if (!workspace || workspace === 'undefined') {
workspace = 'platformio';
};
if (!theme || theme === 'undefined') {
theme = 'dark';
};
var link = document.createElement('link');
var pathname = (window.location? window.location.pathname : '/');
if (pathname[pathname.length - 1] !== '/') {
pathname += '/';
}
link.href = pathname + 'themes/' + workspace + '.' + theme + '.min.css';
link.type = 'text/css';
link.rel = 'stylesheet';
document.getElementsByTagName('head')[0].appendChild(link);
</script>
var workspace = getQueryVariable('workspace');
var theme = getQueryVariable('theme');
if (!workspace || workspace === 'undefined') {
workspace = 'platformio';
};
if (!theme || theme === 'undefined') {
theme = 'dark';
};
var link = document.createElement('link');
var pathname = (window.location? window.location.pathname : '/');
if (pathname[pathname.length - 1] !== '/') {
pathname += '/';
}
link.href = pathname + 'themes/' + workspace + '.' + theme + '.min.css';
link.type = 'text/css';
link.rel = 'stylesheet';
document.getElementsByTagName('head')[0].appendChild(link);
<% } %>
<body>
</script>
<div id="app">Loading...</div>
</body>
</html>
47 changes: 26 additions & 21 deletions app/modules/inspect/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,31 +77,37 @@ function* _inspectMemory({ projectDir, env }) {

function* _inspectCode({ projectDir, env }) {
const start = Date.now();
let codeCheckResults;
let lastError = undefined;
try {
codeCheckResults = yield call(backendFetchData, {
const codeCheckResults = yield call(backendFetchData, {
query: 'core.call',
params: [
['check', '-d', projectDir, '-e', env, '--json-output'],
{ force_subprocess: true }
]
});
yield _updateMetric('code', projectDir, env, Date.now() - start);

if (codeCheckResults && codeCheckResults.length) {
return codeCheckResults;
}
} catch (e) {
if (e instanceof jsonrpc.JsonRpcError) {
// Try to recover from error because of return code <> 0
codeCheckResults = JSON.parse(e.data);
if (codeCheckResults && codeCheckResults.length) {
return codeCheckResults;
}
return codeCheckResults;
} catch (err) {
lastError = err;
console.warn('Problem has occured when inspecting a code', err);
}
// examine tool output in verbose mode
try {
const output = yield call(backendFetchData, {
query: 'core.call',
params: [
['check', '-d', projectDir, '-e', env, '--verbose'],
{ force_subprocess: true }
]
});
throw new Error(output);
} catch (err) {
if (err.data) {
throw new Error(err.data.replace('\\n', '\n'));
}
throw e;
}
throw new Error('Unexpected code check result');
throw lastError;
}

function* watchInspectProject() {
Expand Down Expand Up @@ -148,13 +154,10 @@ function* watchInspectProject() {

if (code) {
codeCheckResult = yield call(_inspectCode, configuration);
yield put(
updateEntity(RESULT_KEY, {
memory: memoryResult,
codeChecks: codeCheckResult
})
);
}
yield put(
updateEntity(RESULT_KEY, { memory: memoryResult, codeChecks: codeCheckResult })
);
const entity = { memory: memoryResult, codeChecks: codeCheckResult };
if (onEnd) {
onEnd(entity);
Expand All @@ -172,6 +175,8 @@ function* watchInspectProject() {
}
} else if (e instanceof SyntaxError) {
error = 'Bad JSON';
} else {
error = e.toString();
}
if (onEnd) {
onEnd(undefined, error);
Expand Down
33 changes: 16 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "platformio-home",
"version": "3.3.3",
"version": "3.3.4",
"description": "PlatformIO Home",
"repository": {
"type": "git",
Expand All @@ -19,11 +19,11 @@
"license": "Apache-2.0",
"dependencies": {
"antd": "~3.26.20",
"clipboard": "~2.0.6",
"highlight.js": "~10.5.0",
"clipboard": "~2.0.7",
"highlight.js": "~10.6.0",
"humanize": "~0.0.9",
"jsonrpc-lite": "~2.2.0",
"marked": "~1.2.7",
"marked": "~2.0.1",
"prop-types": "~15.7.2",
"querystringify": "~2.2.0",
"rc-animate": "~3.1.1",
Expand All @@ -38,29 +38,29 @@
"redux-saga": "~1.1.3",
"sha.js": "~2.4.11",
"superagent": "~6.1.0",
"url-parse": "~1.4.7"
"url-parse": "~1.5.1"
},
"devDependencies": {
"@babel/core": "~7.12.10",
"@babel/plugin-proposal-class-properties": "~7.12.1",
"@babel/plugin-proposal-function-bind": "~7.12.1",
"@babel/plugin-proposal-object-rest-spread": "~7.12.1",
"@babel/core": "~7.13.8",
"@babel/plugin-proposal-class-properties": "~7.13.0",
"@babel/plugin-proposal-function-bind": "~7.12.13",
"@babel/plugin-proposal-object-rest-spread": "~7.13.8",
"@babel/preset-react": "~7.12.10",
"babel-eslint": "~10.1.0",
"babel-loader": "~8.2.2",
"babel-plugin-import": "~1.13.3",
"babel-plugin-redux-saga": "~1.1.2",
"copy-webpack-plugin": "~7.0.0",
"css-loader": "~5.0.1",
"css-loader": "~5.1.1",
"css-minimizer-webpack-plugin": "^1.2.0",
"eslint": "~7.18.0",
"eslint-config-prettier": "~7.2.0",
"eslint": "~7.21.0",
"eslint-config-prettier": "~8.1.0",
"eslint-import-resolver-webpack": "~0.13.0",
"eslint-plugin-import": "~2.22.1",
"eslint-plugin-prettier": "~3.3.1",
"eslint-plugin-react": "~7.22.0",
"file-loader": "~6.2.0",
"html-webpack-plugin": "~4.5.1",
"html-webpack-plugin": "~5.3.1",
"less": "~3.12.2",
"less-loader": "~7.3.0",
"mini-css-extract-plugin": "~1.3.4",
Expand All @@ -71,10 +71,9 @@
"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",
"webpack-cleanup-plugin": "~0.5.1",
"webpack-cli": "~4.4.0",
"webpack": "~5.24.4",
"webpack-bundle-analyzer": "~4.4.0",
"webpack-cli": "~4.5.0",
"webpack-dev-server": "~3.11.2"
},
"themes": {
Expand Down
2 changes: 0 additions & 2 deletions scripts/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const fs = require('fs');
const path = require('path');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const WebpackCleanupPlugin = require('webpack-cleanup-plugin');

const rootDir = path.resolve(__dirname, '..');
const mediaDir = path.join(rootDir, 'app', 'media');
Expand Down Expand Up @@ -132,7 +131,6 @@ module.exports = {
],

plugins: [
// new WebpackCleanupPlugin(),
new webpack.DefinePlugin({
APP_VERSION: JSON.stringify(packageConfig.version)
}),
Expand Down

0 comments on commit 9225640

Please sign in to comment.