1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Removed babel

This commit is contained in:
Laurent Cozic 2017-11-03 18:39:08 +00:00
parent b7e74e4547
commit a1cb172bc3
12 changed files with 54 additions and 3906 deletions

View File

@ -1,6 +1,3 @@
require('source-map-support').install();
require('babel-plugin-transform-runtime');
const fs = require('fs-extra');
const { fileExtension, basename, dirname } = require('lib/path-utils.js');
const wrap_ = require('word-wrap');

View File

@ -1,7 +1,6 @@
"use strict"
require('source-map-support').install();
require('babel-plugin-transform-runtime');
require('app-module-path').addPath(__dirname);
const processArgs = process.argv.splice(2, process.argv.length);

View File

@ -1,6 +1,3 @@
require('source-map-support').install();
require('babel-plugin-transform-runtime');
const fs = require('fs-extra');
const { fileExtension, basename, dirname } = require('lib/path-utils.js');
const { _, setLocale, languageCode } = require('lib/locale.js');

View File

@ -1,8 +1,5 @@
"use strict"
require('source-map-support').install();
require('babel-plugin-transform-runtime');
const fs = require('fs-extra');
const { Logger } = require('lib/logger.js');
const { dirname } = require('lib/path-utils.js');

View File

@ -1,8 +1,5 @@
"use strict"
require('source-map-support').install();
require('babel-plugin-transform-runtime');
const { time } = require('lib/time-utils.js');
const { Logger } = require('lib/logger.js');
const { Resource } = require('lib/models/resource.js');

View File

@ -1,6 +1,3 @@
require('source-map-support').install();
require('babel-plugin-transform-runtime');
const fs = require('fs-extra');
const { wrap } = require('lib/string-utils.js');
const { Setting } = require('lib/models/setting.js');

View File

@ -2,8 +2,7 @@
// Loading time: 20170803: 1.5s with no commands
require('source-map-support').install();
require('babel-plugin-transform-runtime');
require('app-module-path').addPath(__dirname);
const { app } = require('./app.js');
const { BaseModel } = require('lib/base-model.js');

View File

@ -1,41 +1,60 @@
#!/bin/bash
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BUILD_DIR="$ROOT_DIR/build"
# require('cache-require-paths');
rsync -a "$ROOT_DIR/app/" "$BUILD_DIR/"
rsync -a "$ROOT_DIR/../ReactNativeClient/lib/" "$BUILD_DIR/lib/"
cp "$ROOT_DIR/package.json" "$BUILD_DIR"
chmod 755 "$BUILD_DIR/main.js"
mkdir -p "$ROOT_DIR/build"
rm -f "$ROOT_DIR/app/lib"
ln -s "$ROOT_DIR/../ReactNativeClient/lib" "$ROOT_DIR/app"
cd "$BUILD_DIR"
node build-translation.js --silent
npm run build || exit 1
# 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"
chmod 755 "$ROOT_DIR/build/main.js"
# if [[ ! -f "$ROOT_DIR/package.json.md5" ]]; then
# "$ROOT_DIR/update-package-md5.sh"
# ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# # require('cache-require-paths');
# mkdir -p "$ROOT_DIR/build"
# rm -f "$ROOT_DIR/app/lib"
# ln -s "$ROOT_DIR/../ReactNativeClient/lib" "$ROOT_DIR/app"
# npm run build || exit 1
# # 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"
# chmod 755 "$ROOT_DIR/build/main.js"
# # if [[ ! -f "$ROOT_DIR/package.json.md5" ]]; then
# # "$ROOT_DIR/update-package-md5.sh"
# # fi
# # 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.
# #PACKAGE_MD5=$(cat "$ROOT_DIR/package.json.md5")
# MAIN_PATH="$ROOT_DIR/build/main.js"
# #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
# 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.
#PACKAGE_MD5=$(cat "$ROOT_DIR/package.json.md5")
MAIN_PATH="$ROOT_DIR/build/main.js"
#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
# NODE_PATH="$ROOT_DIR/build" node "$ROOT_DIR/build/build-translation.js" --silent

File diff suppressed because it is too large Load Diff

View File

@ -27,8 +27,6 @@
},
"dependencies": {
"app-module-path": "^2.2.0",
"babel-plugin-transform-runtime": "^6.23.0",
"cache-require-paths": "^0.3.0",
"follow-redirects": "^1.2.4",
"form-data": "^2.1.4",
"fs-extra": "^3.0.1",
@ -48,7 +46,6 @@
"sax": "^1.2.2",
"server-destroy": "^1.0.1",
"sharp": "^0.18.4",
"source-map-support": "^0.4.15",
"sprintf-js": "^1.1.1",
"sqlite3": "^3.1.8",
"string-padding": "^1.0.2",
@ -61,21 +58,10 @@
"yargs-parser": "^7.0.0"
},
"devDependencies": {
"babel-changed": "^7.0.0",
"babel-cli": "^6.24.1",
"babel-plugin-syntax-async-functions": "^6.1.4",
"babel-plugin-transform-regenerator": "^6.1.4",
"babel-polyfill": "^6.1.4",
"babel-preset-env": "^1.5.1",
"babel-preset-es2015": "^6.1.4",
"babel-preset-react": "^6.24.1",
"gettext-parser": "^1.2.2",
"jasmine": "^2.6.0"
},
"scripts": {
"babelbuild": "babel app -d build",
"build": "babel-changed app -d build --source-maps && babel-changed app/lib/models -d build/lib/models --source-maps && babel-changed app/lib/services -d build/lib/services --source-maps",
"clean": "babel-changed --reset",
"test": "babel-changed tests -d tests-build --source-maps && jasmine"
"test": "jasmine"
}
}

View File

@ -2,5 +2,6 @@
set -e
CLIENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
bash $CLIENT_DIR/build.sh && NODE_PATH="$CLIENT_DIR/build/" node build/main.js --profile ~/Temp/TestNotes2 --stack-trace-enabled --log-level debug --env dev "$@"
#bash $CLIENT_DIR/build.sh && NODE_PATH="$CLIENT_DIR/build/" node build/main.js --stack-trace-enabled --log-level debug "$@"
bash $CLIENT_DIR/build.sh && node build/main.js --profile ~/Temp/TestNotes2 --stack-trace-enabled --log-level debug --env dev "$@"
#bash $CLIENT_DIR/build.sh && NODE_PATH="$CLIENT_DIR/build/" node build/main.js --profile ~/Temp/TestNotes2 --stack-trace-enabled --log-level debug --env dev "$@"

View File

@ -1,6 +1,3 @@
require('source-map-support').install();
require('babel-plugin-transform-runtime');
const { time } = require('lib/time-utils.js');
const { setupDatabase, setupDatabaseAndSynchronizer, db, synchronizer, fileApi, sleep, clearDatabase, switchClient, syncTargetId } = require('test-utils.js');
const { Folder } = require('lib/models/folder.js');