diff --git a/src/web/api/build.sh b/src/web/api/build.sh
index cc787d6c7..583581bc8 100755
--- a/src/web/api/build.sh
+++ b/src/web/api/build.sh
@@ -1,6 +1,16 @@
#!/bin/bash
-OUT=../../../build/web/
+export OUT=${BUILD_DIR:-../../../build}/web
+MODE=manual
+case "$OUT" in
+ *ninja_release*)
+ MODE=release;;
+ *ninja_debug*)
+ MODE=debug;;
+esac
+echo MODE=$MODE
+echo OUT=$OUT
+
# clean
rm -rf $OUT/api
mkdir -p $OUT/api
@@ -38,7 +48,7 @@ $PROTOC --plugin=protoc-gen-service=../../lib/api/service_compiler/plugin.py \
# run typescript compiler to convert typescript to javascript
echo -e \* ${ORANGE} tsc ${NOCOLOR}
-npx --no-install tsc -p tsconfig.release.json
+npx --no-install tsc -p tsconfig.$MODE.json
# cleanup
@@ -57,11 +67,17 @@ ts2fable $OUT/api
# ts2fable $OUT/api/gen
if [ "$FULL" == "1" ]; then
- echo \* fable
+ export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
+ echo -e \* ${ORANGE} fable ${NOCOLOR}
cd ../ui/
npm install
cd src
- cp -r ../public/* ../$OUT/ui/
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 dotnet restore
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 dotnet fable webpack -- -p
+ mkdir -p $OUT/ui/
+ cp -r ../public/* $OUT/ui/
+ dotnet restore
+ if [ "$MODE" == "release" ]; then
+ dotnet fable webpack -- --env.BUILD_PATH=$OUT -p
+ else
+ dotnet fable webpack -- --env.BUILD_PATH=$OUT
+ fi
fi
diff --git a/src/web/api/tsconfig.debug.json b/src/web/api/tsconfig.debug.json
new file mode 100644
index 000000000..020359459
--- /dev/null
+++ b/src/web/api/tsconfig.debug.json
@@ -0,0 +1,14 @@
+{
+ "extends": "./tsconfig.json",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "../../../build/ninja_debug/web/api",
+ "removeComments": true,
+ "paths": {
+ "proto": ["../../../../build/ninja_debug/web/api/proto"]
+ }
+ },
+ "include": [
+ "./src/**/*.ts"
+ ]
+}
diff --git a/src/web/api/tsconfig.json b/src/web/api/tsconfig.json
index 0dbf306d3..ebe947ec4 100644
--- a/src/web/api/tsconfig.json
+++ b/src/web/api/tsconfig.json
@@ -9,7 +9,7 @@
"allowSyntheticDefaultImports": true,
"allowJs": false,
"alwaysStrict": true,
- "sourceMap": true,
+ "sourceMap": false,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUnusedLocals": false,
@@ -18,10 +18,7 @@
"noImplicitThis": false,
"strictNullChecks": true,
"declaration": true,
- "baseUrl": "src",
- "paths": {
- "proto": ["../../../../build/web/api/proto"]
- }
+ "baseUrl": "src"
},
"include": [
"src/**/*",
diff --git a/src/web/api/tsconfig.manual.json b/src/web/api/tsconfig.manual.json
new file mode 100644
index 000000000..c044f285d
--- /dev/null
+++ b/src/web/api/tsconfig.manual.json
@@ -0,0 +1,15 @@
+{
+ "extends": "./tsconfig.json",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "../../../build/web/api",
+ "sourceMap": true,
+ "removeComments": false,
+ "paths": {
+ "proto": ["../../../../build/web/api/proto"]
+ }
+ },
+ "include": [
+ "./src/**/*.ts"
+ ]
+}
diff --git a/src/web/api/tsconfig.release.json b/src/web/api/tsconfig.release.json
index a3bc8ff8d..aa88bd4ec 100644
--- a/src/web/api/tsconfig.release.json
+++ b/src/web/api/tsconfig.release.json
@@ -2,8 +2,11 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": "src",
- "outDir": "../../../build/web/api",
- "removeComments": true
+ "outDir": "../../../build/ninja_release/web/api",
+ "removeComments": true,
+ "paths": {
+ "proto": ["../../../../build/ninja_release/web/api/proto"]
+ }
},
"include": [
"./src/**/*.ts"
diff --git a/src/web/ui/src/ui.fsproj b/src/web/ui/src/ui.fsproj
index 978f41f95..cac87d77c 100644
--- a/src/web/ui/src/ui.fsproj
+++ b/src/web/ui/src/ui.fsproj
@@ -2,20 +2,32 @@
netstandard2.0
+
+
+
+ ../../../../build/web/api
+
+
+
+
+ $(OUT)/api
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/src/web/ui/webpack.config.js b/src/web/ui/webpack.config.js
index 50974aec3..fa7660801 100644
--- a/src/web/ui/webpack.config.js
+++ b/src/web/ui/webpack.config.js
@@ -21,11 +21,11 @@ var babelOptions = fableUtils.resolveBabelOptions({
var isProduction = process.argv.indexOf("-p") >= 0;
console.log("Bundling for " + (isProduction ? "production" : "development") + "...");
-const build_path = "../../../build/";
-const output_path = resolve(build_path + "web/ui/");
-const api_path = resolve(build_path + "web/api/");
-
-module.exports = {
+module.exports = env => {
+ const build_path = env.BUILD_PATH || resolve("../../../build/web")
+ const output_path = build_path + "/ui/";
+ const api_path = build_path + "/api/";
+ return {
devtool: isProduction ? undefined : "source-map",
entry: resolve('./src/ui.fsproj'),
output: {
@@ -77,4 +77,4 @@ module.exports = {
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin()
]
-};
+}};