Fix infra scripts

This commit is contained in:
Edward Shen 2022-01-18 01:52:44 -08:00
parent 6859bffe05
commit 9a8658e744
Signed by: edward
GPG key ID: 19182661E818369F
4 changed files with 12 additions and 12 deletions

View file

@ -20,20 +20,16 @@ set -euxo pipefail
cd "$(git rev-parse --show-toplevel)" || exit 1 cd "$(git rev-parse --show-toplevel)" || exit 1
# Build frontend assets # Clean resources
yarn
rm -rf dist rm -rf dist
yarn webpack
# Build frontend code
yarn
yarn build
mv dist/static/index.html dist
# Build server # Build server
cargo build --release --bin omegaupload-server cargo build --release --bin omegaupload-server
# Prepare assets for upload to webserver
mkdir -p dist/static
# Move everything that's not index.html into a `static` subdir
find dist -not -name index.html -type f -exec mv {} dist/static/ ";"
strip target/release/omegaupload-server strip target/release/omegaupload-server
cp target/release/omegaupload-server dist/omegaupload-server cp target/release/omegaupload-server dist/omegaupload-server

View file

@ -15,5 +15,9 @@
"dependencies": { "dependencies": {
"highlight.js": "^11.4.0", "highlight.js": "^11.4.0",
"highlightjs-line-numbers.js": "^2.8.0" "highlightjs-line-numbers.js": "^2.8.0"
},
"scripts": {
"build": "webpack --mode production",
"clean": "(git rev-parse --show-toplevel && rm -rf node_modules dist web/pkg)"
} }
} }

View file

@ -17,7 +17,7 @@
import './main.scss'; import './main.scss';
const hljs = require('highlight.js'); const hljs = require('highlight.js');
window.hljs = hljs; (window as any).hljs = hljs;
require('highlightjs-line-numbers.js'); require('highlightjs-line-numbers.js');
function loadFromDb(mimeType: string, name?: string, language?: string) { function loadFromDb(mimeType: string, name?: string, language?: string) {

View file

@ -29,7 +29,7 @@ module.exports = {
extensions: ['.tsx', '.ts', '.js'], extensions: ['.tsx', '.ts', '.js'],
}, },
output: { output: {
path: path.resolve(__dirname, 'dist'), path: path.resolve(__dirname, 'dist/static'),
filename: 'index.js', filename: 'index.js',
}, },
plugins: [ plugins: [