未验证 提交 78878eb1 编写于 作者: J Jason Quense 提交者: GitHub

chore: fix types build output (#5204)

上级 179fec96
......@@ -10,6 +10,7 @@
"sideEffects": false,
"main": "lib/cjs/index.js",
"module": "lib/esm/index.js",
"types": "lib/esm/index.d.ts",
"scripts": {
"bootstrap": "yarn && yarn --cwd www",
"build": "node tools/build.js",
......
......@@ -34,7 +34,10 @@ const buildTypes = step('generating .d.ts', () => shell(`yarn build-types`));
const copyTypes = (dest) => shell(`cpy ${typesRoot}/*.d.ts ${dest}`);
const babel = (outDir, envName) => shell(`yarn babel ${srcRoot} -x .es6,.js,.es,.jsx,.mjs,.ts,.tsx --out-dir ${outDir} --env-name "${envName}"`);
const babel = (outDir, envName) =>
shell(
`yarn babel ${srcRoot} -x .es6,.js,.es,.jsx,.mjs,.ts,.tsx --out-dir ${outDir} --env-name "${envName}"`,
);
/**
* Run babel over the src directory and output
......@@ -42,7 +45,7 @@ const babel = (outDir, envName) => shell(`yarn babel ${srcRoot} -x .es6,.js,.es,
*/
const buildLib = step('commonjs modules', async () => {
await babel(cjsRoot, 'cjs');
await copyTypes(libRoot);
await copyTypes(cjsRoot);
});
/**
......@@ -93,11 +96,13 @@ clean();
Promise.resolve(true)
.then(buildTypes)
.then(() => Promise.all([
has('lib') && buildLib(),
has('es') && buildEsm(),
has('dist') && buildDist(),
]))
.then(() =>
Promise.all([
has('lib') && buildLib(),
has('es') && buildEsm(),
has('dist') && buildDist(),
]),
)
.then(buildDirectories)
.catch((err) => {
if (err) console.error(red(err.stack || err.toString()));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册