6.0 KiB
6.0 KiB
Changelog
5.2.1
- Chore: Upgrade
js-yamlto avoid npm audit warning.
5.2.0
- Added:
packagePropvalues can be arrays of strings, to allow for property names that include periods. (This was possible before, but not documented or deliberately supported.) - Chore: Replaced the
lodash.getdependency with a locally defined function. - Chore: Upgrade
js-yamlto avoid npm audit warning.
5.1.0
- Added:
packagePropvalues can include periods to describe paths to nested objects withinpackage.json.
5.0.7
- Fixed: JS loader bypasses Node's
requirecache, fixing a bug where updates to.jsconfig files would not load even when Cosmiconfig was told not to cache.
5.0.6
- Fixed: Better error message if the end user tries an extension Cosmiconfig is not configured to understand.
5.0.5
- Fixed:
loadandloadSyncwork with paths relative toprocess.cwd().
5.0.4
- Fixed:
rcfiles with.jsextensions included in defaultsearchPlaces.
5.0.3
- Docs: Minor corrections to documentation. Released to update package documentation on npm.
5.0.2
- Fixed: Allow
searchSyncandloadSyncto load JS configuration files whose export is a Promise.
5.0.1
The API has been completely revamped to increase clarity and enable a very wide range of new usage. Please read the readme for all the details.
While the defaults remain just as useful as before — and you can still pass no options at all — now you can also do all kinds of wild and crazy things.
- The
loadersoption allows you specify custom functions to derive config objects from files. Your loader functions could parse ES2015 modules or TypeScript, JSON5, even INI or XML. Whatever suits you. - The
searchPlacesoption allows you to specify exactly where cosmiconfig looks within each directory it searches. - The combination of
loadersandsearchPlacesmeans that you should be able to load pretty much any kind of configuration file you want, from wherever you want it to look.
Additionally, the overloaded load() function has been split up into several clear and focused functions:
search()now searches up the directory tree, andload()loads a configuration file that you don't need to search for.- The
syncoption has been replaced with separate synchronous functions:searchSync()andloadSync(). clearFileCache()andclearDirectoryCache()have been renamed toclearLoadCache()andclearSearchPath()respectively.
More details:
- The default JS loader uses
require, instead ofrequire-from-string. So you could userequirehooks to control the loading of JS files (e.g. pass them through esm or Babel). In most cases it is probably preferable to use a custom loader. - The options
rc,js, andrcExtensionshave all been removed. You can accomplish the same and more withsearchPlaces. - The default
searchPlacesincludercfiles with extensions, e.g..thingrc.json,.thingrc.yaml,.thingrc.yml. This is the equivalent of switching the default value of the oldrcExtensionsoption totrue. - The option
rcStrictJsonhas been removed. To get the same effect, you can specifynoExt: cosmiconfig.loadJsonin yourloadersobject. packagePropno longer acceptsfalse. If you don't want to look inpackage.json, write asearchPlacesarray that does not include it.- By default, empty files are ignored by
search(). The new optionignoreEmptySearchPlacesallows you to load them, instead, in case you want to do something with empty files. - The option
configPathhas been removed. Just pass your filepaths directory toload(). - Removed the
formatoption. Formats are now all handled via the file extensions specified inloaders.
(If you're wondering with happened to 5.0.0 ... it was a silly publishing mistake.)
4.0.0
- Licensing improvement: updated
parse-jsonfrom3.0.0to4.0.0(see sindresorhus/parse-json#12). - Changed: error message format for
JSONparse errors(see #101). If you were relying on the format of JSON-parsing error messages, this will be a breaking change for you. - Changed: set default for
searchPathasprocess.cwd()inexplorer.load.
3.1.0
- Added: infer format based on filePath
3.0.1
- Fixed: memory leak due to bug in
require-from-string. - Added: for JSON files, append position to end of error message.
3.0.0
- Removed: support for loading config path using the
--configflag. cosmiconfig will not parse command line arguments. Your application can parse command line arguments and pass them to cosmiconfig. - Removed:
argvconfig option. - Removed: support for Node versions < 4.
- Added:
syncoption. - Fixed: Throw a clear error on getting empty config file.
- Fixed: when a
options.configPathispackage.json, return the package prop, not the entire JSON file.
2.2.2
- Fixed:
options.configPathand--configflag are respected.
2.2.0, 2.2.1
- 2.2.0 included a number of improvements but somehow broke stylelint. The changes were reverted in 2.2.1, to be restored later.
2.1.3
- Licensing improvement: switched from
json-parse-helpfulerrortoparse-json.
2.1.2
- Fixed: bug where an
ENOENTerror would be thrown issearchPathreferenced a non-existent file. - Fixed: JSON parsing errors in Node v7.
2.1.1
- Fixed: swapped
graceful-fsfor regularfs, fixing a garbage collection problem.
2.1.0
- Added: Node 0.12 support.
2.0.2
- Fixed: Node version specified in
package.json.
2.0.1
- Fixed: no more infinite loop in Windows.
2.0.0
- Changed: module now creates cosmiconfig instances with
loadmethods (see README). - Added: caching (enabled by the change above).
- Removed: support for Node versions <4.
1.1.0
- Add
rcExtensionsoption.
1.0.2
- Fix handling of
require()'s within JS module configs.
1.0.1
- Switch Promise implementation to pinkie-promise.
1.0.0
- Initial release.