1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-11 18:24:43 +02:00

Added script to install app locally

This commit is contained in:
Laurent Cozic 2017-06-25 17:30:44 +01:00
parent 6622f18f76
commit e37604ddba
6 changed files with 43 additions and 12 deletions

View File

@ -1,3 +1,5 @@
#!/usr/bin/env node
require('source-map-support').install();
require('babel-plugin-transform-runtime');

18
CliClient/app/main.sh Normal file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Because all the files in the "lib" directory are included as "lib/file.js" it
# means "lib" must be in NODE_PATH, however modifying the global NODE_PATH
# variable would be messy. So instead, the path is set temporarily just before running
# the app. To do this, this bash wrapper is needed (also a messy solution, but node
# path resolution is messy anyway). See https://gist.github.com/branneman/8048520
# https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
CLIENT_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$CLIENT_DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
CLIENT_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
NODE_PATH="$CLIENT_DIR:$NODE_PATH" node "$CLIENT_DIR/main.js"

5
CliClient/build.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
CLIENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
rm -f "$CLIENT_DIR/app/lib"
ln -s "$CLIENT_DIR/../lib" "$CLIENT_DIR/app"

9
CliClient/install.sh Normal file
View File

@ -0,0 +1,9 @@
#!/bin/bash
CLIENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
bash $CLIENT_DIR/build.sh
cp "$CLIENT_DIR/package.json" build/
cp "$CLIENT_DIR/../lib/package.json" build/lib
cp "$CLIENT_DIR/app/main.sh" build/
cd "$CLIENT_DIR/build"
sudo npm install -g --save
cd -

View File

@ -1,8 +1,12 @@
{
"name": "CliClient",
"version": "0.0.1",
"private": true,
"name": "joplin-cli",
"version": "0.8.0",
"bin": {
"joplin": "./main.sh"
},
"dependencies": {
"babel-plugin-transform-runtime": "^6.23.0",
"source-map-support": "^0.4.15",
"app-module-path": "^2.2.0",
"form-data": "^2.1.4",
"fs-extra": "^3.0.1",
@ -27,12 +31,10 @@
"babel-cli": "^6.24.1",
"babel-plugin-syntax-async-functions": "^6.1.4",
"babel-plugin-transform-regenerator": "^6.1.4",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.1.4",
"babel-preset-env": "^1.5.1",
"babel-preset-es2015": "^6.1.4",
"babel-preset-react": "^6.24.1",
"source-map-support": "^0.4.15",
"jasmine": "^2.6.0"
},
"scripts": {

View File

@ -1,9 +1,4 @@
#!/bin/bash
CLIENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
rm -f "$CLIENT_DIR/app/lib"
ln -s "$CLIENT_DIR/../lib" "$CLIENT_DIR/app"
npm run build && NODE_PATH="$CLIENT_DIR/build/" node build/main.js
#npm run build && NODE_PATH="$CLIENT_DIR/build/" node build/test-onedrive.js
#npm run build && NODE_PATH="$CLIENT_DIR/build/" node build/onedrive-server.js
bash $CLIENT_DIR/build.sh
npm run build && NODE_PATH="$CLIENT_DIR/build/" node build/main.js