Fix client build
This commit is contained in:
parent
1b035eb7c5
commit
19897d2206
@ -31,6 +31,10 @@ tasks:
|
|||||||
yarn global add webpack-cli
|
yarn global add webpack-cli
|
||||||
yarn add webpack-cli
|
yarn add webpack-cli
|
||||||
export NODE_ENV=production
|
export NODE_ENV=production
|
||||||
yarn webpack-cli -p --config ./webpack.config.js
|
yarn webpack-cli -p --config ./webpack.config.js --progress
|
||||||
- deploy: |
|
cp -R ./dev/* ./dist
|
||||||
cd ~/jirs
|
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
|
- https://git.sr.ht/~tsumanu/jirs
|
||||||
environment:
|
environment:
|
||||||
deploy: adrian.wozniak@ita-prog.pl
|
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:
|
secrets:
|
||||||
- 7ebab768-e5e4-4c9d-ba57-ec41a72c5665
|
- 7ebab768-e5e4-4c9d-ba57-ec41a72c5665
|
||||||
tasks:
|
tasks:
|
||||||
- build_config: |
|
- build_config: |
|
||||||
cd jirs/jirs-server
|
cp ~/jirs/.builds/db.toml ~/jirs/jirs-server
|
||||||
cp ../.builds/db.toml ./
|
|
||||||
- setup: |
|
- 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 toolchain install nightly
|
||||||
rustup default nightly
|
rustup default nightly
|
||||||
cargo install diesel_cli --no-default-features --features postgres
|
cargo install diesel_cli --no-default-features --features postgres
|
||||||
cd jirs/jirs-server
|
cd jirs/jirs-server
|
||||||
diesel migration run
|
/home/build/.cargo/bin/diesel setup
|
||||||
- test: |
|
- test: |
|
||||||
cd jirs/jirs-server
|
cd jirs/jirs-server
|
||||||
cargo test --bin jirs_server
|
cargo test --bin jirs_server
|
||||||
|
1
jirs-client/.gitignore
vendored
1
jirs-client/.gitignore
vendored
@ -3,3 +3,4 @@ node_modules
|
|||||||
dist
|
dist
|
||||||
.yarn-error.log
|
.yarn-error.log
|
||||||
tmp
|
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 getWsHostName = () => process.env.JIRS_SERVER_BIND === "0.0.0.0" ? 'localhost' : process.env.JIRS_SERVER_BIND;
|
||||||
const getProtocol = () => window.location.protocol.replace(/^http/, 'ws');
|
const getProtocol = () => window.location.protocol.replace(/^http/, 'ws');
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="icon" href="/favicon.png">
|
<link rel="icon" href="/favicon.png">
|
||||||
<title>JIRS</title>
|
<title>JIRS</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/styles.css" >
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main id="app"></main>
|
<main id="app"></main>
|
||||||
|
@ -1,19 +1,11 @@
|
|||||||
{
|
{
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@wasm-tool/wasm-pack-plugin": "^1.2.0",
|
"@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",
|
"dotenv": "^8.2.0",
|
||||||
"extract-text-webpack-plugin": "2.1.2",
|
|
||||||
"file-loader": "^6.0.0",
|
"file-loader": "^6.0.0",
|
||||||
"glob": "^7.1.6",
|
"glob": "^7.1.6",
|
||||||
"html-webpack-plugin": "^4.0.3",
|
"html-webpack-plugin": "^4.0.3",
|
||||||
"mini-css-extract-plugin": "^0.9.0",
|
|
||||||
"optipng": "^2.1.0",
|
"optipng": "^2.1.0",
|
||||||
"postcss-loader": "^3.0.0",
|
|
||||||
"style-loader": "^1.1.3",
|
|
||||||
"sugarss": "^2.0.0",
|
|
||||||
"svgo": "^1.3.2",
|
"svgo": "^1.3.2",
|
||||||
"svgo-loader": "^2.2.1",
|
"svgo-loader": "^2.2.1",
|
||||||
"watchpack": "^1.6.1",
|
"watchpack": "^1.6.1",
|
||||||
|
@ -5,12 +5,19 @@ const dotenv = require('dotenv');
|
|||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
const { execSync, exec } = require('child_process');
|
const { execSync, exec } = require('child_process');
|
||||||
|
|
||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
||||||
|
|
||||||
process.env.RUST_LOG = 'info';
|
process.env.RUST_LOG = 'info';
|
||||||
|
|
||||||
execSync('cd .. && cargo build --bin jirs-css');
|
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();
|
dotenv.config();
|
||||||
|
|
||||||
@ -21,46 +28,33 @@ module.exports = {
|
|||||||
path: path.resolve(__dirname, process.env.NODE_ENV === 'production' ? 'dist' : 'dev'),
|
path: path.resolve(__dirname, process.env.NODE_ENV === 'production' ? 'dist' : 'dev'),
|
||||||
publicPath: '/',
|
publicPath: '/',
|
||||||
},
|
},
|
||||||
devtool: 'source-map',
|
...(
|
||||||
devServer: {
|
process.env.NODE_ENV === "production"
|
||||||
contentBase: path.join(__dirname, 'dev'),
|
? {
|
||||||
historyApiFallback: true,
|
mode: "production",
|
||||||
hot: true,
|
watch: false,
|
||||||
port: process.env.JIRS_CLIENT_PORT || 6000,
|
devtool: false,
|
||||||
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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
],
|
: {
|
||||||
},
|
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: [
|
plugins: [
|
||||||
new WasmPackPlugin({
|
new WasmPackPlugin({
|
||||||
crateDirectory: path.resolve(__dirname),
|
crateDirectory: path.resolve(__dirname),
|
||||||
@ -77,10 +71,5 @@ module.exports = {
|
|||||||
'JIRS_SERVER_PORT',
|
'JIRS_SERVER_PORT',
|
||||||
'JIRS_SERVER_BIND',
|
'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>>;
|
type Css = Arc<RwLock<CssFile>>;
|
||||||
|
|
||||||
mod prop;
|
// mod prop;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
enum Partial {
|
enum Partial {
|
||||||
@ -308,6 +308,10 @@ fn main() -> Result<(), String> {
|
|||||||
app.parse()?;
|
app.parse()?;
|
||||||
app.print();
|
app.print();
|
||||||
|
|
||||||
|
if !matches.is_present("watch") {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
match rx.recv() {
|
match rx.recv() {
|
||||||
Ok(DebouncedEvent::NoticeWrite(path)) => {
|
Ok(DebouncedEvent::NoticeWrite(path)) => {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
use actix_multipart::Multipart;
|
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 futures::{StreamExt, TryStreamExt};
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
|
|
||||||
#[post("/")]
|
#[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 {
|
while let Ok(Some(mut field)) = payload.try_next().await {
|
||||||
let content_type = field.content_disposition().unwrap();
|
let content_type = field.content_disposition().unwrap();
|
||||||
let filename = content_type.get_filename().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?;
|
f = web::block(move || f.write_all(&data).map(|_| f)).await?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HttpResponse::Ok().json("")
|
Ok(HttpResponse::Ok().json(""))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/{id}")]
|
#[get("/{id}")]
|
||||||
async fn download(id: web::Path<i32>) -> impl Responder {
|
async fn download(_id: web::Path<i32>) -> impl Responder {
|
||||||
HttpResponse::Ok().json("")
|
HttpResponse::Ok().json("")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user