Added support for plugin relative imports

This commit is contained in:
Wyatt Johnson
2017-04-03 13:02:32 -06:00
parent 9c806cb6e4
commit b5280b1221
4 changed files with 24 additions and 14 deletions
+14
View File
@@ -44,6 +44,20 @@ dependancies. _Note that if the plugin is already installed and available in the
node_modules folder, it will not be fetched again unless there is a version
mismatch._
## Plugin Dependencies
From your plugins you may import any component of server code relative to the
project root. An example could be:
```js
const cache = require('services/cache');
```
You may also include additioal external depenancies in your local packages by
specifying a `package.json` at your plugin root which will result in a
`node_modules` folder being generated at the plugin root with your specific
dependencies.
## Server Plugins
### Specification
+1
View File
@@ -49,6 +49,7 @@
},
"homepage": "https://github.com/coralproject/talk#readme",
"dependencies": {
"app-module-path": "^2.2.0",
"bcrypt": "^1.0.2",
"body-parser": "^1.17.1",
"cli-table": "^0.3.1",
+3
View File
@@ -3,6 +3,9 @@ const path = require('path');
const resolve = require('resolve');
const debug = require('debug')('talk:plugins');
// Add support for require rewriting.
require('app-module-path').addPath(__dirname);
let plugins = {};
// Try to parse the plugins.json file, logging out an error if the plugins.json
+6 -14
View File
@@ -189,6 +189,10 @@ apollo-client@^0.8.3:
"@types/graphql" "^0.8.0"
"@types/isomorphic-fetch" "0.0.30"
app-module-path@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/app-module-path/-/app-module-path-2.2.0.tgz#641aa55dfb7d6a6f0a8141c4b9c0aa50b6c24dd5"
"apparatus@>= 0.0.9":
version "0.0.9"
resolved "https://registry.yarnpkg.com/apparatus/-/apparatus-0.0.9.tgz#37dcd25834ad0b651076596291db823eeb1908bd"
@@ -6512,11 +6516,7 @@ react-apollo@^0.10.0:
optionalDependencies:
react-dom "0.14.x || 15.* || ^15.0.0"
"react-dom@0.14.x || 15.* || ^15.0.0", react-dom@^15.3.1:
version "15.3.2"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.3.2.tgz#c46b0aa5380d7b838e7a59c4a7beff2ed315531f"
react-dom@^15.4.2:
"react-dom@0.14.x || 15.* || ^15.0.0", react-dom@^15.3.1, react-dom@^15.4.2:
version "15.4.2"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.4.2.tgz#015363f05b0a1fd52ae9efdd3a0060d90695208f"
dependencies:
@@ -6586,15 +6586,7 @@ react-tagsinput@^3.14.0:
version "3.14.0"
resolved "https://registry.yarnpkg.com/react-tagsinput/-/react-tagsinput-3.14.0.tgz#6729f8d5b313ed8fbb35496205ec2a97654af6bc"
react@^15.3.1:
version "15.3.2"
resolved "https://registry.yarnpkg.com/react/-/react-15.3.2.tgz#a7bccd2fee8af126b0317e222c28d1d54528d09e"
dependencies:
fbjs "^0.8.4"
loose-envify "^1.1.0"
object-assign "^4.1.0"
react@^15.4.2:
react@^15.3.1, react@^15.4.2:
version "15.4.2"
resolved "https://registry.yarnpkg.com/react/-/react-15.4.2.tgz#41f7991b26185392ba9bae96c8889e7e018397ef"
dependencies: