Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
fix: reduce dependencies needed in dev
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Feb 2, 2018
1 parent 5b9dd05 commit 567d46b
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 399 deletions.
6 changes: 0 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +0,0 @@
[submodule "plugins/heroku-run"]
path = plugins/heroku-run
url = https://github.com/heroku/heroku-run
[submodule "plugins/heroku-cli-status"]
path = plugins/heroku-cli-status
url = https://github.com/heroku/heroku-cli-status
5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,22 @@
"author": "Jeff Dickey @jdxcode",
"bugs": "https://github.com/anycli/config/issues",
"dependencies": {
"cli-ux": "^3.3.13",
"debug": "^3.1.0",
"fs-extra": "^5.0.0",
"load-json-file": "^4.0.0",
"lodash": "^4.17.4",
"read-pkg": "^3.0.0"
},
"devDependencies": {
"@anycli/command": "^0.3.10",
"@anycli/config": "^0.3.2",
"@anycli/parser": "^3.0.4",
"@anycli/tslint": "^0.2.3",
"@heroku-cli/config-edit": "^1.0.4",
"@types/chai": "^4.1.2",
"@types/fs-extra": "^5.0.0",
"@types/load-json-file": "^2.0.7",
"@types/lodash": "^4.14.100",
"@types/mocha": "^2.2.48",
"@types/nock": "^9.1.2",
"@types/node": "^9.4.0",
"@types/node-notifier": "^0.0.28",
"@types/read-pkg": "^3.0.0",
"chai": "^4.1.2",
"concurrently": "^3.5.1",
Expand Down
1 change: 0 additions & 1 deletion plugins/heroku-cli-status
Submodule heroku-cli-status deleted from df4d65
1 change: 0 additions & 1 deletion plugins/heroku-run
Submodule heroku-run deleted from 330d81
63 changes: 18 additions & 45 deletions test/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,18 @@ import * as path from 'path'

import * as Config from '../src'

const pluginRoot = (plugin: string) => path.resolve(__dirname, '../plugins', plugin)

const testPlugin = (plugin: string) => async () => {
const config = await Config.read(plugin === '@heroku-cli/config-edit' ? {root: __dirname, name: plugin} : {root: pluginRoot(plugin)})
return {config}
}

describe('PluginConfig', () => {
fancy
.env({}, {clear: true})
.stub(os, 'homedir', () => path.join('/my/home'))
.stub(os, 'platform', () => 'darwin')
.add('config', testPlugin('heroku-cli-status'))
.add('config', Config.read)
.end('darwin', ({config}) => {
expect(config.config).to.include({
cacheDir: path.join('/my/home/Library/Caches/heroku-cli-status'),
configDir: path.join('/my/home/.config/heroku-cli-status'),
errlog: path.join('/my/home/Library/Caches/heroku-cli-status/error.log'),
dataDir: path.join('/my/home/.local/share/heroku-cli-status'),
commandsDir: path.join(pluginRoot('heroku-cli-status'), 'lib/commands'),
expect(config).to.include({
cacheDir: path.join('/my/home/Library/Caches/@anycli/config'),
configDir: path.join('/my/home/.config/@anycli/config'),
errlog: path.join('/my/home/Library/Caches/@anycli/config/error.log'),
dataDir: path.join('/my/home/.local/share/@anycli/config'),
home: path.join('/my/home'),
})
})
Expand All @@ -32,14 +24,13 @@ describe('PluginConfig', () => {
.env({}, {clear: true})
.stub(os, 'homedir', () => path.join('/my/home'))
.stub(os, 'platform', () => 'linux')
.add('config', testPlugin('heroku-cli-status'))
.add('config', Config.read)
.end('linux', ({config}) => {
expect(config.config).to.include({
cacheDir: path.join('/my/home/.cache/heroku-cli-status'),
configDir: path.join('/my/home/.config/heroku-cli-status'),
errlog: path.join('/my/home/.cache/heroku-cli-status/error.log'),
dataDir: path.join('/my/home/.local/share/heroku-cli-status'),
commandsDir: path.join(pluginRoot('heroku-cli-status'), 'lib/commands'),
expect(config).to.include({
cacheDir: path.join('/my/home/.cache/@anycli/config'),
configDir: path.join('/my/home/.config/@anycli/config'),
errlog: path.join('/my/home/.cache/@anycli/config/error.log'),
dataDir: path.join('/my/home/.local/share/@anycli/config'),
home: path.join('/my/home'),
})
})
Expand All @@ -48,32 +39,14 @@ describe('PluginConfig', () => {
.env({LOCALAPPDATA: '/my/home/localappdata'}, {clear: true})
.stub(os, 'homedir', () => path.join('/my/home'))
.stub(os, 'platform', () => 'win32')
.add('config', testPlugin('heroku-cli-status'))
.add('config', Config.read)
.end('win32', ({config}) => {
expect(config.config).to.include({
cacheDir: path.join('/my/home/localappdata/heroku-cli-status'),
configDir: path.join('/my/home/localappdata/heroku-cli-status'),
errlog: path.join('/my/home/localappdata/heroku-cli-status/error.log'),
dataDir: path.join('/my/home/localappdata/heroku-cli-status'),
commandsDir: path.join(pluginRoot('heroku-cli-status'), 'lib/commands'),
expect(config).to.include({
cacheDir: path.join('/my/home/localappdata/@anycli/config'),
configDir: path.join('/my/home/localappdata/@anycli/config'),
errlog: path.join('/my/home/localappdata/@anycli/config/error.log'),
dataDir: path.join('/my/home/localappdata/@anycli/config'),
home: path.join('/my/home'),
})
})

fancy
.add('config', testPlugin('heroku-run'))
.end('heroku-run has properties', ({config}) => {
expect(config.config).to.include({
// commandsDir: undefined
})
})

fancy
.add('plugin', testPlugin('@heroku-cli/config-edit'))
.end('@heroku-cli/config-edit has properties', ({plugin}) => {
expect(plugin.config).to.include({
name: '@heroku-cli/config-edit',
commandsDir: path.join(__dirname, '../node_modules/@heroku-cli/config-edit/lib/commands'),
})
})
})
8 changes: 4 additions & 4 deletions test/fixtures/typescript/src/commands/foo/bar/baz.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Command from '@anycli/command'
import cli from 'cli-ux'
// import Command from '@anycli/command'
// import cli from 'cli-ux'

export default class extends Command {
export default class {
async run() {
cli.log('it works!')
console.log('it works!')
}
}
4 changes: 1 addition & 3 deletions test/fixtures/typescript/src/plugins.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import cli from 'cli-ux'

export default function () {
cli.log('loading plugins')
console.log('loading plugins')
}
Loading

0 comments on commit 567d46b

Please sign in to comment.