From b4c3f76fa73fe821922c6c98a07b0e686a1a579e Mon Sep 17 00:00:00 2001 From: 2betop <2betop.cn@gmail.com> Date: Mon, 26 Oct 2020 20:05:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=8A=20beta=20=E6=94=B9=E6=88=90=E5=86=85?= =?UTF-8?q?=E9=83=A8=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I9eedc732dceffe147911058e6b02afbd5d8e4566 --- .npmignore | 2 +- .travis.yml | 2 +- build.sh | 26 ++++++++++++++++++++++++++ deploy-npm-beta.sh | 2 +- package.json | 6 +++--- publish.sh | 29 ++++++++++++----------------- 6 files changed, 44 insertions(+), 23 deletions(-) create mode 100644 build.sh diff --git a/.npmignore b/.npmignore index 628af7c9b..1e994cf40 100644 --- a/.npmignore +++ b/.npmignore @@ -14,7 +14,7 @@ fis-conf.js /__tests__ /__mocks__ /coverage -/publish.sh +/build.sh /gh-pages /.github /docs diff --git a/.travis.yml b/.travis.yml index e32e08b25..9f5044948 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ language: node_js node_js: - 10 -script: sh deploy-gh-pages.sh && sh deploy-npm-beta.sh +script: sh deploy-gh-pages.sh diff --git a/build.sh b/build.sh new file mode 100644 index 000000000..687854311 --- /dev/null +++ b/build.sh @@ -0,0 +1,26 @@ +#!/bin/bash +set -e + +rm -rf lib +rm -rf output + +fis3 release publish -c +rm -rf lib/node_modules + +# 生成 sdk +rm -rf sdk && fis3 release publish-sdk -c + +# 生成 .d.ts 文件 +./node_modules/.bin/tsc --allowJs --declaration + +cd output + +for f in $(find . -name "*.d.ts"); do + mkdir -p ../lib/$(dirname $f) && mv $f ../lib/$(dirname $f) +done + +cd .. + +rm -rf output + +npm run build-schemas diff --git a/deploy-npm-beta.sh b/deploy-npm-beta.sh index 83bc16841..f95203871 100644 --- a/deploy-npm-beta.sh +++ b/deploy-npm-beta.sh @@ -7,7 +7,7 @@ echo "Cloning" git clone -b npm --depth=1 https://$GH_TOKEN@github.com/baidu/amis.git npm echo "building" -sh publish.sh +sh build.sh cp -rf lib npm cp package.json npm diff --git a/package.json b/package.json index d3cf4f912..59ae1a1ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "amis", - "version": "1.0.17", + "version": "1.0.18-beta.9", "description": "一种MIS页面生成工具", "main": "lib/index.js", "scripts": { @@ -9,8 +9,8 @@ "start": "fis3 server start --www ./public --port 8888 --no-daemon --no-browse", "stop": "fis3 server stop", "dev": "fis3 release -cwd ./public", - "publish2npm": "sh publish.sh && npm publish", - "build": "sh publish.sh", + "publish-to-internal": "sh build.sh && sh publish.sh", + "build": "sh build.sh", "prettier": "prettier --write '{src,examples,scss}/**/*.{tsx,ts,jsx,scss}'", "deploy-gh-page": "sh ./deploy-gh-pages.sh", "build-schemas": "ts-node -O '{\"target\":\"es6\"}' scripts/build-schemas.ts" diff --git a/publish.sh b/publish.sh index 687854311..b1f8e59d2 100644 --- a/publish.sh +++ b/publish.sh @@ -1,26 +1,21 @@ #!/bin/bash set -e -rm -rf lib -rm -rf output +rm -rf npm +mkdir npm -fis3 release publish -c -rm -rf lib/node_modules +cp -rf lib npm +cp package.json npm +cp schema.json npm +cp -rf scss npm +cp -rf examples npm +cp -rf sdk npm -# 生成 sdk -rm -rf sdk && fis3 release publish-sdk -c +cd npm -# 生成 .d.ts 文件 -./node_modules/.bin/tsc --allowJs --declaration +sed -i '' -e 's/\"name\": \"amis\"/\"name\": \"@fex\/amis\"/g' ./package.json -cd output - -for f in $(find . -name "*.d.ts"); do - mkdir -p ../lib/$(dirname $f) && mv $f ../lib/$(dirname $f) -done +npm publish --registry=http://registry.npm.baidu-int.com cd .. - -rm -rf output - -npm run build-schemas +rm -rf npm