This commit is contained in:
Adrian Wozniak 2020-05-19 20:54:46 +02:00
parent cef484987a
commit 9a9eff7c19
46 changed files with 13 additions and 5849 deletions

View File

@ -26,15 +26,10 @@ tasks:
wasm-pack test --node
- build: |
cd ~/jirs/jirs-client
export NODE_ENV=development
yarn
yarn global add webpack-cli
yarn add webpack-cli
export NODE_ENV=production
yarn webpack-cli -p --config ./webpack.config.js --progress
cp -R ./dev/* ./dist
./scripts/prod.sh
export TAR_NAME=$(date -u +"%Y%m%d%H%M%s")
tar -czvf ~/${TAR_NAME}.tar.gz ./dist
tar -czvf ~/${TAR_NAME}.tar.gz ./build
cp ~/${TAR_NAME}.tar.gz ~/latest.tar.gz
artifacts:
- latest.tar.gz

View File

@ -4,3 +4,4 @@ dist
.yarn-error.log
tmp
dev/styles.css
build

View File

@ -1,23 +0,0 @@
{
"jsc": {
"target": "es2018",
"parser": {
"syntax": "ecmascript",
"jsx": false,
"dynamicImport": true,
"numericSeparator": true,
"classPrivateProperty": false,
"privateMethod": false,
"classProperty": false,
"functionBind": false,
"exportDefaultFrom": true,
"exportNamespaceFrom": true,
"decorators": false,
"decoratorsBeforeExport": false,
"nullishCoalescing": true,
"topLevelAwait": true,
"importMeta": false,
"optionalChaining": true
}
}
}

View File

@ -1,135 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
preserveAspectRatio="xMidYMid meet"
viewBox="0 0 640 640"
width="640"
height="640"
>
<defs>
<filter
id="shadow16022051"
filterUnits="userSpaceOnUse"
primitiveUnits="userSpaceOnUse"
>
<feFlood>
</feFlood>
<feComposite in2="SourceAlpha" operator="in">
</feComposite>
<feGaussianBlur stdDeviation="1">
</feGaussianBlur>
<feOffset dx="14" dy="10" result="afterOffset">
</feOffset>
<feFlood flood-color="#0d0e44" flood-opacity="0.5">
</feFlood>
<feComposite in2="afterOffset" operator="in">
</feComposite>
<feMorphology operator="dilate" radius="1">
</feMorphology>
<feComposite in2="SourceAlpha" operator="out">
</feComposite>
</filter>
<path
d="M500 300C500 410.38 410.38 500 300 500C189.62 500 100 410.38 100 300C100 189.61 189.62 100 300 100C410.38 100 500 189.61 500 300Z"
id="b6KNxjEO2"
>
</path>
<mask
id="maskb3oIvRAxi1"
x="78" y="78"
width="444"
height="444"
maskUnits="userSpaceOnUse"
>
<rect x="78" y="78" width="444" height="444" fill="white">
</rect>
<use xlink:href="#b6KNxjEO2" opacity="0.46" fill="black">
</use>
</mask>
<path
d="M520 338.18C520 448.56 430.38 538.18 320 538.18C209.62 538.18 120 448.56 120 338.18C120 227.8 209.62 138.18 320 138.18C430.38 138.18 520 227.8 520 338.18Z"
id="bDKGuSkBj"
>
</path>
<mask id="maskb4LRewzUS" x="98" y="116.18" width="444" height="444" maskUnits="userSpaceOnUse">
<rect x="98" y="116.18" width="444" height="444" fill="white">
</rect>
<use xlink:href="#bDKGuSkBj" opacity="0.46" fill="black">
</use>
</mask>
<path
d="M543.03 374.84C543.03 485.23 453.41 574.84 343.03 574.84C232.65 574.84 143.03 485.23 143.03 374.84C143.03 264.46 232.65 174.84 343.03 174.84C453.41 174.84 543.03 264.46 543.03 374.84Z"
id="a1k8tJrWR3"
>
</path>
<mask id="maskbctn2Bw0" x="121.03" y="152.84" width="444" height="444" maskUnits="userSpaceOnUse">
<rect x="121.03" y="152.84" width="444" height="444" fill="white">
</rect>
<use xlink:href="#a1k8tJrWR3" opacity="0.46" fill="black">
</use>
</mask>
</defs>
<path
d="M500 300C500 410.38 410.38 500 300 500C189.62 500 100 410.38 100 300C100 189.61 189.62 100 300 100C410.38 100 500 189.61 500 300Z"
id="h3zi0EZA0A"
fill-opacity="1"
filter="url(#shadow16022051)"
>
</path>
<use xlink:href="#b6KNxjEO2" opacity="0.46" fill="#fefefe" fill-opacity="1">
</use>
<g mask="url(#maskb3oIvRAxi1)">
<use
xlink:href="#b6KNxjEO2"
opacity="0.46"
fill-opacity="0"
stroke="#06697d"
stroke-width="22"
stroke-opacity="1"
>
</use>
</g>
<path
d="M520 338.18C520 448.56 430.38 538.18 320 538.18C209.62 538.18 120 448.56 120 338.18C120 227.8 209.62 138.18 320 138.18C430.38 138.18 520 227.8 520 338.18Z"
id="mzwSl44s1"
fill-opacity="1"
filter="url(#shadow16022051)"
>
</path>
<use xlink:href="#bDKGuSkBj" opacity="0.46" fill="#fefefe" fill-opacity="1">
</use>
<g mask="url(#maskb4LRewzUS)">
<use
xlink:href="#bDKGuSkBj"
opacity="0.46"
fill-opacity="0"
stroke="#06697d"
stroke-width="22"
stroke-opacity="1"
>
</use>
</g>
<path
d="M543.03 374.84C543.03 485.23 453.41 574.84 343.03 574.84C232.65 574.84 143.03 485.23 143.03 374.84C143.03 264.46 232.65 174.84 343.03 174.84C453.41 174.84 543.03 264.46 543.03 374.84Z"
id="c16Px1v9IX"
fill-opacity="1"
filter="url(#shadow16022051)"
>
</path>
<use xlink:href="#a1k8tJrWR3" opacity="0.46" fill="#fefefe" fill-opacity="1">
</use>
<g mask="url(#maskbctn2Bw0)">
<use
xlink:href="#a1k8tJrWR3"
opacity="0.46"
fill-opacity="0"
stroke="#06697d"
stroke-width="22"
stroke-opacity="1"
>
</use>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -1,20 +0,0 @@
{
"devDependencies": {
"@wasm-tool/wasm-pack-plugin": "^1.2.0",
"dotenv": "^8.2.0",
"file-loader": "^6.0.0",
"glob": "^7.1.6",
"html-webpack-plugin": "^4.0.3",
"optipng": "^2.1.0",
"svgo": "^1.3.2",
"svgo-loader": "^2.2.1",
"watchpack": "^1.6.1",
"webpack": "^4.42.1",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3"
},
"scripts": {
"start": "webpack-dev-server",
"build": "./scripts/build"
}
}

View File

@ -1,7 +0,0 @@
module.exports = {
parser: 'sugarss',
plugins: [
require('autoprefixer')({}),
require('cssnano'),
],
};

View File

@ -8,9 +8,9 @@ mkdir tmp
wasm-pack build --mode normal --dev --out-name jirs --out-dir ./tmp --target web
../target/debug/jirs-css -i ./js/styles.css -O ./tmp/styles.css
cat ./js/index.js \
cp -r ./static/* ./tmp
cat ./static/index.js \
| sed -e "s/process.env.JIRS_SERVER_BIND/'$JIRS_SERVER_BIND'/g" \
| sed -e "s/process.env.JIRS_SERVER_PORT/'$JIRS_SERVER_PORT'/g" &> ./tmp/index.js
cp ./js/template.html ./tmp/index.html
cp -r ./dev/* ./tmp
cp ./js/template.html ./tmp/index.html

View File

@ -2,15 +2,15 @@
. .env
rm -Rf tmp
mkdir tmp
rm -Rf build
mkdir build
wasm-pack build --mode normal --release --out-name jirs --out-dir ./tmp --target web
wasm-pack build --mode normal --release --out-name jirs --out-dir ./build --target web
../target/debug/jirs-css -i ./js/styles.css -O ./tmp/styles.css
cat ./js/index.js \
cp -r ./static/* ./build
cat ./static/index.js \
| sed -e "s/process.env.JIRS_SERVER_BIND/'$JIRS_SERVER_BIND'/g" \
| sed -e "s/process.env.JIRS_SERVER_PORT/'$JIRS_SERVER_PORT'/g" &> ./tmp/index.js
cp ./js/template.html ./tmp/index.html
| sed -e "s/process.env.JIRS_SERVER_PORT/'$JIRS_SERVER_PORT'/g" &> ./build/index.js
cp -r ./dev/* ./tmp
cp ./js/template.html ./build/index.html

View File

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 77 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 473 KiB

After

Width:  |  Height:  |  Size: 473 KiB

View File

Before

Width:  |  Height:  |  Size: 605 KiB

After

Width:  |  Height:  |  Size: 605 KiB

View File

Before

Width:  |  Height:  |  Size: 467 KiB

After

Width:  |  Height:  |  Size: 467 KiB

View File

Before

Width:  |  Height:  |  Size: 604 KiB

After

Width:  |  Height:  |  Size: 604 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 MiB

After

Width:  |  Height:  |  Size: 2.3 MiB

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -1,5 +0,0 @@
plugins:
- removeTitle: true
- convertPathData: true
- convertColors:
shorthex: true

View File

@ -1,103 +0,0 @@
const path = require("path");
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
const HtmlWebpackPlugin = require('html-webpack-plugin');
const dotenv = require('dotenv');
const webpack = require('webpack');
const { execSync, spawn } = require('child_process');
process.env.RUST_LOG = 'info';
const jirDir = require('path').join(__dirname, '..').normalize();
console.log('jir dir %s', jirDir)
if (process.env.NODE_ENV === "production") {
execSync('cargo build --bin jirs-css --release', {
cwd: jirDir,
});
execSync("rm -Rf ./dist");
execSync("mkdir -p ./dist");
execSync('./target/release/jirs-css -O ./jirs-client/dist/styles.css', {
cwd: jirDir,
});
console.log("CSS combined");
} else {
execSync('cargo build --bin jirs-css', {
cwd: jirDir,
});
spawn('./target/debug/jirs-css', [
'-W',
'-O',
'./jirs-client/dev/styles.css'
], {
detached: false,
cwd: jirDir,
}).on("error", (error) => {
console.error(error);
process.exit(1);
}).on('close', code => {
console.error(`CSS watch process finished with code ${ code }`);
// process.exit(1);
});
// css.stdout.on('data', data => {
// console.log(`stdout: ${ data }`);
// });
// css.stderr.on('data', data => {
// console.log(`stdout: ${ data }`);
// });
console.log("CSS combined, watching for changes...");
}
dotenv.config();
module.exports = {
entry: path.resolve(__dirname, 'js', 'index.js'),
output: {
filename: '[name].js',
path: path.resolve(__dirname, process.env.NODE_ENV === 'production' ? 'dist' : 'dev'),
publicPath: '/',
},
...(
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: false,
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),
extraArgs: '--no-typescript'
}),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, "js", "template.ejs"),
}),
new webpack.EnvironmentPlugin([
'NODE_ENV',
'DEBUG',
'JIRS_CLIENT_PORT',
'JIRS_CLIENT_BIND',
'JIRS_SERVER_PORT',
'JIRS_SERVER_BIND',
]),
],
};

File diff suppressed because it is too large Load Diff