import fs from 'fs'; import path from 'path'; // eslint-disable-next-line import/no-extraneous-dependencies import { globby } from 'globby'; import { fileURLToPath } from 'url'; const monoDocsRoot = fileURLToPath(new URL('../../../docs', import.meta.url)); const localDocsRoot = fileURLToPath(new URL('../docs', import.meta.url)); async function copyDocAssets() { // Folders generated by Rocket const oldDestinations = await globby([`${monoDocsRoot}/**/**/*.{js,cjs,mjs}`]); for (const oldDestination of oldDestinations) { const relPath = oldDestination.replace(monoDocsRoot, ''); // don't handle private folders and Rocket specifics if (relPath.startsWith('/_') || oldDestination.endsWith('11tydata.cjs')) { // eslint-disable-next-line no-continue continue; } const newDestination = `${localDocsRoot}${relPath}`; await fs.promises.mkdir(path.dirname(newDestination), { recursive: true }); fs.promises.copyFile(oldDestination, newDestination); } } copyDocAssets();