File tree Expand file tree Collapse file tree 2 files changed +7
-15
lines changed
Expand file tree Collapse file tree 2 files changed +7
-15
lines changed Original file line number Diff line number Diff line change 44 "description" : " An extension for Theia building the Arduino IDE" ,
55 "license" : " AGPL-3.0-or-later" ,
66 "scripts" : {
7- "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" ,
7+ "prepare" : " yarn download-cli && yarn download-fwuploader && yarn download-ls && yarn copy-i18n && yarn clean && yarn download-examples && yarn build && yarn test" ,
88 "clean" : " rimraf lib" ,
99 "compose-changelog" : " node ./scripts/compose-changelog.js" ,
1010 "download-cli" : " node ./scripts/download-cli.js" ,
1111 "download-fwuploader" : " node ./scripts/download-fwuploader.js" ,
12- "copy-serial-plotter" : " npx ncp ../node_modules/arduino-serial-plotter-webapp ./build/arduino-serial-plotter-webapp" ,
1312 "copy-i18n" : " npx ncp ../i18n ./build/i18n" ,
1413 "download-ls" : " node ./scripts/download-ls.js" ,
1514 "download-examples" : " node ./scripts/download-examples.js" ,
Original file line number Diff line number Diff line change 1+ import * as path from 'path' ;
12import * as express from 'express' ;
23import { injectable } from '@theia/core/shared/inversify' ;
34import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application' ;
4- import path = require( 'path' ) ;
55
66@injectable ( )
77export class PlotterBackendContribution
88 implements BackendApplicationContribution
99{
10- async initialize ( ) : Promise < void > { }
11-
1210 configure ( app : express . Application ) : void {
13- const relativePath = [
14- '..' ,
15- '..' ,
16- '..' ,
17- 'build' ,
18- 'arduino-serial-plotter-webapp' ,
19- 'build' ,
20- ] ;
21- app . use ( express . static ( path . join ( __dirname , ...relativePath ) ) ) ;
11+ const index = require . resolve (
12+ 'arduino-serial-plotter-webapp/build/index.html'
13+ ) ;
14+ app . use ( express . static ( path . join ( index , '..' ) ) ) ;
2215 app . get ( '/plotter' , ( req , res ) => {
2316 console . log (
2417 `Serving serial plotter on http://${ req . headers . host } ${ req . url } `
2518 ) ;
26- res . sendFile ( path . join ( __dirname , ... relativePath , ' index.html' ) ) ;
19+ res . sendFile ( index ) ;
2720 } ) ;
2821 }
2922}
You can’t perform that action at this time.
0 commit comments