Skip to content

Avoid duplicated serial plotter builds #1174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions arduino-ide-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
"description": "An extension for Theia building the Arduino IDE",
"license": "AGPL-3.0-or-later",
"scripts": {
"prepare": "yarn download-cli && yarn download-fwuploader && yarn download-ls && yarn copy-serial-plotter && yarn copy-i18n && yarn clean && yarn download-examples && yarn build && yarn test",
"prepare": "yarn download-cli && yarn download-fwuploader && yarn download-ls && yarn copy-i18n && yarn clean && yarn download-examples && yarn build && yarn test",
"clean": "rimraf lib",
"compose-changelog": "node ./scripts/compose-changelog.js",
"download-cli": "node ./scripts/download-cli.js",
"download-fwuploader": "node ./scripts/download-fwuploader.js",
"copy-serial-plotter": "npx ncp ../node_modules/arduino-serial-plotter-webapp ./build/arduino-serial-plotter-webapp",
"copy-i18n": "npx ncp ../i18n ./build/i18n",
"download-ls": "node ./scripts/download-ls.js",
"download-examples": "node ./scripts/download-examples.js",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
import * as path from 'path';
import * as express from 'express';
import { injectable } from '@theia/core/shared/inversify';
import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application';
import path = require('path');

@injectable()
export class PlotterBackendContribution
implements BackendApplicationContribution
{
async initialize(): Promise<void> {}

configure(app: express.Application): void {
const relativePath = [
'..',
'..',
'..',
'build',
'arduino-serial-plotter-webapp',
'build',
];
app.use(express.static(path.join(__dirname, ...relativePath)));
const index = require.resolve(
'arduino-serial-plotter-webapp/build/index.html'
);
app.use(express.static(path.join(index, '..')));
app.get('/plotter', (req, res) => {
console.log(
`Serving serial plotter on http://${req.headers.host}${req.url}`
);
res.sendFile(path.join(__dirname, ...relativePath, 'index.html'));
res.sendFile(index);
});
}
}