@changesets/apply-release-plan
Advanced tools
Comparing version 2.0.1 to 2.0.2
# @changesets/apply-release-plan | ||
## 2.0.2 | ||
### Patch Changes | ||
- [`3dbab2e`](https://github.com/atlassian/changesets/commit/3dbab2e80d9a8a0cccc02d74c6d8150f603219e6) [#343](https://github.com/atlassian/changesets/pull/343) Thanks [@zkochan](https://github.com/zkochan)! - Self-references should be skipped when bumping versions. A self-reference is a dev dep that has the same name as the package. Some projects use self-references as a convinient way to require files using relative paths from the root directory. | ||
## 2.0.1 | ||
@@ -4,0 +10,0 @@ |
@@ -40,3 +40,3 @@ 'use strict'; | ||
let depCurrentVersion = deps[name]; | ||
if (!depCurrentVersion) continue; | ||
if (!depCurrentVersion || depCurrentVersion.startsWith("file:") || depCurrentVersion.startsWith("link:")) continue; | ||
const usesWorkspaceRange = depCurrentVersion.startsWith("workspace:"); | ||
@@ -43,0 +43,0 @@ |
@@ -54,3 +54,3 @@ "use strict"; | ||
let depCurrentVersion = deps[name]; | ||
if (!depCurrentVersion) continue; | ||
if (!depCurrentVersion || depCurrentVersion.startsWith("file:") || depCurrentVersion.startsWith("link:")) continue; | ||
const usesWorkspaceRange = depCurrentVersion.startsWith("workspace:"); | ||
@@ -57,0 +57,0 @@ if (usesWorkspaceRange && (depCurrentVersion = depCurrentVersion.substr(10)), "" !== new semver.Range(depCurrentVersion).range) { |
@@ -34,3 +34,3 @@ import { defaultConfig } from '@changesets/config'; | ||
let depCurrentVersion = deps[name]; | ||
if (!depCurrentVersion) continue; | ||
if (!depCurrentVersion || depCurrentVersion.startsWith("file:") || depCurrentVersion.startsWith("link:")) continue; | ||
const usesWorkspaceRange = depCurrentVersion.startsWith("workspace:"); | ||
@@ -37,0 +37,0 @@ |
{ | ||
"name": "@changesets/apply-release-plan", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Takes a release plan and applies it to packages", | ||
@@ -24,5 +24,5 @@ "main": "dist/apply-release-plan.cjs.js", | ||
"devDependencies": { | ||
"jest-fixtures": "^0.5.0", | ||
"fixturez": "^1.1.0", | ||
"spawndamnit": "^2.0.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
import { copyFixtureIntoTempDir } from "jest-fixtures"; | ||
import fixtures from "fixturez"; | ||
import { | ||
@@ -17,2 +17,4 @@ ReleasePlan, | ||
const f = fixtures(__dirname); | ||
class FakeReleasePlan { | ||
@@ -75,3 +77,3 @@ changesets: NewChangeset[]; | ||
} | ||
let tempDir = await copyFixtureIntoTempDir(__dirname, fixtureName); | ||
let tempDir = await f.copy(fixtureName); | ||
if (setupFunc) { | ||
@@ -106,3 +108,5 @@ await setupFunc(tempDir); | ||
); | ||
let pkgPath = changedFiles.find(a => a.endsWith("pkg-a/package.json")); | ||
let pkgPath = changedFiles.find(a => | ||
a.endsWith(`pkg-a${path.sep}package.json`) | ||
); | ||
@@ -141,3 +145,5 @@ if (!pkgPath) throw new Error(`could not find an updated package json`); | ||
); | ||
let pkgPath = changedFiles.find(a => a.endsWith("pkg-a/package.json")); | ||
let pkgPath = changedFiles.find(a => | ||
a.endsWith(`pkg-a${path.sep}package.json`) | ||
); | ||
@@ -179,3 +185,5 @@ if (!pkgPath) throw new Error(`could not find an updated package json`); | ||
); | ||
let pkgPath = changedFiles.find(a => a.endsWith("pkg-a/package.json")); | ||
let pkgPath = changedFiles.find(a => | ||
a.endsWith(`pkg-a${path.sep}package.json`) | ||
); | ||
@@ -212,4 +220,8 @@ if (!pkgPath) throw new Error(`could not find an updated package json`); | ||
); | ||
let pkgPathA = changedFiles.find(a => a.endsWith("pkg-a/package.json")); | ||
let pkgPathB = changedFiles.find(b => b.endsWith("pkg-b/package.json")); | ||
let pkgPathA = changedFiles.find(a => | ||
a.endsWith(`pkg-a${path.sep}package.json`) | ||
); | ||
let pkgPathB = changedFiles.find(b => | ||
b.endsWith(`pkg-b${path.sep}package.json`) | ||
); | ||
@@ -271,4 +283,8 @@ if (!pkgPathA || !pkgPathB) { | ||
); | ||
let pkgPathA = changedFiles.find(a => a.endsWith("pkg-a/package.json")); | ||
let pkgPathB = changedFiles.find(b => b.endsWith("pkg-b/package.json")); | ||
let pkgPathA = changedFiles.find(a => | ||
a.endsWith(`pkg-a${path.sep}package.json`) | ||
); | ||
let pkgPathB = changedFiles.find(b => | ||
b.endsWith(`pkg-b${path.sep}package.json`) | ||
); | ||
@@ -294,2 +310,47 @@ if (!pkgPathA || !pkgPathB) { | ||
}); | ||
it("should skip dependencies that have the same name as the package", async () => { | ||
let { changedFiles } = await testSetup( | ||
"self-referenced", | ||
{ | ||
changesets: [ | ||
{ | ||
id: "quick-lions-devour", | ||
summary: "Hey, let's have fun with testing!", | ||
releases: [{ name: "self-referenced", type: "minor" }] | ||
} | ||
], | ||
releases: [ | ||
{ | ||
name: "self-referenced", | ||
type: "minor", | ||
oldVersion: "1.0.0", | ||
newVersion: "1.1.0", | ||
changesets: ["quick-lions-devour"] | ||
} | ||
], | ||
preState: undefined | ||
}, | ||
{ | ||
changelog: false, | ||
commit: false, | ||
linked: [], | ||
access: "restricted", | ||
baseBranch: "master" | ||
} | ||
); | ||
let pkgPath = changedFiles.find(a => | ||
a.endsWith(`self-referenced${path.sep}package.json`) | ||
); | ||
if (!pkgPath) throw new Error(`could not find an updated package json`); | ||
let pkgJSON = await fs.readJSON(pkgPath); | ||
expect(pkgJSON).toMatchObject({ | ||
name: "self-referenced", | ||
version: "1.1.0", | ||
devDependencies: { | ||
"self-referenced": "file:" | ||
} | ||
}); | ||
}); | ||
}); | ||
@@ -311,3 +372,5 @@ describe("changelogs", () => { | ||
let readmePath = changedFiles.find(a => a.endsWith("pkg-a/CHANGELOG.md")); | ||
let readmePath = changedFiles.find(a => | ||
a.endsWith(`pkg-a${path.sep}CHANGELOG.md`) | ||
); | ||
@@ -350,5 +413,7 @@ if (!readmePath) throw new Error(`could not find an updated changelog`); | ||
let readmePath = changedFiles.find(a => a.endsWith("pkg-a/CHANGELOG.md")); | ||
let readmePath = changedFiles.find(a => | ||
a.endsWith(`pkg-a${path.sep}CHANGELOG.md`) | ||
); | ||
let readmePathB = changedFiles.find(a => | ||
a.endsWith("pkg-b/CHANGELOG.md") | ||
a.endsWith(`pkg-b${path.sep}CHANGELOG.md`) | ||
); | ||
@@ -420,3 +485,3 @@ | ||
let pkgAChangelogPath = changedFiles.find(a => | ||
a.endsWith("pkg-a/CHANGELOG.md") | ||
a.endsWith(`pkg-a${path.sep}CHANGELOG.md`) | ||
); | ||
@@ -454,3 +519,5 @@ | ||
let readmePath = changedFiles.find(a => a.endsWith("pkg-a/CHANGELOG.md")); | ||
let readmePath = changedFiles.find(a => | ||
a.endsWith(`pkg-a${path.sep}CHANGELOG.md`) | ||
); | ||
@@ -532,3 +599,3 @@ if (!readmePath) throw new Error(`could not find an updated changelog`); | ||
let tempDir = await copyFixtureIntoTempDir(__dirname, "with-git"); | ||
let tempDir = await f.copy("with-git"); | ||
@@ -564,3 +631,3 @@ await spawn("git", ["init"], { cwd: tempDir }); | ||
let tempDir = await copyFixtureIntoTempDir(__dirname, "with-git"); | ||
let tempDir = await f.copy("with-git"); | ||
@@ -567,0 +634,0 @@ await spawn("git", ["init"], { cwd: tempDir }); |
@@ -29,3 +29,8 @@ import { ComprehensiveRelease, PackageJSON } from "@changesets/types"; | ||
let depCurrentVersion = deps[name]; | ||
if (!depCurrentVersion) continue; | ||
if ( | ||
!depCurrentVersion || | ||
depCurrentVersion.startsWith("file:") || | ||
depCurrentVersion.startsWith("link:") | ||
) | ||
continue; | ||
const usesWorkspaceRange = depCurrentVersion.startsWith("workspace:"); | ||
@@ -32,0 +37,0 @@ if (usesWorkspaceRange) { |
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
95183
2128