File tree 3 files changed +23
-17
lines changed
3 files changed +23
-17
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 clean && yarn download-examples && yarn build && yarn test" ,
7
+ "prepare" : " yarn download-cli && yarn download-fwuploader && yarn download-ls && yarn copy-serial-plotter && yarn clean && yarn download-examples && yarn build && yarn test" ,
8
8
"clean" : " rimraf lib" ,
9
9
"download-cli" : " node ./scripts/download-cli.js" ,
10
10
"download-fwuploader" : " node ./scripts/download-fwuploader.js" ,
11
+ "copy-serial-plotter" : " npx ncp ../node_modules/arduino-serial-plotter-webapp ./build/arduino-serial-plotter-webapp" ,
11
12
"download-ls" : " node ./scripts/download-ls.js" ,
12
13
"download-examples" : " node ./scripts/download-examples.js" ,
13
14
"generate-protocol" : " node ./scripts/generate-protocol.js" ,
18
19
"test:watch" : " mocha --watch --watch-files lib \" ./lib/test/**/*.test.js\" "
19
20
},
20
21
"dependencies" : {
22
+ "arduino-serial-plotter-webapp" : " 0.0.2" ,
21
23
"@grpc/grpc-js" : " ^1.3.7" ,
22
24
"@theia/application-package" : " 1.18.0" ,
23
25
"@theia/core" : " 1.18.0" ,
Original file line number Diff line number Diff line change @@ -10,21 +10,20 @@ export class PlotterBackendContribution
10
10
async initialize ( ) : Promise < void > { }
11
11
12
12
configure ( app : express . Application ) : void {
13
- app . use (
14
- express . static (
15
- path . join (
16
- __dirname ,
17
- '../../../node_modules/arduino-serial-plotter-webapp/build'
18
- )
19
- )
20
- ) ;
21
- app . get ( '/plotter' , ( req , res ) =>
22
- res . sendFile (
23
- path . join (
24
- __dirname ,
25
- '../../../node_modules/arduino-serial-plotter-webapp/build/index.html'
26
- )
27
- )
28
- ) ;
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 ) ) ) ;
22
+ app . get ( '/plotter' , ( req , res ) => {
23
+ console . log (
24
+ `Serving serial plotter on http://${ req . headers . host } ${ req . url } `
25
+ ) ;
26
+ res . sendFile ( path . join ( __dirname , ...relativePath , 'index.html' ) ) ;
27
+ } ) ;
29
28
}
30
29
}
Original file line number Diff line number Diff line change @@ -4012,6 +4012,11 @@ archive-type@^4.0.0:
4012
4012
dependencies:
4013
4013
file-type "^4.2.0"
4014
4014
4015
+ arduino-serial-plotter-webapp@0.0.1:
4016
+ version "0.0.1"
4017
+ resolved "https://registry.yarnpkg.com/arduino-serial-plotter-webapp/-/arduino-serial-plotter-webapp-0.0.1.tgz#a66b512df72432bdb0f48495955351e637190943"
4018
+ integrity sha512-6k+8MF6LtMdEZUSDh1FY/pmrI2wCTpFTVriEt5/sa9vJKnoZxkxwoSZzbYNtsqbJU2D4knzoVyS4J/LjaTbkOg==
4019
+
4015
4020
are-we-there-yet@~1.1.2:
4016
4021
version "1.1.5"
4017
4022
resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21"
You can’t perform that action at this time.
0 commit comments