diff --git a/packages/size-limit/get-config.js b/packages/size-limit/get-config.js index 5f06908c..54548f9d 100644 --- a/packages/size-limit/get-config.js +++ b/packages/size-limit/get-config.js @@ -1,5 +1,5 @@ let { isAbsolute, dirname, join, relative } = require('path') -let { cosmiconfig } = require('cosmiconfig') +let { lilconfig } = require('lilconfig') let globby = require('globby') let bytes = require('bytes') @@ -99,7 +99,7 @@ module.exports = async function getConfig (plugins, process, args, pkg) { if (args.files.length > 0) { config.checks = [{ files: args.files }] } else { - let explorer = cosmiconfig('size-limit', { + let explorer = lilconfig('size-limit', { searchPlaces: [ 'package.json', '.size-limit.json', @@ -116,18 +116,19 @@ module.exports = async function getConfig (plugins, process, args, pkg) { config.cwd = dirname(result.filepath) config.checks = await Promise.all( result.config.map(async check => { + let processed = { ...check } if (check.path) { - check.files = await globby(check.path, { cwd: config.cwd }) + processed.files = await globby(check.path, { cwd: config.cwd }) } else if (!check.entry) { if (pkg.packageJson.main) { - check.files = [ + processed.files = [ require.resolve(join(dirname(pkg.path), pkg.packageJson.main)) ] } else { - check.files = [join(dirname(pkg.path), 'index.js')] + processed.files = [join(dirname(pkg.path), 'index.js')] } } - return check + return processed }) ) } diff --git a/packages/size-limit/package.json b/packages/size-limit/package.json index d2a9c586..b472c065 100644 --- a/packages/size-limit/package.json +++ b/packages/size-limit/package.json @@ -22,8 +22,8 @@ "chokidar": "^3.4.3", "ci-job-number": "^1.2.2", "colorette": "^1.2.1", - "cosmiconfig": "^7.0.0", "globby": "^11.0.1", + "lilconfig": "^2.0.1", "ora": "^5.1.0", "read-pkg-up": "^7.0.1" } diff --git a/yarn.lock b/yarn.lock index 1705df09..69f0f1ea 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5055,6 +5055,11 @@ levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" +lilconfig@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-2.0.1.tgz#24353e5eadfbd7fcf314bad46714161e4e085ebf" + integrity sha512-fFzm+Lj/Up8OGJfygxz1VLVuihcqZQpqFMmQ3yklVwUIA8Z6LWBwiISObInLg8R8g9E9r7b9t2+kh8+N7vRS+g== + line-column@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/line-column/-/line-column-1.0.2.tgz#d25af2936b6f4849172b312e4792d1d987bc34a2"