From 214a42223f0ad8701354a3fe14f9817237e65f9a Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Fri, 30 Jun 2023 11:56:56 -0400 Subject: [PATCH 1/4] Make the package-json path repo-relative --- test-packages/release/src/interdep.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test-packages/release/src/interdep.ts b/test-packages/release/src/interdep.ts index bade2de48..556c9ec43 100644 --- a/test-packages/release/src/interdep.ts +++ b/test-packages/release/src/interdep.ts @@ -1,5 +1,5 @@ import glob from 'globby'; -import { resolve } from 'path'; +import { resolve, relative } from 'path'; import { readFileSync, readJSONSync } from 'fs-extra'; import yaml from 'js-yaml'; @@ -21,15 +21,15 @@ export function publishedInterPackageDeps(): Map { for (let pattern of (yaml.load(readFileSync(resolve(__dirname, '../../../pnpm-workspace.yaml'), 'utf8')) as any) .packages) { for (let dir of glob.sync(pattern, { cwd: rootDir, expandDirectories: false, onlyDirectories: true })) { - let pkgJSONPath = resolve(rootDir, dir, 'package.json'); - let pkg = readJSONSync(pkgJSONPath); + let absolutePkgJSONPath = resolve(rootDir, dir, 'package.json'); + let pkg = readJSONSync(absolutePkgJSONPath); if (pkg.private) { continue; } pkgJSONS.set(pkg.name, pkg); packages.set(pkg.name, { version: pkg.version, - pkgJSONPath, + pkgJSONPath: dir, isDependencyOf: new Map(), isPeerDependencyOf: new Map(), }); From a3d1ead4fcc8b32dd748c5e8cf86f78b0c666ab8 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Fri, 30 Jun 2023 12:13:07 -0400 Subject: [PATCH 2/4] Convert relative to absolute paths when needed, allowing embroider-release to be ran in other places than the root directory, just in case people do that --- test-packages/release/src/prepare.ts | 5 +++-- test-packages/release/src/publish.ts | 6 +++--- test-packages/release/src/utils.ts | 11 +++++++++++ 3 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 test-packages/release/src/utils.ts diff --git a/test-packages/release/src/prepare.ts b/test-packages/release/src/prepare.ts index 6b4659054..dab07ab0a 100644 --- a/test-packages/release/src/prepare.ts +++ b/test-packages/release/src/prepare.ts @@ -3,6 +3,7 @@ import { readFileSync, writeFileSync } from 'fs'; import { resolve } from 'path'; import { planVersionBumps, saveSolution, Solution } from './plan'; import { readJSONSync, writeJSONSync } from 'fs-extra'; +import { relativeToAbsolute } from './utils'; const changelogPreamble = `# Embroider Changelog `; @@ -36,9 +37,9 @@ function versionSummary(solution: Solution): string { function updateVersions(solution: Solution) { for (let entry of solution.values()) { if (entry.impact) { - let pkg = readJSONSync(entry.pkgJSONPath); + let pkg = readJSONSync(relativeToAbsolute(entry.pkgJSONPath)); pkg.version = entry.newVersion; - writeJSONSync(entry.pkgJSONPath, pkg, { spaces: 2 }); + writeJSONSync(relativeToAbsolute(entry.pkgJSONPath), pkg, { spaces: 2 }); } } } diff --git a/test-packages/release/src/publish.ts b/test-packages/release/src/publish.ts index 14d7a2f8d..e1439789b 100644 --- a/test-packages/release/src/publish.ts +++ b/test-packages/release/src/publish.ts @@ -1,7 +1,7 @@ import execa from 'execa'; import { loadSolution, Solution } from './plan'; -import { dirname } from 'path'; import { Octokit } from '@octokit/rest'; +import { absoluteDirname } from './utils'; async function hasCleanRepo(): Promise { let result = await execa('git', ['status', '--porcelain=v1'], { cwd: __dirname }); @@ -27,7 +27,7 @@ async function makeTags(solution: Solution, reporter: IssueReporter): Promise Date: Fri, 30 Jun 2023 12:15:57 -0400 Subject: [PATCH 3/4] lint:fix --- test-packages/release/src/interdep.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-packages/release/src/interdep.ts b/test-packages/release/src/interdep.ts index 556c9ec43..c1fb6b0b6 100644 --- a/test-packages/release/src/interdep.ts +++ b/test-packages/release/src/interdep.ts @@ -1,5 +1,5 @@ import glob from 'globby'; -import { resolve, relative } from 'path'; +import { resolve } from 'path'; import { readFileSync, readJSONSync } from 'fs-extra'; import yaml from 'js-yaml'; From 33efc39a2ba5c054e9e51fb380aea95e9917af52 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Sun, 2 Jul 2023 12:11:44 -0400 Subject: [PATCH 4/4] the package.json part of the path needs to be part of the path --- test-packages/release/src/interdep.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test-packages/release/src/interdep.ts b/test-packages/release/src/interdep.ts index c1fb6b0b6..b5e1f06cf 100644 --- a/test-packages/release/src/interdep.ts +++ b/test-packages/release/src/interdep.ts @@ -1,5 +1,5 @@ import glob from 'globby'; -import { resolve } from 'path'; +import { resolve, join } from 'path'; import { readFileSync, readJSONSync } from 'fs-extra'; import yaml from 'js-yaml'; @@ -29,7 +29,7 @@ export function publishedInterPackageDeps(): Map { pkgJSONS.set(pkg.name, pkg); packages.set(pkg.name, { version: pkg.version, - pkgJSONPath: dir, + pkgJSONPath: join(dir, 'package.json'), isDependencyOf: new Map(), isPeerDependencyOf: new Map(), });