| Total Complexity | 5 |
| Complexity/F | 2.5 |
| Lines of Code | 37 |
| Function Count | 2 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | const install = require('spawn-npm-install') |
||
| 2 | const Plugins = require('../../util/Plugins') |
||
| 3 | const output = require('../../output') |
||
| 4 | const fs = require('fs') |
||
| 5 | |||
| 6 | module.exports = function (name) { |
||
| 7 | if (name.indexOf('cli-') < 0) { |
||
| 8 | name = '@includable/cli-' + name |
||
| 9 | } |
||
| 10 | |||
| 11 | if (!fs.existsSync(Plugins.packageFile)) { |
||
| 12 | const json = { |
||
| 13 | 'private': true, |
||
| 14 | 'name': 'my-inc-plugins', |
||
| 15 | 'description': 'Auto-generated by the Includable CLI!', |
||
| 16 | 'version': '0.0.1', |
||
| 17 | 'license': 'MIT', |
||
| 18 | 'dependencies': {} |
||
| 19 | } |
||
| 20 | fs.writeFileSync(Plugins.packageFile, JSON.stringify(json, null, 3), 'utf8') |
||
| 21 | } |
||
| 22 | |||
| 23 | install(name, { |
||
| 24 | cwd: Plugins.directory, |
||
| 25 | noShrinkwrap: true, |
||
| 26 | production: true, |
||
| 27 | noBinLinks: true, |
||
| 28 | save: true |
||
| 29 | }, function (err) { |
||
| 30 | if (err) { |
||
| 31 | output.errSimple(err.message) |
||
| 32 | return |
||
| 33 | } |
||
| 34 | |||
| 35 | Plugins.describePlugin(name) |
||
| 36 | }) |
||
| 37 | } |
||
| 38 |