ice/scripts/build.ts

29 lines
789 B
TypeScript

import glob from 'glob';
import * as path from 'path';
import * as fs from 'fs-extra';
import { run } from './shell';
(async () => {
await run('npm run clean');
const fileParten = '*/src/**/!(*.ts|*.tsx|*.rs)';
console.log(`[COPY]: ${fileParten}`);
const cwd = path.join(process.cwd(), 'packages');
const files = glob.sync(fileParten, { cwd, nodir: true });
// eslint-disable-next-line
for (const file of files) {
const from = path.join(cwd, file);
const to = path.join(cwd, file.replace(/\/src\//, '/lib/'));
// eslint-disable-next-line
await fs.mkdirp(path.dirname(to));
// eslint-disable-next-line
await fs.copyFile(from, to);
}
await run('npx tsc --build ./tsconfig.json');
})().catch((e) => {
console.trace(e);
process.exit(128);
});