@reelout/config 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -0
- package/dist/index.js +4 -8
- package/dist/index.js.map +1 -1
- package/package.json +8 -7
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# @reelout/config
|
|
2
|
+
|
|
3
|
+
Configuration discovery and normalization for
|
|
4
|
+
[ReelOut](https://github.com/reelout/reelout). The package uses
|
|
5
|
+
[cosmiconfig](https://github.com/cosmiconfig/cosmiconfig) to find user settings,
|
|
6
|
+
merges them with the defaults, and normalizes the result.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install @reelout/config
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
This ESM-only package requires Node.js `>=24.15`.
|
|
15
|
+
|
|
16
|
+
## API
|
|
17
|
+
|
|
18
|
+
- `resolveConfig(cwd, name?)` — find configuration for a directory, merge it with the defaults, and normalize it.
|
|
19
|
+
- `defaultConfig` — the built-in default configuration.
|
|
20
|
+
- `mergeConfig(defaults, config)` — merge user configuration over defaults.
|
|
21
|
+
- `normalizeConfig(cwd, config)` — normalize a configuration object, including its author, release rules, and plugins.
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { resolveConfig } from '@reelout/config'
|
|
25
|
+
|
|
26
|
+
const config = await resolveConfig(process.cwd())
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Documentation
|
|
30
|
+
|
|
31
|
+
- [Configuration guide](https://github.com/reelout/reelout/blob/main/docs/02-config.md)
|
|
32
|
+
- [API reference](https://reelout.overview.vercel.app/)
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { assignWith } from "lodash-es";
|
|
2
2
|
import { compact, normalizeCommitFilter, normalizeReleaseRule, resolvePlugin } from "@reelout/core";
|
|
3
3
|
import { cosmiconfig } from "cosmiconfig";
|
|
4
|
-
|
|
4
|
+
// src/defaultConfig.ts
|
|
5
5
|
/**
|
|
6
6
|
* Default release configuration used when no user config is provided.
|
|
7
7
|
*
|
|
@@ -51,8 +51,7 @@ var defaultConfig = Object.freeze({
|
|
|
51
51
|
"@reelout/github"
|
|
52
52
|
]
|
|
53
53
|
});
|
|
54
|
-
|
|
55
|
-
//#region src/mergeConfig.ts
|
|
54
|
+
// src/mergeConfig.ts
|
|
56
55
|
/**
|
|
57
56
|
* Merge a user configuration into the defaults, preserving unspecified keys.
|
|
58
57
|
*
|
|
@@ -68,8 +67,7 @@ function mergeConfig(defaultConfig, userConfig) {
|
|
|
68
67
|
if (srcValue === void 0) return objValue;
|
|
69
68
|
});
|
|
70
69
|
}
|
|
71
|
-
|
|
72
|
-
//#region src/normalizeConfig.ts
|
|
70
|
+
// src/normalizeConfig.ts
|
|
73
71
|
/**
|
|
74
72
|
* Normalize and resolve a release configuration.
|
|
75
73
|
*
|
|
@@ -106,8 +104,7 @@ async function normalizeConfig(cwd, config) {
|
|
|
106
104
|
plugins
|
|
107
105
|
};
|
|
108
106
|
}
|
|
109
|
-
|
|
110
|
-
//#region src/resolveConfig.ts
|
|
107
|
+
// src/resolveConfig.ts
|
|
111
108
|
/**
|
|
112
109
|
* Resolve and normalize a release configuration for a target directory.
|
|
113
110
|
*
|
|
@@ -121,7 +118,6 @@ async function normalizeConfig(cwd, config) {
|
|
|
121
118
|
async function resolveConfig(cwd, name = "reelout") {
|
|
122
119
|
return normalizeConfig(cwd, mergeConfig(defaultConfig, (await cosmiconfig(name).search(cwd))?.config));
|
|
123
120
|
}
|
|
124
|
-
//#endregion
|
|
125
121
|
export { defaultConfig, mergeConfig, normalizeConfig, resolveConfig };
|
|
126
122
|
|
|
127
123
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/defaultConfig.ts","../src/mergeConfig.ts","../src/normalizeConfig.ts","../src/resolveConfig.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\nimport type { ReleaseConfig } from '@reelout/core'\n\n/**\n * Default release configuration used when no user config is provided.\n *\n * Includes defaults for user identity, workspace layout, release rules,\n * commit-to-release mappings, and built-in plugins.\n */\nexport const defaultConfig = Object.freeze({\n author: {\n name: 'github-actions[bot]',\n email: '41898282+github-actions[bot]@users.noreply.github.com',\n },\n classifier: {\n major: [],\n minor: ['feat'],\n patch: ['fix', 'perf', 'revert'],\n },\n rules: [\n { type: 'branch', pattern: 'alpha', qualifier: 'alpha', channel: 'alpha' },\n { type: 'branch', pattern: 'beta', qualifier: 'beta', channel: 'beta' },\n { type: 'branch', pattern: 'next', qualifier: 'next', channel: 'next' },\n ],\n plugins: [\n '@reelout/core/analyzer', // Analyze the commits and determine the release type.\n '@reelout/core/builder', // Build the release artifacts.\n '@reelout/core/changelog', // Generate and write changelog entries for each release.\n '@reelout/npm', // Update package manifests and publish packages to npm.\n '@reelout/git', // Create release commits and tags, then push them.\n '@reelout/github', // Create GitHub releases from finalized plans.\n ],\n} satisfies Required<ReleaseConfig>)\n","// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\nimport { assignWith } from 'lodash-es'\n\n/**\n * Merge a user configuration into the defaults, preserving unspecified keys.\n *\n * Uses `lodash.assignWith` to avoid overwriting default values with\n * `undefined` from the user configuration.\n *\n * @param defaultConfig Default configuration object\n * @param userConfig Partial user-provided configuration\n * @returns Merged configuration object\n */\nexport function mergeConfig<T>(\n defaultConfig: T,\n userConfig: Partial<T> | null | undefined\n): T {\n return assignWith({}, defaultConfig, userConfig, (objValue, srcValue) => {\n if (srcValue === undefined) {\n return objValue\n }\n })\n}\n","// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\nimport {\n compact,\n normalizeCommitFilter,\n normalizeReleaseRule,\n resolvePlugin,\n type GitAuthor,\n type ReleaseConfig,\n type ResolvedReleaseConfig,\n} from '@reelout/core'\nimport { defaultConfig } from './defaultConfig'\n\n/**\n * Normalize and resolve a release configuration.\n *\n * Applies default author settings when incomplete, normalizes commit filters\n * and release rules, and loads specified plugins.\n *\n * @param cwd Working directory path used for plugin resolution\n * @param config User-supplied release configuration\n * @returns Resolved and normalized release configuration\n * @throws If a configured plugin cannot be resolved\n */\nexport async function normalizeConfig(\n cwd: string,\n config: Required<ReleaseConfig>\n): Promise<ResolvedReleaseConfig> {\n const author: GitAuthor =\n config.author.name && config.author.email\n ? { name: config.author.name, email: config.author.email }\n : { ...defaultConfig.author }\n\n const classifier = normalizeCommitFilter(config.classifier)\n\n const rules = compact(config.rules.map((rule) => normalizeReleaseRule(rule)))\n\n const plugins = compact(\n await Promise.all(\n config.plugins.map(async (plugin) => {\n try {\n return await resolvePlugin(cwd, plugin)\n } catch (err) {\n try {\n return await resolvePlugin(import.meta.filename, plugin)\n } catch {}\n\n throw err\n }\n })\n )\n )\n\n return {\n ...config,\n author,\n classifier,\n rules,\n plugins,\n }\n}\n","// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\nimport type { ReleaseConfig, ResolvedReleaseConfig } from '@reelout/core'\nimport { cosmiconfig } from 'cosmiconfig'\nimport { defaultConfig } from './defaultConfig'\nimport { mergeConfig } from './mergeConfig'\nimport { normalizeConfig } from './normalizeConfig'\n\n/**\n * Resolve and normalize a release configuration for a target directory.\n *\n * Searches for configuration files using `cosmiconfig`, merges discovered user\n * settings with default configurations, and normalizes the resulting structure.\n *\n * @param cwd Working directory path to search from\n * @param name Module name used for configuration file discovery\n * @returns Resolved and normalized release configuration\n */\nexport async function resolveConfig(\n cwd: string,\n name = 'reelout'\n): Promise<ResolvedReleaseConfig> {\n const explorer = cosmiconfig(name)\n\n const result = await explorer.search(cwd)\n\n const config = mergeConfig<Required<ReleaseConfig>>(\n defaultConfig,\n result?.config\n )\n\n return normalizeConfig(cwd, config)\n}\n"],"mappings":";;;;;;;;;;AAWA,IAAa,gBAAgB,OAAO,OAAO;CACzC,QAAQ;EACN,MAAM;EACN,OAAO;CACT;CACA,YAAY;EACV,OAAO,CAAC;EACR,OAAO,CAAC,MAAM;EACd,OAAO;GAAC;GAAO;GAAQ;EAAQ;CACjC;CACA,OAAO;EACL;GAAE,MAAM;GAAU,SAAS;GAAS,WAAW;GAAS,SAAS;EAAQ;EACzE;GAAE,MAAM;GAAU,SAAS;GAAQ,WAAW;GAAQ,SAAS;EAAO;EACtE;GAAE,MAAM;GAAU,SAAS;GAAQ,WAAW;GAAQ,SAAS;EAAO;CACxE;CACA,SAAS;EACP;EACA;EACA;EACA;EACA;EACA;CACF;AACF,CAAmC
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/defaultConfig.ts","../src/mergeConfig.ts","../src/normalizeConfig.ts","../src/resolveConfig.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\nimport type { ReleaseConfig } from '@reelout/core'\n\n/**\n * Default release configuration used when no user config is provided.\n *\n * Includes defaults for user identity, workspace layout, release rules,\n * commit-to-release mappings, and built-in plugins.\n */\nexport const defaultConfig = Object.freeze({\n author: {\n name: 'github-actions[bot]',\n email: '41898282+github-actions[bot]@users.noreply.github.com',\n },\n classifier: {\n major: [],\n minor: ['feat'],\n patch: ['fix', 'perf', 'revert'],\n },\n rules: [\n { type: 'branch', pattern: 'alpha', qualifier: 'alpha', channel: 'alpha' },\n { type: 'branch', pattern: 'beta', qualifier: 'beta', channel: 'beta' },\n { type: 'branch', pattern: 'next', qualifier: 'next', channel: 'next' },\n ],\n plugins: [\n '@reelout/core/analyzer', // Analyze the commits and determine the release type.\n '@reelout/core/builder', // Build the release artifacts.\n '@reelout/core/changelog', // Generate and write changelog entries for each release.\n '@reelout/npm', // Update package manifests and publish packages to npm.\n '@reelout/git', // Create release commits and tags, then push them.\n '@reelout/github', // Create GitHub releases from finalized plans.\n ],\n} satisfies Required<ReleaseConfig>)\n","// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\nimport { assignWith } from 'lodash-es'\n\n/**\n * Merge a user configuration into the defaults, preserving unspecified keys.\n *\n * Uses `lodash.assignWith` to avoid overwriting default values with\n * `undefined` from the user configuration.\n *\n * @param defaultConfig Default configuration object\n * @param userConfig Partial user-provided configuration\n * @returns Merged configuration object\n */\nexport function mergeConfig<T>(\n defaultConfig: T,\n userConfig: Partial<T> | null | undefined\n): T {\n return assignWith({}, defaultConfig, userConfig, (objValue, srcValue) => {\n if (srcValue === undefined) {\n return objValue\n }\n })\n}\n","// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\nimport {\n compact,\n normalizeCommitFilter,\n normalizeReleaseRule,\n resolvePlugin,\n type GitAuthor,\n type ReleaseConfig,\n type ResolvedReleaseConfig,\n} from '@reelout/core'\nimport { defaultConfig } from './defaultConfig'\n\n/**\n * Normalize and resolve a release configuration.\n *\n * Applies default author settings when incomplete, normalizes commit filters\n * and release rules, and loads specified plugins.\n *\n * @param cwd Working directory path used for plugin resolution\n * @param config User-supplied release configuration\n * @returns Resolved and normalized release configuration\n * @throws If a configured plugin cannot be resolved\n */\nexport async function normalizeConfig(\n cwd: string,\n config: Required<ReleaseConfig>\n): Promise<ResolvedReleaseConfig> {\n const author: GitAuthor =\n config.author.name && config.author.email\n ? { name: config.author.name, email: config.author.email }\n : { ...defaultConfig.author }\n\n const classifier = normalizeCommitFilter(config.classifier)\n\n const rules = compact(config.rules.map((rule) => normalizeReleaseRule(rule)))\n\n const plugins = compact(\n await Promise.all(\n config.plugins.map(async (plugin) => {\n try {\n return await resolvePlugin(cwd, plugin)\n } catch (err) {\n try {\n return await resolvePlugin(import.meta.filename, plugin)\n } catch {}\n\n throw err\n }\n })\n )\n )\n\n return {\n ...config,\n author,\n classifier,\n rules,\n plugins,\n }\n}\n","// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\nimport type { ReleaseConfig, ResolvedReleaseConfig } from '@reelout/core'\nimport { cosmiconfig } from 'cosmiconfig'\nimport { defaultConfig } from './defaultConfig'\nimport { mergeConfig } from './mergeConfig'\nimport { normalizeConfig } from './normalizeConfig'\n\n/**\n * Resolve and normalize a release configuration for a target directory.\n *\n * Searches for configuration files using `cosmiconfig`, merges discovered user\n * settings with default configurations, and normalizes the resulting structure.\n *\n * @param cwd Working directory path to search from\n * @param name Module name used for configuration file discovery\n * @returns Resolved and normalized release configuration\n */\nexport async function resolveConfig(\n cwd: string,\n name = 'reelout'\n): Promise<ResolvedReleaseConfig> {\n const explorer = cosmiconfig(name)\n\n const result = await explorer.search(cwd)\n\n const config = mergeConfig<Required<ReleaseConfig>>(\n defaultConfig,\n result?.config\n )\n\n return normalizeConfig(cwd, config)\n}\n"],"mappings":";;;;;;;;;;AAWA,IAAa,gBAAgB,OAAO,OAAO;CACzC,QAAQ;EACN,MAAM;EACN,OAAO;CACT;CACA,YAAY;EACV,OAAO,CAAC;EACR,OAAO,CAAC,MAAM;EACd,OAAO;GAAC;GAAO;GAAQ;EAAQ;CACjC;CACA,OAAO;EACL;GAAE,MAAM;GAAU,SAAS;GAAS,WAAW;GAAS,SAAS;EAAQ;EACzE;GAAE,MAAM;GAAU,SAAS;GAAQ,WAAW;GAAQ,SAAS;EAAO;EACtE;GAAE,MAAM;GAAU,SAAS;GAAQ,WAAW;GAAQ,SAAS;EAAO;CACxE;CACA,SAAS;EACP;EACA;EACA;EACA;EACA;EACA;CACF;AACF,CAAmC;;;;;;;;;;;;ACnBnC,SAAgB,YACd,eACA,YACG;CACH,OAAO,WAAW,CAAC,GAAG,eAAe,aAAa,UAAU,aAAa;EACvE,IAAI,aAAa,KAAA,GACf,OAAO;CAEX,CAAC;AACH;;;;;;;;;;;;;ACCA,eAAsB,gBACpB,KACA,QACgC;CAChC,MAAM,SACJ,OAAO,OAAO,QAAQ,OAAO,OAAO,QAChC;EAAE,MAAM,OAAO,OAAO;EAAM,OAAO,OAAO,OAAO;CAAM,IACvD,EAAE,GAAG,cAAc,OAAO;CAEhC,MAAM,aAAa,sBAAsB,OAAO,UAAU;CAE1D,MAAM,QAAQ,QAAQ,OAAO,MAAM,KAAK,SAAS,qBAAqB,IAAI,CAAC,CAAC;CAE5E,MAAM,UAAU,QACd,MAAM,QAAQ,IACZ,OAAO,QAAQ,IAAI,OAAO,WAAW;EACnC,IAAI;GACF,OAAO,MAAM,cAAc,KAAK,MAAM;EACxC,SAAS,KAAK;GACZ,IAAI;IACF,OAAO,MAAM,cAAc,YAAY,UAAU,MAAM;GACzD,QAAQ,CAAC;GAET,MAAM;EACR;CACF,CAAC,CACH,CACF;CAEA,OAAO;EACL,GAAG;EACH;EACA;EACA;EACA;CACF;AACF;;;;;;;;;;;;AC1CA,eAAsB,cACpB,KACA,OAAO,WACyB;CAUhC,OAAO,gBAAgB,KALR,YACb,gBACA,MANe,YAAY,IAER,CAAA,CAAS,OAAO,GAAG,EAItC,EAAQ,MAGkB,CAAM;AACpC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reelout/config",
|
|
3
|
-
"version": "0.4.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.4.2",
|
|
4
|
+
"description": "Discovers, merges, and normalizes ReelOut configuration, including plugin registrations.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/
|
|
7
|
+
"url": "git+https://github.com/reelout/reelout.git",
|
|
8
8
|
"directory": "packages/config"
|
|
9
9
|
},
|
|
10
10
|
"license": "MIT",
|
|
@@ -32,10 +32,11 @@
|
|
|
32
32
|
"./src"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@reelout/core": "^0.5.
|
|
36
|
-
"@reelout/git": "^0.4.
|
|
37
|
-
"@reelout/github": "^0.4.
|
|
38
|
-
"@reelout/
|
|
35
|
+
"@reelout/core": "^0.5.1",
|
|
36
|
+
"@reelout/git": "^0.4.2",
|
|
37
|
+
"@reelout/github": "^0.4.2",
|
|
38
|
+
"@reelout/gitlab": "^0.4.2",
|
|
39
|
+
"@reelout/npm": "^0.5.1",
|
|
39
40
|
"cosmiconfig": "^10.0.1",
|
|
40
41
|
"lodash-es": "^4.18.1"
|
|
41
42
|
},
|