Skip to content

Commit

Permalink
Update all deps, some devDeps (#72)
Browse files Browse the repository at this point in the history
* Update all deps, some devDeps

* Added node v14.

* Updated cpy-cli and del-cli

* Updated execa

* Updated eslint-formatter-pretty
  • Loading branch information
mcollina authored Jun 14, 2020
1 parent 861db08 commit 9666433
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 19 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: node_js
node_js:
- '14'
- '12'
- '10'
- '8'
Expand Down
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion source/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 6 additions & 4 deletions source/lib/index.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions source/test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down

0 comments on commit 9666433

Please sign in to comment.