diff --git a/packages/material-ui-icons/scripts/copy-files.js b/packages/material-ui-icons/scripts/copy-files.js index 38cc6d631c2056..591e6b3f33dcfb 100644 --- a/packages/material-ui-icons/scripts/copy-files.js +++ b/packages/material-ui-icons/scripts/copy-files.js @@ -2,6 +2,7 @@ import path from 'path'; import fse from 'fs-extra'; +import glob from 'glob'; async function copyFile(file) { const buildPath = path.resolve(__dirname, '../build/', path.basename(file)); @@ -27,6 +28,12 @@ async function createPackageFile() { return newPackageData; } +function typescriptCopy(from, to) { + const files = glob.sync('**/*.d.ts', { cwd: from }); + const cmds = files.map(file => fse.copy(path.resolve(from, file), path.resolve(to, file))); + return Promise.all(cmds); +} + async function prepend(file, string) { const data = await fse.readFile(file, 'utf8'); await fse.writeFile(file, string + data, 'utf8'); @@ -50,6 +57,13 @@ async function run() { await ['README.md', '../../LICENSE'].map(file => copyFile(file)); const packageData = await createPackageFile(); await addLicense(packageData); + + // TypeScript + const from = path.resolve(__dirname, '../src'); + await Promise.all([ + typescriptCopy(from, path.resolve(__dirname, '../build')), + typescriptCopy(from, path.resolve(__dirname, '../build/es')), + ]); } run();