diff --git a/.travis.yml b/.travis.yml index e155464f..81f3378f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: node_js node_js: + - '14' - '12' - '10' - '8' diff --git a/package.json b/package.json index 1a83aaea..fe120f91 100644 --- a/package.json +++ b/package.json @@ -40,21 +40,21 @@ "typedefinitions" ], "dependencies": { - "eslint-formatter-pretty": "^1.3.0", - "globby": "^9.1.0", - "meow": "^5.0.0", - "path-exists": "^3.0.0", - "read-pkg-up": "^4.0.0", - "update-notifier": "^2.5.0" + "eslint-formatter-pretty": "^4.0.0", + "globby": "^11.0.1", + "meow": "^7.0.1", + "path-exists": "^4.0.0", + "read-pkg-up": "^7.0.0", + "update-notifier": "^4.1.0" }, "devDependencies": { - "@types/node": "^11.10.4", + "@types/node": "^14.0.0", "@types/react": "^16.9.2", - "@types/update-notifier": "^2.2.0", - "ava": "^1.4.1", - "cpy-cli": "^2.0.0", - "del-cli": "^1.1.0", - "execa": "^3.3.0", + "@types/update-notifier": "^4.1.0", + "ava": "^3.8.2", + "cpy-cli": "^3.0.0", + "del-cli": "^3.0.0", + "execa": "^4.0.0", "react": "^16.9.0", "rxjs": "^6.5.3", "tslint": "^5.11.0", diff --git a/source/cli.ts b/source/cli.ts index 1ed34a51..6712b892 100644 --- a/source/cli.ts +++ b/source/cli.ts @@ -18,7 +18,7 @@ const cli = meow(` `); (async () => { // tslint:disable-line:no-floating-promises - updateNotifier({pkg: cli.pkg}).notify(); + updateNotifier({pkg: cli.pkg as updateNotifier.Package}).notify(); try { const options = cli.input.length > 0 ? {cwd: cli.input[0]} : undefined; diff --git a/source/lib/index.ts b/source/lib/index.ts index ba71256c..4e56dbb2 100644 --- a/source/lib/index.ts +++ b/source/lib/index.ts @@ -1,7 +1,7 @@ import * as path from 'path'; import * as readPkgUp from 'read-pkg-up'; import * as pathExists from 'path-exists'; -import globby from 'globby'; +import * as globby from 'globby'; import {getDiagnostics as getTSDiagnostics} from './compiler'; import loadConfig from './config'; import getCustomDiagnostics from './rules'; @@ -49,13 +49,15 @@ const findTestFiles = async (typingsFile: string, options: Options & {config: Co * @returns A promise which resolves the diagnostics of the type definition. */ export default async (options: Options = {cwd: process.cwd()}) => { - const {pkg} = await readPkgUp({cwd: options.cwd}); + const pkgResult = await readPkgUp({cwd: options.cwd}); - if (!pkg) { + if (!pkgResult) { throw new Error('No `package.json` file found. Make sure you are running the command in a Node.js project.'); } - const config = loadConfig(pkg, options.cwd); + const pkg = pkgResult.packageJson; + + const config = loadConfig(pkg as any, options.cwd); // Look for a typings file, otherwise use `index.d.ts` in the root directory. If the file is not found, throw an error. const typingsFile = await findTypingsFile(pkg, options); diff --git a/source/test/test.ts b/source/test/test.ts index 73e19bf3..ebe99335 100644 --- a/source/test/test.ts +++ b/source/test/test.ts @@ -4,11 +4,11 @@ import {verify} from './fixtures/utils'; import tsd from '..'; test('throw if no type definition was found', async t => { - await t.throwsAsync(tsd({cwd: path.join(__dirname, 'fixtures/no-tsd')}), 'The type definition `index.d.ts` does not exist. Create one and try again.'); + await t.throwsAsync(tsd({cwd: path.join(__dirname, 'fixtures/no-tsd')}), {message: 'The type definition `index.d.ts` does not exist. Create one and try again.'}); }); test('throw if no test is found', async t => { - await t.throwsAsync(tsd({cwd: path.join(__dirname, 'fixtures/no-test')}), 'The test file `index.test-d.ts` or `index.test-d.tsx` does not exist. Create one and try again.'); + await t.throwsAsync(tsd({cwd: path.join(__dirname, 'fixtures/no-test')}), {message: 'The test file `index.test-d.ts` or `index.test-d.tsx` does not exist. Create one and try again.'}); }); test('return diagnostics', async t => {