2021-09-10 07:27:23 -07:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Copyright 2021 The Prometheus Authors
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
set -e
|
2022-06-13 01:53:46 -07:00
|
|
|
|
2022-06-09 06:11:46 -07:00
|
|
|
if ! [[ -w $HOME ]]
|
|
|
|
then
|
|
|
|
export npm_config_cache=$(mktemp -d)
|
|
|
|
fi
|
2021-09-10 07:27:23 -07:00
|
|
|
|
2022-06-13 01:53:46 -07:00
|
|
|
buildOrder=(lezer-promql codemirror-promql)
|
2021-09-10 07:27:23 -07:00
|
|
|
|
|
|
|
function buildModule() {
|
|
|
|
for module in "${buildOrder[@]}"; do
|
|
|
|
echo "build ${module}"
|
2022-06-13 07:40:08 -07:00
|
|
|
npm run build -w "@prometheus-io/${module}"
|
2021-09-10 07:27:23 -07:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
function buildReactApp() {
|
2024-04-18 06:00:27 -07:00
|
|
|
echo "build react-app"
|
|
|
|
cd react-app
|
|
|
|
npm run build
|
|
|
|
cd ..
|
|
|
|
rm -rf ./static/react-app
|
|
|
|
mv ./react-app/build ./static/react-app
|
|
|
|
}
|
|
|
|
|
|
|
|
function buildMantineUI() {
|
2024-02-21 02:14:35 -08:00
|
|
|
echo "build mantine-ui"
|
|
|
|
npm run build -w @prometheus-io/mantine-ui
|
2024-04-18 06:00:27 -07:00
|
|
|
rm -rf ./static/mantine-ui
|
|
|
|
mv ./mantine-ui/dist ./static/mantine-ui
|
2021-09-10 07:27:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
for i in "$@"; do
|
|
|
|
case ${i} in
|
|
|
|
--all)
|
|
|
|
buildModule
|
|
|
|
buildReactApp
|
2024-04-18 06:00:27 -07:00
|
|
|
buildMantineUI
|
2021-09-10 07:27:23 -07:00
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--build-module)
|
|
|
|
buildModule
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|