Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions change/change-c5a48f0a-a227-499f-a95c-472f52bd1eb9.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"type": "none",
"comment": "Revert temporarily added versions.json file with packToPath",
"packageName": "beachball",
"email": "elcraig@microsoft.com",
"dependentChangeType": "none"
}
]
}
2 changes: 1 addition & 1 deletion docs/overview/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
2 changes: 1 addition & 1 deletion packages/beachball/src/__e2e__/publishNpm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <packPath>/1/lib-1.0.0.tgz
[log] Wrote versions of packed packages to <packPath>/versions.json"
[log] Packed lib@1.0.0 to <packPath>/1/lib-1.0.0.tgz"
`;
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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]: '<root>', [packToPath]: '<packPath>' } })
).toMatchSnapshot();
Expand Down
11 changes: 0 additions & 11 deletions packages/beachball/src/publish/publishToRegistry.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions packages/beachball/src/types/BeachballOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
/**
Expand Down
Loading