diff --git a/change/change-c5a48f0a-a227-499f-a95c-472f52bd1eb9.json b/change/change-c5a48f0a-a227-499f-a95c-472f52bd1eb9.json new file mode 100644 index 000000000..5bb2a3199 --- /dev/null +++ b/change/change-c5a48f0a-a227-499f-a95c-472f52bd1eb9.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "type": "none", + "comment": "Revert temporarily added versions.json file with packToPath", + "packageName": "beachball", + "email": "elcraig@microsoft.com", + "dependentChangeType": "none" + } + ] +} \ No newline at end of file diff --git a/docs/overview/configuration.md b/docs/overview/configuration.md index 600148c57..002d496c7 100644 --- a/docs/overview/configuration.md +++ b/docs/overview/configuration.md @@ -94,7 +94,7 @@ For the latest full list of supported options, see `RepoOptions` [in this file]( | `npmReadConcurrency` | number | 5 | repo | Maximum concurrency for fetching package versions from the registry (see `concurrency` for write operations) | | `package` | `string` | | repo | Specifies which package the command relates to (overrides change detection based on `git diff`) | | `prereleasePrefix` | `string` | | repo | Prerelease prefix, e.g. `"beta"`. Note that if this is specified, packages with change type major/minor/patch will be bumped as prerelease instead. | -| `packToPath` | `string` | | repo | Instead of publishing to npm, pack packages to tgz files in numbered subfolders under this path, based on dependency tree layers (leaves first). There will also be a file `versions.json` at the top level with the versions of the packed packages in each layer. | +| `packToPath` | `string` | | repo | Instead of publishing to npm, pack packages to tgz files in numbered subfolders under this path, based on dependency tree layers (leaves first). | | `publish` | `boolean` | `true` | repo | Whether to publish to npm registry | | `push` | `boolean` | `true` | repo | Whether to push to the remote git branch | | `registry` | `string` | | repo | Publish to this npm registry | diff --git a/packages/beachball/src/__e2e__/publishNpm.test.ts b/packages/beachball/src/__e2e__/publishNpm.test.ts index fdfacc801..327eac1ad 100644 --- a/packages/beachball/src/__e2e__/publishNpm.test.ts +++ b/packages/beachball/src/__e2e__/publishNpm.test.ts @@ -91,7 +91,7 @@ describe('publish command (npm)', () => { generateChangeFiles(['foo'], options); await publishWrapper(parsedOptions); - expect(fs.readdirSync(packToPath).sort()).toEqual(['1', 'versions.json']); + expect(fs.readdirSync(packToPath)).toEqual(['1']); expect(fs.readdirSync(path.join(packToPath, '1'))).toEqual(['foo-1.1.0.tgz']); expect(npmMock.getPublishedVersions('foo')).toBeUndefined(); expect(logs.mocks.error).not.toHaveBeenCalled(); diff --git a/packages/beachball/src/__functional__/publish/__snapshots__/publishToRegistry.test.ts.snap b/packages/beachball/src/__functional__/publish/__snapshots__/publishToRegistry.test.ts.snap index 9e645f208..eb066ab33 100644 --- a/packages/beachball/src/__functional__/publish/__snapshots__/publishToRegistry.test.ts.snap +++ b/packages/beachball/src/__functional__/publish/__snapshots__/publishToRegistry.test.ts.snap @@ -265,6 +265,5 @@ exports[`publishToRegistry with packToPath packs packages into layer folders 1`] [log] lib-1.0.0.tgz -[log] Packed lib@1.0.0 to /1/lib-1.0.0.tgz -[log] Wrote versions of packed packages to /versions.json" +[log] Packed lib@1.0.0 to /1/lib-1.0.0.tgz" `; diff --git a/packages/beachball/src/__functional__/publish/publishToRegistry.test.ts b/packages/beachball/src/__functional__/publish/publishToRegistry.test.ts index 6fd711965..b80551e41 100644 --- a/packages/beachball/src/__functional__/publish/publishToRegistry.test.ts +++ b/packages/beachball/src/__functional__/publish/publishToRegistry.test.ts @@ -7,7 +7,7 @@ import { makePackageInfos } from '../../__fixtures__/packageInfos'; import { removeTempDir, tmpdir } from '../../__fixtures__/tmpdir'; import { writeJson } from '../../object/writeJson'; import { getDefaultOptions } from '../../options/getDefaultOptions'; -import { publishToRegistry, type LayerVersionsJson } from '../../publish/publishToRegistry'; +import { publishToRegistry } from '../../publish/publishToRegistry'; import type { BeachballOptions, HooksOptions } from '../../types/BeachballOptions'; import type { PublishBumpInfo } from '../../types/BumpInfo'; import type { PackageJson } from '../../types/PackageInfo'; @@ -403,11 +403,6 @@ describe('publishToRegistry', () => { getMockNpmPackName(bumpInfo.packageInfos.other), ]); - const versionsPath = path.join(packToPath, 'versions.json'); - expect(fs.existsSync(versionsPath)).toBe(true); - const versionsJson = JSON.parse(fs.readFileSync(versionsPath, 'utf-8')) as LayerVersionsJson; - expect(versionsJson).toEqual([{ lib: '1.0.0' }, { app: '1.0.0', other: '1.0.0' }]); - expect( logs.getMockLines('all', { replacePaths: { [tempRoot]: '', [packToPath]: '' } }) ).toMatchSnapshot(); diff --git a/packages/beachball/src/publish/publishToRegistry.ts b/packages/beachball/src/publish/publishToRegistry.ts index 14f587abf..d576a4e73 100644 --- a/packages/beachball/src/publish/publishToRegistry.ts +++ b/packages/beachball/src/publish/publishToRegistry.ts @@ -1,5 +1,3 @@ -import fs from 'fs'; -import path from 'path'; import { getCatalogs } from 'workspace-tools'; import { performBump } from '../bump/performBump'; import type { PublishBumpInfo } from '../types/BumpInfo'; @@ -109,15 +107,6 @@ export async function publishToRegistry(bumpInfo: PublishBumpInfo, options: Beac continue: true, }); } - - if (packToPath && layers) { - const layerVersions: LayerVersionsJson = layers.map(layer => - Object.fromEntries(layer.map(pkg => [pkg, bumpInfo.packageInfos[pkg].version])) - ); - const versionsPath = path.join(packToPath, 'versions.json'); - fs.writeFileSync(versionsPath, JSON.stringify(layerVersions, null, 2)); - console.log(`Wrote versions of packed packages to ${versionsPath}`); - } } catch (error) { // p-graph will throw an array of errors if it fails to run all tasks let err = error; diff --git a/packages/beachball/src/types/BeachballOptions.ts b/packages/beachball/src/types/BeachballOptions.ts index 65e18c80f..19a99607c 100644 --- a/packages/beachball/src/types/BeachballOptions.ts +++ b/packages/beachball/src/types/BeachballOptions.ts @@ -227,8 +227,7 @@ export interface RepoOptions { publish: boolean; /** * Instead of publishing to npm, pack packages to tgz files in numbered subfolders under this path, - * based on dependency tree layers (leaves first). There will also be a file `versions.json` at - * the top level with the versions of the packed packages in each layer. (Implies `publish: false`.) + * based on dependency tree layers (leaves first). Implies `publish: false`. */ packToPath?: string; /**