diff --git a/packages/xod-client-browser/src/containers/App.jsx b/packages/xod-client-browser/src/containers/App.jsx index d438960c..98ba51a5 100644 --- a/packages/xod-client-browser/src/containers/App.jsx +++ b/packages/xod-client-browser/src/containers/App.jsx @@ -10,6 +10,7 @@ import { HotKeys } from 'react-hotkeys'; import * as XP from 'xod-project'; import client from 'xod-client'; import { foldEither, notNil } from 'xod-func-tools'; +import { LIVENESS } from 'xod-arduino'; import packageJson from '../../package.json'; import PopupInstallApp from '../components/PopupInstallApp'; @@ -275,6 +276,13 @@ class App extends client.App { ]), submenu(items.deploy, [ onClick(items.showCodeForArduino, this.onShowCodeArduino), + ...(process.env.IS_DEV + ? [ + onClick(items.showCodeWithDebug, () => + this.onShowCodeArduino(LIVENESS.DEBUG) + ), + ] + : []), onClick(items.uploadToArduino, this.onUpload), onClick(items.runSimulation, this.onRunSimulation), ]), diff --git a/packages/xod-client-browser/webpack.config.dev.js b/packages/xod-client-browser/webpack.config.dev.js index 139c1675..f8b5427e 100644 --- a/packages/xod-client-browser/webpack.config.dev.js +++ b/packages/xod-client-browser/webpack.config.dev.js @@ -1,5 +1,6 @@ const path = require('path'); /* eslint-disable import/no-extraneous-dependencies */ +const webpack = require('webpack'); const merge = require('webpack-merge'); /* eslint-enable import/no-extraneous-dependencies */ const baseConfig = require('./webpack.config.js'); @@ -18,4 +19,9 @@ module.exports = merge.smart(baseConfig, { contentBase: pkgpath('dist'), compress: true, }, + plugins: [ + new webpack.DefinePlugin({ + 'process.env.IS_DEV': true, + }), + ], }); diff --git a/packages/xod-client-electron/src/view/containers/App.jsx b/packages/xod-client-electron/src/view/containers/App.jsx index 4025ccf6..c9875c88 100644 --- a/packages/xod-client-electron/src/view/containers/App.jsx +++ b/packages/xod-client-electron/src/view/containers/App.jsx @@ -61,7 +61,7 @@ import { proceedPackageUpgrade, } from '../../arduinoDependencies/actions'; import { loadWorkspacePath } from '../../app/workspaceActions'; -import { getPathToBundledWorkspace } from '../../app/utils'; +import { getPathToBundledWorkspace, IS_DEV } from '../../app/utils'; import getLibraryNames from '../../arduinoDependencies/getLibraryNames'; @@ -677,6 +677,13 @@ class App extends client.App { ]), submenu(items.deploy, [ onClick(items.showCodeForArduino, this.onShowCodeArduino), + ...(IS_DEV + ? [ + onClick(items.showCodeWithDebug, () => + this.onShowCodeArduino(LIVENESS.DEBUG) + ), + ] + : []), onClick(items.uploadToArduino, this.onUploadToArduinoClicked), onClick(items.runSimulation, this.onRunSimulation), onClick( diff --git a/packages/xod-client/src/core/containers/App.jsx b/packages/xod-client/src/core/containers/App.jsx index b82539a7..544f6e0c 100644 --- a/packages/xod-client/src/core/containers/App.jsx +++ b/packages/xod-client/src/core/containers/App.jsx @@ -93,7 +93,7 @@ export default class App extends React.Component { this.props.actions.fetchGrant(/* startup */ true); } - onShowCodeArduino() { + onShowCodeArduino(liveness = LIVENESS.NONE) { R.compose( foldEither( R.compose( @@ -104,7 +104,7 @@ export default class App extends React.Component { ), R.map(transpile), this.transformProjectForTranspiler - )(LIVENESS.NONE); + )(liveness); } onRunSimulation() { diff --git a/packages/xod-client/src/utils/menu.js b/packages/xod-client/src/utils/menu.js index 400176c6..e26ff8da 100644 --- a/packages/xod-client/src/utils/menu.js +++ b/packages/xod-client/src/utils/menu.js @@ -103,6 +103,9 @@ const rawItems = { showCodeForArduino: { label: 'Show Code for Arduino', }, + showCodeWithDebug: { + label: 'Show Code with Debug', + }, uploadToArduino: { label: 'Upload to Arduino...', },