Просмотр исходного кода

ensure not to use app-root-path

Yuki Takei 9 лет назад
Родитель
Сommit
7e618f7253

+ 2 - 4
packages/growi-commons/package.json

@@ -1,6 +1,6 @@
 {
   "name": "crowi-pluginkit",
-  "version": "1.0.6",
+  "version": "1.0.7",
   "description": "The Crowi Plugin Kit to develop plugins",
   "main": "lib/index.js",
   "files": [
@@ -25,9 +25,7 @@
     "url": "https://github.com/weseek/crowi-pluginkit/issues"
   },
   "homepage": "https://github.com/weseek/crowi-pluginkit#readme",
-  "dependencies": {
-    "app-root-path": "^2.0.1"
-  },
+  "dependencies": {},
   "devDependencies": {
     "babel-cli": "^6.23.0",
     "babel-plugin-add-module-exports": "^0.2.1",

+ 2 - 2
packages/growi-commons/src/util/ModulePathResolver.js

@@ -1,5 +1,4 @@
 import * as path from 'path';
-import * as appRoot from 'app-root-path';
 
 /**
  * Resolve path tools
@@ -7,7 +6,8 @@ import * as appRoot from 'app-root-path';
 export class ModulePathResolver {
 
   relativeFromRoot(modulePath) {
-    return path.relative(appRoot.path, modulePath)
+    const appRoot = path.dirname(require.main.filename)
+    return path.relative(appRoot, modulePath)
   }
 
 }