gl-matrix/utils/build.js
Linus Miller 3a421940a4 Convert package type to module and add exports
- All util and config files have been converted to ESM
- Use file extensions in import calls spec files
- Use Node 14.17.0 in Travis
2021-06-07 01:09:30 +02:00

18 lines
532 B
JavaScript

import fs from 'fs';
const pkgStr = fs.readFileSync(new URL('../package.json', import.meta.url), 'utf-8');
const pkg = JSON.parse(pkgStr.replace(/\.\/dist\//g, './'));
const copyFileSync = (source, dest) => {
const content = fs.readFileSync(source, 'utf-8');
fs.writeFileSync(dest, content);
};
delete pkg.private;
delete pkg.scripts;
delete pkg.devDependencies;
fs.writeFileSync('dist/package.json', JSON.stringify(pkg, null, 2));
copyFileSync('README.md', 'dist/README.md');
copyFileSync('LICENSE.md', 'dist/LICENSE.md');