File tree Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 2525 "test:watch" : " jest --watch"
2626 },
2727 "dependencies" : {
28- "app-root-path" : " ^2.0.1" ,
2928 "chalk" : " ^2.3.1" ,
3029 "commander" : " ^2.14.1" ,
3130 "cosmiconfig" : " ^5.0.2" ,
Original file line number Diff line number Diff line change 11'use strict'
22
33const parse = require ( 'string-argv' )
4- const appRoot = require ( 'app-root-path' )
54const npmWhich = require ( 'npm-which' ) ( process . cwd ( ) )
65const checkPkgScripts = require ( './checkPkgScripts' )
76
8- // Find and load the package.json at the root of the project.
9- const pkg = require ( appRoot . resolve ( 'package.json' ) ) // eslint-disable-line import/no-dynamic-require
107const debug = require ( 'debug' ) ( 'lint-staged:find-bin' )
118
9+ // Find and load the package.json at the root of the project.
10+ let pkg
11+ try {
12+ // eslint-disable-next-line import/no-dynamic-require, global-require
13+ pkg = require ( `${ process . cwd ( ) } /package.json` )
14+ debug ( 'Loaded package.json using `process.cwd()`' )
15+ } catch ( ignore ) {
16+ debug ( 'Could not load package.json using `process.cwd()`' )
17+ pkg = { }
18+ }
19+
1220const cache = new Map ( )
1321
1422module . exports = function findBin ( cmd ) {
Original file line number Diff line number Diff line change @@ -124,10 +124,6 @@ anymatch@^2.0.0:
124124 micromatch "^3.1.4"
125125 normalize-path "^2.1.1"
126126
127- app-root-path@^2.0.1 :
128- version "2.1.0"
129- resolved "https://registry.yarnpkg.com/app-root-path/-/app-root-path-2.1.0.tgz#98bf6599327ecea199309866e8140368fd2e646a"
130-
131127append-transform@^1.0.0 :
132128 version "1.0.0"
133129 resolved "https://registry.yarnpkg.com/append-transform/-/append-transform-1.0.0.tgz#046a52ae582a228bd72f58acfbe2967c678759ab"
You can’t perform that action at this time.
0 commit comments