This repository has been archived by the owner on Apr 24, 2023. It is now read-only.
forked from fabric8-launcher/launcher-creator-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate-platform-generators.sh
executable file
·112 lines (90 loc) · 3.04 KB
/
update-platform-generators.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
#!/bin/bash
update_angular() {
local tmp=$(mktemp -d)
local name="my-angular-app"
pushd $tmp
npx @angular/cli new $name --defaults
cd $name
rm -rf node_modules package-lock.json yarn.lock
cat >>README.md.tmp <<'EOT'
# platform-angular
Created by the Cloud App Generator
Now that the application has been generated it can be deployed in the currently active project on OpenShift by running:
```
$ ./gap deploy
```
Now the only thing that is left to do is push the project's code to OpenShift to be run. To push the sources and
have the project be built on OpenShift you can do the following:
```
$ ./gap push
```
EOT
cat README.md >>README.md.tmp
mv README.md.tmp README.md
jq '.name = "{{.nodejs.name}}" | .version = "{{.nodejs.version}}"' package.json > package.json.tmp
mv package.json.tmp package.json
find . \( -name "*.ts" -o -name "*.json" -o -name "*.html" -o -name "*.md" \) -exec sed -i "s/$name/\{\{.nodejs.name\}\}/g" '{}' \;
popd
cp -a $tmp/$name/* catalog/generators/platform-angular/files/
rm -rf $tmp
}
update_react() {
local tmp=$(mktemp -d)
local name="my-react-app"
pushd $tmp
npx create-react-app $name
cd $name
rm -rf node_modules package-lock.json yarn.lock
cat >>README.md.tmp <<'EOT'
# platform-react
Created by the Cloud App Generator
Now that the application has been generated it can be deployed in the currently active project on OpenShift by running:
```
$ ./gap deploy
```
Now the only thing that is left to do is push the project's code to OpenShift to be run. To push the sources and
have the project be built on OpenShift you can do the following:
```
$ ./gap push
```
EOT
cat README.md >>README.md.tmp
mv README.md.tmp README.md
jq '.name = "{{.nodejs.name}}" | .version = "{{.nodejs.version}}"' package.json > package.json.tmp
mv package.json.tmp package.json
popd
cp -a $tmp/$name/* catalog/generators/platform-react/files/
rm -rf $tmp
}
update_vuejs() {
local tmp=$(mktemp -d)
local name="my-vuejs-app"
pushd $tmp
npx @vue/cli create --default $name
cd $name
rm -rf node_modules package-lock.json yarn.lock
cat >>README.md.tmp <<'EOT'
# platform-vuejs
Created by the Cloud App Generator
Now that the application has been generated it can be deployed in the currently active project on OpenShift by running:
```
$ ./gap deploy
```
Now the only thing that is left to do is push the project's code to OpenShift to be run. To push the sources and
have the project be built on OpenShift you can do the following:
```
$ ./gap push
```
EOT
cat README.md >>README.md.tmp
mv README.md.tmp README.md
jq '.name = "{{.nodejs.name}}" | .version = "{{.nodejs.version}}"' package.json > package.json.tmp
mv package.json.tmp package.json
find . \( -name "*.ts" -o -name "*.json" -o -name "*.html" -o -name "*.md" \) -exec sed -i "s/$name/\{\{.nodejs.name\}\}/g" '{}' \;
popd
cp -a $tmp/$name/* catalog/generators/platform-vuejs/files/
rm -rf $tmp
}
update_angular
update_react
update_vuejs