-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.js
25 lines (20 loc) · 992 Bytes
/
build.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
import fs from 'node:fs';
import { exec } from 'node:child_process';
import { errorMonitor } from 'node:events';
const folderPath = '.';
const aFolders = await fs.promises.readdir(folderPath);
for(const sFolder of aFolders){
const oStats = await fs.promises.lstat(sFolder);
if(!['dist','.git', 'node_modules', '.github', '.devcontainer'].includes(sFolder) && oStats.isDirectory()){
exec(`R -e 'rmarkdown::render("${sFolder}/slides.Rmd", output_format = "html_document", output_dir = "dist/${sFolder}")'`, {}, (error, stdout, stderr)=>{
if(error){
throw `${error}, ${stdout}, ${stderr}`;
}
exec(`R -e 'rmarkdown::render("${sFolder}/slides.Rmd", output_format = "powerpoint_presentation", output_dir = "dist/${sFolder}")'`, {}, (error, stdout, stderr)=>{
if(error){
throw `${error}, ${stdout}, ${stderr}`;
}
});
});
}
}