Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Commit c2e862d

Browse files
authored
Merge pull request #1321 from aleun/dev/alleu/serial-deps
Add gulp task to consume serial-monitor-cli artifacts
2 parents e41684b + 65d44fa commit c2e862d

File tree

3 files changed

+748
-3
lines changed

3 files changed

+748
-3
lines changed

gulpfile.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ const ts = require("gulp-typescript");
77
const sourcemaps = require("gulp-sourcemaps");
88
const webpack = require("webpack");
99
const del = require('del');
10+
const download = require("download");
11+
const extract = require("extract-zip");
1012
const fs = require("fs");
1113
const path = require("path");
1214
const childProcess = require("child_process");
@@ -61,6 +63,26 @@ gulp.task("node_modules-webpack", (done) => {
6163
});
6264
});
6365

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+
6486
gulp.task("ts-compile", () => {
6587
const tsProject = ts.createProject("./tsconfig.json");
6688
return tsProject.src()
@@ -132,7 +154,8 @@ gulp.task("test", (done) => {
132154
});
133155
});
134156

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+
136159

137160
gulp.task("build_without_view", gulp.series("clean", "ts-compile"));
138161

0 commit comments

Comments
 (0)