1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-24 08:12:24 +02:00
joplin/CliClient/build.sh

42 lines
1.4 KiB
Bash
Raw Normal View History

2017-06-25 18:30:44 +02:00
#!/bin/bash
2017-07-18 20:04:47 +02:00
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
2017-06-25 18:30:44 +02:00
# require('cache-require-paths');
mkdir -p "$ROOT_DIR/build"
rm -f "$ROOT_DIR/app/lib"
ln -s "$ROOT_DIR/../ReactNativeClient/lib" "$ROOT_DIR/app"
2017-06-27 22:16:03 +02:00
npm run build || exit 1
2017-07-18 20:04:47 +02:00
2017-10-07 23:01:03 +02:00
# Files under app/gui are in ES6 already but I cannot get Babel
# to ignore them, so copy them back to the build directory.
rsync -a "$ROOT_DIR/app/gui/" "$ROOT_DIR/build/gui/"
cp "$ROOT_DIR/package.json" "$ROOT_DIR/build"
cp "$ROOT_DIR/app/autocompletion_template.txt" "$ROOT_DIR/build"
2017-08-04 22:23:47 +02:00
chmod 755 "$ROOT_DIR/build/main.js"
2017-10-21 18:53:43 +02:00
# if [[ ! -f "$ROOT_DIR/package.json.md5" ]]; then
# "$ROOT_DIR/update-package-md5.sh"
# fi
2017-08-04 22:19:53 +02:00
# Add modules on top of main.js:
# - cache-require-paths to cache require() calls
# - app-module-path so that lib/something paths can be resolved.
2017-10-21 18:53:43 +02:00
#PACKAGE_MD5=$(cat "$ROOT_DIR/package.json.md5")
MAIN_PATH="$ROOT_DIR/build/main.js"
2017-10-15 13:13:09 +02:00
#LINE_TO_ADD="var osTmpdir = require('os-tmpdir'); process.env.CACHE_REQUIRE_PATHS_FILE = osTmpdir() + '/joplin-module-path-cache-$PACKAGE_MD5'; require('cache-require-paths'); require('app-module-path').addPath(__dirname);"
LINE_TO_ADD="require('app-module-path').addPath(__dirname);"
RESULT="$(grep "$LINE_TO_ADD" "$MAIN_PATH")"
if [[ -z "$RESULT" ]]; then
echo "Adding extra modules..."
sed -i "2i $LINE_TO_ADD" "$MAIN_PATH"
else
echo "Extra modules already added."
fi
NODE_PATH="$ROOT_DIR/build" node "$ROOT_DIR/build/build-translation.js" --silent