From 2e130f47d4339de285953d3bf477827c96224771 Mon Sep 17 00:00:00 2001 From: brucewar Date: Sat, 10 Dec 2016 23:44:39 +0800 Subject: [PATCH 1/2] :thinking: manage by package.json --- src/web_console/bin/script_init.sh | 8 ++++ src/web_console/{ => bin}/script_run.sh | 3 +- src/web_console/package.json | 32 ++++++++++++++- src/web_console/script_init.sh | 54 ------------------------- 4 files changed, 40 insertions(+), 57 deletions(-) create mode 100644 src/web_console/bin/script_init.sh rename src/web_console/{ => bin}/script_run.sh (65%) delete mode 100755 src/web_console/script_init.sh diff --git a/src/web_console/bin/script_init.sh b/src/web_console/bin/script_init.sh new file mode 100644 index 0000000..936e408 --- /dev/null +++ b/src/web_console/bin/script_init.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +# run this script before you setup the irext web console + +echo "create logging directory" +mkdir -p ./logs +mkdir -p ./logs/production +mkdir -p ./logs/dev +mkdir -p ./logs/user_debug diff --git a/src/web_console/script_run.sh b/src/web_console/bin/script_run.sh similarity index 65% rename from src/web_console/script_run.sh rename to src/web_console/bin/script_run.sh index 80c806e..f03a67d 100644 --- a/src/web_console/script_run.sh +++ b/src/web_console/bin/script_run.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash -filepath=$(cd "$(dirname "$0")"; pwd) +filepath=$(cd "$(dirname "$0")"/../; pwd) cd $filepath + NODE_ENV=${1} nohup forever irext_console.js & diff --git a/src/web_console/package.json b/src/web_console/package.json index 19ff150..82070df 100644 --- a/src/web_console/package.json +++ b/src/web_console/package.json @@ -1,7 +1,35 @@ { - "name": "application-name", + "name": "irext", "version": "0.0.1", + "description": "console of irext", + "scripts": { + "server": "bash bin/script_run.sh", + "log": "bash bin/script_init.sh", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/strawmanbobi/irext" + }, + "keywords": [ + "IRDA" + ], + "author": "strawmanbobi", + "license": "MIT", "dependencies": { - "orm": "latest" + "async": "^2.1.4", + "body-parser": "^1.15.2", + "express": "^4.14.0", + "form-data": "^2.1.2", + "formidable": "^1.0.17", + "log4js": "^1.0.1", + "method-override": "^2.3.7", + "mysql": "^2.12.0", + "orm": "^3.2.0", + "platform": "^1.3.3", + "python-shell": "^0.4.0", + "redis": "^2.6.3", + "request": "^2.79.0", + "ua-parser-js": "^0.7.12" } } diff --git a/src/web_console/script_init.sh b/src/web_console/script_init.sh deleted file mode 100755 index 51b68cb..0000000 --- a/src/web_console/script_init.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env bash -# run this script before you setup the irext web console -echo "running script of npm install needed by irext..." - -echo "npm install express" -npm install express - -echo "npm install body-parser" -npm install body-parser - -echo "npm install method-override" -npm install method-override - -echo "npm install platform" -npm install platform - -echo "npm install ua-parser-js" -npm install ua-parser-js - -echo "npm install log4js" -npm install log4js - -echo "npm install formidable" -npm install formidable - -echo "npm install mysql" -npm install mysql - -echo "npm install redis" -npm install redis - -echo "npm install orm" -npm install orm - -echo "npm install python-shell" -npm install python-shell - -echo "npm install request" -npm install request - -echo "npm install form-data" -npm install form-data - -echo "npm install async" -npm install async - -echo "npm install done" - -echo "create logging directory" -mkdir -p logs -mkdir -p logs/production -mkdir -p logs/dev -mkdir -p logs/user_debug - From 2d8e00f58b1d7429f0a6788484bc33b2de935f28 Mon Sep 17 00:00:00 2001 From: brucewar Date: Mon, 12 Dec 2016 15:08:55 +0800 Subject: [PATCH 2/2] dev environment and readme for it :robot: --- src/web_console/README.md | 21 +++++++++++++++++++ .../configuration/system_configs.js | 2 +- src/web_console/package.json | 7 +++++-- 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 src/web_console/README.md diff --git a/src/web_console/README.md b/src/web_console/README.md new file mode 100644 index 0000000..c4c52ed --- /dev/null +++ b/src/web_console/README.md @@ -0,0 +1,21 @@ +# dev environment + +* install mysql +* init sql + + refer to file `data/db/irext_private_20161204.sql` +* install redis + + [Windows](https://github.com/MSOpenTech/redis/releases) + [Linux](https://redis.io/) +* `npm install` +* init log directory + ```bash + npm run log + ``` +* start dev server + ```bash + npm run dev + ``` + +Open [http://localhost:6001](http://localhost:6001) \ No newline at end of file diff --git a/src/web_console/configuration/system_configs.js b/src/web_console/configuration/system_configs.js index 1fc30e8..25d3b8c 100644 --- a/src/web_console/configuration/system_configs.js +++ b/src/web_console/configuration/system_configs.js @@ -35,7 +35,7 @@ exports.setupEnvironment = function () { MYSQL_DB_PASSWORD = "root"; FILE_TEMP_PATH = "D:/rc_extension"; PYTHON_PATH = "C:/Python27/python.exe"; - LISTEN_PORT = "80"; + LISTEN_PORT = "6001"; SERVER_ADDRESS = "localhost"; REDIS_HOST = "localhost"; REDIS_PORT = "6379"; diff --git a/src/web_console/package.json b/src/web_console/package.json index 82070df..61212d7 100644 --- a/src/web_console/package.json +++ b/src/web_console/package.json @@ -3,9 +3,9 @@ "version": "0.0.1", "description": "console of irext", "scripts": { + "dev": "supervisor -w . -i ./web irext_console.js", "server": "bash bin/script_run.sh", - "log": "bash bin/script_init.sh", - "test": "echo \"Error: no test specified\" && exit 1" + "log": "bash bin/script_init.sh" }, "repository": { "type": "git", @@ -31,5 +31,8 @@ "redis": "^2.6.3", "request": "^2.79.0", "ua-parser-js": "^0.7.12" + }, + "devDependencies": { + "supervisor": "^0.12.0" } }