Skip to content

Commit

Permalink
Unified debug and release mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
petersirka committed Aug 5, 2024
1 parent 4a896cd commit a6f757b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
0.0.6
========================

- unified debug and release mode
- they use monitoring files
- monitoring can be disabled via `options.watcher = false` in the start script

========================
0.0.5
========================
Expand Down
4 changes: 2 additions & 2 deletions debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ function killapp(pid) {

function runapp() {
!options && (options = {});
global.DEBUG = options.release !== true;
if (options.servicemode) {
var types = options.servicemode === true || options.servicemode === 1 ? '' : options.servicemode.split(',').trim();
global.DEBUG = true;
F.load(types);
} else
F.http(options);
Expand Down Expand Up @@ -492,7 +492,7 @@ function runwatching() {

if (process.pid > 0) {

!Meta.callback && console.log(prefix.substring(8) + 'DEBUG PID: ' + process.pid + ' (v' + VERSION + ')');
!Meta.callback && console.log(prefix.substring(8) + 'Total.js watcher PID: ' + process.pid + ' (v' + VERSION + ')');

pid = F.Path.join(directory, PIDNAME);
F.Fs.writeFileSync(pid, process.pid + '');
Expand Down
2 changes: 1 addition & 1 deletion helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const options = {};
// options.inspector = 9229;
// options.watch = ['private'];
// options.livereload = 'https://yourhostname';
// options.watcher = true; // enables watcher for the release mode only controlled by the app `F.restart()`
// options.watcher = false; // disables watcher
// options.edit = 'wss://www.yourcodeinstance.com/?id=projectname'
options.release = process.argv.includes('--release');

Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2519,7 +2519,8 @@ F.dir = function(val) {
};

F.run = function(opt) {
var type = opt.release ? 'release' : 'debug';
var type = opt.watcher === false ? 'release' : 'debug';
opt.watcher = false;
require('./' + type)(opt);
};

Expand Down

0 comments on commit a6f757b

Please sign in to comment.