Skip to content

Commit

Permalink
Fix CLI path resolving for absolute paths
Browse files Browse the repository at this point in the history
  • Loading branch information
adamreisnz committed Dec 20, 2017
1 parent 24ce4a6 commit 310d37b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,20 @@ replace-in-file from to some/file.js,some/**/glob.js

Multiple files or globs can be replaced by providing a comma separated list.

The flags `disableGlobs`, `ignore` and `encoding` are supported in the CLI.
The flags `--disableGlobs`, `--ignore` and `--encoding` are supported in the CLI.

The flag `allowEmptyPaths` is not supported in the CLI as the replacement is
synchronous, and the flag is only relevant for asynchronous replacement.
The setting `allowEmptyPaths` is not supported in the CLI as the replacement is
synchronous, and this setting is only relevant for asynchronous replacement.

To list the changed files, use the `verbose` flag.
To list the changed files, use the `--verbose` flag.

A regular expression may be used for the `from` parameter by specifying the `--isRegex` flag.

The `from` and `to` parameters, as well as the files list, can be omitted if you provide this
information in a configuration file. You can provide a path to a configuration file
(either Javascript or JSON) with the `--configFile` flag. This path will be resolved using
Node’s built in `path.resolve()`, so you can pass in an absolute or relative path.

## Version information
From version 3.0.0 onwards, replace in file requires Node 6 or higher. If you need support for Node 4 or 5, use version 2.x.x.

Expand Down
4 changes: 2 additions & 2 deletions lib/helpers/load-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ module.exports = function loadConfig(file) {
return {};
}

//Combine with CWD
file = path.join(process.cwd(), file);
//Resolve path
file = path.resolve(file);

//Try to load
return require(file);
Expand Down

0 comments on commit 310d37b

Please sign in to comment.