-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreateAngularPackage.sh
54 lines (37 loc) · 1.13 KB
/
CreateAngularPackage.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
set -e
specurl=$1
packageversion=$2
echo Spec Url $specurl
echo Version $packageversion
mkdir -p ./service
case $specurl in
"http"*)
echo Downloading spec file
curl $specurl > ./spec.json ;;
*)
echo Copying spec file
cp $specurl ./spec.json ;;
esac
#apt-get update -y && apt-get upgrade -y
if java -version 2>&1 >/dev/null | egrep -q "\S+\s+version" ; then
echo "Java installed."
else
apt-get install default-jdk -y
fi
npm install @openapitools/openapi-generator-cli@1.0.18-4.3.1 -g
npx openapi-generator generate -i ./spec.json -g typescript-angular -o service --additional-properties=fileNaming=camelCase --enable-post-process-file
sed -i 's/0.0.0/'$packageversion'/g' ./package.json
cp ./package.json ./service/package.json
cp ./tsconfig.json ./service/tsconfig.json
cd service
npm install --save rxjs@6.6.7
npm install --save zone.js@0.9.1
npm install --save @angular/core@8.2.14
npm install --save @angular/common@8.2.14
npm install -g @angular/compiler-cli@8.2.14 @angular/platform-server@8.2.14 @angular/compiler@8.2.14
ngc
cd ..
cp ./.npmrc ./dist/.npmrc
cp ./package.json ./dist/package.json
cd dist
npm publish