forked from oktadev/schematics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-app.sh
executable file
·103 lines (99 loc) · 2.59 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
#!/usr/bin/env bash
framework="$1"
issuer="https://dev-737523.oktapreview.com/oauth2/default"
clientId="0oak8qpmhim2MmwF20h7"
# build and package this project
npm run build
npm pack
# create directory to store created apps
mkdir -p apps
cd apps
if [ "$1" == "angular" ] || [ "$1" == "a" ]
then
ng new angular-app --routing --style css
cd angular-app
npm install ../../oktadev*.tgz
ng add @oktadev/schematics --issuer=$issuer --clientId=$clientId
ng test --watch=false && ng e2e
elif [ "$1" == "react-ts" ] || [ "$1" == "rts" ]
then
npx create-react-app react-app-ts --typescript
cd react-app-ts
npm install ../../oktadev*.tgz
schematics @oktadev/schematics:add-auth --issuer=$issuer --clientId=$clientId
CI=true npm test
elif [ "$1" == "react" ] || [ "$1" == "r" ]
then
npx create-react-app react-app
cd react-app
npm install ../../oktadev*.tgz
schematics @oktadev/schematics:add-auth --issuer=$issuer --clientId=$clientId
CI=true npm test
elif [ "$1" == "vue-ts" ] || [ "$1" == "vts" ]
then
config=$(cat <<EOF
{
"useConfigFiles": true,
"plugins": {
"@vue/cli-plugin-babel": {},
"@vue/cli-plugin-typescript": {
"classComponent": true,
"tsLint": true,
"lintOn": [
"save"
],
"useTsWithBabel": true
},
"@vue/cli-plugin-unit-jest": {},
"@vue/cli-plugin-e2e-cypress": {}
},
"router": true,
"routerHistoryMode": false
}
EOF
)
vue create vue-app-ts -i "$config"
cd vue-app-ts
npm install ../../oktadev*.tgz
schematics @oktadev/schematics:add-auth --issuer=$issuer --clientId=$clientId
npm run test:unit
elif [ "$1" == "vue" ] || [ "$1" == "v" ]
then
config=$(cat <<EOF
{
"useConfigFiles": true,
"plugins": {
"@vue/cli-plugin-babel": {},
"@vue/cli-plugin-eslint": {
"config": "base",
"lintOn": [
"save"
]
},
"@vue/cli-plugin-unit-jest": {}
},
"router": true,
"routerHistoryMode": true
}
EOF
)
vue create vue-app -i "$config"
cd vue-app
npm install ../../oktadev*.tgz
schematics @oktadev/schematics:add-auth --issuer=$issuer --clientId=$clientId
npm run test:unit
elif [ "$1" == "ionic" ] || [ "$1" == "i" ]
then
ionic start ionic-cordova tabs --no-interactive
cd ionic-cordova
npm install ../../oktadev*.tgz
ng add @oktadev/schematics --issuer=$issuer --clientId=$clientId
ng test --watch=false
elif [ "$1" == "ionic-cap" ] || [ "$1" == "icap" ]
then
ionic start ionic-capacitor tabs --no-interactive
cd ionic-capacitor
npm install ../../oktadev*.tgz
ng add @oktadev/schematics --issuer=$issuer --clientId=$clientId --platform=capacitor
ng test --watch=false
fi