Skip to content

Commit bbd263e

Browse files
wyattjohJLHwung
authored andcommitted
Support Yarn Workspaces (#27)
* replaced custom resolve with resolve * linted * removed resolve in favour of base require.resolve * Revert "removed resolve in favour of base require.resolve" This reverts commit 618286b.
1 parent f2f7364 commit bbd263e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/hexo.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
var chalk = require('chalk');
44
var tildify = require('tildify');
5-
var pathFn = require('path');
65
var Promise = require('bluebird');
76
var Context = require('./context');
87
var findPkg = require('./find_pkg');
98
var goodbye = require('./goodbye');
109
var minimist = require('minimist');
10+
var resolve = require('resolve');
1111
var camelCaseKeys = require('hexo-util/lib/camel_case_keys');
1212

1313
class HexoNotFoundError extends Error {}
@@ -86,7 +86,7 @@ entry.version = require('../package.json').version;
8686

8787
function loadModule(path, args) {
8888
return Promise.try(function() {
89-
var modulePath = pathFn.join(path, 'node_modules', 'hexo');
89+
var modulePath = resolve.sync('hexo', { basedir: path });
9090
var Hexo = require(modulePath);
9191

9292
return new Hexo(path, args);

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,14 @@
3535
"abbrev": "^1.0.7",
3636
"bluebird": "^3.4.0",
3737
"chalk": "^1.1.3",
38+
"command-exists": "^1.2.0",
3839
"hexo-fs": "^0.2.0",
3940
"hexo-log": "^0.2.0",
4041
"hexo-util": "^0.6.0",
4142
"minimist": "^1.2.0",
4243
"object-assign": "^4.1.0",
43-
"tildify": "^1.2.0",
44-
"command-exists": "^1.2.0"
44+
"resolve": "^1.5.0",
45+
"tildify": "^1.2.0"
4546
},
4647
"devDependencies": {
4748
"chai": "^3.5.0",

0 commit comments

Comments
 (0)