1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-15 09:04:04 +02:00
joplin/Tools/buildReactNativeInjectedJs.js
2019-02-27 23:37:16 +00:00

21 lines
578 B
JavaScript

const fs = require('fs-extra');
const cwd = process.cwd();
const outputDir = cwd + '/lib/rnInjectedJs';
async function copyJs(name, filePath) {
const js = await fs.readFile(filePath, 'utf-8');
const json = 'module.exports = ' + JSON.stringify(js) + ';';
const outputPath = outputDir + '/' + name + '.js';
await fs.writeFile(outputPath, json);
}
async function main(argv) {
await fs.mkdirp(outputDir);
await copyJs('mermaid', __dirname + '/node_modules/mermaid/dist/mermaid.min.js');
}
main(process.argv).catch((error) => {
console.error(error);
process.exit(1);
});