You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

151 lines
6.0 KiB

4 years ago
  1. # Changelog
  2. ## 5.2.1
  3. - Chore: Upgrade `js-yaml` to avoid npm audit warning.
  4. ## 5.2.0
  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. ## 5.1.0
  9. - Added: `packageProp` values can include periods to describe paths to nested objects within `package.json`.
  10. ## 5.0.7
  11. - 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.
  12. ## 5.0.6
  13. - Fixed: Better error message if the end user tries an extension Cosmiconfig is not configured to understand.
  14. ## 5.0.5
  15. - Fixed: `load` and `loadSync` work with paths relative to `process.cwd()`.
  16. ## 5.0.4
  17. - Fixed: `rc` files with `.js` extensions included in default `searchPlaces`.
  18. ## 5.0.3
  19. - Docs: Minor corrections to documentation. *Released to update package documentation on npm*.
  20. ## 5.0.2
  21. - Fixed: Allow `searchSync` and `loadSync` to load JS configuration files whose export is a Promise.
  22. ## 5.0.1
  23. 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.**
  24. 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.
  25. - 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.
  26. - The `searchPlaces` option allows you to specify exactly where cosmiconfig looks within each directory it searches.
  27. - 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.
  28. Additionally, the overloaded `load()` function has been split up into several clear and focused functions:
  29. - `search()` now searches up the directory tree, and `load()` loads a configuration file that you don't need to search for.
  30. - The `sync` option has been replaced with separate synchronous functions: `searchSync()` and `loadSync()`.
  31. - `clearFileCache()` and `clearDirectoryCache()` have been renamed to `clearLoadCache()` and `clearSearchPath()` respectively.
  32. More details:
  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. (If you're wondering with happened to 5.0.0 ... it was a silly publishing mistake.)
  42. ## 4.0.0
  43. - Licensing improvement: updated `parse-json` from `3.0.0` to `4.0.0`(see [sindresorhus/parse-json#12][parse-json-pr-12]).
  44. - 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.
  45. - Changed: set default for `searchPath` as `process.cwd()` in `explorer.load`.
  46. ## 3.1.0
  47. - Added: infer format based on filePath
  48. ## 3.0.1
  49. - Fixed: memory leak due to bug in `require-from-string`.
  50. - Added: for JSON files, append position to end of error message.
  51. ## 3.0.0
  52. - 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.
  53. - Removed: `argv` config option.
  54. - Removed: support for Node versions < 4.
  55. - Added: `sync` option.
  56. - Fixed: Throw a clear error on getting empty config file.
  57. - Fixed: when a `options.configPath` is `package.json`, return the package prop, not the entire JSON file.
  58. ## 2.2.2
  59. - Fixed: `options.configPath` and `--config` flag are respected.
  60. ## 2.2.0, 2.2.1
  61. - 2.2.0 included a number of improvements but somehow broke stylelint. The changes were reverted in 2.2.1, to be restored later.
  62. ## 2.1.3
  63. - Licensing improvement: switched from `json-parse-helpfulerror` to `parse-json`.
  64. ## 2.1.2
  65. - Fixed: bug where an `ENOENT` error would be thrown is `searchPath` referenced a non-existent file.
  66. - Fixed: JSON parsing errors in Node v7.
  67. ## 2.1.1
  68. - Fixed: swapped `graceful-fs` for regular `fs`, fixing a garbage collection problem.
  69. ## 2.1.0
  70. - Added: Node 0.12 support.
  71. ## 2.0.2
  72. - Fixed: Node version specified in `package.json`.
  73. ## 2.0.1
  74. - Fixed: no more infinite loop in Windows.
  75. ## 2.0.0
  76. - Changed: module now creates cosmiconfig instances with `load` methods (see README).
  77. - Added: caching (enabled by the change above).
  78. - Removed: support for Node versions <4.
  79. ## 1.1.0
  80. - Add `rcExtensions` option.
  81. ## 1.0.2
  82. - Fix handling of `require()`'s within JS module configs.
  83. ## 1.0.1
  84. - Switch Promise implementation to pinkie-promise.
  85. ## 1.0.0
  86. - Initial release.
  87. [parse-json-pr-12]: https://github.com/sindresorhus/parse-json/pull/12
  88. [pr-101]: https://github.com/davidtheclark/cosmiconfig/pull/101