File tree 2 files changed +7
-15
lines changed
2 files changed +7
-15
lines changed Original file line number Diff line number Diff line change 4
4
"description" : " An extension for Theia building the Arduino IDE" ,
5
5
"license" : " AGPL-3.0-or-later" ,
6
6
"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" ,
8
8
"clean" : " rimraf lib" ,
9
9
"compose-changelog" : " node ./scripts/compose-changelog.js" ,
10
10
"download-cli" : " node ./scripts/download-cli.js" ,
11
11
"download-fwuploader" : " node ./scripts/download-fwuploader.js" ,
12
- "copy-serial-plotter" : " npx ncp ../node_modules/arduino-serial-plotter-webapp ./build/arduino-serial-plotter-webapp" ,
13
12
"copy-i18n" : " npx ncp ../i18n ./build/i18n" ,
14
13
"download-ls" : " node ./scripts/download-ls.js" ,
15
14
"download-examples" : " node ./scripts/download-examples.js" ,
Original file line number Diff line number Diff line change
1
+ import * as path from 'path' ;
1
2
import * as express from 'express' ;
2
3
import { injectable } from '@theia/core/shared/inversify' ;
3
4
import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application' ;
4
- import path = require( 'path' ) ;
5
5
6
6
@injectable ( )
7
7
export class PlotterBackendContribution
8
8
implements BackendApplicationContribution
9
9
{
10
- async initialize ( ) : Promise < void > { }
11
-
12
10
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 , '..' ) ) ) ;
22
15
app . get ( '/plotter' , ( req , res ) => {
23
16
console . log (
24
17
`Serving serial plotter on http://${ req . headers . host } ${ req . url } `
25
18
) ;
26
- res . sendFile ( path . join ( __dirname , ... relativePath , ' index.html' ) ) ;
19
+ res . sendFile ( index ) ;
27
20
} ) ;
28
21
}
29
22
}
You can’t perform that action at this time.
0 commit comments