# jenkins shell 构建

# 正式环境配置

1、构建

echo [xiaofang-web] $PATH
node -v
npm -v

npx browserslist@latest --update-db

echo 'set config'
npm config set registry=https://laoyaojing-npm.pkg.coding.net/new-xiaofang-web/xz-components/

echo 'run install'
npm install
npm install pdfjs-dist@2.2.228 --save-dev

echo 'run build'
npm run build

echo 'build dist'
cd dist
rm -rf dist.tar.gz
tar -zcvf dist.tar.gz *
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

2、构建后

	Source files:dist/dist.tar.gz
    Remove prefix:dist
    Remote directory:/data/xiaofang-web/dist
    Exec command:
                cd /data/xiaofang-web/
                mkdir dist-bak
                mv dist/dist.tar.gz ./dist-bak
                cd ./dist-bak
                tar -zxvf dist.tar.gz
                cd ../
                mv dist dist2  && mv dist-bak dist
                rm -rf dist2 && rm -rf dist-bak
1
2
3
4
5
6
7
8
9
10
11
12

# 测试环境配置

1、构建

echo [new-xiaofang-web] $PATH
node -v
npm -v

echo 'run install'
npm install --registry=https://registry.npm.taobao.org

echo 'run build'
npm run build

echo 'build dist'
cd dist
rm -rf dist.tar.gz
tar -zcvf dist.tar.gz *
1
2
3
4
5
6
7
8
9
10
11
12
13
14

2、构建后

	Source files:dist/dist.tar.gz
    Remove prefix:dist
    Remote directory:/data/ceshixf/dist
    Exec command:
                cd /data/ceshixf/
                mkdir dist-bak
                mv dist/dist.tar.gz ./dist-bak
                cd ./dist-bak
                tar -zxvf dist.tar.gz
                cd ../
                mv dist dist2  && mv dist-bak dist
                rm -rf dist2 && rm -rf dist-bak
1
2
3
4
5
6
7
8
9
10
11
12

==================

echo [testjenkins] $PATH node -v npm -v

npx browserslist@latest --update-db

echo 'set config' npm config set registery=https://e.coding.net/iskeys/testjenkins.git

dist/dist.tar.gz

dist

/data/project/test/dist

cd /data/project/test mkdir dist-bak mv dist/dist.tar.gz ./dist-bak cd ./dist-bak tar -zxvf dist.tar.gz cd ../ mv dist dist2 && mv dist-bak dist rm -rf dist2 && rm -rf dist-bak

Last Updated: 3/1/2022, 6:21:10 PM