Skip to content

Commit

Permalink
move copy md script contents in to script
Browse files Browse the repository at this point in the history
  • Loading branch information
lunelson committed Aug 4, 2020
1 parent 3557253 commit d752798
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 33 deletions.
31 changes: 0 additions & 31 deletions docs/plugins/copy_md_files.js

This file was deleted.

2 changes: 1 addition & 1 deletion docs/scripts/compile_program_outputs.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const getProgramOutputs = require('./plugins/program_output.js');
const getProgramOutputs = require('../plugins/program_output.js');



Expand Down
26 changes: 25 additions & 1 deletion docs/scripts/copy_md_files.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
const copyMarkdownFiles = require('./plugins/copy_md_files.js');
const fs = require('fs');

const { copyFile } = fs.promises;

const defaultOptions = {
files: {},
docsDir: './docs'
};

/**
This function is used to copy markdown files from a source
outside the `docs/` folder to a destination inside the `docs/` folder.
Options:
- files: a mapping of source: destination
- docsDir: the docs folder
*/
async function copyMarkdownFiles(options) {

options = { ...defaultOptions, ...options };
const { docsDir, files } = options;

for (const [source, destination] of Object.entries(files)) {
await copyFile(source, `${docsDir}/${destination}`);
}
};


console.info('Copying markdown files');
Expand Down

0 comments on commit d752798

Please sign in to comment.