forked from eez-open/studio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnpm-module-publish.js
30 lines (24 loc) · 972 Bytes
/
npm-module-publish.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const fse = require("fs-extra");
const { spawn } = require("child_process");
const FOLDERS = ["packages", "libs", "resources"];
for (const folder of FOLDERS) {
console.log(`Copy ${folder} to npm-module/${folder} ...`);
fse.copySync(folder, `npm-module/${folder}`, { overwrite: true });
}
console.log(`Remove npm-module/packages/project-editor/flow/runtime/cpp ...`);
fse.removeSync(`npm-module/packages/project-editor/flow/runtime/cpp`);
console.log("Spawn npm publish ...");
const dir = spawn(
process.platform == "win32" ? "npm.cmd" : "npm",
["publish"],
{ cwd: __dirname + "/npm-module" }
);
dir.stdout.on("data", data => console.log(data.toString()));
dir.stderr.on("data", data => console.log(data.toString()));
dir.on("error", err => console.log(err.toString()));
dir.on("close", code => {
for (const folder of FOLDERS) {
console.log(`Remove npm-module/${folder} ...`);
fse.removeSync(`npm-module/${folder}`);
}
});