From d7527988f8bfd27695bc60c8d0838c93f34c1222 Mon Sep 17 00:00:00 2001 From: Lu Nelson Date: Mon, 3 Aug 2020 17:27:14 +0200 Subject: [PATCH] move copy md script contents in to script --- docs/plugins/copy_md_files.js | 31 ------------------------- docs/scripts/compile_program_outputs.js | 2 +- docs/scripts/copy_md_files.js | 26 ++++++++++++++++++++- 3 files changed, 26 insertions(+), 33 deletions(-) delete mode 100644 docs/plugins/copy_md_files.js diff --git a/docs/plugins/copy_md_files.js b/docs/plugins/copy_md_files.js deleted file mode 100644 index 3d5e96c2e673..000000000000 --- a/docs/plugins/copy_md_files.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - -*/ -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}`); - } -}; - -module.exports = copyMarkdownFiles; diff --git a/docs/scripts/compile_program_outputs.js b/docs/scripts/compile_program_outputs.js index 5e16ab5be711..edd44b414093 100644 --- a/docs/scripts/compile_program_outputs.js +++ b/docs/scripts/compile_program_outputs.js @@ -1,4 +1,4 @@ -const getProgramOutputs = require('./plugins/program_output.js'); +const getProgramOutputs = require('../plugins/program_output.js'); diff --git a/docs/scripts/copy_md_files.js b/docs/scripts/copy_md_files.js index d6e7456df69b..1cbfe269a3f3 100644 --- a/docs/scripts/copy_md_files.js +++ b/docs/scripts/copy_md_files.js @@ -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');