-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.sh
More file actions
131 lines (87 loc) · 3.57 KB
/
build.sh
File metadata and controls
131 lines (87 loc) · 3.57 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
_SHELL="$(ps -p $$ -o comm=)"; # bash || sh || zsh
_SHELL="$(basename ${_SHELL//-/})"
case ${_SHELL} in
zsh)
_DIR="$( cd "$( dirname "${(%):-%N}" )" && pwd -P )"
;;
sh)
_DIR="$( cd "$( dirname "${0}" )" && pwd -P )"
;;
*)
_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd -P )"
;;
esac
export NODE_OPTIONS=""
ROOT="${_DIR}"
# let's not enable it here
# because some scripts here will use node some only in CI
# and by fixing this export here additional logs will appear in CI mode
# Debugger listening on ws://127.0.0.1:35133/beec5c79-0b8f-43c1-b83a-f9ebc185d9a9
# For help, see: https://nodejs.org/en/docs/inspector
# let's individual sh files called from here decide if they need this export or not
# export NODE_OPTIONS=""
set -e
if [ ! -f ".env" ]; then
echo "${0} error: file .env doesn't exist"
exit 1
fi
source ".env"
if [ ! -f ".env.sh" ]; then
echo "${0} error: file .env doesn't exist"
exit 1
fi
eval "$(/bin/bash bash/exportsource.sh ".env")"
source ".env.sh"
if [ "${PROJECT_NAME}" = "" ]; then
echo "env var PROJECT_NAME is not defined";
exit 1
fi
if [ "${GITSTORAGE_CORE_REPOSITORY}" = "" ]; then
echo "env var GITSTORAGE_CORE_REPOSITORY is not defined";
exit 1
fi
if [ "${GITHUB_SOURCES_PREFIX}" = "" ]; then
echo "env var GITHUB_SOURCES_PREFIX is not defined";
exit 1
fi
if [ "${EXPOSE_EXTRA_ENV_VARIABLES}" = "" ]; then
echo "env var EXPOSE_EXTRA_ENV_VARIABLES is not defined";
exit 1
fi
mkdir -p public
# transpile all "module*.ts" right next in the same directoris but as *.js
/bin/bash node_modules/.bin/tsc
node pages/portsregistry/lists/ports-generator.js
# call those together in this order vvv
time /bin/bash scripts/uglify.sh
time /bin/bash scripts/template.sh
# call those together in this order ^^^
# node libs/preprocessor.js
time node node_modules/envprocessor/dist/esm/cli.js --maskEnv EXPOSE_EXTRA_ENV_VARIABLES --verbose --debug build/preprocessed.js public/preprocessed.js
cp node_modules/envprocessor/dist/esm/env.js public/env.js
time node esbuild-entries.js
time /bin/bash esbuild-node.sh
time /bin/bash .github/ytlinksfix.sh
# /bin/bash pages/kubernetes/compress.sh
time /bin/bash bash/substitute-variables-bash.sh gitstorage-core.sh -- \
GITSTORAGE_CORE_REPOSITORY "${GITSTORAGE_CORE_REPOSITORY}" \
PROD_SCHEMA "${PROD_SCHEMA}" \
PROD_PORT "${PROD_PORT}" \
PROD_HOSTNAME "${PROD_HOSTNAME}"
# NOTICE: remember it will not process if --run not passed or CI env var is not present
# I'm deliberately suppressing error to continue if above is not provided for local dev environment
time /bin/bash .github/urlwizzard.sh
# /bin/bash .github/toc-check.sh README.md
/bin/bash node_modules/.bin/markdown-toc -i README.md
time /bin/bash node_modules/.bin/prettier --config prettier.config.cjs --write . 1> >(/bin/bash bash/dlogger.sh o prettier) 2> >(/bin/bash bash/dlogger.sh e prettier)
# this one after style_fix
# inject special blocking code
# NOTICE: remember it will not process if --run not passed or CI env var is not present
# I'm deliberately suppressing error to continue if above is not provided for local dev environment
time /bin/bash .github/clicksecure.sh
time /bin/bash .github/injector.sh
# NOTICE: remember it will not process if --run not passed or CI env var is not present
# I'm deliberately suppressing error to continue if above is not provided for local dev environment
time /bin/bash .github/sha384.sh
/bin/bash pages/typescript/defaults/getconfig.sh
/bin/bash es.sh # transpilation of *.ts to *.js - and adding individual output files to .gitignore