代码拉取完成,页面将自动刷新
同步操作将从 DiDi-opensource/pile.js 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import batchPackages from '@lerna/batch-packages';
import filterPackages from '@lerna/filter-packages';
import { getPackages } from '@lerna/project';
import path from 'path';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import babel from 'rollup-plugin-babel';
import filesize from 'rollup-plugin-filesize';
import minimist from 'minimist';
import alias from 'rollup-plugin-alias';
/**
* Get a list of the non-private sorted packages with Lerna v3
* @see https://github.com/lerna/lerna/issues/1848
* @return {Promise<Package[]>} List of packages
*/
async function getSortedPackages() {
// Support --scope and --ignore globs
const { scope, ignore } = minimist(process.argv.slice(2));
// Standard Lerna plumbing getting packages
const packages = await getPackages(__dirname);
const filtered = filterPackages(
packages,
scope,
ignore,
false,
);
return batchPackages(filtered)
.reduce((arr, batch) => arr.concat(batch), []);
}
async function main() {
const plugins = [
alias({
resolve: ['.js', '.jsx'],
}),
resolve({
extensions: ['.js', '.jsx'],
}),
babel({
runtimeHelpers: true,
exclude: 'node_modules/**', // only transpile our source code
babelrc: false,
presets: [['@babel/preset-env', { modules: false }], '@babel/preset-react'],
plugins: [["lodash", { "id": ["recompose"] }]]
}),
commonjs({
namedExports: {
classnames: ['classNames'],
},
}),
filesize(),
];
if (process.env.NODE_ENV === 'production') {
// 添加压缩处理
}
const sourcemap = true;
const packages = await getSortedPackages();
const results = [];
packages.filter(pkg => pkg.name !== '@pile-ui/theme-default').forEach((pkg) => {
// Get settings from package JSON
const {
name, main, module, version, author,
} = pkg.toJSON();
const basePath = path.relative(__dirname, pkg.location);
const input = path.join(basePath, 'src/index.js');
// banner
const banner = `${'/*!\n'
+ ' * '}${name}.js v${version}\n`
+ ` * (c) 2018-${new Date().getFullYear()} ${author}\n`
+ ' * Released under the MIT License.\n'
+ ' */';
// Generate the externals to use, by default don't include dependencies
const baseExternal = ['react', 'react-dom'];
const external = [].concat(baseExternal, Object.keys(pkg.dependencies || []));
// cjs format output
const mainOutput = {
name,
file: path.join(basePath, main),
format: 'cjs',
sourcemap,
banner,
};
// ES format output
const moduleOutput = {
name,
file: path.join(basePath, module),
format: 'esm',
sourcemap,
banner,
};
results.push({
input,
output: [
mainOutput,
moduleOutput,
],
external,
plugins,
});
// bundle for browser
// 先关闭打包成umd,classnames模块打包有点问题
// issuse: https://github.com/rollup/rollup-plugin-commonjs/issues/256
//
// const rename = name.substr(6);
// results.push({
// input,
// external: baseExternal,
// output: {
// name,
// banner,
// globals: {},
// file: path.join(basePath, `/lib/${rename}.iife.js`),
// format: 'umd',
// sourcemap,
// },
// // treeshake: false,
// plugins,
// });
});
return results;
}
export default main();
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。