Skip to content

Commit

Permalink
impr: added extra data to pid file (#133)
Browse files Browse the repository at this point in the history
* impr: added extra data to pid file

Closes TIMOB-25968

* impr: refactored the code to make use of existing condition
  • Loading branch information
Dankyi committed Feb 25, 2020
1 parent 9cac924 commit 1419c54
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 6 deletions.
13 changes: 11 additions & 2 deletions lib/fserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const http = require('http'),
url = require('url'),
path = require('path'),
join = path.join,
fs = require('fs'),
fs = require('fs-extra'),
colors = require('coloring'), // eslint-disable-line no-unused-vars
fsWatcher = require('chokidar'),
debug = require('debug')('liveview:server'),
Expand Down Expand Up @@ -170,9 +170,18 @@ FServer.start = function (opts) {
const isAlloy = fs.existsSync(ALLOY_DIR);
const hasLocale = fs.existsSync(LOCALE_DIR);

const pidObj = {
projectPath: PROJECT_DIR,
ip: HOST,
eport: EPORT,
fport: FPORT,
alloy: isAlloy,
platform: PLATFORM
};

// create new pid file
fs.existsSync(PID_FILE) && fs.unlinkSync(PID_FILE);
fs.writeFileSync(PID_FILE, PROJECT_DIR);
fs.writeJsonSync(PID_FILE, pidObj, { spaces: '\t' });

// create static file server
const fServer = http.createServer(function (request, response) {
Expand Down
35 changes: 31 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"coloring": "~0.1.0",
"commander": "~2.0.0",
"debug": "~0.7.2",
"fs-extra": "^8.1.0",
"hypar": "~0.1.0",
"node-titanium-sdk": "^3.0.1",
"shelljs": "~0.2.6",
Expand Down

0 comments on commit 1419c54

Please sign in to comment.