Replace find-up (#4385)
This commit is contained in:
parent
eb0ba42207
commit
25c4aa2995
|
|
@ -8,10 +8,10 @@ import get from 'lodash.get';
|
||||||
import yargs from 'yargs';
|
import yargs from 'yargs';
|
||||||
import { hideBin } from 'yargs/helpers';
|
import { hideBin } from 'yargs/helpers';
|
||||||
|
|
||||||
import { findUpSync } from 'find-up';
|
|
||||||
import { BrowsertimeEngine, configureLogging } from 'browsertime';
|
import { BrowsertimeEngine, configureLogging } from 'browsertime';
|
||||||
|
|
||||||
import { getURLs } from '../lib/cli/util.js';
|
import { getURLs } from '../lib/cli/util.js';
|
||||||
|
import { findUpSync } from '../lib/support/fileUtil.js';
|
||||||
|
|
||||||
import {config as browsertimeConfig} from '../lib/plugins/browsertime/index.js';
|
import {config as browsertimeConfig} from '../lib/plugins/browsertime/index.js';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import merge from 'lodash.merge';
|
||||||
import reduce from 'lodash.reduce';
|
import reduce from 'lodash.reduce';
|
||||||
import set from 'lodash.set';
|
import set from 'lodash.set';
|
||||||
import get from 'lodash.get';
|
import get from 'lodash.get';
|
||||||
import { findUpSync } from 'find-up';
|
|
||||||
|
|
||||||
import { getURLs, getAliases } from './util.js';
|
import { getURLs, getAliases } from './util.js';
|
||||||
import { toArray } from '../support/util.js';
|
import { toArray } from '../support/util.js';
|
||||||
|
|
@ -19,6 +18,7 @@ import { config as metricsConfig } from '../plugins/metrics/index.js';
|
||||||
import { config as slackConfig } from '../plugins/slack/index.js';
|
import { config as slackConfig } from '../plugins/slack/index.js';
|
||||||
import { config as htmlConfig } from '../plugins/html/index.js';
|
import { config as htmlConfig } from '../plugins/html/index.js';
|
||||||
import { messageTypes as matrixMessageTypes } from '../plugins/matrix/index.js';
|
import { messageTypes as matrixMessageTypes } from '../plugins/matrix/index.js';
|
||||||
|
import { findUpSync } from '../support/fileUtil.js';
|
||||||
|
|
||||||
const metricList = Object.keys(friendlynames);
|
const metricList = Object.keys(friendlynames);
|
||||||
const require = createRequire(import.meta.url);
|
const require = createRequire(import.meta.url);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { readdir } from 'node:fs/promises';
|
import { readdir } from 'node:fs/promises';
|
||||||
|
import { existsSync } from 'node:fs';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
|
||||||
export async function recursiveReaddir(dir, ignoreDirectories = false) {
|
export async function recursiveReaddir(dir, ignoreDirectories = false) {
|
||||||
|
|
@ -21,3 +22,19 @@ export async function recursiveReaddir(dir, ignoreDirectories = false) {
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function findUpSync(filenames, startDir = process.cwd()) {
|
||||||
|
let currentDir = startDir;
|
||||||
|
|
||||||
|
while (currentDir !== path.dirname(currentDir)) {
|
||||||
|
for (const filename of filenames) {
|
||||||
|
const filePath = path.resolve(currentDir, filename);
|
||||||
|
if (existsSync(filePath)) {
|
||||||
|
return filePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
currentDir = path.dirname(currentDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@
|
||||||
"dayjs": "1.11.11",
|
"dayjs": "1.11.11",
|
||||||
"fast-crc32c": "2.0.0",
|
"fast-crc32c": "2.0.0",
|
||||||
"fast-stats": "0.0.7",
|
"fast-stats": "0.0.7",
|
||||||
"find-up": "7.0.0",
|
|
||||||
"import-global": "1.1.1",
|
"import-global": "1.1.1",
|
||||||
"influx": "5.9.3",
|
"influx": "5.9.3",
|
||||||
"jstransformer-markdown-it": "3.0.0",
|
"jstransformer-markdown-it": "3.0.0",
|
||||||
|
|
@ -5352,22 +5351,6 @@
|
||||||
"integrity": "sha1-2wAjj/hoVRoYLnShA0FtKVqYyMo=",
|
"integrity": "sha1-2wAjj/hoVRoYLnShA0FtKVqYyMo=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/find-up": {
|
|
||||||
"version": "7.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-7.0.0.tgz",
|
|
||||||
"integrity": "sha512-YyZM99iHrqLKjmt4LJDj58KI+fYyufRLBSYcqycxf//KpBk9FoewoGX0450m9nB44qrZnovzC2oeP5hUibxc/g==",
|
|
||||||
"dependencies": {
|
|
||||||
"locate-path": "^7.2.0",
|
|
||||||
"path-exists": "^5.0.0",
|
|
||||||
"unicorn-magic": "^0.1.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=18"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/find-up-simple": {
|
"node_modules/find-up-simple": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/find-up-simple/-/find-up-simple-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/find-up-simple/-/find-up-simple-1.0.0.tgz",
|
||||||
|
|
@ -7102,20 +7085,6 @@
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/locate-path": {
|
|
||||||
"version": "7.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz",
|
|
||||||
"integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==",
|
|
||||||
"dependencies": {
|
|
||||||
"p-locate": "^6.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/lodash": {
|
"node_modules/lodash": {
|
||||||
"version": "4.17.21",
|
"version": "4.17.21",
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||||
|
|
@ -7934,45 +7903,6 @@
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/p-locate": {
|
|
||||||
"version": "6.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz",
|
|
||||||
"integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==",
|
|
||||||
"dependencies": {
|
|
||||||
"p-limit": "^4.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/p-locate/node_modules/p-limit": {
|
|
||||||
"version": "4.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz",
|
|
||||||
"integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"yocto-queue": "^1.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/p-locate/node_modules/yocto-queue": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12.20"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/p-map": {
|
"node_modules/p-map": {
|
||||||
"version": "7.0.2",
|
"version": "7.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/p-map/-/p-map-7.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/p-map/-/p-map-7.0.2.tgz",
|
||||||
|
|
@ -8087,14 +8017,6 @@
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/path-exists": {
|
|
||||||
"version": "5.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz",
|
|
||||||
"integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==",
|
|
||||||
"engines": {
|
|
||||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/path-is-absolute": {
|
"node_modules/path-is-absolute": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||||
|
|
@ -10191,6 +10113,7 @@
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.1.0.tgz",
|
||||||
"integrity": "sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==",
|
"integrity": "sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==",
|
||||||
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,6 @@
|
||||||
"dayjs": "1.11.11",
|
"dayjs": "1.11.11",
|
||||||
"fast-crc32c": "2.0.0",
|
"fast-crc32c": "2.0.0",
|
||||||
"fast-stats": "0.0.7",
|
"fast-stats": "0.0.7",
|
||||||
"find-up": "7.0.0",
|
|
||||||
"import-global": "1.1.1",
|
"import-global": "1.1.1",
|
||||||
"influx": "5.9.3",
|
"influx": "5.9.3",
|
||||||
"jstransformer-markdown-it": "3.0.0",
|
"jstransformer-markdown-it": "3.0.0",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue