-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdynamics.js
30 lines (27 loc) · 853 Bytes
/
dynamics.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 spawn = require("child_process").spawn;
const fs = require("fs");
function runPublisher(webResourcePublisherPath, configPath) {
const ipc = spawn(webResourcePublisherPath, ["-p", configPath]);
ipc.stdin.setEncoding("utf8");
ipc.stderr.on("data", function(data) {
process.stdout.write(data.toString());
});
ipc.stdout.on("data", function(data) {
process.stdout.write(data.toString());
});
}
function publish(folderPath) {
const configPath = folderPath + "/publisher.json";
if (!fs.existsSync(configPath)) {
console.log("Publisher config not found.");
return;
}
fs.readFile(configPath, "utf8", function(err, data) {
if (err) {
console.log("Can't read publisher config.");
return;
}
runPublisher(JSON.parse(data).publisherToolPath, configPath);
});
}
module.exports.publish = publish;