Fix client build
This commit is contained in:
parent
1b035eb7c5
commit
19897d2206
@ -31,6 +31,10 @@ tasks:
|
||||
yarn global add webpack-cli
|
||||
yarn add webpack-cli
|
||||
export NODE_ENV=production
|
||||
yarn webpack-cli -p --config ./webpack.config.js
|
||||
- deploy: |
|
||||
cd ~/jirs
|
||||
yarn webpack-cli -p --config ./webpack.config.js --progress
|
||||
cp -R ./dev/* ./dist
|
||||
export TAR_NAME=$(date -u +"%Y%m%d%H%M%s")
|
||||
tar -czvf ~/${TAR_NAME}.tar.gz ./dist
|
||||
cp ~/${TAR_NAME}.tar.gz ./latest.tar.gz
|
||||
artifacts:
|
||||
- ./latest.tar.gz
|
||||
|
2
.builds/db.toml
Normal file
2
.builds/db.toml
Normal file
@ -0,0 +1,2 @@
|
||||
concurrency = 2
|
||||
database_url = "postgres://build@localhost:5432/jirs"
|
@ -6,19 +6,31 @@ sources:
|
||||
- https://git.sr.ht/~tsumanu/jirs
|
||||
environment:
|
||||
deploy: adrian.wozniak@ita-prog.pl
|
||||
DATABASE_URL: postgres://build@localhost:5432/jirs
|
||||
DEBUG: true
|
||||
NODE_ENV: development
|
||||
RUST_LOG: debug
|
||||
JIRS_CLIENT_PORT: 7000
|
||||
JIRS_CLIENT_BIND: 0.0.0.0
|
||||
JIRS_SERVER_PORT: 5000
|
||||
JIRS_SERVER_BIND: 0.0.0.0
|
||||
secrets:
|
||||
- 7ebab768-e5e4-4c9d-ba57-ec41a72c5665
|
||||
tasks:
|
||||
- build_config: |
|
||||
cd jirs/jirs-server
|
||||
cp ../.builds/db.toml ./
|
||||
cp ~/jirs/.builds/db.toml ~/jirs/jirs-server
|
||||
- setup: |
|
||||
sudo systemctl start postgresql || journalctl -xe
|
||||
sudo mkdir -p /var/lib/postgres/data
|
||||
sudo chown build /var/lib/postgres/data
|
||||
initdb -D /var/lib/postgres/data
|
||||
sudo mkdir -p /run/postgresql
|
||||
sudo chown build /run/postgresql
|
||||
pg_ctl -D /var/lib/postgres/data start
|
||||
rustup toolchain install nightly
|
||||
rustup default nightly
|
||||
cargo install diesel_cli --no-default-features --features postgres
|
||||
cd jirs/jirs-server
|
||||
diesel migration run
|
||||
/home/build/.cargo/bin/diesel setup
|
||||
- test: |
|
||||
cd jirs/jirs-server
|
||||
cargo test --bin jirs_server
|
||||
|
1
jirs-client/.gitignore
vendored
1
jirs-client/.gitignore
vendored
@ -3,3 +3,4 @@ node_modules
|
||||
dist
|
||||
.yarn-error.log
|
||||
tmp
|
||||
dev/styles.css
|
||||
|
@ -1 +0,0 @@
|
||||
|
@ -1,4 +1,4 @@
|
||||
import "../tmp/styles.css";
|
||||
// import "../tmp/styles.css";
|
||||
|
||||
const getWsHostName = () => process.env.JIRS_SERVER_BIND === "0.0.0.0" ? 'localhost' : process.env.JIRS_SERVER_BIND;
|
||||
const getProtocol = () => window.location.protocol.replace(/^http/, 'ws');
|
||||
|
@ -5,6 +5,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="icon" href="/favicon.png">
|
||||
<title>JIRS</title>
|
||||
<link rel="stylesheet" type="text/css" href="/styles.css" >
|
||||
</head>
|
||||
<body>
|
||||
<main id="app"></main>
|
||||
|
@ -1,19 +1,11 @@
|
||||
{
|
||||
"devDependencies": {
|
||||
"@wasm-tool/wasm-pack-plugin": "^1.2.0",
|
||||
"autoprefixer": "^9.7.5",
|
||||
"css-loader": "^3.4.2",
|
||||
"cssnano": "^4.1.10",
|
||||
"dotenv": "^8.2.0",
|
||||
"extract-text-webpack-plugin": "2.1.2",
|
||||
"file-loader": "^6.0.0",
|
||||
"glob": "^7.1.6",
|
||||
"html-webpack-plugin": "^4.0.3",
|
||||
"mini-css-extract-plugin": "^0.9.0",
|
||||
"optipng": "^2.1.0",
|
||||
"postcss-loader": "^3.0.0",
|
||||
"style-loader": "^1.1.3",
|
||||
"sugarss": "^2.0.0",
|
||||
"svgo": "^1.3.2",
|
||||
"svgo-loader": "^2.2.1",
|
||||
"watchpack": "^1.6.1",
|
||||
|
@ -5,12 +5,19 @@ const dotenv = require('dotenv');
|
||||
const webpack = require('webpack');
|
||||
const { execSync, exec } = require('child_process');
|
||||
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
|
||||
process.env.RUST_LOG = 'info';
|
||||
|
||||
execSync('cd .. && cargo build --bin jirs-css');
|
||||
exec('cd .. && ./target/debug/jirs-css -O ./jirs-client/tmp/styles.css');
|
||||
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
execSync("rm -Rf ./dist");
|
||||
execSync("mkdir -p ./dist");
|
||||
execSync('cd .. && ./target/debug/jirs-css -O ./jirs-client/dist/styles.css');
|
||||
console.log("CSS combined");
|
||||
} else {
|
||||
exec('cd .. && ./target/debug/jirs-css --watch -O ./jirs-client/dev/styles.css');
|
||||
console.log("CSS combined, watching for changes...");
|
||||
}
|
||||
|
||||
dotenv.config();
|
||||
|
||||
@ -21,46 +28,33 @@ module.exports = {
|
||||
path: path.resolve(__dirname, process.env.NODE_ENV === 'production' ? 'dist' : 'dev'),
|
||||
publicPath: '/',
|
||||
},
|
||||
devtool: 'source-map',
|
||||
devServer: {
|
||||
contentBase: path.join(__dirname, 'dev'),
|
||||
historyApiFallback: true,
|
||||
hot: true,
|
||||
port: process.env.JIRS_CLIENT_PORT || 6000,
|
||||
host: process.env.JIRS_CLIENT_BIND || '0.0.0.0',
|
||||
allowedHosts: [
|
||||
'localhost:6000',
|
||||
'localhost:8000',
|
||||
],
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
}
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/i,
|
||||
use: [
|
||||
MiniCssExtractPlugin.loader,
|
||||
{
|
||||
loader: 'css-loader',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
test: /\.svg$/,
|
||||
use: [
|
||||
{ loader: 'file-loader' },
|
||||
{
|
||||
loader: 'svgo-loader',
|
||||
options: {
|
||||
externalConfig: "svgo-config.yml"
|
||||
}
|
||||
}
|
||||
]
|
||||
...(
|
||||
process.env.NODE_ENV === "production"
|
||||
? {
|
||||
mode: "production",
|
||||
watch: false,
|
||||
devtool: false,
|
||||
}
|
||||
],
|
||||
},
|
||||
: {
|
||||
mode: "development",
|
||||
watch: true,
|
||||
devtool: 'source-map',
|
||||
devServer: {
|
||||
contentBase: path.join(__dirname, 'dev'),
|
||||
historyApiFallback: true,
|
||||
hot: true,
|
||||
port: process.env.JIRS_CLIENT_PORT || 6000,
|
||||
host: process.env.JIRS_CLIENT_BIND || '0.0.0.0',
|
||||
allowedHosts: [
|
||||
'localhost:6000',
|
||||
'localhost:8000',
|
||||
],
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
}
|
||||
},
|
||||
}
|
||||
),
|
||||
plugins: [
|
||||
new WasmPackPlugin({
|
||||
crateDirectory: path.resolve(__dirname),
|
||||
@ -77,10 +71,5 @@ module.exports = {
|
||||
'JIRS_SERVER_PORT',
|
||||
'JIRS_SERVER_BIND',
|
||||
]),
|
||||
new MiniCssExtractPlugin({
|
||||
filename: '[name].css',
|
||||
chunkFilename: '[id].css',
|
||||
ignoreOrder: true,
|
||||
}),
|
||||
]
|
||||
],
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -12,7 +12,7 @@ const INPUT: &str = "./jirs-client/js/styles.css";
|
||||
|
||||
type Css = Arc<RwLock<CssFile>>;
|
||||
|
||||
mod prop;
|
||||
// mod prop;
|
||||
|
||||
#[derive(Debug)]
|
||||
enum Partial {
|
||||
@ -308,6 +308,10 @@ fn main() -> Result<(), String> {
|
||||
app.parse()?;
|
||||
app.print();
|
||||
|
||||
if !matches.is_present("watch") {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
loop {
|
||||
match rx.recv() {
|
||||
Ok(DebouncedEvent::NoticeWrite(path)) => {
|
||||
|
@ -1,10 +1,10 @@
|
||||
use actix_multipart::Multipart;
|
||||
use actix_web::{get, post, web, HttpResponse, Responder};
|
||||
use actix_web::{get, post, web, Error, HttpResponse, Responder};
|
||||
use futures::{StreamExt, TryStreamExt};
|
||||
use std::io::Write;
|
||||
|
||||
#[post("/")]
|
||||
async fn upload(mut payload: Multipart) -> impl Responder {
|
||||
async fn upload(mut payload: Multipart) -> Result<HttpResponse, Error> {
|
||||
while let Ok(Some(mut field)) = payload.try_next().await {
|
||||
let content_type = field.content_disposition().unwrap();
|
||||
let filename = content_type.get_filename().unwrap();
|
||||
@ -20,10 +20,10 @@ async fn upload(mut payload: Multipart) -> impl Responder {
|
||||
f = web::block(move || f.write_all(&data).map(|_| f)).await?;
|
||||
}
|
||||
}
|
||||
HttpResponse::Ok().json("")
|
||||
Ok(HttpResponse::Ok().json(""))
|
||||
}
|
||||
|
||||
#[get("/{id}")]
|
||||
async fn download(id: web::Path<i32>) -> impl Responder {
|
||||
async fn download(_id: web::Path<i32>) -> impl Responder {
|
||||
HttpResponse::Ok().json("")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user