@changesets/config
Advanced tools
Comparing version 2.0.1 to 2.1.0
# @changesets/config | ||
## 2.1.0 | ||
### Minor Changes | ||
- [#858](https://github.com/changesets/changesets/pull/858) [`dd9b76f`](https://github.com/changesets/changesets/commit/dd9b76f162a546ae8b412e0cb10277f971f3585e) Thanks [@dotansimha](https://github.com/dotansimha)! - Added a new config option: `snapshot.prereleaseTemplate` for customizing the way snapshot release numbers are being composed. | ||
### Patch Changes | ||
- [#858](https://github.com/changesets/changesets/pull/858) [`dd9b76f`](https://github.com/changesets/changesets/commit/dd9b76f162a546ae8b412e0cb10277f971f3585e) Thanks [@dotansimha](https://github.com/dotansimha)! - A possibility to use the calculated version for snapshot releases is now stable 🥳 All snapshot-related config parameters are now grouped under a single config property called `snapshot`. | ||
To migrate, make sure to update your `config.json`. | ||
Old usage (still works, but comes with a deprecated warning): | ||
```json | ||
{ | ||
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": { | ||
"useCalculatedVersionForSnapshots": true | ||
} | ||
} | ||
``` | ||
New usage: | ||
```json | ||
{ | ||
"snapshot": { | ||
"useCalculatedVersion": true | ||
} | ||
} | ||
``` | ||
- Updated dependencies [[`dd9b76f`](https://github.com/changesets/changesets/commit/dd9b76f162a546ae8b412e0cb10277f971f3585e)]: | ||
- @changesets/types@5.1.0 | ||
- @changesets/get-dependents-graph@1.3.3 | ||
## 2.0.1 | ||
@@ -4,0 +40,0 @@ |
@@ -19,3 +19,3 @@ 'use strict'; | ||
name: "@changesets/config", | ||
version: "2.0.1", | ||
version: "2.1.0", | ||
description: "Utilities for reading and parsing Changeset's config", | ||
@@ -32,5 +32,5 @@ main: "dist/config.cjs.js", | ||
"@changesets/errors": "^0.1.4", | ||
"@changesets/get-dependents-graph": "^1.3.2", | ||
"@changesets/get-dependents-graph": "^1.3.3", | ||
"@changesets/logger": "^0.0.5", | ||
"@changesets/types": "^5.0.0", | ||
"@changesets/types": "^5.1.0", | ||
"@manypkg/get-packages": "^1.1.3", | ||
@@ -112,3 +112,3 @@ "fs-extra": "^7.0.1", | ||
let parse = (json, packages) => { | ||
var _json$___experimental, _json$___experimental2; | ||
var _json$snapshot$prerel, _json$snapshot, _json$snapshot2, _json$___experimental, _json$___experimental2, _json$___experimental3, _json$___experimental4; | ||
@@ -237,2 +237,16 @@ let messages = []; | ||
const { | ||
snapshot | ||
} = json; | ||
if (snapshot !== undefined) { | ||
if (snapshot.useCalculatedVersion !== undefined && typeof snapshot.useCalculatedVersion !== "boolean") { | ||
messages.push(`The \`snapshot.useCalculatedVersion\` option is set as ${JSON.stringify(snapshot.useCalculatedVersion, null, 2)} when the only valid values are undefined or a boolean`); | ||
} | ||
if (snapshot.prereleaseTemplate !== undefined && typeof snapshot.prereleaseTemplate !== "string") { | ||
messages.push(`The \`snapshot.prereleaseTemplate\` option is set as ${JSON.stringify(snapshot.prereleaseTemplate, null, 2)} when the only valid values are undefined, or a template string.`); | ||
} | ||
} | ||
if (json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH !== undefined) { | ||
@@ -253,4 +267,8 @@ const { | ||
if (useCalculatedVersionForSnapshots !== undefined && typeof useCalculatedVersionForSnapshots !== "boolean") { | ||
messages.push(`The \`useCalculatedVersionForSnapshots\` option is set as ${JSON.stringify(useCalculatedVersionForSnapshots, null, 2)} when the only valid values are undefined or a boolean`); | ||
if (useCalculatedVersionForSnapshots && useCalculatedVersionForSnapshots !== undefined) { | ||
console.warn(`Experimental flag "useCalculatedVersionForSnapshots" is deprecated since snapshot feature became stable. Please use "snapshot.useCalculatedVersion" instead.`); | ||
if (typeof useCalculatedVersionForSnapshots !== "boolean") { | ||
messages.push(`The \`useCalculatedVersionForSnapshots\` option is set as ${JSON.stringify(useCalculatedVersionForSnapshots, null, 2)} when the only valid values are undefined or a boolean`); | ||
} | ||
} | ||
@@ -273,6 +291,9 @@ } | ||
bumpVersionsWithWorkspaceProtocolOnly: json.bumpVersionsWithWorkspaceProtocolOnly === true, | ||
snapshot: { | ||
prereleaseTemplate: (_json$snapshot$prerel = (_json$snapshot = json.snapshot) === null || _json$snapshot === void 0 ? void 0 : _json$snapshot.prereleaseTemplate) !== null && _json$snapshot$prerel !== void 0 ? _json$snapshot$prerel : null, | ||
useCalculatedVersion: ((_json$snapshot2 = json.snapshot) === null || _json$snapshot2 === void 0 ? void 0 : _json$snapshot2.useCalculatedVersion) !== undefined ? json.snapshot.useCalculatedVersion : ((_json$___experimental = json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH) === null || _json$___experimental === void 0 ? void 0 : _json$___experimental.useCalculatedVersionForSnapshots) !== undefined ? (_json$___experimental2 = json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH) === null || _json$___experimental2 === void 0 ? void 0 : _json$___experimental2.useCalculatedVersionForSnapshots : false | ||
}, | ||
___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH: { | ||
onlyUpdatePeerDependentsWhenOutOfRange: json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH === undefined || json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange === undefined ? false : json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange, | ||
updateInternalDependents: (_json$___experimental = (_json$___experimental2 = json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH) === null || _json$___experimental2 === void 0 ? void 0 : _json$___experimental2.updateInternalDependents) !== null && _json$___experimental !== void 0 ? _json$___experimental : "out-of-range", | ||
useCalculatedVersionForSnapshots: json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH === undefined || json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.useCalculatedVersionForSnapshots === undefined ? false : json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.useCalculatedVersionForSnapshots | ||
updateInternalDependents: (_json$___experimental3 = (_json$___experimental4 = json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH) === null || _json$___experimental4 === void 0 ? void 0 : _json$___experimental4.updateInternalDependents) !== null && _json$___experimental3 !== void 0 ? _json$___experimental3 : "out-of-range" | ||
} | ||
@@ -279,0 +300,0 @@ }; |
@@ -17,3 +17,3 @@ "use strict"; | ||
name: "@changesets/config", | ||
version: "2.0.1", | ||
version: "2.1.0", | ||
description: "Utilities for reading and parsing Changeset's config", | ||
@@ -27,5 +27,5 @@ main: "dist/config.cjs.js", | ||
"@changesets/errors": "^0.1.4", | ||
"@changesets/get-dependents-graph": "^1.3.2", | ||
"@changesets/get-dependents-graph": "^1.3.3", | ||
"@changesets/logger": "^0.0.5", | ||
"@changesets/types": "^5.0.0", | ||
"@changesets/types": "^5.1.0", | ||
"@manypkg/get-packages": "^1.1.3", | ||
@@ -82,3 +82,3 @@ "fs-extra": "^7.0.1", | ||
}, parse = (json, packages) => { | ||
var _json$___experimental, _json$___experimental2; | ||
var _json$snapshot$prerel, _json$snapshot, _json$snapshot2, _json$___experimental, _json$___experimental2, _json$___experimental3, _json$___experimental4; | ||
let messages = [], pkgNames = packages.packages.map((({packageJson: packageJson}) => packageJson.name)); | ||
@@ -131,7 +131,11 @@ void 0 === json.changelog || !1 === json.changelog || "string" == typeof json.changelog || isArray(json.changelog) && 2 === json.changelog.length && "string" == typeof json.changelog[0] || messages.push(`The \`changelog\` option is set as ${JSON.stringify(json.changelog, null, 2)} when the only valid values are undefined, a module path(e.g. "@changesets/cli/changelog" or "./some-module") or a tuple with a module path and config for the changelog generator(e.g. ["@changesets/cli/changelog", { someOption: true }])`); | ||
} else messages.push(`The \`ignore\` option is set as ${JSON.stringify(json.ignore, null, 2)} when the only valid values are undefined or an array of package names`); | ||
if (void 0 !== json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH) { | ||
const {snapshot: snapshot} = json; | ||
if (void 0 !== snapshot && (void 0 !== snapshot.useCalculatedVersion && "boolean" != typeof snapshot.useCalculatedVersion && messages.push(`The \`snapshot.useCalculatedVersion\` option is set as ${JSON.stringify(snapshot.useCalculatedVersion, null, 2)} when the only valid values are undefined or a boolean`), | ||
void 0 !== snapshot.prereleaseTemplate && "string" != typeof snapshot.prereleaseTemplate && messages.push(`The \`snapshot.prereleaseTemplate\` option is set as ${JSON.stringify(snapshot.prereleaseTemplate, null, 2)} when the only valid values are undefined, or a template string.`)), | ||
void 0 !== json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH) { | ||
const {onlyUpdatePeerDependentsWhenOutOfRange: onlyUpdatePeerDependentsWhenOutOfRange, updateInternalDependents: updateInternalDependents, useCalculatedVersionForSnapshots: useCalculatedVersionForSnapshots} = json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH; | ||
void 0 !== onlyUpdatePeerDependentsWhenOutOfRange && "boolean" != typeof onlyUpdatePeerDependentsWhenOutOfRange && messages.push(`The \`onlyUpdatePeerDependentsWhenOutOfRange\` option is set as ${JSON.stringify(onlyUpdatePeerDependentsWhenOutOfRange, null, 2)} when the only valid values are undefined or a boolean`), | ||
void 0 === updateInternalDependents || [ "always", "out-of-range" ].includes(updateInternalDependents) || messages.push(`The \`updateInternalDependents\` option is set as ${JSON.stringify(updateInternalDependents, null, 2)} but can only be 'always' or 'out-of-range'`), | ||
void 0 !== useCalculatedVersionForSnapshots && "boolean" != typeof useCalculatedVersionForSnapshots && messages.push(`The \`useCalculatedVersionForSnapshots\` option is set as ${JSON.stringify(useCalculatedVersionForSnapshots, null, 2)} when the only valid values are undefined or a boolean`); | ||
useCalculatedVersionForSnapshots && void 0 !== useCalculatedVersionForSnapshots && (console.warn('Experimental flag "useCalculatedVersionForSnapshots" is deprecated since snapshot feature became stable. Please use "snapshot.useCalculatedVersion" instead.'), | ||
"boolean" != typeof useCalculatedVersionForSnapshots && messages.push(`The \`useCalculatedVersionForSnapshots\` option is set as ${JSON.stringify(useCalculatedVersionForSnapshots, null, 2)} when the only valid values are undefined or a boolean`)); | ||
} | ||
@@ -149,6 +153,9 @@ if (messages.length) throw new errors.ValidationError("Some errors occurred when validating the changesets config:\n" + messages.join("\n")); | ||
bumpVersionsWithWorkspaceProtocolOnly: !0 === json.bumpVersionsWithWorkspaceProtocolOnly, | ||
snapshot: { | ||
prereleaseTemplate: null !== (_json$snapshot$prerel = null === (_json$snapshot = json.snapshot) || void 0 === _json$snapshot ? void 0 : _json$snapshot.prereleaseTemplate) && void 0 !== _json$snapshot$prerel ? _json$snapshot$prerel : null, | ||
useCalculatedVersion: void 0 !== (null === (_json$snapshot2 = json.snapshot) || void 0 === _json$snapshot2 ? void 0 : _json$snapshot2.useCalculatedVersion) ? json.snapshot.useCalculatedVersion : void 0 !== (null === (_json$___experimental = json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH) || void 0 === _json$___experimental ? void 0 : _json$___experimental.useCalculatedVersionForSnapshots) && (null === (_json$___experimental2 = json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH) || void 0 === _json$___experimental2 ? void 0 : _json$___experimental2.useCalculatedVersionForSnapshots) | ||
}, | ||
___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH: { | ||
onlyUpdatePeerDependentsWhenOutOfRange: void 0 !== json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH && void 0 !== json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange && json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange, | ||
updateInternalDependents: null !== (_json$___experimental = null === (_json$___experimental2 = json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH) || void 0 === _json$___experimental2 ? void 0 : _json$___experimental2.updateInternalDependents) && void 0 !== _json$___experimental ? _json$___experimental : "out-of-range", | ||
useCalculatedVersionForSnapshots: void 0 !== json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH && void 0 !== json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.useCalculatedVersionForSnapshots && json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.useCalculatedVersionForSnapshots | ||
updateInternalDependents: null !== (_json$___experimental3 = null === (_json$___experimental4 = json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH) || void 0 === _json$___experimental4 ? void 0 : _json$___experimental4.updateInternalDependents) && void 0 !== _json$___experimental3 ? _json$___experimental3 : "out-of-range" | ||
} | ||
@@ -155,0 +162,0 @@ }; |
@@ -10,3 +10,3 @@ import { readJSON } from 'fs-extra'; | ||
name: "@changesets/config", | ||
version: "2.0.1", | ||
version: "2.1.0", | ||
description: "Utilities for reading and parsing Changeset's config", | ||
@@ -23,5 +23,5 @@ main: "dist/config.cjs.js", | ||
"@changesets/errors": "^0.1.4", | ||
"@changesets/get-dependents-graph": "^1.3.2", | ||
"@changesets/get-dependents-graph": "^1.3.3", | ||
"@changesets/logger": "^0.0.5", | ||
"@changesets/types": "^5.0.0", | ||
"@changesets/types": "^5.1.0", | ||
"@manypkg/get-packages": "^1.1.3", | ||
@@ -103,3 +103,3 @@ "fs-extra": "^7.0.1", | ||
let parse = (json, packages) => { | ||
var _json$___experimental, _json$___experimental2; | ||
var _json$snapshot$prerel, _json$snapshot, _json$snapshot2, _json$___experimental, _json$___experimental2, _json$___experimental3, _json$___experimental4; | ||
@@ -228,2 +228,16 @@ let messages = []; | ||
const { | ||
snapshot | ||
} = json; | ||
if (snapshot !== undefined) { | ||
if (snapshot.useCalculatedVersion !== undefined && typeof snapshot.useCalculatedVersion !== "boolean") { | ||
messages.push(`The \`snapshot.useCalculatedVersion\` option is set as ${JSON.stringify(snapshot.useCalculatedVersion, null, 2)} when the only valid values are undefined or a boolean`); | ||
} | ||
if (snapshot.prereleaseTemplate !== undefined && typeof snapshot.prereleaseTemplate !== "string") { | ||
messages.push(`The \`snapshot.prereleaseTemplate\` option is set as ${JSON.stringify(snapshot.prereleaseTemplate, null, 2)} when the only valid values are undefined, or a template string.`); | ||
} | ||
} | ||
if (json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH !== undefined) { | ||
@@ -244,4 +258,8 @@ const { | ||
if (useCalculatedVersionForSnapshots !== undefined && typeof useCalculatedVersionForSnapshots !== "boolean") { | ||
messages.push(`The \`useCalculatedVersionForSnapshots\` option is set as ${JSON.stringify(useCalculatedVersionForSnapshots, null, 2)} when the only valid values are undefined or a boolean`); | ||
if (useCalculatedVersionForSnapshots && useCalculatedVersionForSnapshots !== undefined) { | ||
console.warn(`Experimental flag "useCalculatedVersionForSnapshots" is deprecated since snapshot feature became stable. Please use "snapshot.useCalculatedVersion" instead.`); | ||
if (typeof useCalculatedVersionForSnapshots !== "boolean") { | ||
messages.push(`The \`useCalculatedVersionForSnapshots\` option is set as ${JSON.stringify(useCalculatedVersionForSnapshots, null, 2)} when the only valid values are undefined or a boolean`); | ||
} | ||
} | ||
@@ -264,6 +282,9 @@ } | ||
bumpVersionsWithWorkspaceProtocolOnly: json.bumpVersionsWithWorkspaceProtocolOnly === true, | ||
snapshot: { | ||
prereleaseTemplate: (_json$snapshot$prerel = (_json$snapshot = json.snapshot) === null || _json$snapshot === void 0 ? void 0 : _json$snapshot.prereleaseTemplate) !== null && _json$snapshot$prerel !== void 0 ? _json$snapshot$prerel : null, | ||
useCalculatedVersion: ((_json$snapshot2 = json.snapshot) === null || _json$snapshot2 === void 0 ? void 0 : _json$snapshot2.useCalculatedVersion) !== undefined ? json.snapshot.useCalculatedVersion : ((_json$___experimental = json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH) === null || _json$___experimental === void 0 ? void 0 : _json$___experimental.useCalculatedVersionForSnapshots) !== undefined ? (_json$___experimental2 = json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH) === null || _json$___experimental2 === void 0 ? void 0 : _json$___experimental2.useCalculatedVersionForSnapshots : false | ||
}, | ||
___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH: { | ||
onlyUpdatePeerDependentsWhenOutOfRange: json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH === undefined || json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange === undefined ? false : json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange, | ||
updateInternalDependents: (_json$___experimental = (_json$___experimental2 = json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH) === null || _json$___experimental2 === void 0 ? void 0 : _json$___experimental2.updateInternalDependents) !== null && _json$___experimental !== void 0 ? _json$___experimental : "out-of-range", | ||
useCalculatedVersionForSnapshots: json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH === undefined || json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.useCalculatedVersionForSnapshots === undefined ? false : json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.useCalculatedVersionForSnapshots | ||
updateInternalDependents: (_json$___experimental3 = (_json$___experimental4 = json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH) === null || _json$___experimental4 === void 0 ? void 0 : _json$___experimental4.updateInternalDependents) !== null && _json$___experimental3 !== void 0 ? _json$___experimental3 : "out-of-range" | ||
} | ||
@@ -270,0 +291,0 @@ }; |
{ | ||
"name": "@changesets/config", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Utilities for reading and parsing Changeset's config", | ||
@@ -15,5 +15,5 @@ "main": "dist/config.cjs.js", | ||
"@changesets/errors": "^0.1.4", | ||
"@changesets/get-dependents-graph": "^1.3.2", | ||
"@changesets/get-dependents-graph": "^1.3.3", | ||
"@changesets/logger": "^0.0.5", | ||
"@changesets/types": "^5.0.0", | ||
"@changesets/types": "^5.1.0", | ||
"@manypkg/get-packages": "^1.1.3", | ||
@@ -20,0 +20,0 @@ "fs-extra": "^7.0.1", |
@@ -102,4 +102,23 @@ { | ||
"default": "patch" | ||
}, | ||
"bumpVersionsWithWorkspaceProtocolOnly": { | ||
"type": "boolean", | ||
"default": false, | ||
"description": "Determines whether Changesets should only bump dependency ranges that use workspace protocol of packages that are part of the workspace." | ||
}, | ||
"snapshot": { | ||
"type": "object", | ||
"properties": { | ||
"useCalculatedVersion": { | ||
"type": "boolean", | ||
"description": "It can be used to make generated snapshot versions use the calculated version (based on the changeset files) as a base version, instead of 0.0.0" | ||
}, | ||
"prereleaseTemplate": { | ||
"type": "string", | ||
"description": "A template for the prerelease (suffix) part of the generated snapshot version. The template can use the following variable patterns: {commit}, {tag}, {datetime}, {timestamp}.", | ||
"minLength": 1 | ||
} | ||
} | ||
} | ||
} | ||
} |
65667
841