@@ -7,6 +7,8 @@ const ts = require("gulp-typescript");
7
7
const sourcemaps = require ( "gulp-sourcemaps" ) ;
8
8
const webpack = require ( "webpack" ) ;
9
9
const del = require ( 'del' ) ;
10
+ const download = require ( "download" ) ;
11
+ const extract = require ( "extract-zip" ) ;
10
12
const fs = require ( "fs" ) ;
11
13
const path = require ( "path" ) ;
12
14
const childProcess = require ( "child_process" ) ;
@@ -61,6 +63,26 @@ gulp.task("node_modules-webpack", (done) => {
61
63
} ) ;
62
64
} ) ;
63
65
66
+ gulp . task ( "insert-serial-monitor-cli" , async ( done ) => {
67
+ const platforms = [
68
+ "linux" ,
69
+ "macos" ,
70
+ "windows" ,
71
+ ]
72
+ const release = "latest"
73
+ const destDir = path . resolve ( "out" , "serial-monitor-cli" )
74
+
75
+ async function downloadAndUnzip ( platform ) {
76
+ const fileName = `${ platform } .zip` ;
77
+ const zipPath = path . join ( destDir , fileName ) ;
78
+ await download ( `https://github.com/microsoft/serial-monitor-cli/releases/${ release } /download/${ fileName } ` , destDir ) ;
79
+ await extract ( zipPath , { dir : path . join ( destDir , platform ) } ) ;
80
+ fs . rmSync ( zipPath ) ;
81
+ }
82
+
83
+ Promise . all ( platforms . map ( downloadAndUnzip ) ) . then ( done ) ;
84
+ } )
85
+
64
86
gulp . task ( "ts-compile" , ( ) => {
65
87
const tsProject = ts . createProject ( "./tsconfig.json" ) ;
66
88
return tsProject . src ( )
@@ -132,7 +154,8 @@ gulp.task("test", (done) => {
132
154
} ) ;
133
155
} ) ;
134
156
135
- gulp . task ( "build" , gulp . series ( "clean" , "ts-compile" , "html-webpack" , "node_modules-webpack" ) ) ;
157
+ gulp . task ( "build" , gulp . series ( "clean" , "ts-compile" , "html-webpack" , "node_modules-webpack" , "insert-serial-monitor-cli" ) ) ;
158
+
136
159
137
160
gulp . task ( "build_without_view" , gulp . series ( "clean" , "ts-compile" ) ) ;
138
161
0 commit comments