Write file to the necessary file

This commit is contained in:
Jeroen Engels 2021-03-12 00:19:39 +01:00
parent 449136fd43
commit 93345ebdfd
2 changed files with 6 additions and 81 deletions

View File

@ -1,5 +1,6 @@
const util = require('util');
const path = require('path');
const https = require('https');
const fs = require('fs').promises;
console.warn = () => { }
@ -41,9 +42,10 @@ function createFile([elmJson, docsJson]) {
flags: { elmJson, docsJson }
});
app.ports.sendToJs.subscribe(result => {
console.log(result);
process.exit(0);
app.ports.sendToJs.subscribe(async ([filePath, source]) => {
const relativeFilePath = path.resolve(process.cwd(), filePath);
await fs.mkdir(path.dirname(relativeFilePath), { recursive: true });
await fs.writeFile(relativeFilePath, source);
});
return;

File diff suppressed because one or more lines are too long