UNPKG

5.27 kBMarkdownView Raw
1# Changelog
2
3## 5.0.4
4
5- Fixed: `rc` files with `.js` extensions included in default `searchPlaces`.
6
7## 5.0.3
8
9- Docs: Minor corrections to documentation. *Released to update package documentation on npm*.
10
11## 5.0.2
12
13- Fixed: Allow `searchSync` and `loadSync` to load JS configuration files whose export is a Promise.
14
15## 5.0.1
16
17The 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.**
18
19While 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.
20
21- The `loaders` option 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.
22- The `searchPlaces` option allows you to specify exactly where cosmiconfig looks within each directory it searches.
23- The combination of `loaders` and `searchPlaces` means that you should be able to load pretty much any kind of configuration file you want, from wherever you want it to look.
24
25Additionally, the overloaded `load()` function has been split up into several clear and focused functions:
26
27- `search()` now searches up the directory tree, and `load()` loads a configuration file that you don't need to search for.
28- The `sync` option has been replaced with separate synchronous functions: `searchSync()` and `loadSync()`.
29- `clearFileCache()` and `clearDirectoryCache()` have been renamed to `clearLoadCache()` and `clearSearchPath()` respectively.
30
31More details:
32
33- The default JS loader uses `require`, instead of `require-from-string`. So you *could* use `require` hooks 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.
34- The options `rc`, `js`, and `rcExtensions` have all been removed. You can accomplish the same and more with `searchPlaces`.
35- The default `searchPlaces` include `rc` files with extensions, e.g. `.thingrc.json`, `.thingrc.yaml`, `.thingrc.yml`. This is the equivalent of switching the default value of the old `rcExtensions` option to `true`.
36- The option `rcStrictJson` has been removed. To get the same effect, you can specify `noExt: cosmiconfig.loadJson` in your `loaders` object.
37- `packageProp` no longer accepts `false`. If you don't want to look in `package.json`, write a `searchPlaces` array that does not include it.
38- By default, empty files are ignored by `search()`. The new option `ignoreEmptySearchPlaces` allows you to load them, instead, in case you want to do something with empty files.
39- The option `configPath` has been removed. Just pass your filepaths directory to `load()`.
40- Removed the `format` option. Formats are now all handled via the file extensions specified in `loaders`.
41
42(If you're wondering with happened to 5.0.0 ... it was a silly publishing mistake.)
43
44## 4.0.0
45
46- Licensing improvement: updated `parse-json` from `3.0.0` to `4.0.0`(see [sindresorhus/parse-json#12][parse-json-pr-12]).
47- Changed: error message format for `JSON` parse errors(see [#101][pr-101]). If you were relying on the format of JSON-parsing error messages, this will be a breaking change for you.
48- Changed: set default for `searchPath` as `process.cwd()` in `explorer.load`.
49
50## 3.1.0
51
52- Added: infer format based on filePath
53
54## 3.0.1
55
56- Fixed: memory leak due to bug in `require-from-string`.
57- Added: for JSON files, append position to end of error message.
58
59## 3.0.0
60
61- Removed: support for loading config path using the `--config` flag. cosmiconfig will not parse command line arguments. Your application can parse command line arguments and pass them to cosmiconfig.
62- Removed: `argv` config option.
63- Removed: support for Node versions < 4.
64- Added: `sync` option.
65- Fixed: Throw a clear error on getting empty config file.
66- Fixed: when a `options.configPath` is `package.json`, return the package prop, not the entire JSON file.
67
68## 2.2.2
69
70- Fixed: `options.configPath` and `--config` flag are respected.
71
72## 2.2.0, 2.2.1
73
74- 2.2.0 included a number of improvements but somehow broke stylelint. The changes were reverted in 2.2.1, to be restored later.
75
76## 2.1.3
77
78- Licensing improvement: switched from `json-parse-helpfulerror` to `parse-json`.
79
80## 2.1.2
81
82- Fixed: bug where an `ENOENT` error would be thrown is `searchPath` referenced a non-existent file.
83- Fixed: JSON parsing errors in Node v7.
84
85## 2.1.1
86
87- Fixed: swapped `graceful-fs` for regular `fs`, fixing a garbage collection problem.
88
89## 2.1.0
90
91- Added: Node 0.12 support.
92
93## 2.0.2
94
95- Fixed: Node version specified in `package.json`.
96
97## 2.0.1
98
99- Fixed: no more infinite loop in Windows.
100
101## 2.0.0
102
103- Changed: module now creates cosmiconfig instances with `load` methods (see README).
104- Added: caching (enabled by the change above).
105- Removed: support for Node versions <4.
106
107## 1.1.0
108
109- Add `rcExtensions` option.
110
111## 1.0.2
112
113- Fix handling of `require()`'s within JS module configs.
114
115## 1.0.1
116
117- Switch Promise implementation to pinkie-promise.
118
119## 1.0.0
120
121- Initial release.
122
123[parse-json-pr-12]: https://github.com/sindresorhus/parse-json/pull/12
124
125[pr-101]: https://github.com/davidtheclark/cosmiconfig/pull/101