You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
843 B
33 lines
843 B
#!/usr/bin/env moshell
|
|
|
|
mkdir -p /outputs/public
|
|
|
|
apt update && apt install jq -y
|
|
|
|
val drone_branch = std::env("DRONE_BRANCH").unwrap()
|
|
|
|
val base = "/IQBall/$drone_branch/public"
|
|
npm run build -- --base=$base --mode PROD
|
|
|
|
// Read generated mappings from build
|
|
val result = $(jq -r 'to_entries|map(.key + " " +.value.file)|.[]' dist/manifest.json)
|
|
val mappings = $result.split('\n')
|
|
|
|
|
|
echo '<?php\nconst ASSETS = [' > views-mappings.php
|
|
|
|
while $mappings.len() > 0 {
|
|
val mapping = $mappings.pop().unwrap();
|
|
val mapping = $mapping.split(' ');
|
|
val source_file = $mapping[0]
|
|
val build_file = $mapping[1]
|
|
echo "\t'$source_file' => '$build_file'," >> views-mappings.php
|
|
}
|
|
|
|
echo "];" >> views-mappings.php
|
|
|
|
chmod +r views-mappings.php
|
|
|
|
mv dist/* front/assets/ front/style/ public/* /outputs/public/
|
|
mv views-mappings.php /outputs/
|