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

Migrate to monorepo to split Vue 2 and Vue 3 packages #355

Closed
2 of 10 tasks
nogic1008 opened this issue Jun 14, 2021 · 12 comments
Closed
2 of 10 tasks

Migrate to monorepo to split Vue 2 and Vue 3 packages #355

nogic1008 opened this issue Jun 14, 2021 · 12 comments
Assignees
Milestone

Comments

@nogic1008
Copy link
Collaborator

nogic1008 commented Jun 14, 2021

Related #343

Currently, the structure of this repository is as follows:

Branch Version Vue Jest
master 4.x 2.x <27
next 5.x(alpha) 3.x <27

In Jest 27, breaking changes have came. (#344, #348, #351)
To accommodate it, this package also requires breaking changes. (and need to increment semver)

But, vue-jest@4 cannot increment because of 5.x exists.
So we should split it to another package.

If you want to keep the package name different, I don't think it is necessary to divide the version by branch. (ex. CI/CD)

@lmiller1990
Could you tell us your thoughts on the items in the "Consideration" section?

Details

Package naming & Support version

Package Ver. Vue ver. Jest ver. Description
vue-jest 4.x 2.x <27 alias for vue2-jest@26
vue-jest 5.x(alpha) 3.x <27 deprecate (use vue3-jest@26 instead)
vue-jest 27.x latest (=2.x now) 27.x alias for vue2-jest@27 now
vue2-jest 26.x 2.x 26.x equals to vue-jest@4
vue3-jest 26.x 3.x 26.x equals to vue-jest@5
vue2-jest 27.x 2.x 27.x
vue3-jest 27.x 3.x 27.x

Versioning

Like ts-jest, We DOES NOT use Semantic Versioning.

vue2-jest@xx.yy.zz
vue3-jest@xx.yy.zz
  • xx: Equals supported Jest major version
  • yy: Compliant with semVer major & patch version (ie included BREAKING CHANGE)
  • zz: Compliant with semVer patch version

It is recommended for users to pin version as below:

"devDependencies": {
  "vue2-jest": "^27.1.1", // Not recommended. It means 27.1.1 <= x < 28.0.0
  "vue2-jest": "27.1.x", // 27.1.0 <= x < 27.2.0
  "vue2-jest": "~27.1", // 27.1.0 <= x < 27.2.0
  "vue2-jest": "~27.1.1" // 27.1.1 <= x < 27.2.0
}

Repository Structures

Tasks

  1. Add missing dependencies in /e2e projects
  2. Setup monorepo in master branch (build: migrate to monorepo (for vue-jest@4) #360)
    • move vue-jest@4 library to /packages/vue2-jest
    • rename package to vue2-jest
    • move end-to-end tests to /e2e/2.x
  3. Setup monorepo in next branch (build: migrate to monorepo (for vue-jest@5) #361)
    • move vue-jest@5 library to /packages/vue3-jest
    • rename package to vue3-jest
    • move end-to-end tests to /e2e/3.x
  4. Merge next branch into master (build: merge 'next' (Vue 3) branch into 'master' (Vue 2) for monorepo #363)
  5. (Optional) Split duplicated code in another package (like /packages/vue-jest-core)
  6. Create vue-jest package that wraps vue2-jest@latest
  7. Add or update README
    • vue-jest
    • vue2-jest
    • vue3-jest
    • root
  8. Release vue2-jest, vue3-jest, and vue-jest-core

Consideration (Resolved)

Package name

  • vue2-jest, vue-jest
  • vue2-jest, vue3-jest
  • vue2-jest, vue3-jest, vue-jest(alias of vue3-jest)
  • Other

Use semver or not

  • Yes, we will release new packages as version 1.x. Major version does not match Jest version.
  • No, like ts-jest, we will release new packages as version 27.x. Major version matches Jest version.

Deprecates vue-jest or not

  • **Yes.
  • No. use vue-jest as alias of latest Vue + Jest package (currently vue3-jest@latest)
@nogic1008
Copy link
Collaborator Author

Ultimately, it will have the same structure as the branch in this repository..

@nogic1008 nogic1008 changed the title Migrate to monorepo Migrate to monorepo to split Vue 2 and Vue 3 packages Jun 14, 2021
@lmiller1990
Copy link
Member

Thanks for putting together this document. It's really good. Here's my thoughts:

Consideration

Package name

  • vue2-jest, vue-jest
  • vue2-jest, vue3-jest
  • vue2-jest, vue3-jest, vue-jest(alias of vue3-jest)
  • Other

I think this makes sense. Evan agrees, too. We will just need to ensure that vue-jest always matches the latest version of the current release (so right now it'll be vue2-jest). Once Vue 3 becomes the main version on npm for Vue, we will change it.

I'm not sure if npm has the concept of an alias, but I think there should be some way to set this up.

Use semver or not

  • Yes, we will release new packages as version 1.x. Major version does not match Jest version.
  • No, like ts-jest, we will release new packages as version 27.x. Major version matches Jest version.

I think it makes sense to match the Jest version. Currently we have vue-jest v3, v4 and v5 - it's not at all clear which version of Vue they work with. It makes more sense to match the Jest version.

Deprecates vue-jest or not

  • Yes.
  • No. use vue-jest as alias of latest Vue + Jest package (currently vue3-jest@latest)

Agree, but currently this should match vue2-jest, also known as vue-jest@4. We should match the main version of Vue on npm. At the moment, that's Vue 2.

Structure

Happy to let you own this, and decide whatever you think is best.

Final Thoughts

As a final recommendation, when you move or copy and files, please do git mv. This will preserve the git history.

If you'd like to work on this, I can review any code or PRs you've made. I think it's fine to fork this repository. Again, please use git mv if you are moving things around so we can keep the history.

@nogic1008
Copy link
Collaborator Author

@lmiller1990
Thank you for your thoughts!
I wrote "Details" section. If you find any mistakes or have any questions, please let me know.

I'll send PRs for monorepo, but please do not "Squash Merge".
It can sometimes break git mv history.

@lmiller1990
Copy link
Member

Sounds good, I'll look forward to the PR.

I'll make sure not to squash merge that PR.

@lmiller1990
Copy link
Member

Ok, those are both merged. What's next? Let's update the plan:

next (Vue 3) and master (Vue 2) branches is now using a monorepo thanks to @nogic1008. This should help us support multiple Vue versions better.

We will not use next anymore. master will target the latest version of Jest (in this case 27). It will have support for both Vue 2 and 3.

I think the next step is having master include support for both Vue 2 and 3.

So

  1. Merge next into master. We need two packages: vue2-jest and vue3-jest. This will target Jest 27.
  2. Make a new PR with the changes to support Jest 27. This will target master.
  3. Fork master -> call the new branch 26.x
  4. Merge Jest 27 support to master.
  5. Release 6? new versions:
  • vue-jest@27 (Vue 2, Jest 27)
  • vue-jest@27 (Vue 2, Jest 27)
  • vue2-jest@26
  • vue2-jest@27,
  • vue3-jest@26
  • vue3-jest@27

Does this sound correct?

@nogic1008
Copy link
Collaborator Author

nogic1008 commented Jun 21, 2021

@lmiller1990 Yes, That's right!

Please add the following text to the README of each packages.


Like ts-jest, We DOES NOT use Semantic Versioning.

vue-jest@xx.yy.zz
vue2-jest@xx.yy.zz
vue3-jest@xx.yy.zz
  • xx: Equals supported Jest major version
  • yy: Compliant with semVer major & minor version (ie. included BREAKING CHANGE)
  • zz: Compliant with semVer patch version

It is recommended for users to pin version as below:

"devDependencies": {
  "vue2-jest": "^27.1.1", // Not recommended. It means 27.1.1 <= x < 28.0.0
  "vue2-jest": "27.1.x", // 27.1.0 <= x < 27.2.0
  "vue2-jest": "~27.1", // 27.1.0 <= x < 27.2.0
  "vue2-jest": "~27.1.1" // 27.1.1 <= x < 27.2.0
}

@nogic1008
Copy link
Collaborator Author

nogic1008 commented Jun 23, 2021

@lmiller1990
Here is a sample to merge next into master.
nogic1008#3

To resolve conflicts, I did:

  1. Copy 2 files & 4 directories
    • README.md at master
    • yarn.lock at master
    • packages/vue2-jest/ at master
    • packages/vue3-jest/ at next
    • e2e/2.x/ at master
    • e2e/3.x/ at next
  2. Run git merge master on next branch
  3. Paste copied files & directories
  4. Mark as resolved
  5. Run yarn install
  6. Add nohoist option like this commit

@lmiller1990
Copy link
Member

Great. Can you make the PR against this repo? Let's get this merged up.

@Tofandel
Copy link

Tofandel commented Jul 15, 2021

Hmm it looks like someone stole the namespace 20 days ago before publish and published a malware on vue2-jest it's already been removed but it means the name can't be used (or maybe the npm support needs to be contacted)

Otherwise maybe it would be possible to use the official org repo?
Like
@vue/2-jest
@vue/3-jest

@nickmccurdy
Copy link

nickmccurdy commented Jul 15, 2021

The vue2-jest package is held by npm for security purposes, so it may be possible to submit a dispute with npm support to get access to it.

@jolting
Copy link
Contributor

jolting commented Jul 16, 2021

I like @Tofandel's suggestion, but with one tweak. Starting a package name with a number after the scope part just looks wrong. I think it makes sense to go with the original complete names prepended with the scopes. I don't think anyone will mind the redundancy.
@vue/vue2-jest
@vue/vue3-jest

@lmiller1990
Copy link
Member

That would work too. I'm sure we can ask npm for the package name vue2-jest, but it's probably easier to just publish under the vue org.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants