/
githubmirror
/
material-ui
Обзор
Документация
Войти
/
githubmirror
/
material-ui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v6.5.0
scripts/copyFiles.mjs
63 строки
2 KB
Zeeshan Tamboli
[material-ui] Remove UMD bundle (#42172)
17 май 2024, 13:31
Не верифицирован
17 май 2024, 13:31
393f744
Код
Авторство
О чём код?
/* eslint-disable no-console */ import path from 'path'; import { createModulePackages, createPackageFile, includeFileInBuild, prepend, typescriptCopy, } from './copyFilesUtils.mjs'; const packagePath = process.cwd(); const buildPath = path.join(packagePath, './build'); const srcPath = path.join(packagePath, './src'); async function addLicense(packageData) { const license = `/** * ${packageData.name} v${packageData.version} * * @license ${packageData.license} * This source code is licensed under the ${packageData.license} license found in the * LICENSE file in the root directory of this source tree. */ `; await Promise.all( ['./index.js', './modern/index.js', './node/index.js'].map(async (file) => { try { await prepend(path.resolve(buildPath, file), license); } catch (err) { if (err.code === 'ENOENT') { console.log(`Skipped license for ${file}`); } else { throw err; } } }), ); } async function run() { const extraFiles = process.argv.slice(2); try { // TypeScript await typescriptCopy({ from: srcPath, to: buildPath }); const packageData = await createPackageFile(); await Promise.all( ['./README.md', '../../CHANGELOG.md', '../../LICENSE', ...extraFiles].map(async (file) => { const [sourcePath, targetPath] = file.split(':'); await includeFileInBuild(sourcePath, targetPath); }), ); await addLicense(packageData); await createModulePackages({ from: srcPath, to: buildPath }); } catch (err) { console.error(err); process.exit(1); } } run();