Skip to content

Commit

Permalink
Add typescript definition related bits
Browse files Browse the repository at this point in the history
  • Loading branch information
mgansler committed Feb 13, 2019
1 parent d4130c7 commit eb4c64e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/material-ui-icons/scripts/copy-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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');
Expand All @@ -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();

0 comments on commit eb4c64e

Please sign in to comment.