Rename static directory to generated

This commit is contained in:
projectmoon 2021-01-09 13:03:07 +00:00
parent 55dff277ef
commit a34e8d24c6
5 changed files with 6 additions and 5 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ todo.org
node_modules node_modules
static/scripts/dist static/scripts/dist
static/templates/* static/templates/*
generated/

View File

@ -1,5 +1,5 @@
[default] [default]
template_dir = "static/templates/" template_dir = "generated/templates/"
[development] [development]
address = "localhost" address = "localhost"

View File

@ -5,7 +5,7 @@
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"webpack-dev": "cd static/scripts && webpack serve --watch --inline --port 8081 --host 0.0.0.0 --output-path=./build", "webpack-dev": "webpack serve --watch --inline --port 8081 --host 0.0.0.0 --output-path=./build",
"build:protobuf": "mkdir -p src/frontend/_proto && protoc --plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts -I ./proto --js_out=import_style=commonjs,binary:./src/frontend/_proto --ts_out=service=grpc-web:./src/frontend/_proto ./proto/*.proto", "build:protobuf": "mkdir -p src/frontend/_proto && protoc --plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts -I ./proto --js_out=import_style=commonjs,binary:./src/frontend/_proto --ts_out=service=grpc-web:./src/frontend/_proto ./proto/*.proto",
"build:webpack": "webpack" "build:webpack": "webpack"
}, },

View File

@ -43,7 +43,7 @@ async fn make_rocket(database: sqlx::SqlitePool) -> Result<(), Box<dyn std::erro
.mount("/api", api_routes) .mount("/api", api_routes)
.mount( .mount(
"/scripts", "/scripts",
StaticFiles::from(concat!(env!("CARGO_MANIFEST_DIR"), "/static/scripts")), StaticFiles::from(concat!(env!("CARGO_MANIFEST_DIR"), "/generated/scripts")),
) )
.mount( .mount(
"/protos", "/protos",

View File

@ -10,7 +10,7 @@ function packPage(page, chunks) {
if (!chunks) chunks = []; if (!chunks) chunks = [];
return new HtmlWebpackPlugin({ return new HtmlWebpackPlugin({
template: `${root}/src/frontend/templates/${page}`, template: `${root}/src/frontend/templates/${page}`,
filename: `${root}/static/templates/${page}`, filename: `${root}/generated/templates/${page}`,
publicPath: '/scripts/dist', publicPath: '/scripts/dist',
scriptLoading: 'defer', scriptLoading: 'defer',
chunks: chunks, chunks: chunks,
@ -31,7 +31,7 @@ module.exports = {
}, },
mode: "development", mode: "development",
output: { output: {
path: `${root}/static/scripts/dist`, path: `${root}/generated/scripts/dist`,
filename: '[name].bundle.js' filename: '[name].bundle.js'
}, },
devtool: 'inline-source-map', devtool: 'inline-source-map',