Skip to content

Commit

Permalink
fix: remove lodash
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Feb 5, 2018
1 parent 8b7d0e6 commit 61c267f
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 746 deletions.
18 changes: 6 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,20 @@
"author": "Jeff Dickey @jdxcode",
"bugs": "https://github.com/anycli/test/issues",
"dependencies": {
"fancy-test": "^0.6.10",
"lodash": "^4.17.4"
"fancy-test": "^1.0.1"
},
"devDependencies": {
"@anycli/command": "^1.2.3",
"@anycli/config": "^1.0.18",
"@anycli/command": "^1.2.4",
"@anycli/config": "^1.1.6",
"@anycli/tslint": "^0.2.5",
"@anycli/version": "^0.1.19",
"@types/chai": "^4.1.2",
"@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",
"cli-ux": "^3.3.13",
"cli-ux": "^3.3.15",
"concurrently": "^3.5.1",
"eslint": "^4.17.0",
"eslint-config-anycli": "^1.3.2",
"globby": "^7.1.1",
"husky": "^0.14.3",
"mocha": "^5.0.0",
"ts-node": "^4.1.0",
Expand All @@ -45,7 +39,7 @@
"repository": "anycli/test",
"scripts": {
"build": "rm -rf lib && tsc",
"lint": "concurrently -p command \"eslint .\" \"tsc -p test --noEmit\" \"tslint -p test\"",
"lint": "concurrently -p command \"tsc -p test --noEmit\" \"tslint -p test\"",
"posttest": "yarn run lint",
"prepublishOnly": "yarn run build",
"test": "mocha --forbid-only \"test/**/*.test.ts\""
Expand Down
8 changes: 6 additions & 2 deletions src/command.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import * as Config from '@anycli/config'
import * as _ from 'lodash'

import {loadConfig} from './load_config'

export function command(args: string[] | string | undefined, opts: loadConfig.Options = {}) {
return {
async run(ctx: {config: Config.IConfig, expectation: string}) {
if (!ctx.config || opts.reset) ctx.config = loadConfig(opts).run({} as any)
args = _.castArray(args)
args = castArray(args)
let [cmd, ...extra] = args
ctx.expectation = ctx.expectation || `runs ${args.join(' ')}`
await ctx.config.runCommand(cmd, extra)
}
}
}

const castArray = <T>(input?: T | T[]): T[] => {
if (input === undefined) return []
return Array.isArray(input) ? input : [input]
}
3 changes: 1 addition & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Config from '@anycli/config'
import {expect, fancy, FancyTypes, NockScope} from 'fancy-test'
import {expect, fancy, FancyTypes} from 'fancy-test'

import {command} from './command'
import exit from './exit'
Expand All @@ -20,6 +20,5 @@ export {
expect,
FancyTypes,
Config,
NockScope,
command,
}
Loading

0 comments on commit 61c267f

Please sign in to comment.