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

Add linked option/lockstep #27

Merged
merged 5 commits into from
May 7, 2019
Merged

Add linked option/lockstep #27

merged 5 commits into from
May 7, 2019

Conversation

emmatown
Copy link
Member

@emmatown emmatown commented May 6, 2019

Closes #7

I think we ended up deciding on calling the option linked, not sure if I'm remembering correctly though.

The behavior here is that nothing changes for adding changesets. You still write changesets for individual packages. During bumping, for each set of linked packages, it'll find the highest bump type and the highest current version of all the packages in the set and and set the new version for all the packages in the set that are being released to highest current version + highest bump type.

An example

I have three packages, pkg-a, pkg-b and pkg-c. pkg-a and pkg-b are linked but pkg-c is not so the config looks like this.

// stuff...

const versionOptions = {
  ...otherStuff,
  linked: [['pkg-a', 'pkg-b']]
}

// stuff...
  • pkg-a is at 1.0.0
  • pkg-b is at 1.0.0
  • pkg-c is at 1.0.0

I have a changeset with a patch for pkg-a, minor for pkg-b and major for pkg-c and I do a release, the resulting versions will be:

  • pkg-a is at 1.1.0
  • pkg-b is at 1.1.0
  • pkg-c is at 2.0.0

I now have another changeset with a minor for pkg-a and I do a release, the resulting versions will be:

  • pkg-a is at 1.2.0
  • pkg-b is at 1.1.0
  • pkg-c is at 2.0.0

I now have another changeset with a minor for pkg-b and I do a release, the resulting versions will be:

  • pkg-a is at 1.2.0
  • pkg-b is at 1.3.0
  • pkg-c is at 2.0.0

I now have another changeset with patches for all three packages and I do a release, the resulting versions will be:

  • pkg-a is at 1.3.1
  • pkg-b is at 1.3.1
  • pkg-c is at 2.0.1

I'm pretty sure this example shows all the cases for lockstep and it's the behavior I'm pretty sure I want for emotion.

@@ -0,0 +1,88 @@
/*
Hey, welcome to the changeset config! This file has been generated
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sounds like you didn't want this config file from the replacement readme text?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or was that from a different fixture?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, the readme text is wrong, I just copied this fixture from another one and updated the part of the config I needed to.

Copy link
Collaborator

@Noviny Noviny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good! Just had one question about double-iteration.

@@ -0,0 +1,88 @@
/*
Hey, welcome to the changeset config! This file has been generated
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or was that from a different fixture?

packages/cli/src/commands/bump/index.js Show resolved Hide resolved
for (let linkedPackages of allLinkedPackages) {
let highestVersion;
for (let linkedPackage of linkedPackages) {
let version = currentVersions.get(linkedPackage);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use 'let' again in our code. I could cry. In sadness. About having obeyed bad lint rules.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a support group for people who have been affected by prefer-const eslint rule.

packages/cli/src/utils/createRelease/index.js Show resolved Hide resolved
@Noviny Noviny merged commit 6929624 into changesets:master May 7, 2019
@emmatown emmatown deleted the lockstep branch May 7, 2019 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for a monorepo that requires everything remain on version lockstep
3 participants