@changesets/assemble-release-plan
Advanced tools
Comparing version 5.1.1-temp.0 to 5.1.1
# @changesets/assemble-release-plan | ||
## 5.1.1-temp.0 | ||
## 5.1.1 | ||
### Patch Changes | ||
- [#696](https://github.com/changesets/changesets/pull/696) [`c8ab098`](https://github.com/changesets/changesets/commit/c8ab0987e75c34ff5e09e6465fe0a1918137d91b) Thanks [@Andarist](https://github.com/Andarist)! - Versioning a package without a `package.json#version` will no longer result in `null` being generated as the new version of a package (or as part of it when dealing with pre mode of snapshot releases). Instead we'll generate the minimal version - e.g. for a minor bump the `0.1.0` version will be generated. | ||
- [#769](https://github.com/changesets/changesets/pull/769) [`3e8e672`](https://github.com/changesets/changesets/commit/3e8e6721d31f80fff28826e0fad2c14216c3d94f) Thanks [@Andarist](https://github.com/Andarist)! - Fixed an infinite loop involving a fixed group of packages and a package within that group that was both ignored and dependent on another package from that group. | ||
@@ -9,0 +9,0 @@ ## 5.1.0 |
@@ -69,6 +69,2 @@ 'use strict'; | ||
if (!version) { | ||
throw new Error(`Could not increment version ("${release.oldVersion}") for package "${release.name}"`); | ||
} | ||
if (preInfo !== undefined && preInfo.state.mode !== "exit") { | ||
@@ -89,59 +85,2 @@ let preVersion = preInfo.preVersions.get(release.name); | ||
function getHighestReleaseType(releases) { | ||
if (releases.length === 0) { | ||
throw new Error(`Large internal Changesets error when calculating highest release type in the set of releases. Please contact the maintainers`); | ||
} | ||
let highestReleaseType = "none"; | ||
for (let release of releases) { | ||
switch (release.type) { | ||
case "major": | ||
return "major"; | ||
case "minor": | ||
highestReleaseType = "minor"; | ||
break; | ||
case "patch": | ||
if (highestReleaseType === "none") { | ||
highestReleaseType = "patch"; | ||
} | ||
break; | ||
} | ||
} | ||
return highestReleaseType; | ||
} | ||
function getCurrentHighestVersion(packageGroup, packagesByName) { | ||
let highestVersion; | ||
for (let pkgName of packageGroup) { | ||
let pkg = packagesByName.get(pkgName); | ||
if (!pkg) { | ||
console.error(`FATAL ERROR IN CHANGESETS! We were unable to version for package group: ${pkgName} in package group: ${packageGroup.toString()}`); | ||
throw new Error(`fatal: could not resolve linked packages`); | ||
} | ||
if (highestVersion === undefined || semver__default['default'].gt(pkg.packageJson.version, highestVersion)) { | ||
highestVersion = pkg.packageJson.version; | ||
} | ||
} | ||
return highestVersion; | ||
} | ||
const getPkgJsonVersion = packageJson => { | ||
if (packageJson.version === undefined) { | ||
return "0.0.0"; | ||
} | ||
if (typeof packageJson.version === "string") { | ||
return packageJson.version; | ||
} | ||
throw new Error(`Package "${packageJson.name}" has invalid version property: ${packageJson.version}.`); | ||
}; | ||
/* | ||
@@ -263,3 +202,3 @@ WARNING: | ||
type, | ||
oldVersion: getPkgJsonVersion(pkgJSON), | ||
oldVersion: pkgJSON.version, | ||
changesets: [] | ||
@@ -327,2 +266,3 @@ }; | ||
// This function takes in changesets and returns one release per | ||
// package listed in the changesets | ||
function flattenReleases(changesets, packagesByName, ignoredPackages) { | ||
@@ -350,3 +290,3 @@ let releases = new Map(); | ||
type, | ||
oldVersion: getPkgJsonVersion(pkg.packageJson), | ||
oldVersion: pkg.packageJson.version, | ||
changesets: [changeset.id] | ||
@@ -371,6 +311,52 @@ }; | ||
function matchFixedConstraint(releases, packagesByName, fixed) { | ||
function getHighestReleaseType(releases) { | ||
if (releases.length === 0) { | ||
throw new Error(`Large internal Changesets error when calculating highest release type in the set of releases. Please contact the maintainers`); | ||
} | ||
let highestReleaseType = "none"; | ||
for (let release of releases) { | ||
switch (release.type) { | ||
case "major": | ||
return "major"; | ||
case "minor": | ||
highestReleaseType = "minor"; | ||
break; | ||
case "patch": | ||
if (highestReleaseType === "none") { | ||
highestReleaseType = "patch"; | ||
} | ||
break; | ||
} | ||
} | ||
return highestReleaseType; | ||
} | ||
function getCurrentHighestVersion(packageGroup, packagesByName) { | ||
let highestVersion; | ||
for (let pkgName of packageGroup) { | ||
let pkg = packagesByName.get(pkgName); | ||
if (!pkg) { | ||
console.error(`FATAL ERROR IN CHANGESETS! We were unable to version for package group: ${pkgName} in package group: ${packageGroup.toString()}`); | ||
throw new Error(`fatal: could not resolve linked packages`); | ||
} | ||
if (highestVersion === undefined || semver__default['default'].gt(pkg.packageJson.version, highestVersion)) { | ||
highestVersion = pkg.packageJson.version; | ||
} | ||
} | ||
return highestVersion; | ||
} | ||
function matchFixedConstraint(releases, packagesByName, config) { | ||
let updated = false; | ||
for (let fixedPackages of fixed) { | ||
for (let fixedPackages of config.fixed) { | ||
let releasingFixedPackages = [...releases.values()].filter(release => fixedPackages.includes(release.name) && release.type !== "none"); | ||
@@ -382,2 +368,6 @@ if (releasingFixedPackages.length === 0) continue; | ||
for (let pkgName of fixedPackages) { | ||
if (config.ignore.includes(pkgName)) { | ||
continue; | ||
} | ||
let release = releases.get(pkgName); | ||
@@ -529,3 +519,3 @@ | ||
let fixedConstraintUpdated = matchFixedConstraint(releases, packagesByName, config.fixed); | ||
let fixedConstraintUpdated = matchFixedConstraint(releases, packagesByName, config); | ||
let linksUpdated = applyLinks(releases, packagesByName, config.linked); | ||
@@ -547,3 +537,3 @@ releasesValidated = !linksUpdated && !dependentAdded && !fixedConstraintUpdated; | ||
type: "patch", | ||
oldVersion: getPkgJsonVersion(pkg.packageJson), | ||
oldVersion: pkg.packageJson.version, | ||
changesets: [] | ||
@@ -550,0 +540,0 @@ }); |
@@ -52,3 +52,2 @@ "use strict"; | ||
let version = semver.inc(release.oldVersion, release.type); | ||
if (!version) throw new Error(`Could not increment version ("${release.oldVersion}") for package "${release.name}"`); | ||
if (void 0 !== preInfo && "exit" !== preInfo.state.mode) { | ||
@@ -62,36 +61,2 @@ let preVersion = preInfo.preVersions.get(release.name); | ||
function getHighestReleaseType(releases) { | ||
if (0 === releases.length) throw new Error("Large internal Changesets error when calculating highest release type in the set of releases. Please contact the maintainers"); | ||
let highestReleaseType = "none"; | ||
for (let release of releases) switch (release.type) { | ||
case "major": | ||
return "major"; | ||
case "minor": | ||
highestReleaseType = "minor"; | ||
break; | ||
case "patch": | ||
"none" === highestReleaseType && (highestReleaseType = "patch"); | ||
} | ||
return highestReleaseType; | ||
} | ||
function getCurrentHighestVersion(packageGroup, packagesByName) { | ||
let highestVersion; | ||
for (let pkgName of packageGroup) { | ||
let pkg = packagesByName.get(pkgName); | ||
if (!pkg) throw console.error(`FATAL ERROR IN CHANGESETS! We were unable to version for package group: ${pkgName} in package group: ${packageGroup.toString()}`), | ||
new Error("fatal: could not resolve linked packages"); | ||
(void 0 === highestVersion || semver__default.default.gt(pkg.packageJson.version, highestVersion)) && (highestVersion = pkg.packageJson.version); | ||
} | ||
return highestVersion; | ||
} | ||
const getPkgJsonVersion = packageJson => { | ||
if (void 0 === packageJson.version) return "0.0.0"; | ||
if ("string" == typeof packageJson.version) return packageJson.version; | ||
throw new Error(`Package "${packageJson.name}" has invalid version property: ${packageJson.version}.`); | ||
}; | ||
function determineDependents({releases: releases, packagesByName: packagesByName, dependencyGraph: dependencyGraph, preInfo: preInfo, config: config}) { | ||
@@ -143,3 +108,3 @@ let updated = !1, pkgsToSearch = [ ...releases.values() ]; | ||
type: type, | ||
oldVersion: getPkgJsonVersion(pkgJSON), | ||
oldVersion: pkgJSON.version, | ||
changesets: [] | ||
@@ -184,3 +149,3 @@ }; | ||
type: type, | ||
oldVersion: getPkgJsonVersion(pkg.packageJson), | ||
oldVersion: pkg.packageJson.version, | ||
changesets: [ changeset.id ] | ||
@@ -192,5 +157,33 @@ }, releases.set(name, release); | ||
function matchFixedConstraint(releases, packagesByName, fixed) { | ||
function getHighestReleaseType(releases) { | ||
if (0 === releases.length) throw new Error("Large internal Changesets error when calculating highest release type in the set of releases. Please contact the maintainers"); | ||
let highestReleaseType = "none"; | ||
for (let release of releases) switch (release.type) { | ||
case "major": | ||
return "major"; | ||
case "minor": | ||
highestReleaseType = "minor"; | ||
break; | ||
case "patch": | ||
"none" === highestReleaseType && (highestReleaseType = "patch"); | ||
} | ||
return highestReleaseType; | ||
} | ||
function getCurrentHighestVersion(packageGroup, packagesByName) { | ||
let highestVersion; | ||
for (let pkgName of packageGroup) { | ||
let pkg = packagesByName.get(pkgName); | ||
if (!pkg) throw console.error(`FATAL ERROR IN CHANGESETS! We were unable to version for package group: ${pkgName} in package group: ${packageGroup.toString()}`), | ||
new Error("fatal: could not resolve linked packages"); | ||
(void 0 === highestVersion || semver__default.default.gt(pkg.packageJson.version, highestVersion)) && (highestVersion = pkg.packageJson.version); | ||
} | ||
return highestVersion; | ||
} | ||
function matchFixedConstraint(releases, packagesByName, config) { | ||
let updated = !1; | ||
for (let fixedPackages of fixed) { | ||
for (let fixedPackages of config.fixed) { | ||
let releasingFixedPackages = [ ...releases.values() ].filter((release => fixedPackages.includes(release.name) && "none" !== release.type)); | ||
@@ -200,2 +193,3 @@ if (0 === releasingFixedPackages.length) continue; | ||
for (let pkgName of fixedPackages) { | ||
if (config.ignore.includes(pkgName)) continue; | ||
let release = releases.get(pkgName); | ||
@@ -260,3 +254,3 @@ release ? (release.type !== highestReleaseType && (updated = !0, release.type = highestReleaseType), | ||
config: config | ||
}), fixedConstraintUpdated = matchFixedConstraint(releases, packagesByName, config.fixed); | ||
}), fixedConstraintUpdated = matchFixedConstraint(releases, packagesByName, config); | ||
releasesValidated = !applyLinks(releases, packagesByName, config.linked) && !dependentAdded && !fixedConstraintUpdated; | ||
@@ -269,3 +263,3 @@ } | ||
type: "patch", | ||
oldVersion: getPkgJsonVersion(pkg.packageJson), | ||
oldVersion: pkg.packageJson.version, | ||
changesets: [] | ||
@@ -272,0 +266,0 @@ }); |
@@ -61,6 +61,2 @@ import semver, { inc, parse } from 'semver'; | ||
if (!version) { | ||
throw new Error(`Could not increment version ("${release.oldVersion}") for package "${release.name}"`); | ||
} | ||
if (preInfo !== undefined && preInfo.state.mode !== "exit") { | ||
@@ -81,59 +77,2 @@ let preVersion = preInfo.preVersions.get(release.name); | ||
function getHighestReleaseType(releases) { | ||
if (releases.length === 0) { | ||
throw new Error(`Large internal Changesets error when calculating highest release type in the set of releases. Please contact the maintainers`); | ||
} | ||
let highestReleaseType = "none"; | ||
for (let release of releases) { | ||
switch (release.type) { | ||
case "major": | ||
return "major"; | ||
case "minor": | ||
highestReleaseType = "minor"; | ||
break; | ||
case "patch": | ||
if (highestReleaseType === "none") { | ||
highestReleaseType = "patch"; | ||
} | ||
break; | ||
} | ||
} | ||
return highestReleaseType; | ||
} | ||
function getCurrentHighestVersion(packageGroup, packagesByName) { | ||
let highestVersion; | ||
for (let pkgName of packageGroup) { | ||
let pkg = packagesByName.get(pkgName); | ||
if (!pkg) { | ||
console.error(`FATAL ERROR IN CHANGESETS! We were unable to version for package group: ${pkgName} in package group: ${packageGroup.toString()}`); | ||
throw new Error(`fatal: could not resolve linked packages`); | ||
} | ||
if (highestVersion === undefined || semver.gt(pkg.packageJson.version, highestVersion)) { | ||
highestVersion = pkg.packageJson.version; | ||
} | ||
} | ||
return highestVersion; | ||
} | ||
const getPkgJsonVersion = packageJson => { | ||
if (packageJson.version === undefined) { | ||
return "0.0.0"; | ||
} | ||
if (typeof packageJson.version === "string") { | ||
return packageJson.version; | ||
} | ||
throw new Error(`Package "${packageJson.name}" has invalid version property: ${packageJson.version}.`); | ||
}; | ||
/* | ||
@@ -255,3 +194,3 @@ WARNING: | ||
type, | ||
oldVersion: getPkgJsonVersion(pkgJSON), | ||
oldVersion: pkgJSON.version, | ||
changesets: [] | ||
@@ -319,2 +258,3 @@ }; | ||
// This function takes in changesets and returns one release per | ||
// package listed in the changesets | ||
function flattenReleases(changesets, packagesByName, ignoredPackages) { | ||
@@ -342,3 +282,3 @@ let releases = new Map(); | ||
type, | ||
oldVersion: getPkgJsonVersion(pkg.packageJson), | ||
oldVersion: pkg.packageJson.version, | ||
changesets: [changeset.id] | ||
@@ -363,6 +303,52 @@ }; | ||
function matchFixedConstraint(releases, packagesByName, fixed) { | ||
function getHighestReleaseType(releases) { | ||
if (releases.length === 0) { | ||
throw new Error(`Large internal Changesets error when calculating highest release type in the set of releases. Please contact the maintainers`); | ||
} | ||
let highestReleaseType = "none"; | ||
for (let release of releases) { | ||
switch (release.type) { | ||
case "major": | ||
return "major"; | ||
case "minor": | ||
highestReleaseType = "minor"; | ||
break; | ||
case "patch": | ||
if (highestReleaseType === "none") { | ||
highestReleaseType = "patch"; | ||
} | ||
break; | ||
} | ||
} | ||
return highestReleaseType; | ||
} | ||
function getCurrentHighestVersion(packageGroup, packagesByName) { | ||
let highestVersion; | ||
for (let pkgName of packageGroup) { | ||
let pkg = packagesByName.get(pkgName); | ||
if (!pkg) { | ||
console.error(`FATAL ERROR IN CHANGESETS! We were unable to version for package group: ${pkgName} in package group: ${packageGroup.toString()}`); | ||
throw new Error(`fatal: could not resolve linked packages`); | ||
} | ||
if (highestVersion === undefined || semver.gt(pkg.packageJson.version, highestVersion)) { | ||
highestVersion = pkg.packageJson.version; | ||
} | ||
} | ||
return highestVersion; | ||
} | ||
function matchFixedConstraint(releases, packagesByName, config) { | ||
let updated = false; | ||
for (let fixedPackages of fixed) { | ||
for (let fixedPackages of config.fixed) { | ||
let releasingFixedPackages = [...releases.values()].filter(release => fixedPackages.includes(release.name) && release.type !== "none"); | ||
@@ -374,2 +360,6 @@ if (releasingFixedPackages.length === 0) continue; | ||
for (let pkgName of fixedPackages) { | ||
if (config.ignore.includes(pkgName)) { | ||
continue; | ||
} | ||
let release = releases.get(pkgName); | ||
@@ -521,3 +511,3 @@ | ||
let fixedConstraintUpdated = matchFixedConstraint(releases, packagesByName, config.fixed); | ||
let fixedConstraintUpdated = matchFixedConstraint(releases, packagesByName, config); | ||
let linksUpdated = applyLinks(releases, packagesByName, config.linked); | ||
@@ -539,3 +529,3 @@ releasesValidated = !linksUpdated && !dependentAdded && !fixedConstraintUpdated; | ||
type: "patch", | ||
oldVersion: getPkgJsonVersion(pkg.packageJson), | ||
oldVersion: pkg.packageJson.version, | ||
changesets: [] | ||
@@ -542,0 +532,0 @@ }); |
@@ -1,4 +0,4 @@ | ||
import { Fixed } from "@changesets/types"; | ||
import { Config } from "@changesets/types"; | ||
import { Package } from "@manypkg/get-packages"; | ||
import { InternalRelease } from "./types"; | ||
export default function matchFixedConstraint(releases: Map<string, InternalRelease>, packagesByName: Map<string, Package>, fixed: Fixed): boolean; | ||
export default function matchFixedConstraint(releases: Map<string, InternalRelease>, packagesByName: Map<string, Package>, config: Config): boolean; |
@@ -1,2 +0,2 @@ | ||
import { PackageGroup, VersionType, PackageJSON } from "@changesets/types"; | ||
import { PackageGroup, VersionType } from "@changesets/types"; | ||
import { Package } from "@manypkg/get-packages"; | ||
@@ -6,2 +6,1 @@ import { InternalRelease } from "./types"; | ||
export declare function getCurrentHighestVersion(packageGroup: PackageGroup, packagesByName: Map<string, Package>): string; | ||
export declare const getPkgJsonVersion: (packageJson: PackageJSON) => string; |
{ | ||
"name": "@changesets/assemble-release-plan", | ||
"version": "5.1.1-temp.0", | ||
"version": "5.1.1", | ||
"description": "Reads changesets and adds information on dependents that need bumping", | ||
@@ -18,4 +18,4 @@ "main": "dist/assemble-release-plan.cjs.js", | ||
"devDependencies": { | ||
"@changesets/config": "1.7.0" | ||
"@changesets/config": "*" | ||
} | ||
} |
@@ -12,3 +12,2 @@ import semver from "semver"; | ||
import { incrementVersion } from "./increment"; | ||
import { getPkgJsonVersion } from "./utils"; | ||
@@ -150,3 +149,3 @@ /* | ||
type, | ||
oldVersion: getPkgJsonVersion(pkgJSON), | ||
oldVersion: pkgJSON.version, | ||
changesets: [] | ||
@@ -153,0 +152,0 @@ }; |
@@ -7,3 +7,2 @@ // This function takes in changesets and returns one release per | ||
import { InternalRelease } from "./types"; | ||
import { getPkgJsonVersion } from "./utils"; | ||
@@ -32,3 +31,3 @@ export default function flattenReleases( | ||
type, | ||
oldVersion: getPkgJsonVersion(pkg.packageJson), | ||
oldVersion: pkg.packageJson.version, | ||
changesets: [changeset.id] | ||
@@ -35,0 +34,0 @@ }; |
@@ -8,3 +8,3 @@ import * as semver from "semver"; | ||
preInfo: PreInfo | undefined | ||
): string { | ||
) { | ||
if (release.type === "none") { | ||
@@ -14,8 +14,3 @@ return release.oldVersion; | ||
let version = semver.inc(release.oldVersion, release.type); | ||
if (!version) { | ||
throw new Error( | ||
`Could not increment version ("${release.oldVersion}") for package "${release.name}"` | ||
); | ||
} | ||
let version = semver.inc(release.oldVersion, release.type)!; | ||
if (preInfo !== undefined && preInfo.state.mode !== "exit") { | ||
@@ -22,0 +17,0 @@ let preVersion = preInfo.preVersions.get(release.name); |
@@ -18,3 +18,2 @@ import { | ||
import { PreInfo, InternalRelease } from "./types"; | ||
import { getPkgJsonVersion } from "./utils"; | ||
@@ -131,3 +130,3 @@ function getPreVersion(version: string) { | ||
packagesByName, | ||
config.fixed | ||
config | ||
); | ||
@@ -151,3 +150,3 @@ let linksUpdated = applyLinks(releases, packagesByName, config.linked); | ||
type: "patch", | ||
oldVersion: getPkgJsonVersion(pkg.packageJson), | ||
oldVersion: pkg.packageJson.version, | ||
changesets: [] | ||
@@ -154,0 +153,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
import { Fixed } from "@changesets/types"; | ||
import { Config } from "@changesets/types"; | ||
import { Package } from "@manypkg/get-packages"; | ||
@@ -9,7 +9,7 @@ import { InternalRelease } from "./types"; | ||
packagesByName: Map<string, Package>, | ||
fixed: Fixed | ||
config: Config | ||
): boolean { | ||
let updated = false; | ||
for (let fixedPackages of fixed) { | ||
for (let fixedPackages of config.fixed) { | ||
let releasingFixedPackages = [...releases.values()].filter( | ||
@@ -29,2 +29,5 @@ release => fixedPackages.includes(release.name) && release.type !== "none" | ||
for (let pkgName of fixedPackages) { | ||
if (config.ignore.includes(pkgName)) { | ||
continue; | ||
} | ||
let release = releases.get(pkgName); | ||
@@ -31,0 +34,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { PackageGroup, VersionType, PackageJSON } from "@changesets/types"; | ||
import { PackageGroup, VersionType } from "@changesets/types"; | ||
import { Package } from "@manypkg/get-packages"; | ||
@@ -61,13 +61,1 @@ import semver from "semver"; | ||
} | ||
export const getPkgJsonVersion = (packageJson: PackageJSON): string => { | ||
if (packageJson.version === undefined) { | ||
return "0.0.0"; | ||
} | ||
if (typeof packageJson.version === "string") { | ||
return packageJson.version; | ||
} | ||
throw new Error( | ||
`Package "${packageJson.name}" has invalid version property: ${packageJson.version}.` | ||
); | ||
}; |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
156003
3518