Skip to content

Commit

Permalink
chore(cli): remove findup-sync from package dir and move to utils
Browse files Browse the repository at this point in the history
remove findup-sycn from package dir and move to utils

ISSUES CLOSED: webpack#805
  • Loading branch information
anshumanv committed Mar 27, 2019
1 parent 3e870e2 commit 26fbaae
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 33 deletions.
5 changes: 2 additions & 3 deletions bin/utils/convert-argv.js
Expand Up @@ -6,7 +6,7 @@ const prepareOptions = require("./prepareOptions");
const webpackConfigurationSchema = require("../config/webpackConfigurationSchema.json");
const validateSchema = require("webpack").validateSchema;
const WebpackOptionsValidationError = require("webpack").WebpackOptionsValidationError;
const findup = require("findup-sync");
const { webpackConfigPath } = require("../../packages/utils/webpack-config-path");

module.exports = function(...args) {
const argv = args[1] || args[0];
Expand Down Expand Up @@ -70,8 +70,7 @@ module.exports = function(...args) {
configFiles = configArgList.map(mapConfigArg);
} else {
const defaultConfigFileNames = ["webpack.config", "webpackfile"].join("|");
const webpackConfigFileRegExp = `(${defaultConfigFileNames})(${extensions.join("|")})`;
const pathToWebpackConfig = findup(webpackConfigFileRegExp);
const pathToWebpackConfig = webpackConfigPath(extensions);

if (pathToWebpackConfig) {
const resolvedPath = path.resolve(pathToWebpackConfig);
Expand Down
41 changes: 11 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions packages/utils/webpack-config-path.ts
@@ -0,0 +1,7 @@
import * as findup from "findup-sync";

export function webpackConfigPath(extensions: string[]): string {
const defaultConfigFileNames = ["webpack.config", "webpackfile"].join("|");
const webpackConfigFileRegExp = `(${defaultConfigFileNames})(${extensions.join("|")})`;
return findup(webpackConfigFileRegExp);
}

0 comments on commit 26fbaae

Please sign in to comment.