Repository navigation
Expand file tree
/
Copy pathpanda
More file actions
executable file
·219 lines (183 loc) · 4.21 KB
/
Copy pathpanda
File metadata and controls
executable file
·219 lines (183 loc) · 4.21 KB
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
#!/usr/bin/env bash
_VERSION='0.1.1'
_ME=$(basename "${0}")
BANNER=$(cat <<HEREDOC
iLearn Ext Panda! (@,@)
Usage:
${_ME} <command> [--command-options] [<arguments>]
${_ME} -?
${_ME} --version
Options:
-? Display this help information.
--version Display version information.
Version: ${_VERSION}
Help:
${_ME} help [<command>]
HEREDOC
)
source ./tools/pandalib.sh
# Ensure that webpack binaries are in path too.
PATH="$PATH:./node_modules/.bin"
# ... and that the local .env file is also sourced.
if [[ -f ".env" ]]; then
_info 'Sourcing local .env file'
source ./.env
else
_info 'Sourcing sample .env to maintain variable declaration'
source ./.env.sample
fi
# ... and that it isnt too verbose.
export FLAGS_VERBOSE='no'
__sigint () {
printf '\n'
_abort 'Ended all sessions'
}
trap __sigint SIGINT
#=== Dev Builds:
dev:storybook () {
_info 'Starting Storybook Server'
export ILRN_IS_DEV='yes'
start-storybook --port 8519 --ci
}
dev:watch () {
prep:all
export ILRN_IS_DEV='yes'
webpack --watch
}
dev:server () {
_info 'Starting dev-server'
export ILRN_IS_DEV='yes'
prep:all
webpack-dev-server --hot
}
dev:build () {
_info 'Building [dev]'
export ILRN_IS_DEV='yes'
prep:all
webpack
}
dev:webext () {
export FLAGS_VERBOSE='yes'
web-ext run
_success 'Closing Firefox'
}
#=== Preprocessing steps:
prep:webfonts () {
# Generates fonts.css in src/styles with the fonts found in assets/fonts.
python tools/discover-fonts.py --silent
}
prep:locales () {
python tools/combine-locales.py --silent
}
desc 'prep:all' <<BOOP
Usage:
${_ME} prep:all
Description:
Preprocess generated css and locales jsons.
BOOP
prep:all () {
prep:webfonts
prep:locales
}
release:bump () {
# Bump the extension version!
_info 'Bumping version'
}
release:pack () {
_info 'Linting Extension Sources [firefox]'
web-ext lint
_info 'Building Package [firefox]'
web-ext build --overwrite-dest
_info 'Building Package [chrome]'
(cd .builds && zip -r chrome.zip ./chrome -x ./chrome/report.html)
}
release:build () {
_info "<*> Compiling [target -> ${FLAGS_TARGET}]"
export ILRN_IS_DEV='no'
export NODE_ENV='production'
prep:all
webpack
_success 'Done'
}
release:dev () {
export FLAGS_VERBOSE='no'
export ILRN_IS_DEV='yes'
export NODE_ENV='production'
_info 'Building preview release'
prep:all
webpack
_success 'Done!'
}
release () {
export FLAGS_VERBOSE='no'
_info '<*> Creating a PUBLIC release! <*>'
release:build-all
release:pack
_success 'Packed all targets succesfully!'
}
release:build-all () {
export NODE_ENV='production'
export FLAGS_TARGET='chrome'
release:build
export FLAGS_TARGET='firefox'
release:build
export FLAGS_TARGET='web'
release:build
}
#=== Publishing routines
publish:firefox () {
_info '<-> Publishing to firefox with self hosted server'
web-ext lint
web-ext build --overwrite-dest
_info ' Requesting Signing Service for signed artifact [firefox]'
web-ext sign \
--api-key $DEV_WEBEXT_API_KEY \
--api-secret $DEV_WEBEXT_API_SECRET \
--id $DEV_WEBEXT_EXTENSION_ID
rsync -r ./.builds/gecko-artifacts/ $DEV_EXTENSION_STORE
}
publish:chrome () {
_info '<-> Publishing to chrome store with shipit'
shipit chrome .builds/chrome
}
publish:web () {
_info '<-> Publishing webapp to static server'
rsync -r ./.builds/web/ $DEV_WEBAPP_RSYNC_PATH
}
publish () {
_info '<*> Publishing to chrome, firefox, and web'
publish:web
publish:chrome
publish:firefox
}
#=== Tests
test:ci () {
_info 'Starting Karma with JSDom.'
# rc is the return code. This makes sure we return correct exit status for CI.
karma start --single-run && rc=$? || rc=$?
return $rc
}
_get_target () {
local _target
for __arg in "${_COMMAND_ARGV[@]:-}"
do
case ${__arg} in
--chrome) _target='chrome';;
--firefox) _target='firefox';;
--web) _target='web';;
esac
done
if [[ "${_CMD}" == 'release:build-all' ]]
then
return 0
fi
if _blank "$_target"
then
_warn "Target unspecified. Using firefox as default."
_info "[*] You can use --chrome, --firefox, or --web to specify a target."
fi
export FLAGS_TARGET="${_target}"
}
#================================================
_get_target
_main