Skip to content

Commit

Permalink
Global require function with usage example
Browse files Browse the repository at this point in the history
  • Loading branch information
ernstwi committed Feb 14, 2018
1 parent bfd3286 commit 2bed9fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

var Promise = require('bluebird'),
common = require('../../../../lib/common'),
commands = require('../../../schema').commands,
common = requireRoot('lib/common'),
commands = requireRoot('data/schema').commands,
table = 'webhooks',
message1 = 'Adding table: ' + table,
message2 = 'Dropping table: ' + table;
Expand Down
4 changes: 4 additions & 0 deletions core/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
*/
require('./overrides');

global.requireRoot = function(module) {
return require(`${__dirname}/${module}`);
}

// Module dependencies
var debug = require('ghost-ignition').debug('boot:init'),
config = require('./config'),
Expand Down

0 comments on commit 2bed9fe

Please sign in to comment.