2022-06-06 17:28:39 +08:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
set -e
|
|
|
|
|
|
2023-04-21 13:52:06 +08:00
|
|
|
|
npm run build --workspace=amis-formula --workspace=amis-core --workspace=amis-ui --workspace=amis
|
2022-06-06 17:28:39 +08:00
|
|
|
|
|
|
|
|
|
rm -rf npm
|
2023-04-21 13:52:06 +08:00
|
|
|
|
mkdir -p npm/packages
|
2022-06-06 17:28:39 +08:00
|
|
|
|
|
2022-07-22 15:20:19 +08:00
|
|
|
|
# 如果有问题可以注释掉这两行,不知道为啥会导致 cp -rf 挂掉
|
|
|
|
|
# rm -rf packages/amis/node_modules/.bin
|
|
|
|
|
# rm -rf packages/amis-ui/node_modules/.bin
|
|
|
|
|
|
2023-04-21 13:52:06 +08:00
|
|
|
|
cp -r packages/{amis-formula,amis-core,amis-ui,amis} npm/packages
|
2022-06-06 17:28:39 +08:00
|
|
|
|
cp package.json npm
|
|
|
|
|
|
2022-09-06 17:51:36 +08:00
|
|
|
|
# 记录last commit,便于区分内网版本包之间的差异
|
|
|
|
|
REVISION=revision.json
|
|
|
|
|
npm run revision -- $REVISION
|
|
|
|
|
|
|
|
|
|
if [ -f "$REVISION" ]; then
|
|
|
|
|
for dir in $(find ./npm/packages -mindepth 1 -maxdepth 1 -type d); do
|
|
|
|
|
[ -d "$dir" ] && cp $REVISION "$dir/$REVISION";
|
|
|
|
|
done;
|
|
|
|
|
else
|
|
|
|
|
echo "$REVISION not exists."
|
|
|
|
|
fi
|
|
|
|
|
|
2022-06-06 17:28:39 +08:00
|
|
|
|
cd npm
|
|
|
|
|
|
|
|
|
|
# package.json 里面把包名称换了
|
2022-06-07 11:40:09 +08:00
|
|
|
|
for f in $(find ./packages -name "package.json"); do
|
2022-06-06 17:28:39 +08:00
|
|
|
|
sed -i '' -e 's/\"name\": \"amis/\"name\": \"@fex\/amis/g' $f
|
2022-06-07 11:40:09 +08:00
|
|
|
|
sed -i '' -e 's/\"amis-/\"@fex\/amis-/g' $f
|
2022-06-06 17:28:39 +08:00
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
# 把代码里面import的部分换成内部包名称
|
2022-07-01 10:43:20 +08:00
|
|
|
|
for f in $(find ./packages/*/lib -type f -name "*.[tj]s"); do
|
2022-09-15 19:14:27 +08:00
|
|
|
|
sed -i '' -e "s/from \'amis/from \'@fex\/amis/g" $f
|
|
|
|
|
sed -i '' -e "s/import(\'amis/import(\'@fex\/amis/g" $f
|
2022-12-05 15:00:43 +08:00
|
|
|
|
sed -i '' -e "s/import[ ]*\'amis/import \'@fex\/amis/g" $f
|
2022-09-17 13:03:45 +08:00
|
|
|
|
sed -i '' -e "s/require(\'amis/require(\'@fex\/amis/g" $f
|
2022-09-21 19:42:03 +08:00
|
|
|
|
sed -i '' -e "s/require(\[\'amis/require(\[\'@fex\/amis/g" $f
|
2022-06-06 17:28:39 +08:00
|
|
|
|
done
|
|
|
|
|
|
2022-07-01 10:43:20 +08:00
|
|
|
|
for f in $(find ./packages/*/esm -type f -name "*.[tj]s"); do
|
2022-09-15 19:14:27 +08:00
|
|
|
|
sed -i '' -e "s/from \'amis/from \'@fex\/amis/g" $f
|
|
|
|
|
sed -i '' -e "s/import(\'amis/import(\'@fex\/amis/g" $f
|
2022-12-05 15:00:43 +08:00
|
|
|
|
sed -i '' -e "s/import[ ]*\'amis/import \'@fex\/amis/g" $f
|
2022-09-17 13:03:45 +08:00
|
|
|
|
sed -i '' -e "s/require(\'amis/require(\'@fex\/amis/g" $f
|
2022-09-21 19:42:03 +08:00
|
|
|
|
sed -i '' -e "s/require(\[\'amis/require(\[\'@fex\/amis/g" $f
|
2022-06-07 16:28:28 +08:00
|
|
|
|
done
|
|
|
|
|
|
2022-06-07 16:30:38 +08:00
|
|
|
|
npm publish --workspaces --registry=http://registry.npm.baidu-int.com --ignore-scripts
|
2022-06-06 17:28:39 +08:00
|
|
|
|
|
|
|
|
|
cd ..
|
2022-06-07 16:30:38 +08:00
|
|
|
|
rm -rf npm
|