Commit 000feaa0 authored by 邓晓峰's avatar 邓晓峰

fix: 修复esm commonjs build

parent 40fada3b
......@@ -26,15 +26,34 @@ const tailPkgs = pkgList
return `${path}/${name}`;
});
export default {
const type = process.env.BUILD_TYPE;
let config = {};
if (type === 'lib') {
config = {
cjs: { type: 'babel', lazy: true },
esm: false,
runtimeHelpers: true,
pkgs: [...headPkgs, ...tailPkgs],
extraBabelPlugins: [
['babel-plugin-import', { libraryName: 'antd', libraryDirectory: 'es', style: true }, 'antd'],
],
};
}
if (type === 'es') {
config = {
cjs: false,
esm: {
type: 'babel',
importLibToEs: true,
},
runtimeHelpers: true,
pkgs: [...headPkgs, ...tailPkgs],
extraBabelPlugins: [
['babel-plugin-import', { libraryName: 'antd', libraryDirectory: 'es', style: true }, 'antd'],
[require('./scripts/replaceLib')],
['babel-plugin-import', { libraryName: 'antd', libraryDirectory: 'es', style: true }, 'antd'],
],
};
};
}
export default config;
# .npmrc
node-options=--max_old_space_size=8192
......@@ -7,7 +7,8 @@
],
"scripts": {
"bootstrap": "node ./scripts/bootstrap.js",
"build": "cross-env BUILD_TYPE=lib father-build && cross-env BUILD_TYPE=es father-build && webpack && node ./scripts/gen_less_entry.js",
"build": "npm run build-lib && webpack && node ./scripts/gen_less_entry.js",
"build-lib": "cross-env BUILD_TYPE=lib father-build && cross-env BUILD_TYPE=es father-build",
"changelog": "pro-changelog",
"createRelease": "node ./scripts/createRelease.js",
"deploy": "npm run site && gh-pages -d ./dist",
......@@ -42,6 +43,8 @@
"@babel/preset-env": "^7.8.3",
"@babel/preset-react": "^7.8.3",
"@babel/preset-typescript": "^7.8.3",
"@babel/runtime": "^7.17.9",
"@babel/plugin-transform-runtime": "^7.17.10",
"@octokit/core": "^3.2.5",
"@size-limit/preset-big-lib": "^4.5.5",
"@testing-library/react": "^10.0.2",
......@@ -62,6 +65,7 @@
"@types/warning": "^3.0.0",
"@types/xhr-mock": "^2.0.0",
"@umijs/babel-preset-umi": "^3.0.14",
"@umijs/doctor": "^0.0.16",
"@umijs/fabric": "^2.0.0",
"@umijs/plugin-analytics": "^0.2.2",
"@umijs/plugin-antd": "^0.9.0",
......
......@@ -22,5 +22,8 @@
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
},
"dependencies": {
"@babel/runtime": "^7.17.9"
}
}
......@@ -24,6 +24,7 @@
"test": "echo \"Error: run tests from root\" && exit 1"
},
"dependencies": {
"classnames": "^2.2.6"
"classnames": "^2.2.6",
"@babel/runtime": "^7.17.9"
}
}
......@@ -24,6 +24,7 @@
"test": "echo \"Error: run tests from root\" && exit 1"
},
"dependencies": {
"moment": "^2.27.0"
"moment": "^2.27.0",
"@babel/runtime": "^7.17.9"
}
}
......@@ -22,5 +22,8 @@
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
},
"dependencies": {
"@babel/runtime": "^7.17.9"
}
}
......@@ -24,6 +24,7 @@
"test": "echo \"Error: run tests from root\" && exit 1"
},
"dependencies": {
"classnames": "^2.2.6"
"classnames": "^2.2.6",
"@babel/runtime": "^7.17.9"
}
}
......@@ -22,6 +22,7 @@
"url": "https://g.civnet.cn:8443/ReactWeb5/wisdom-components.git"
},
"dependencies": {
"classnames": "^2.2.6"
"classnames": "^2.2.6",
"@babel/runtime": "^7.17.9"
}
}
......@@ -25,6 +25,7 @@
},
"dependencies": {
"js-export-excel": "^1.1.4",
"jszip": "^3.5.0"
"jszip": "^3.5.0",
"@babel/runtime": "^7.17.9"
}
}
......@@ -27,6 +27,7 @@
"classnames": "^2.2.6",
"highcharts": "^9.0.1",
"highcharts-react-official": "^3.0.0",
"moment": "^2.27.0"
"moment": "^2.27.0",
"@babel/runtime": "^7.17.9"
}
}
......@@ -24,6 +24,7 @@
"test": "echo \"Error: run tests from root\" && exit 1"
},
"dependencies": {
"classnames": "^2.2.6"
"classnames": "^2.2.6",
"@babel/runtime": "^7.17.9"
}
}
......@@ -22,5 +22,8 @@
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
},
"dependencies": {
"@babel/runtime": "^7.17.9"
}
}
......@@ -24,6 +24,7 @@
"test": "echo \"Error: run tests from root\" && exit 1"
},
"dependencies": {
"mqtt-client": "^1.0.12"
"mqtt-client": "^1.0.12",
"@babel/runtime": "^7.17.9"
}
}
......@@ -25,6 +25,7 @@
},
"dependencies": {
"form-render": "^0.9.12",
"parseForm": "^0.0.8"
"parseForm": "^0.0.8",
"@babel/runtime": "^7.17.9"
}
}
......@@ -24,6 +24,7 @@
"test": "echo \"Error: run tests from root\" && exit 1"
},
"dependencies": {
"classnames": "^2.2.6"
"classnames": "^2.2.6",
"@babel/runtime": "^7.17.9"
}
}
......@@ -24,6 +24,7 @@
"test": "echo \"Error: run tests from root\" && exit 1"
},
"dependencies": {
"classnames": "^2.2.6"
"classnames": "^2.2.6",
"@babel/runtime": "^7.17.9"
}
}
......@@ -24,6 +24,7 @@
"test": "echo \"Error: run tests from root\" && exit 1"
},
"dependencies": {
"classnames": "^2.2.6"
"classnames": "^2.2.6",
"@babel/runtime": "^7.17.9"
}
}
......@@ -26,6 +26,7 @@
"build": "father-build"
},
"dependencies": {
"lodash": "^4.17.21"
"lodash": "^4.17.21",
"@babel/runtime": "^7.17.9"
}
}
......@@ -26,6 +26,7 @@
"dependencies": {
"@wisdom-components/ec_historyinfo": "1.2.20",
"@wisdom-components/mqttview": "1.3.4",
"cross-env": "^7.0.3"
"cross-env": "^7.0.3",
"@babel/runtime": "^7.17.9"
}
}
......@@ -22,5 +22,8 @@
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
},
"dependencies": {
"@babel/runtime": "^7.17.9"
}
}
......@@ -22,5 +22,8 @@
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
},
"dependencies": {
"@babel/runtime": "^7.17.9"
}
}
......@@ -22,5 +22,8 @@
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
},
"dependencies": {
"@babel/runtime": "^7.17.9"
}
}
......@@ -22,5 +22,8 @@
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
},
"dependencies": {
"@babel/runtime": "^7.17.9"
}
}
const docker = require('@umijs/doctor');
const path = require('path');
const repo_path = path.join(__dirname, '..');
const genChangelogs = () => {
docker.genChangelogs(repo_path);
};
genChangelogs();
......@@ -52,6 +52,7 @@ const getMds = (allVersion = false) => {
.filter((tag) => tag.includes(pkg))
.map((tag) => tag.split('@').pop());
}
console.log(versions.toString());
// eslint-disable-next-line array-callback-return
versions.map((version) => {
const versionPkg = `@wisdom-components/pro-${pkg}@${version}`;
......
......@@ -127,8 +127,8 @@ async function release() {
const pkgs = args.publishOnly ? getPackages() : updated;
logStep(`publish packages: ${chalk.blue(pkgs.join(', '))}`);
// eslint-disable-next-line consistent-return
pkgs.forEach((pkg, index) => {
// eslint-disable-next-line consistent-return,array-callback-return
const publishList = pkgs.map((pkg, index) => {
const pkgMap = locMap[pkg];
const [p, shortName] = pkgMap.split('/');
const pkgPath = join(cwd, 'packages', p, shortName.replace('pro-', ''));
......@@ -147,14 +147,16 @@ async function release() {
console.log(
`[${index + 1}/${pkgs.length}] Publish package ${name} ${isNext ? 'with next tag' : ''}`,
);
const cliArgs = isNext ? ['publish', '--tag', 'next'] : ['publish'];
const { stdout } = execa.sync('npm', cliArgs, {
const cliArgs = isNext ? ['publish', '--tag', 'next'] : ['publish', '--tag', 'beta'];
return execa('npm', cliArgs, {
cwd: pkgPath,
});
console.log(stdout);
}
});
console.log(`发布中${pkgs.join('/')}`);
await Promise.all(publishList);
console.log('发布成功! ');
await exec('npm', ['run', 'prettier']);
logStep('done');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment