Add --no-plugin-search (#10274)

Co-authored-by: Alexander Kachkaev <alexander@kachkaev.ru>
This commit is contained in:
fisker CheungandAlexander Kachkaev authored and GitHub committed 2022-02-18 16:36:53 +08:00
1 parent 162097e2d2
commit 3ba48bb266
14 files changed
+190 -20

No files matched your search

+23 -11
View File
@@ -14,6 +14,10 @@ function parseArgv(rawArguments, detailedOptions, logger, keys) {
let argv = minimist(rawArguments, minimistOptions);
if (keys) {
if (keys.includes("plugin-search-dir") && !keys.includes("plugin-search")) {
keys.push("plugin-search");
}
detailedOptions = detailedOptions.filter((option) =>
keys.includes(option.name)
);
@@ -25,19 +29,27 @@ function parseArgv(rawArguments, detailedOptions, logger, keys) {
colorsModule: chalk,
});
return Object.fromEntries(
Object.entries(normalized).map(([key, value]) => {
const option = detailedOptions.find(({ name }) => name === key) || {};
// If the flag is a prettier option, use the option name
// `--plugin-search-dir` -> `pluginSearchDirs`
// Otherwise use camel case for readability
// `--ignore-unknown` -> `ignoreUnknown`
return [option.forwardToApi || camelCase(key), value];
})
);
return {
...Object.fromEntries(
Object.entries(normalized).map(([key, value]) => {
const option = detailedOptions.find(({ name }) => name === key) || {};
// If the flag is a prettier option, use the option name
// `--plugin-search-dir` -> `pluginSearchDirs`
// Otherwise use camel case for readability
// `--ignore-unknown` -> `ignoreUnknown`
return [option.forwardToApi || camelCase(key), value];
})
),
get __raw() {
return argv;
},
};
}
const detailedOptionsWithoutPlugins = getContextOptions().detailedOptions;
const detailedOptionsWithoutPlugins = getContextOptions(
[],
false
).detailedOptions;
function parseArgvWithoutPlugins(rawArguments, logger, keys) {
return parseArgv(
rawArguments,