@changesets/config
Advanced tools
Comparing version 1.4.0 to 1.5.0
# @changesets/config | ||
## 1.5.0 | ||
### Minor Changes | ||
- [`12f9a43`](https://github.com/atlassian/changesets/commit/12f9a433a6c3ac38f9405fcd77c9108c423d7101) [#507](https://github.com/atlassian/changesets/pull/507) Thanks [@zkochan](https://github.com/zkochan)! - New setting added: bumpVersionsWithWorkspaceProtocolOnly. When it is set to `true`, versions are bumped in `dependencies`, only if those versions are prefixed by the workspace protocol. For instance, `"foo": "workspace:^1.0.0"`. | ||
### Patch Changes | ||
- Updated dependencies [[`12f9a43`](https://github.com/atlassian/changesets/commit/12f9a433a6c3ac38f9405fcd77c9108c423d7101)]: | ||
- @changesets/get-dependents-graph@1.2.0 | ||
- @changesets/types@3.3.0 | ||
## 1.4.0 | ||
@@ -4,0 +16,0 @@ |
@@ -5,7 +5,5 @@ 'use strict'; | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var fs = require('fs-extra'); | ||
var path = _interopDefault(require('path')); | ||
var micromatch = _interopDefault(require('micromatch')); | ||
var path = require('path'); | ||
var micromatch = require('micromatch'); | ||
var errors = require('@changesets/errors'); | ||
@@ -15,5 +13,10 @@ var logger = require('@changesets/logger'); | ||
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; } | ||
var path__default = /*#__PURE__*/_interopDefault(path); | ||
var micromatch__default = /*#__PURE__*/_interopDefault(micromatch); | ||
var packageJson = { | ||
name: "@changesets/config", | ||
version: "1.4.0", | ||
version: "1.5.0", | ||
description: "Utilities for reading and parsing Changeset's config", | ||
@@ -30,5 +33,5 @@ main: "dist/config.cjs.js", | ||
"@changesets/errors": "^0.1.4", | ||
"@changesets/get-dependents-graph": "^1.1.3", | ||
"@changesets/get-dependents-graph": "^1.2.0", | ||
"@changesets/logger": "^0.0.5", | ||
"@changesets/types": "^3.2.0", | ||
"@changesets/types": "^3.3.0", | ||
"@manypkg/get-packages": "^1.0.1", | ||
@@ -69,6 +72,6 @@ "fs-extra": "^7.0.1", | ||
function normalizePackageNames(listOfPackageNamesOrGlob, pkgNames) { | ||
const matchingPackages = micromatch(pkgNames, listOfPackageNamesOrGlob); // Go through the list of given package globs (again) in order to find out | ||
const matchingPackages = micromatch__default['default'](pkgNames, listOfPackageNamesOrGlob); // Go through the list of given package globs (again) in order to find out | ||
// which packages didn't match so that we can show a validation message. | ||
const nonExistingPackages = listOfPackageNamesOrGlob.filter(pkgNameOrGlob => !pkgNames.some(pkgName => micromatch.isMatch(pkgName, pkgNameOrGlob))); // Since the validation happens in subsequent steps, we need to return a tuple | ||
const nonExistingPackages = listOfPackageNamesOrGlob.filter(pkgNameOrGlob => !pkgNames.some(pkgName => micromatch__default['default'].isMatch(pkgName, pkgNameOrGlob))); // Since the validation happens in subsequent steps, we need to return a tuple | ||
// with the list of non-existing packages. | ||
@@ -87,3 +90,3 @@ // TODO: refactor the validation logic to exit early when something is not valid. | ||
let read = async (cwd, packages) => { | ||
let json = await fs.readJSON(path.join(cwd, ".changeset", "config.json")); | ||
let json = await fs.readJSON(path__default['default'].join(cwd, ".changeset", "config.json")); | ||
return parse(json, packages); | ||
@@ -212,2 +215,3 @@ }; | ||
ignore: json.ignore === undefined ? defaultWrittenConfig.ignore : normalizePackageNames(json.ignore, pkgNames)[0], | ||
bumpVersionsWithWorkspaceProtocolOnly: json.bumpVersionsWithWorkspaceProtocolOnly === true, | ||
___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH: { | ||
@@ -214,0 +218,0 @@ onlyUpdatePeerDependentsWhenOutOfRange: json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH === undefined || json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange === undefined ? false : json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange, |
"use strict"; | ||
function _interopDefault(ex) { | ||
return ex && "object" == typeof ex && "default" in ex ? ex.default : ex; | ||
} | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -11,5 +7,13 @@ value: !0 | ||
var fs = require("fs-extra"), path = _interopDefault(require("path")), micromatch = _interopDefault(require("micromatch")), errors = require("@changesets/errors"), logger = require("@changesets/logger"), getDependentsGraph = require("@changesets/get-dependents-graph"), packageJson = { | ||
var fs = require("fs-extra"), path = require("path"), micromatch = require("micromatch"), errors = require("@changesets/errors"), logger = require("@changesets/logger"), getDependentsGraph = require("@changesets/get-dependents-graph"); | ||
function _interopDefault(e) { | ||
return e && e.__esModule ? e : { | ||
default: e | ||
}; | ||
} | ||
var path__default = _interopDefault(path), micromatch__default = _interopDefault(micromatch), packageJson = { | ||
name: "@changesets/config", | ||
version: "1.4.0", | ||
version: "1.5.0", | ||
description: "Utilities for reading and parsing Changeset's config", | ||
@@ -23,5 +27,5 @@ main: "dist/config.cjs.js", | ||
"@changesets/errors": "^0.1.4", | ||
"@changesets/get-dependents-graph": "^1.1.3", | ||
"@changesets/get-dependents-graph": "^1.2.0", | ||
"@changesets/logger": "^0.0.5", | ||
"@changesets/types": "^3.2.0", | ||
"@changesets/types": "^3.3.0", | ||
"@manypkg/get-packages": "^1.0.1", | ||
@@ -54,3 +58,3 @@ "fs-extra": "^7.0.1", | ||
function normalizePackageNames(listOfPackageNamesOrGlob, pkgNames) { | ||
return [ micromatch(pkgNames, listOfPackageNamesOrGlob), listOfPackageNamesOrGlob.filter(pkgNameOrGlob => !pkgNames.some(pkgName => micromatch.isMatch(pkgName, pkgNameOrGlob))) ]; | ||
return [ micromatch__default.default(pkgNames, listOfPackageNamesOrGlob), listOfPackageNamesOrGlob.filter((pkgNameOrGlob => !pkgNames.some((pkgName => micromatch__default.default.isMatch(pkgName, pkgNameOrGlob))))) ]; | ||
} | ||
@@ -63,6 +67,6 @@ | ||
let read = async (cwd, packages) => { | ||
let json = await fs.readJSON(path.join(cwd, ".changeset", "config.json")); | ||
let json = await fs.readJSON(path__default.default.join(cwd, ".changeset", "config.json")); | ||
return parse(json, packages); | ||
}, parse = (json, packages) => { | ||
let messages = [], pkgNames = packages.packages.map(({packageJson: packageJson}) => packageJson.name); | ||
let messages = [], pkgNames = packages.packages.map((({packageJson: packageJson}) => packageJson.name)); | ||
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 }])`); | ||
@@ -74,3 +78,3 @@ let normalizedAccess = json.access; | ||
void 0 !== json.baseBranch && "string" != typeof json.baseBranch && messages.push(`The \`baseBranch\` option is set as ${JSON.stringify(json.baseBranch, null, 2)} but the \`baseBranch\` option can only be set as a string`), | ||
void 0 !== json.linked) if (isArray(json.linked) && json.linked.every(arr => Array.isArray(arr) && arr.every(pkgName => "string" == typeof pkgName))) { | ||
void 0 !== json.linked) if (isArray(json.linked) && json.linked.every((arr => Array.isArray(arr) && arr.every((pkgName => "string" == typeof pkgName))))) { | ||
let foundPkgNames = new Set, duplicatedPkgNames = new Set; | ||
@@ -81,16 +85,16 @@ for (let linkedGroup of json.linked) { | ||
foundPkgNames.add(linkedPkgName); | ||
nonExistingPackages.length > 0 && nonExistingPackages.forEach(nonExistingPkgName => { | ||
nonExistingPackages.length > 0 && nonExistingPackages.forEach((nonExistingPkgName => { | ||
messages.push(`The package or glob expression "${nonExistingPkgName}" specified in the \`linked\` option does not match any package in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.`); | ||
}); | ||
})); | ||
} | ||
duplicatedPkgNames.size && duplicatedPkgNames.forEach(pkgName => { | ||
duplicatedPkgNames.size && duplicatedPkgNames.forEach((pkgName => { | ||
messages.push(`The package "${pkgName}" is defined in multiple sets of linked packages. Packages can only be defined in a single set of linked packages. If you are using glob expressions, make sure that they are valid according to https://www.npmjs.com/package/micromatch.`); | ||
}); | ||
})); | ||
} else messages.push(`The \`linked\` option is set as ${JSON.stringify(json.linked, null, 2)} when the only valid values are undefined or an array of arrays of package names`); | ||
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'`), | ||
json.ignore) if (isArray(json.ignore) && json.ignore.every(pkgName => "string" == typeof pkgName)) { | ||
json.ignore) if (isArray(json.ignore) && json.ignore.every((pkgName => "string" == typeof pkgName))) { | ||
let [, nonExistingPackages] = normalizePackageNames(json.ignore, pkgNames); | ||
nonExistingPackages.length > 0 && nonExistingPackages.forEach(nonExistingPkgName => { | ||
nonExistingPackages.length > 0 && nonExistingPackages.forEach((nonExistingPkgName => { | ||
messages.push(`The package or glob expression "${nonExistingPkgName}" is specified in the \`ignore\` option but it is not found in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.`); | ||
}); | ||
})); | ||
const dependentsGraph = getDependentsGraph.getDependentsGraph(packages); | ||
@@ -112,6 +116,7 @@ for (const ignoredPackage of json.ignore) { | ||
commit: void 0 === json.commit ? defaultWrittenConfig.commit : json.commit, | ||
linked: void 0 === json.linked ? defaultWrittenConfig.linked : json.linked.map(linkedGroup => normalizePackageNames(linkedGroup, pkgNames)[0]), | ||
linked: void 0 === json.linked ? defaultWrittenConfig.linked : json.linked.map((linkedGroup => normalizePackageNames(linkedGroup, pkgNames)[0])), | ||
baseBranch: void 0 === json.baseBranch ? defaultWrittenConfig.baseBranch : json.baseBranch, | ||
updateInternalDependencies: void 0 === json.updateInternalDependencies ? defaultWrittenConfig.updateInternalDependencies : json.updateInternalDependencies, | ||
ignore: void 0 === json.ignore ? defaultWrittenConfig.ignore : normalizePackageNames(json.ignore, pkgNames)[0], | ||
bumpVersionsWithWorkspaceProtocolOnly: !0 === json.bumpVersionsWithWorkspaceProtocolOnly, | ||
___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH: { | ||
@@ -118,0 +123,0 @@ 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, |
@@ -10,3 +10,3 @@ import { readJSON } from 'fs-extra'; | ||
name: "@changesets/config", | ||
version: "1.4.0", | ||
version: "1.5.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.1.3", | ||
"@changesets/get-dependents-graph": "^1.2.0", | ||
"@changesets/logger": "^0.0.5", | ||
"@changesets/types": "^3.2.0", | ||
"@changesets/types": "^3.3.0", | ||
"@manypkg/get-packages": "^1.0.1", | ||
@@ -203,2 +203,3 @@ "fs-extra": "^7.0.1", | ||
ignore: json.ignore === undefined ? defaultWrittenConfig.ignore : normalizePackageNames(json.ignore, pkgNames)[0], | ||
bumpVersionsWithWorkspaceProtocolOnly: json.bumpVersionsWithWorkspaceProtocolOnly === true, | ||
___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH: { | ||
@@ -205,0 +206,0 @@ onlyUpdatePeerDependentsWhenOutOfRange: json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH === undefined || json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange === undefined ? false : json.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange, |
{ | ||
"name": "@changesets/config", | ||
"version": "1.4.0", | ||
"version": "1.5.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.1.3", | ||
"@changesets/get-dependents-graph": "^1.2.0", | ||
"@changesets/logger": "^0.0.5", | ||
"@changesets/types": "^3.2.0", | ||
"@changesets/types": "^3.3.0", | ||
"@manypkg/get-packages": "^1.0.1", | ||
@@ -20,0 +20,0 @@ "fs-extra": "^7.0.1", |
@@ -7,3 +7,2 @@ # @changesets/config | ||
```tsx | ||
@@ -10,0 +9,0 @@ import { parse, read, ValidationError } from "@changesets/config"; |
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
46026
11
637
24