@changesets/apply-release-plan
Advanced tools
Comparing version 7.0.7 to 7.0.8
# @changesets/apply-release-plan | ||
## 7.0.8 | ||
### Patch Changes | ||
- [#1562](https://github.com/changesets/changesets/pull/1562) [`a0f87f1`](https://github.com/changesets/changesets/commit/a0f87f1ce596e7c5c316edc24d5d4571e6acd4d7) Thanks [@Netail](https://github.com/Netail), [@cefn](https://github.com/cefn)! - Add an ability to pass in `contextDir` of the running script (like the `@changesets/cli`) so the changelog modules can be alternatively resolved using it | ||
## 7.0.7 | ||
@@ -4,0 +10,0 @@ |
@@ -318,3 +318,3 @@ 'use strict'; | ||
async function applyReleasePlan(releasePlan, packages, config$1 = config.defaultConfig, snapshot) { | ||
async function applyReleasePlan(releasePlan, packages, config$1 = config.defaultConfig, snapshot, contextDir = __dirname) { | ||
let cwd = packages.root.dir; | ||
@@ -333,3 +333,3 @@ let touchedFiles = []; | ||
let releaseWithChangelogs = await getNewChangelogEntry(releasesWithPackage, changesets, config$1, cwd); | ||
let releaseWithChangelogs = await getNewChangelogEntry(releasesWithPackage, changesets, config$1, cwd, contextDir); | ||
@@ -413,3 +413,3 @@ if (releasePlan.preState !== undefined && snapshot === undefined) { | ||
async function getNewChangelogEntry(releasesWithPackage, changesets, config, cwd) { | ||
async function getNewChangelogEntry(releasesWithPackage, changesets, config, cwd, contextDir) { | ||
if (!config.changelog) { | ||
@@ -427,4 +427,10 @@ return Promise.resolve(releasesWithPackage.map(release => _objectSpread2(_objectSpread2({}, release), {}, { | ||
let changesetPath = path__default["default"].join(cwd, ".changeset"); | ||
let changelogPath = resolveFrom__default["default"](changesetPath, config.changelog[0]); | ||
let changelogPath; | ||
try { | ||
changelogPath = resolveFrom__default["default"](changesetPath, config.changelog[0]); | ||
} catch (_unused) { | ||
changelogPath = resolveFrom__default["default"](contextDir, config.changelog[0]); | ||
} | ||
let possibleChangelogFunc = require(changelogPath); | ||
@@ -431,0 +437,0 @@ |
@@ -281,3 +281,3 @@ import { defaultConfig } from '@changesets/config'; | ||
async function applyReleasePlan(releasePlan, packages, config = defaultConfig, snapshot) { | ||
async function applyReleasePlan(releasePlan, packages, config = defaultConfig, snapshot, contextDir = __dirname) { | ||
let cwd = packages.root.dir; | ||
@@ -296,3 +296,3 @@ let touchedFiles = []; | ||
let releaseWithChangelogs = await getNewChangelogEntry(releasesWithPackage, changesets, config, cwd); | ||
let releaseWithChangelogs = await getNewChangelogEntry(releasesWithPackage, changesets, config, cwd, contextDir); | ||
@@ -376,3 +376,3 @@ if (releasePlan.preState !== undefined && snapshot === undefined) { | ||
async function getNewChangelogEntry(releasesWithPackage, changesets, config, cwd) { | ||
async function getNewChangelogEntry(releasesWithPackage, changesets, config, cwd, contextDir) { | ||
if (!config.changelog) { | ||
@@ -390,4 +390,10 @@ return Promise.resolve(releasesWithPackage.map(release => _objectSpread2(_objectSpread2({}, release), {}, { | ||
let changesetPath = path.join(cwd, ".changeset"); | ||
let changelogPath = resolveFrom(changesetPath, config.changelog[0]); | ||
let changelogPath; | ||
try { | ||
changelogPath = resolveFrom(changesetPath, config.changelog[0]); | ||
} catch (_unused) { | ||
changelogPath = resolveFrom(contextDir, config.changelog[0]); | ||
} | ||
let possibleChangelogFunc = require(changelogPath); | ||
@@ -394,0 +400,0 @@ |
import { Config, ReleasePlan } from "@changesets/types"; | ||
import { Packages } from "@manypkg/get-packages"; | ||
export default function applyReleasePlan(releasePlan: ReleasePlan, packages: Packages, config?: Config, snapshot?: string | boolean): Promise<string[]>; | ||
export default function applyReleasePlan(releasePlan: ReleasePlan, packages: Packages, config?: Config, snapshot?: string | boolean, contextDir?: string): Promise<string[]>; |
{ | ||
"name": "@changesets/apply-release-plan", | ||
"version": "7.0.7", | ||
"version": "7.0.8", | ||
"description": "Takes a release plan and applies it to packages", | ||
@@ -5,0 +5,0 @@ "main": "dist/changesets-apply-release-plan.cjs.js", |
@@ -71,3 +71,4 @@ import { defaultConfig } from "@changesets/config"; | ||
config: Config = defaultConfig, | ||
snapshot?: string | boolean | ||
snapshot?: string | boolean, | ||
contextDir = __dirname | ||
) { | ||
@@ -101,3 +102,4 @@ let cwd = packages.root.dir; | ||
config, | ||
cwd | ||
cwd, | ||
contextDir | ||
); | ||
@@ -194,3 +196,4 @@ | ||
config: Config, | ||
cwd: string | ||
cwd: string, | ||
contextDir: string | ||
) { | ||
@@ -213,4 +216,10 @@ if (!config.changelog) { | ||
let changesetPath = path.join(cwd, ".changeset"); | ||
let changelogPath = resolveFrom(changesetPath, config.changelog[0]); | ||
let changelogPath; | ||
try { | ||
changelogPath = resolveFrom(changesetPath, config.changelog[0]); | ||
} catch { | ||
changelogPath = resolveFrom(contextDir, config.changelog[0]); | ||
} | ||
let possibleChangelogFunc = require(changelogPath); | ||
@@ -217,0 +226,0 @@ if (possibleChangelogFunc.default) { |
188464
4560