build(project): update bundle strategy

- Update the build script for generating *.d.ts files
- Update package.json module entry.
- Update CI pipeline node version
- Reorganized main bundle structure
- Update i18n functionalities
This commit is contained in:
jeremywuuuuu
2021-07-23 16:35:20 +08:00
committed by hangzou
parent ec56779bf0
commit 4e5ef0d3a8
12 changed files with 432 additions and 346 deletions

View File

@@ -7,17 +7,11 @@
# which means the result will not contain folder name includes utils
yarn bootstrap
yarn clean:lib
yarn build:esm-bundle
tar --exclude=index.esm.js -zcvf ./es.gz ./lib
mkdir -p es
tar -zxvf ./es.gz --strip-component 2 -C ./es
yarn build:type
yarn build:lib
yarn build:lib-full
# -P2 stands for 2 maximum parallel, with
# node .build/build.js command
# find './packages' -type d -maxdepth 1 ! -name '*util*' ! -name '__mocks__' ! -name 'locale' ! -name 'theme*' -print0 | xargs -I {} -P2 -0 node ./build/build.comps.js {}
yarn build:components
find ./packages/utils -type f ! -name '*.test.ts' ! -name 'package.json' -print0 \
@@ -25,7 +19,7 @@ find ./packages/utils -type f ! -name '*.test.ts' ! -name 'package.json' -print0
node ./build/build.entry.js
find ./packages/locale -type f ! -name '*.spec.ts' ! -name 'package.json' -print0 \
find ./packages/locale -type f ! -name '*.spec.ts' ! -name 'package.json' ! -name '.DS_Store' -print0 \
| xargs -P2 -0 -I {} node ./build/build-util.js {}
yarn build:locale-umd
@@ -34,6 +28,33 @@ yarn build:theme
yarn build:helper
# Post build clean up
# Post build cp type definitions
touch temp
find dist -type d ! -name 'element-plus' -depth 1 -print0 | xargs -0 -I {} sh -c "basename {}" > temp
rm ./es.gz
input="./temp"
mkdir -p tempDir
while IFS= read -r line
do
filepath="el-$line"
case "$line" in
directives|locale|utils|hooks)
filepath="$line"
;;
esac
mv "dist/$line" "tempDir/$filepath"
cp -nR "tempDir/" es
cp -nR "tempDir/" lib
done < "$input"
cp packages/utils/types.ts es/utils/
cp dist/element-plus/* lib
cp packages/utils/types.ts lib/utils/
cp dist/element-plus/* es
# Post build cleanup
rm -rf temp
rm -rf tempDir