UNPKG

6.09 kBMarkdownView Raw
1# Changelog
2
3## 5.2.0
4
5- Added: `packageProp` values can be arrays of strings, to allow for property names that include periods. (This was possible before, but not documented or deliberately supported.)
6- Chore: Replaced the `lodash.get` dependency with a locally defined function.
7- Chore: Upgrade `js-yaml` to avoid npm audit warning.
8
9## 5.1.0
10
11- Added: `packageProp` values can include periods to describe paths to nested objects within `package.json`.
12
13## 5.0.7
14
15- Fixed: JS loader bypasses Node's `require` cache, fixing a bug where updates to `.js` config files would not load even when Cosmiconfig was told not to cache.
16
17## 5.0.6
18
19- Fixed: Better error message if the end user tries an extension Cosmiconfig is not configured to understand.
20
21## 5.0.5
22
23- Fixed: `load` and `loadSync` work with paths relative to `process.cwd()`.
24
25## 5.0.4
26
27- Fixed: `rc` files with `.js` extensions included in default `searchPlaces`.
28
29## 5.0.3
30
31- Docs: Minor corrections to documentation. *Released to update package documentation on npm*.
32
33## 5.0.2
34
35- Fixed: Allow `searchSync` and `loadSync` to load JS configuration files whose export is a Promise.
36
37## 5.0.1
38
39The 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.**
40
41While 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.
42
43- 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.
44- The `searchPlaces` option allows you to specify exactly where cosmiconfig looks within each directory it searches.
45- 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.
46
47Additionally, the overloaded `load()` function has been split up into several clear and focused functions:
48
49- `search()` now searches up the directory tree, and `load()` loads a configuration file that you don't need to search for.
50- The `sync` option has been replaced with separate synchronous functions: `searchSync()` and `loadSync()`.
51- `clearFileCache()` and `clearDirectoryCache()` have been renamed to `clearLoadCache()` and `clearSearchPath()` respectively.
52
53More details:
54
55- 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.
56- The options `rc`, `js`, and `rcExtensions` have all been removed. You can accomplish the same and more with `searchPlaces`.
57- 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`.
58- The option `rcStrictJson` has been removed. To get the same effect, you can specify `noExt: cosmiconfig.loadJson` in your `loaders` object.
59- `packageProp` no longer accepts `false`. If you don't want to look in `package.json`, write a `searchPlaces` array that does not include it.
60- 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.
61- The option `configPath` has been removed. Just pass your filepaths directory to `load()`.
62- Removed the `format` option. Formats are now all handled via the file extensions specified in `loaders`.
63
64(If you're wondering with happened to 5.0.0 ... it was a silly publishing mistake.)
65
66## 4.0.0
67
68- Licensing improvement: updated `parse-json` from `3.0.0` to `4.0.0`(see [sindresorhus/parse-json#12][parse-json-pr-12]).
69- 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.
70- Changed: set default for `searchPath` as `process.cwd()` in `explorer.load`.
71
72## 3.1.0
73
74- Added: infer format based on filePath
75
76## 3.0.1
77
78- Fixed: memory leak due to bug in `require-from-string`.
79- Added: for JSON files, append position to end of error message.
80
81## 3.0.0
82
83- 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.
84- Removed: `argv` config option.
85- Removed: support for Node versions < 4.
86- Added: `sync` option.
87- Fixed: Throw a clear error on getting empty config file.
88- Fixed: when a `options.configPath` is `package.json`, return the package prop, not the entire JSON file.
89
90## 2.2.2
91
92- Fixed: `options.configPath` and `--config` flag are respected.
93
94## 2.2.0, 2.2.1
95
96- 2.2.0 included a number of improvements but somehow broke stylelint. The changes were reverted in 2.2.1, to be restored later.
97
98## 2.1.3
99
100- Licensing improvement: switched from `json-parse-helpfulerror` to `parse-json`.
101
102## 2.1.2
103
104- Fixed: bug where an `ENOENT` error would be thrown is `searchPath` referenced a non-existent file.
105- Fixed: JSON parsing errors in Node v7.
106
107## 2.1.1
108
109- Fixed: swapped `graceful-fs` for regular `fs`, fixing a garbage collection problem.
110
111## 2.1.0
112
113- Added: Node 0.12 support.
114
115## 2.0.2
116
117- Fixed: Node version specified in `package.json`.
118
119## 2.0.1
120
121- Fixed: no more infinite loop in Windows.
122
123## 2.0.0
124
125- Changed: module now creates cosmiconfig instances with `load` methods (see README).
126- Added: caching (enabled by the change above).
127- Removed: support for Node versions <4.
128
129## 1.1.0
130
131- Add `rcExtensions` option.
132
133## 1.0.2
134
135- Fix handling of `require()`'s within JS module configs.
136
137## 1.0.1
138
139- Switch Promise implementation to pinkie-promise.
140
141## 1.0.0
142
143- Initial release.
144
145[parse-json-pr-12]: https://github.com/sindresorhus/parse-json/pull/12
146
147[pr-101]: https://github.com/davidtheclark/cosmiconfig/pull/101