@changesets/config
Advanced tools
Comparing version 1.1.0 to 1.2.0
# @changesets/config | ||
## 1.2.0 | ||
### Minor Changes | ||
- [`9dcc364`](https://github.com/atlassian/changesets/commit/9dcc364bf19e48f8f2824ebaf967d9ef41b6fc04) [#371](https://github.com/atlassian/changesets/pull/371) Thanks [@Feiyang1](https://github.com/Feiyang1)! - Add `ignore` config option to configure ignored packages. The versions of ignored packages will not be bumped during a release, but their dependencies will still be bumped normally. | ||
### Patch Changes | ||
- [`addd725`](https://github.com/atlassian/changesets/commit/addd7256d9251d999251a7c16c0a0b068d557b5d) [#383](https://github.com/atlassian/changesets/pull/383) Thanks [@Feiyang1](https://github.com/Feiyang1)! - Added an experimental flag `onlyUpdatePeerDependentsWhenOutOfRange`. When set to `true`, we only bump peer dependents when peerDependencies are leaving range. | ||
- Updated dependencies [[`addd725`](https://github.com/atlassian/changesets/commit/addd7256d9251d999251a7c16c0a0b068d557b5d), [`9dcc364`](https://github.com/atlassian/changesets/commit/9dcc364bf19e48f8f2824ebaf967d9ef41b6fc04)]: | ||
- @changesets/types@3.1.0 | ||
## 1.1.0 | ||
@@ -4,0 +17,0 @@ |
@@ -11,6 +11,7 @@ 'use strict'; | ||
var logger = require('@changesets/logger'); | ||
var getDependentsGraph = require('@changesets/get-dependents-graph'); | ||
var packageJson = { | ||
name: "@changesets/config", | ||
version: "1.1.0", | ||
version: "1.2.0", | ||
description: "Utilities for reading and parsing Changeset's config", | ||
@@ -27,4 +28,5 @@ main: "dist/config.cjs.js", | ||
"@changesets/errors": "^0.1.4", | ||
"@changesets/get-dependents-graph": "^1.1.3", | ||
"@changesets/logger": "^0.0.5", | ||
"@changesets/types": "^3.0.0", | ||
"@changesets/types": "^3.1.0", | ||
"@manypkg/get-packages": "^1.0.1", | ||
@@ -46,3 +48,8 @@ "fs-extra": "^7.0.1" | ||
baseBranch: "master", | ||
updateInternalDependencies: "patch" | ||
updateInternalDependencies: "patch", | ||
ignore: [], | ||
___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH: { | ||
onlyUpdatePeerDependentsWhenOutOfRange: false, | ||
useCalculatedVersionForSnapshots: false | ||
} | ||
}; | ||
@@ -128,2 +135,46 @@ | ||
if (json.ignore) { | ||
if (!(Array.isArray(json.ignore) && json.ignore.every(pkgName => typeof pkgName === "string"))) { | ||
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`); | ||
} else { | ||
let pkgNames = new Set(packages.packages.map(({ | ||
packageJson | ||
}) => packageJson.name)); | ||
for (let pkgName of json.ignore) { | ||
if (!pkgNames.has(pkgName)) { | ||
messages.push(`The package "${pkgName}" is specified in the \`ignore\` option but it is not found in the project. You may have misspelled the package name.`); | ||
} | ||
} // Validate that all dependents of ignored packages are listed in the ignore list | ||
const dependentsGraph = getDependentsGraph.getDependentsGraph(packages); | ||
for (const ignoredPackage of json.ignore) { | ||
const dependents = dependentsGraph.get(ignoredPackage) || []; | ||
for (const dependent of dependents) { | ||
if (!json.ignore.includes(dependent)) { | ||
messages.push(`The package "${dependent}" depends on the ignored package "${ignoredPackage}", but "${dependent}" is not being ignored. Please add "${dependent}" to the \`ignore\` option.`); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
if (json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH !== undefined) { | ||
const { | ||
onlyUpdatePeerDependentsWhenOutOfRange, | ||
useCalculatedVersionForSnapshots | ||
} = json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH; | ||
if (onlyUpdatePeerDependentsWhenOutOfRange !== undefined && typeof onlyUpdatePeerDependentsWhenOutOfRange !== "boolean") { | ||
messages.push(`The \`onlyUpdatePeerDependentsWhenOutOfRange\` option is set as ${JSON.stringify(onlyUpdatePeerDependentsWhenOutOfRange, null, 2)} when the only valid values are undefined or a boolean`); | ||
} | ||
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 (messages.length) { | ||
@@ -139,3 +190,8 @@ throw new errors.ValidationError(`Some errors occurred when validating the changesets config:\n` + messages.join("\n")); | ||
baseBranch: json.baseBranch === undefined ? defaultWrittenConfig.baseBranch : json.baseBranch, | ||
updateInternalDependencies: json.updateInternalDependencies === undefined ? defaultWrittenConfig.updateInternalDependencies : json.updateInternalDependencies | ||
updateInternalDependencies: json.updateInternalDependencies === undefined ? defaultWrittenConfig.updateInternalDependencies : json.updateInternalDependencies, | ||
ignore: json.ignore === undefined ? defaultWrittenConfig.ignore : json.ignore, | ||
___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH: { | ||
onlyUpdatePeerDependentsWhenOutOfRange: json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH === undefined || json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange === undefined ? defaultWrittenConfig.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange : json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange, | ||
useCalculatedVersionForSnapshots: json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH === undefined || json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.useCalculatedVersionForSnapshots === undefined ? defaultWrittenConfig.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.useCalculatedVersionForSnapshots : json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.useCalculatedVersionForSnapshots | ||
} | ||
}; | ||
@@ -142,0 +198,0 @@ return config; |
@@ -11,5 +11,5 @@ "use strict"; | ||
var fs = require("fs-extra"), path = _interopDefault(require("path")), errors = require("@changesets/errors"), logger = require("@changesets/logger"), packageJson = { | ||
var fs = require("fs-extra"), path = _interopDefault(require("path")), errors = require("@changesets/errors"), logger = require("@changesets/logger"), getDependentsGraph = require("@changesets/get-dependents-graph"), packageJson = { | ||
name: "@changesets/config", | ||
version: "1.1.0", | ||
version: "1.2.0", | ||
description: "Utilities for reading and parsing Changeset's config", | ||
@@ -23,4 +23,5 @@ main: "dist/config.cjs.js", | ||
"@changesets/errors": "^0.1.4", | ||
"@changesets/get-dependents-graph": "^1.1.3", | ||
"@changesets/logger": "^0.0.5", | ||
"@changesets/types": "^3.0.0", | ||
"@changesets/types": "^3.1.0", | ||
"@manypkg/get-packages": "^1.0.1", | ||
@@ -42,3 +43,8 @@ "fs-extra": "^7.0.1" | ||
baseBranch: "master", | ||
updateInternalDependencies: "patch" | ||
updateInternalDependencies: "patch", | ||
ignore: [], | ||
___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH: { | ||
onlyUpdatePeerDependentsWhenOutOfRange: !1, | ||
useCalculatedVersionForSnapshots: !1 | ||
} | ||
}; | ||
@@ -70,3 +76,17 @@ | ||
if (void 0 === json.updateInternalDependencies || [ "patch", "minor" ].includes(json.updateInternalDependencies) || messages.push(`The \`updateInternalDependencies\` option is set as ${JSON.stringify(json.updateInternalDependencies, null, 2)} but can only be 'patch' or 'minor'`), | ||
messages.length) throw new errors.ValidationError("Some errors occurred when validating the changesets config:\n" + messages.join("\n")); | ||
json.ignore) if (Array.isArray(json.ignore) && json.ignore.every(pkgName => "string" == typeof pkgName)) { | ||
let pkgNames = new Set(packages.packages.map(({packageJson: packageJson}) => packageJson.name)); | ||
for (let pkgName of json.ignore) pkgNames.has(pkgName) || messages.push(`The package "${pkgName}" is specified in the \`ignore\` option but it is not found in the project. You may have misspelled the package name.`); | ||
const dependentsGraph = getDependentsGraph.getDependentsGraph(packages); | ||
for (const ignoredPackage of json.ignore) { | ||
const dependents = dependentsGraph.get(ignoredPackage) || []; | ||
for (const dependent of dependents) json.ignore.includes(dependent) || messages.push(`The package "${dependent}" depends on the ignored package "${ignoredPackage}", but "${dependent}" is not being ignored. Please add "${dependent}" to the \`ignore\` option.`); | ||
} | ||
} 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 {onlyUpdatePeerDependentsWhenOutOfRange: onlyUpdatePeerDependentsWhenOutOfRange, 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 !== 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`); | ||
} | ||
if (messages.length) throw new errors.ValidationError("Some errors occurred when validating the changesets config:\n" + messages.join("\n")); | ||
return { | ||
@@ -78,3 +98,8 @@ changelog: getNormalisedChangelogOption(void 0 === json.changelog ? defaultWrittenConfig.changelog : json.changelog), | ||
baseBranch: void 0 === json.baseBranch ? defaultWrittenConfig.baseBranch : json.baseBranch, | ||
updateInternalDependencies: void 0 === json.updateInternalDependencies ? defaultWrittenConfig.updateInternalDependencies : json.updateInternalDependencies | ||
updateInternalDependencies: void 0 === json.updateInternalDependencies ? defaultWrittenConfig.updateInternalDependencies : json.updateInternalDependencies, | ||
ignore: void 0 === json.ignore ? defaultWrittenConfig.ignore : json.ignore, | ||
___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH: { | ||
onlyUpdatePeerDependentsWhenOutOfRange: void 0 === json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH || void 0 === json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange ? defaultWrittenConfig.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange : json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange, | ||
useCalculatedVersionForSnapshots: void 0 === json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH || void 0 === json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.useCalculatedVersionForSnapshots ? defaultWrittenConfig.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.useCalculatedVersionForSnapshots : json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.useCalculatedVersionForSnapshots | ||
} | ||
}; | ||
@@ -81,0 +106,0 @@ }, fakePackage = { |
@@ -5,6 +5,7 @@ import { readJSON } from 'fs-extra'; | ||
import { warn } from '@changesets/logger'; | ||
import { getDependentsGraph } from '@changesets/get-dependents-graph'; | ||
var packageJson = { | ||
name: "@changesets/config", | ||
version: "1.1.0", | ||
version: "1.2.0", | ||
description: "Utilities for reading and parsing Changeset's config", | ||
@@ -21,4 +22,5 @@ main: "dist/config.cjs.js", | ||
"@changesets/errors": "^0.1.4", | ||
"@changesets/get-dependents-graph": "^1.1.3", | ||
"@changesets/logger": "^0.0.5", | ||
"@changesets/types": "^3.0.0", | ||
"@changesets/types": "^3.1.0", | ||
"@manypkg/get-packages": "^1.0.1", | ||
@@ -40,3 +42,8 @@ "fs-extra": "^7.0.1" | ||
baseBranch: "master", | ||
updateInternalDependencies: "patch" | ||
updateInternalDependencies: "patch", | ||
ignore: [], | ||
___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH: { | ||
onlyUpdatePeerDependentsWhenOutOfRange: false, | ||
useCalculatedVersionForSnapshots: false | ||
} | ||
}; | ||
@@ -122,2 +129,46 @@ | ||
if (json.ignore) { | ||
if (!(Array.isArray(json.ignore) && json.ignore.every(pkgName => typeof pkgName === "string"))) { | ||
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`); | ||
} else { | ||
let pkgNames = new Set(packages.packages.map(({ | ||
packageJson | ||
}) => packageJson.name)); | ||
for (let pkgName of json.ignore) { | ||
if (!pkgNames.has(pkgName)) { | ||
messages.push(`The package "${pkgName}" is specified in the \`ignore\` option but it is not found in the project. You may have misspelled the package name.`); | ||
} | ||
} // Validate that all dependents of ignored packages are listed in the ignore list | ||
const dependentsGraph = getDependentsGraph(packages); | ||
for (const ignoredPackage of json.ignore) { | ||
const dependents = dependentsGraph.get(ignoredPackage) || []; | ||
for (const dependent of dependents) { | ||
if (!json.ignore.includes(dependent)) { | ||
messages.push(`The package "${dependent}" depends on the ignored package "${ignoredPackage}", but "${dependent}" is not being ignored. Please add "${dependent}" to the \`ignore\` option.`); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
if (json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH !== undefined) { | ||
const { | ||
onlyUpdatePeerDependentsWhenOutOfRange, | ||
useCalculatedVersionForSnapshots | ||
} = json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH; | ||
if (onlyUpdatePeerDependentsWhenOutOfRange !== undefined && typeof onlyUpdatePeerDependentsWhenOutOfRange !== "boolean") { | ||
messages.push(`The \`onlyUpdatePeerDependentsWhenOutOfRange\` option is set as ${JSON.stringify(onlyUpdatePeerDependentsWhenOutOfRange, null, 2)} when the only valid values are undefined or a boolean`); | ||
} | ||
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 (messages.length) { | ||
@@ -133,3 +184,8 @@ throw new ValidationError(`Some errors occurred when validating the changesets config:\n` + messages.join("\n")); | ||
baseBranch: json.baseBranch === undefined ? defaultWrittenConfig.baseBranch : json.baseBranch, | ||
updateInternalDependencies: json.updateInternalDependencies === undefined ? defaultWrittenConfig.updateInternalDependencies : json.updateInternalDependencies | ||
updateInternalDependencies: json.updateInternalDependencies === undefined ? defaultWrittenConfig.updateInternalDependencies : json.updateInternalDependencies, | ||
ignore: json.ignore === undefined ? defaultWrittenConfig.ignore : json.ignore, | ||
___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH: { | ||
onlyUpdatePeerDependentsWhenOutOfRange: json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH === undefined || json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange === undefined ? defaultWrittenConfig.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange : json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange, | ||
useCalculatedVersionForSnapshots: json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH === undefined || json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.useCalculatedVersionForSnapshots === undefined ? defaultWrittenConfig.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.useCalculatedVersionForSnapshots : json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.useCalculatedVersionForSnapshots | ||
} | ||
}; | ||
@@ -136,0 +192,0 @@ return config; |
@@ -11,2 +11,7 @@ import { Packages } from "@manypkg/get-packages"; | ||
readonly updateInternalDependencies: "patch"; | ||
readonly ignore: readonly string[]; | ||
readonly ___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH: { | ||
readonly onlyUpdatePeerDependentsWhenOutOfRange: false; | ||
readonly useCalculatedVersionForSnapshots: false; | ||
}; | ||
}; | ||
@@ -13,0 +18,0 @@ export declare let read: (cwd: string, packages: Packages) => Promise<Config>; |
{ | ||
"name": "@changesets/config", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Utilities for reading and parsing Changeset's config", | ||
@@ -15,4 +15,5 @@ "main": "dist/config.cjs.js", | ||
"@changesets/errors": "^0.1.4", | ||
"@changesets/get-dependents-graph": "^1.1.3", | ||
"@changesets/logger": "^0.0.5", | ||
"@changesets/types": "^3.0.0", | ||
"@changesets/types": "^3.1.0", | ||
"@manypkg/get-packages": "^1.0.1", | ||
@@ -19,0 +20,0 @@ "fs-extra": "^7.0.1" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38970
552
6
+ Added@changesets/get-dependents-graph@1.3.6(transitive)
+ Added@changesets/types@5.2.1(transitive)
+ Addedsemver@7.6.3(transitive)
Updated@changesets/types@^3.1.0