-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathtest-app.sh
executable file
·235 lines (229 loc) · 6.94 KB
/
test-app.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
#!/usr/bin/env bash
# exit when any command fails
set -e
framework="$1"
issuer="https://dev-17700857.okta.com/oauth2/default"
clientId="0oa9nr5n8dgfTLgk05d7"
auth0Issuer="https://dev-06bzs1cu.us.auth0.com/"
auth0ClientId="KW1uEoUtqQKdiDpdhn82Z3KKIwSJLwjo"
# build and package this project
rm -f *.tgz
npm run build
npm pack
# create directory to store created apps
mkdir -p apps
cd apps
# install snapshot version of schematics-utilities
# if [ ! -d schematics-utilities ]; then
# git clone -b refactor/restore-angular-cdk-clone https://github.com/nitayneeman/schematics-utilities.git
# fi
# cd schematics-utilities && npm link
# cd ..
if [ $framework == "angular" ] || [ $framework == "a" ]
then
ng new angular-app --routing --style css --strict --ssr false
cd angular-app
npm install -D ../../oktadev*.tgz
schematics @oktadev/schematics:add-auth --issuer=$issuer --client-id=$clientId
ng test --watch=false
elif [ $framework == "angular-auth0" ] || [ $framework == "a0" ]
then
ng new angular-auth0 --routing --style css --strict --ssr false
cd angular-auth0
npm install -D ../../oktadev*.tgz
schematics @oktadev/schematics:add-auth --issuer=$auth0Issuer --client-id=$auth0ClientId --auth0
ng test --watch=false
elif [ $framework == "react-ts" ] || [ $framework == "rts" ]
then
npx create-react-app react-app-ts --template typescript
cd react-app-ts
npm install -D ../../oktadev*.tgz
schematics @oktadev/schematics:add-auth --issuer=$issuer --client-id=$clientId
CI=true npm test
elif [ $framework == "react" ] || [ $framework == "r" ]
then
npx create-react-app react-app
cd react-app
npm install -D ../../oktadev*.tgz
schematics @oktadev/schematics:add-auth --issuer=$issuer --client-id=$clientId
CI=true npm test
elif [ $framework == "react-ts-auth0" ] || [ $framework == "rts0" ]
then
npx create-react-app react-auth0-ts --template typescript
cd react-auth0-ts
npm install -D ../../oktadev*.tgz
schematics @oktadev/schematics:add-auth --issuer=$auth0Issuer --client-id=$auth0ClientId --auth0
CI=true npm test
elif [ $framework == "react-auth0" ] || [ $framework == "r0" ]
then
npx create-react-app react-auth0
cd react-auth0
npm install -D ../../oktadev*.tgz
schematics @oktadev/schematics:add-auth --issuer=$auth0Issuer --client-id=$auth0ClientId --auth0
CI=true npm test
elif [ $framework == "vue-ts" ] || [ $framework == "vts" ]
then
config=$(cat <<EOF
{
"useConfigFiles": true,
"plugins": {
"@vue/cli-plugin-babel": {},
"@vue/cli-plugin-typescript": {
"classComponent": false,
"useTsWithBabel": true
},
"@vue/cli-plugin-router": {
"historyMode": true
},
"@vue/cli-plugin-eslint": {
"config": "base",
"lintOn": [
"save"
]
},
"@vue/cli-plugin-unit-jest": {}
},
"vueVersion": "3"
}
EOF
)
vue create vue-app-ts -i "$config" --registry=http://registry.npm.taobao.org
cd vue-app-ts
npm install -D ../../oktadev*.tgz
schematics @oktadev/schematics:add-auth --issuer=$issuer --client-id=$clientId
npm run test:unit
elif [ $framework == "vue" ] || [ $framework == "v" ]
then
config=$(cat <<EOF
{
"useConfigFiles": true,
"plugins": {
"@vue/cli-plugin-babel": {},
"@vue/cli-plugin-router": {
"historyMode": true
},
"@vue/cli-plugin-eslint": {
"config": "base",
"lintOn": [
"save"
]
},
"@vue/cli-plugin-unit-jest": {}
},
"vueVersion": "3"
}
EOF
)
vue create vue-app -i "$config" --registry=http://registry.npm.taobao.org
cd vue-app
npm install -D ../../oktadev*.tgz
schematics @oktadev/schematics:add-auth --issuer=$issuer --client-id=$clientId
npm run test:unit
elif [ $framework == "vue-ts-auth0" ] || [ $framework == "vts0" ]
then
config=$(cat <<EOF
{
"useConfigFiles": true,
"plugins": {
"@vue/cli-plugin-babel": {},
"@vue/cli-plugin-typescript": {
"classComponent": false,
"useTsWithBabel": true
},
"@vue/cli-plugin-router": {
"historyMode": true
},
"@vue/cli-plugin-eslint": {
"config": "base",
"lintOn": [
"save"
]
},
"@vue/cli-plugin-unit-jest": {}
},
"vueVersion": "3"
}
EOF
)
vue create vue-auth0-ts -i "$config" --registry=http://registry.npm.taobao.org
cd vue-auth0-ts
npm install -D ../../oktadev*.tgz
schematics @oktadev/schematics:add-auth --issuer=$auth0Issuer --client-id=$auth0ClientId --auth0
npm run test:unit
elif [ $framework == "vue-auth0" ] || [ $framework == "v0" ]
then
config=$(cat <<EOF
{
"useConfigFiles": true,
"plugins": {
"@vue/cli-plugin-babel": {},
"@vue/cli-plugin-router": {
"historyMode": true
},
"@vue/cli-plugin-eslint": {
"config": "base",
"lintOn": [
"save"
]
},
"@vue/cli-plugin-unit-jest": {}
},
"vueVersion": "3"
}
EOF
)
vue create vue-auth0 -i "$config" --registry=http://registry.npm.taobao.org
cd vue-auth0
npm install -D ../../oktadev*.tgz
schematics @oktadev/schematics:add-auth --issuer=$auth0Issuer --client-id=$auth0ClientId --auth0
npm run test:unit
elif [ $framework == "ionic" ] || [ $framework == "i" ]
then
ionic start ionic-app tabs --type angular --no-interactive
cd ionic-app
npm install -D ../../oktadev*.tgz
schematics @oktadev/schematics:add-auth --issuer=$issuer --client-id=$clientId
npm run build && ng test --watch=false
elif [ $framework == "ionic-auth0" ] || [ $framework == "i0" ]
then
ionic start ionic-auth0 tabs --type angular --no-interactive
cd ionic-auth0
npm install -D ../../oktadev*.tgz
schematics @oktadev/schematics:add-auth --issuer=$auth0Issuer --client-id=$auth0ClientId --auth0
npm run build && ng test --watch=false
elif [ $framework == "react-native" ] || [ $framework == "rn" ]
then
npx -y react-native init SecureApp
cd SecureApp
npm install -D ../../oktadev*.tgz
schematics @oktadev/schematics:add-auth --issuer=$issuer --client-id=$clientId
# pod install --project-directory=ios --repo-update
npm test -- -u
elif [ $framework == "react-native-auth0" ] || [ $framework == "rn0" ]
then
npx -y react-native init SecureAuth0
cd SecureAuth0
npm install -D ../../oktadev*.tgz
schematics @oktadev/schematics:add-auth --issuer=$auth0Issuer --client-id=$auth0ClientId --auth0
# pod install --project-directory=ios --repo-update
npm test -- -u
elif [ $framework == "express" ] || [ $framework == "e" ]
then
mkdir express-app && cd express-app
npx express-generator --view=pug
npm i
npm install -D ../../oktadev*.tgz
schematics @oktadev/schematics:add-auth --issuer=$issuer --client-id=$clientId --client-secret='may the auth be with you'
# npm test -- -u
elif [ $framework == "express-auth0" ] || [ $framework == "e0" ]
then
mkdir express-auth0 && cd express-auth0
npx express-generator --view=pug
npm i
npm install -D ../../oktadev*.tgz
schematics @oktadev/schematics:add-auth --issuer=$auth0Issuer --client-id=$auth0ClientId \
--client-secret='may the auth be with you' --auth0
# npm test -- -u
else
echo "No '${framework}' framework found!"
fi