Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: indentation option #952

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions docs/overview/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ For the latest full list of supported options, see `RepoOptions` [in this file](
| `shouldPublish` | false \| undefined | | package | manually disable publishing of a package by beachball (does not work to force publishing) |
| `tag` | string | `'latest'` | repo, package | dist-tag for npm when published |
| `transform` | `TransformOptions` ([details][4]) | | repo | transformations for change files |
| `indentation` | number | 2 | repo | a custom indentendation for the beachball generated files |

[1]: https://github.com/microsoft/beachball/blob/master/src/types/ChangeFilePrompt.ts
[2]: https://github.com/microsoft/beachball/blob/master/src/types/ChangelogOptions.ts
Expand Down
49 changes: 26 additions & 23 deletions src/__e2e__/bump.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('version bumping', () => {
repositoryFactory = new RepositoryFactory({ folders: monorepo });
const repo = repositoryFactory.cloneRepository();

generateChangeFiles(['pkg-1'], repo.rootPath);
generateChangeFiles(['pkg-1'], repo.rootPath, 2);

repo.push();

Expand Down Expand Up @@ -65,8 +65,8 @@ describe('version bumping', () => {
const workspaceARoot = repo.pathTo('workspace-a');
const workspaceBRoot = repo.pathTo('workspace-b');

generateChangeFiles([{ packageName: '@workspace-a/foo' }], workspaceARoot);
generateChangeFiles([{ packageName: '@workspace-a/foo', type: 'major' }], workspaceBRoot);
generateChangeFiles([{ packageName: '@workspace-a/foo' }], workspaceARoot, 2);
generateChangeFiles([{ packageName: '@workspace-a/foo', type: 'major' }], workspaceBRoot, 2);

repo.push();

Expand Down Expand Up @@ -94,11 +94,11 @@ describe('version bumping', () => {
repositoryFactory = new RepositoryFactory({ folders: monorepo });
const repo = repositoryFactory.cloneRepository();

generateChangeFiles(['pkg-1'], repo.rootPath);
generateChangeFiles(['pkg-1'], repo.rootPath, 2);

const oldCommit = repo.getCurrentHash();

generateChangeFiles(['pkg-3'], repo.rootPath);
generateChangeFiles(['pkg-3'], repo.rootPath, 2);

repo.push();

Expand Down Expand Up @@ -132,7 +132,7 @@ describe('version bumping', () => {
repositoryFactory = new RepositoryFactory({ folders: monorepo });
const repo = repositoryFactory.cloneRepository();

generateChangeFiles(['pkg-1'], repo.rootPath);
generateChangeFiles(['pkg-1'], repo.rootPath, 2);

repo.push();

Expand Down Expand Up @@ -169,7 +169,7 @@ describe('version bumping', () => {
repositoryFactory = new RepositoryFactory({ folders: monorepo });
const repo = repositoryFactory.cloneRepository();

generateChangeFiles(['pkg-1'], repo.rootPath);
generateChangeFiles(['pkg-1'], repo.rootPath, 2);

repo.push();

Expand Down Expand Up @@ -207,7 +207,7 @@ describe('version bumping', () => {
repositoryFactory = new RepositoryFactory({ folders: monorepo });
const repo = repositoryFactory.cloneRepository();

generateChangeFiles([{ packageName: 'commonlib', dependentChangeType: 'minor' }], repo.rootPath);
generateChangeFiles([{ packageName: 'commonlib', dependentChangeType: 'minor' }], repo.rootPath, 2);

repo.push();

Expand Down Expand Up @@ -236,7 +236,7 @@ describe('version bumping', () => {
const monorepo = repositoryFactory.fixture.folders!;
const repo = repositoryFactory.cloneRepository();

generateChangeFiles(['foo'], repo.rootPath);
generateChangeFiles(['foo'], repo.rootPath, 2);

repo.push();

Expand All @@ -259,7 +259,7 @@ describe('version bumping', () => {
const monorepo = repositoryFactory.fixture.folders!;
const repo = repositoryFactory.cloneRepository();

generateChangeFiles([{ packageName: 'bar', type: 'patch' }], repo.rootPath);
generateChangeFiles([{ packageName: 'bar', type: 'patch' }], repo.rootPath, 2);

repo.push();

Expand Down Expand Up @@ -291,7 +291,7 @@ describe('version bumping', () => {
repositoryFactory = new RepositoryFactory({ folders: monorepo });
const repo = repositoryFactory.cloneRepository();

generateChangeFiles(['pkg-1'], repo.rootPath);
generateChangeFiles(['pkg-1'], repo.rootPath, 2);

repo.push();

Expand Down Expand Up @@ -332,7 +332,7 @@ describe('version bumping', () => {
repositoryFactory = new RepositoryFactory({ folders: monorepo });
const repo = repositoryFactory.cloneRepository();

generateChangeFiles([{ packageName: 'pkg-1', type: 'prerelease' }], repo.rootPath);
generateChangeFiles([{ packageName: 'pkg-1', type: 'prerelease' }], repo.rootPath, 2);

repo.push();

Expand Down Expand Up @@ -374,7 +374,7 @@ describe('version bumping', () => {
repositoryFactory = new RepositoryFactory({ folders: monorepo });
const repo = repositoryFactory.cloneRepository();

generateChangeFiles([{ packageName: 'pkg-1', type: 'prerelease' }], repo.rootPath);
generateChangeFiles([{ packageName: 'pkg-1', type: 'prerelease' }], repo.rootPath, 2);

repo.push();

Expand Down Expand Up @@ -417,7 +417,7 @@ describe('version bumping', () => {
repositoryFactory = new RepositoryFactory({ folders: monorepo });
const repo = repositoryFactory.cloneRepository();

generateChangeFiles([{ packageName: 'pkg-1', type: 'prerelease' }], repo.rootPath);
generateChangeFiles([{ packageName: 'pkg-1', type: 'prerelease' }], repo.rootPath, 2);

repo.push();

Expand Down Expand Up @@ -462,7 +462,8 @@ describe('version bumping', () => {

generateChangeFiles(
[{ packageName: 'pkg-1', type: 'prerelease', dependentChangeType: 'prerelease' }],
repo.rootPath
repo.rootPath,
2
);

repo.push();
Expand Down Expand Up @@ -506,7 +507,8 @@ describe('version bumping', () => {

generateChangeFiles(
[{ packageName: 'pkg-1', type: 'prerelease', dependentChangeType: 'prerelease' }],
repo.rootPath
repo.rootPath,
2
);

repo.push();
Expand Down Expand Up @@ -554,7 +556,8 @@ describe('version bumping', () => {
packageName: 'package1',
},
],
repo.rootPath
repo.rootPath,
2,
);

repo.push();
Expand Down Expand Up @@ -582,7 +585,7 @@ describe('version bumping', () => {
});
const repo = repositoryFactory.cloneRepository();

generateChangeFiles(['pkg-1'], repo.rootPath);
generateChangeFiles(['pkg-1'], repo.rootPath, 2);

repo.push();

Expand Down Expand Up @@ -615,7 +618,7 @@ describe('version bumping', () => {
});
const repo = repositoryFactory.cloneRepository();

generateChangeFiles(['pkg-1'], repo.rootPath);
generateChangeFiles(['pkg-1'], repo.rootPath, 2);

repo.push();

Expand Down Expand Up @@ -648,7 +651,7 @@ describe('version bumping', () => {
});
const repo = repositoryFactory.cloneRepository();

generateChangeFiles(['pkg-1'], repo.rootPath);
generateChangeFiles(['pkg-1'], repo.rootPath, 2);

repo.push();

Expand All @@ -673,7 +676,7 @@ describe('version bumping', () => {
});
const repo = repositoryFactory.cloneRepository();

generateChangeFiles(['pkg-1'], repo.rootPath);
generateChangeFiles(['pkg-1'], repo.rootPath, 2);

repo.push();

Expand Down Expand Up @@ -708,7 +711,7 @@ describe('version bumping', () => {
});
const repo = repositoryFactory.cloneRepository();

generateChangeFiles(['pkg-1'], repo.rootPath);
generateChangeFiles(['pkg-1'], repo.rootPath, 2);

repo.push();

Expand Down Expand Up @@ -743,7 +746,7 @@ describe('version bumping', () => {
});
const repo = repositoryFactory.cloneRepository();

generateChangeFiles(['pkg-1'], repo.rootPath);
generateChangeFiles(['pkg-1'], repo.rootPath, 2);

repo.push();

Expand Down
2 changes: 1 addition & 1 deletion src/__e2e__/getChangedPackages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('getChangedPackages', () => {
// setup: create branch, change foo, create a change file, commit
repo.checkout('-b', 'test');
repo.commitChange('packages/foo/test.js');
generateChangeFiles(['foo'], repo.rootPath);
generateChangeFiles(['foo'], repo.rootPath, 2);
logs.clear();

const options = { fetch: false, path: repo.rootPath, branch: defaultBranchName, verbose: true } as BeachballOptions;
Expand Down
30 changes: 15 additions & 15 deletions src/__e2e__/publishE2E.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('publish command (e2e)', () => {
repositoryFactory = new RepositoryFactory('single');
const repo = repositoryFactory.cloneRepository();

generateChangeFiles(['foo'], repo.rootPath);
generateChangeFiles(['foo'], repo.rootPath, 2);

repo.push();

Expand All @@ -77,7 +77,7 @@ describe('publish command (e2e)', () => {
repositoryFactory = new RepositoryFactory('single');
const repo = repositoryFactory.cloneRepository();

generateChangeFiles(['foo'], repo.rootPath);
generateChangeFiles(['foo'], repo.rootPath, 2);

repo.push();

Expand All @@ -96,7 +96,7 @@ describe('publish command (e2e)', () => {
repositoryFactory = new RepositoryFactory('single');
const repo = repositoryFactory.cloneRepository();

generateChangeFiles(['foo'], repo.rootPath);
generateChangeFiles(['foo'], repo.rootPath, 2);

repo.push();

Expand Down Expand Up @@ -136,7 +136,7 @@ describe('publish command (e2e)', () => {
repositoryFactory = new RepositoryFactory('single');
const repo = repositoryFactory.cloneRepository();

generateChangeFiles(['foo'], repo.rootPath);
generateChangeFiles(['foo'], repo.rootPath, 2);

repo.push();

Expand Down Expand Up @@ -183,7 +183,7 @@ describe('publish command (e2e)', () => {
repositoryFactory = new RepositoryFactory('single');
const repo = repositoryFactory.cloneRepository();

generateChangeFiles(['foo'], repo.rootPath);
generateChangeFiles(['foo'], repo.rootPath, 2);

repo.push();

Expand All @@ -204,7 +204,7 @@ describe('publish command (e2e)', () => {
repositoryFactory = new RepositoryFactory('monorepo');
const repo = repositoryFactory.cloneRepository();

generateChangeFiles(['foo'], repo.rootPath);
generateChangeFiles(['foo'], repo.rootPath, 2);

repo.push();

Expand All @@ -228,7 +228,7 @@ describe('publish command (e2e)', () => {
const repo = repositoryFactory.cloneRepository();

// bump baz => dependent bump bar => dependent bump foo
generateChangeFiles(['baz'], repo.rootPath);
generateChangeFiles(['baz'], repo.rootPath, 2);
expect(repositoryFactory.fixture.folders!.packages.foo.dependencies!.bar).toBeTruthy();
expect(repositoryFactory.fixture.folders!.packages.bar.dependencies!.baz).toBeTruthy();

Expand Down Expand Up @@ -270,7 +270,7 @@ describe('publish command (e2e)', () => {
});
const repo = repositoryFactory.cloneRepository();

generateChangeFiles(['foo'], repo.rootPath);
generateChangeFiles(['foo'], repo.rootPath, 2);
// generateChangeFiles(['bar'], repo.rootPath);

repo.push();
Expand All @@ -289,8 +289,8 @@ describe('publish command (e2e)', () => {
repositoryFactory = new RepositoryFactory('monorepo');
const repo = repositoryFactory.cloneRepository();

generateChangeFiles(['foo'], repo.rootPath);
generateChangeFiles(['bar'], repo.rootPath);
generateChangeFiles(['foo'], repo.rootPath, 2);
generateChangeFiles(['bar'], repo.rootPath, 2);

repo.push();

Expand All @@ -315,7 +315,7 @@ describe('publish command (e2e)', () => {
repositoryFactory = new RepositoryFactory('monorepo');
const repo = repositoryFactory.cloneRepository();

generateChangeFiles(['foo'], repo.rootPath);
generateChangeFiles(['foo'], repo.rootPath, 2);

repo.push();

Expand Down Expand Up @@ -357,7 +357,7 @@ describe('publish command (e2e)', () => {
const repo = repositoryFactory.cloneRepository();
let notified;

generateChangeFiles(['foo'], repo.rootPath);
generateChangeFiles(['foo'], repo.rootPath, 2);

repo.push();

Expand Down Expand Up @@ -385,7 +385,7 @@ describe('publish command (e2e)', () => {
repositoryFactory = new RepositoryFactory('single');
const repo = repositoryFactory.cloneRepository();

generateChangeFiles(['foo'], repo.rootPath);
generateChangeFiles(['foo'], repo.rootPath, 2);

repo.push();

Expand Down Expand Up @@ -413,7 +413,7 @@ describe('publish command (e2e)', () => {
repositoryFactory = new RepositoryFactory('single');
const repo = repositoryFactory.cloneRepository();

generateChangeFiles(['foo'], repo.rootPath);
generateChangeFiles(['foo'], repo.rootPath, 2);

repo.push();

Expand All @@ -440,7 +440,7 @@ describe('publish command (e2e)', () => {
repositoryFactory = new RepositoryFactory('monorepo');
const repo = repositoryFactory.cloneRepository();

generateChangeFiles(['foo'], repo.rootPath);
generateChangeFiles(['foo'], repo.rootPath, 2);

repo.push();

Expand Down
6 changes: 3 additions & 3 deletions src/__e2e__/publishGit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('publish command (git)', () => {
it('can perform a successful git push', async () => {
const repo = repositoryFactory.cloneRepository();

generateChangeFiles(['foo'], repo.rootPath);
generateChangeFiles(['foo'], repo.rootPath, 2);

repo.push();

Expand All @@ -67,7 +67,7 @@ describe('publish command (git)', () => {
it('can handle a merge when there are change files present', async () => {
// 1. clone a new repo1, write a change file in repo1
const repo1 = repositoryFactory.cloneRepository();
generateChangeFiles(['foo'], repo1.rootPath);
generateChangeFiles(['foo'], repo1.rootPath, 2);
repo1.push();

// 2. simulate the start of a publish from repo1
Expand All @@ -80,7 +80,7 @@ describe('publish command (git)', () => {

// 3. Meanwhile, in repo2, also create a new change file
const repo2 = repositoryFactory.cloneRepository();
generateChangeFiles(['foo2'], repo2.rootPath);
generateChangeFiles(['foo2'], repo2.rootPath, 2);
repo2.push();

// 4. Pretend to continue on with repo1's publish
Expand Down
Loading