Releases: jaywcjlove/auto-config-loader
v2.0.2
Documentation v2.0.2: https://raw.githack.com/jaywcjlove/auto-config-loader/e3ec651/index.html
npm i [email protected]
- 📖 doc: update document. 50b1fee @jaywcjlove
v2.0.1
Documentation v2.0.1: https://raw.githack.com/jaywcjlove/auto-config-loader/61285d8/index.html
npm i [email protected]
- 📖 doc: update document. ac39e72 @jaywcjlove
v2.0.0
Documentation v2.0.0: https://raw.githack.com/jaywcjlove/auto-config-loader/790defe/index.html
npm i [email protected]
- test: update test case. @jaywcjlove
- fix: ensure consistent handling of default exports across platforms. @jaywcjlove
- fix: ensure consistent handling of default exports across platforms. @jaywcjlove
- fix(deps): update dependency jiti to v2 #13 @jaywcjlove
V1 To V2 Migration
This guide provides the steps to migrate to the latest version of the configuration loader API.
Key Changes
-
Loader Functions Support Async
LoaderFunc<T>
now supports returningT
orPromise<T>
.- Update custom loaders to handle asynchronous operations if needed.
Example:
export type LoaderFunc<T> = ( filepath: string, content: string, jsOption?: LoadConfOption ) => T | Promise<T>;
-
autoConf
Returns a Promise- The
autoConf
function now returns aPromise
instead of a synchronous result. - Update your code to handle asynchronous calls.
Example:
export declare function autoConf<T>( namespace?: string, option?: AutoConfOption<T> ): Promise<{} & T>;
- The
Migration Steps
1. Update Custom Loader Functions
If you have custom loaders, update their return types to support asynchronous operations:
Example:
const jsonLoader: LoaderFunc<MyConfig> = async (
filepath, content
) => JSON.parse(content);
2. Handle Asynchronous autoConf
Calls
Update all calls to autoConf
to use await
or .then
to handle Promises:
Example Using await
:
const config = await autoConf('myNamespace', options);
console.log(config);
Example Using .then
:
autoConf('myNamespace', options).then(config => {
console.log(config);
});
v1.7.8
Documentation v1.7.8: https://raw.githack.com/jaywcjlove/auto-config-loader/216556f/index.html
npm i auto-config-loader@
v1.7.7
Documentation v1.7.7: https://raw.githack.com/jaywcjlove/auto-config-loader/736b00a/index.html
npm i auto-config-loader@
v1.7.6
Documentation v1.7.6: https://raw.githack.com/jaywcjlove/auto-config-loader/0254cd8/index.html
npm i [email protected]
- 💄 chore: add sponsor badge. ddedaf7 @jaywcjlove
v1.7.5
Documentation v1.7.5: https://raw.githack.com/jaywcjlove/auto-config-loader/8ada4f2/index.html
npm i [email protected]
- 📖 doc: Update README.md 2e84def @jaywcjlove
- 📖 doc: Update README.md 0896d0e @jaywcjlove
- 📖 doc: Update README.md c5fba91 @jaywcjlove
- 🐞 fix(deps): update dependency prettier to v3 (#3) 26fc592 @renovate-bot
- 🐞 fix(deps): update dependency toml-eslint-parser to ^0.7.0 (#6) be5d003 @renovate-bot
- 💄 chore: update workflows config. 743f9d3 @jaywcjlove
v1.7.4
Documentation v1.7.4: https://raw.githack.com/jaywcjlove/auto-config-loader/d1b70cb/index.html
npm i [email protected]
- 💄 chore: fix wrong config loading prompt. e6a5741 @jaywcjlove
v1.7.3
Documentation v1.7.3: https://raw.githack.com/jaywcjlove/auto-config-loader/f2e2e6f/index.html
npm i [email protected]
- 🐞 fix: fix
mustExist
option issue. 586e366 @jaywcjlove - 🐞 fix: fix
mustExist
option issue. de46dc5 @jaywcjlove
v1.7.2
Documentation v1.7.2: https://raw.githack.com/jaywcjlove/auto-config-loader/cf3fb70/index.html
npm i [email protected]
- 💄 chore: update workflows config. 22b0d4e @jaywcjlove
- ⛑ test: add test case. add7ae0 @jaywcjlove
- 🐞 fix: fix
mustExist
option issue. 4387779 @jaywcjlove - 💄 chore(deps): update dependency lerna to v7 c14c18f @jaywcjlove