Skip to content

Move to kcd-scripts #86

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

Merged
merged 22 commits into from
Aug 18, 2019
Merged

Move to kcd-scripts #86

merged 22 commits into from
Aug 18, 2019

Conversation

afontcu
Copy link
Member

@afontcu afontcu commented Aug 17, 2019

By using kcd-scripts we stay one step closer to Testing Library sibling packages while removing the need to handle stuff manually.

  • Installed kcd-scripts to manage npm scripts.
  • Customized them to work with Vue files.
  • Move test files to src/__tests__ to honor default config.
  • Achieved 100% code coverage (required by default kcd-scripts config). I had to remove a seemingly useless if statement here. Correct me if I'm wrong!
  • Ran npm run format (this is why there's a lot of small styling changes - mostly trailing commas and whitespaces around brackets).
  • Test travis + coveralls + semantic-release integration. Not sure how to do that.

Is this a Breaking Change?:
I'd love to make sure that the build output is still okay. I removed browsers from .babelrc to use the default config (the same used in RTL, for instance).

@afontcu afontcu requested a review from dfcook August 17, 2019 12:26
@codecov
Copy link

codecov bot commented Aug 17, 2019

Codecov Report

Merging #86 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #86   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           1      1           
  Lines          63     63           
  Branches       11     10    -1     
=====================================
  Hits           63     63
Impacted Files Coverage Δ
src/vue-testing-library.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 40ff06e...80fc03a. Read the comment docs.

@afontcu
Copy link
Member Author

afontcu commented Aug 17, 2019

I''ll shamelessly ping @kentcdodds to see if he can provide some insights with regarding testing the Travis part (especially the semantic-release one, which is the main goal of this PR. See #85).

🙌

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

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

Looks cool. kcd-scripts is pretty nice 😉

@kentcdodds
Copy link
Member

As far as testing, it's hard to test Travis. I normally just do trial and error 😅

@afontcu afontcu mentioned this pull request Aug 17, 2019
@@ -1,22 +1,28 @@
{
"name": "@testing-library/vue",
"version": "2.0.0",
"version": "0.0.0-semantically-released",
"description": "Simple and complete Vue DOM testing utilities that encourage good testing practices.",
"main": "dist/vue-testing-library.js",
Copy link
Member

Choose a reason for hiding this comment

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

I believe this will need to be changed

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, how come? I was expecting Travis + semantic release will set the version right before it releases.

Actually, I wanted to ask you something. I saw that semantic-release uses git commit messages to compute the required version bump. I've noticed, however, that you are not enforcing any commit structure in RTL, for instance (example). How does that work?

Copy link
Member Author

@afontcu afontcu Aug 17, 2019

Choose a reason for hiding this comment

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

Oh, sorry Kent, I thought you meant the version field, now I see you added your comment two lines below. I double checked, and since the file is called src/vue-testing-library.js, the generated dist/ folder keeps the same naming.

Copy link
Member

Choose a reason for hiding this comment

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

When I merge pill requests I use the "Squash and merge" option which allows me to write my own commit message. Much less of a burden on contributors and I don't need commitizen.

@afontcu afontcu marked this pull request as ready for review August 17, 2019 18:28
Copy link
Collaborator

@dfcook dfcook left a comment

Choose a reason for hiding this comment

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

This is great, do we have a workflow for commit -> release now?

@afontcu
Copy link
Member Author

afontcu commented Aug 18, 2019

This is great, do we have a workflow for commit -> release now?

So the idea is that we set VTL repo to only work with "squash and merge" strategy (this can be done through config, no problem) (update: done), so that we get to author the commit message that merges to master.

This way, by following semantic-release guidelines, Travis script will automatically run tests, update to the appropriate package version, and deploy it.

This remove burden from contributors, because we don't have to set commitizen and make sure everyone is properly tagging their commits.

At least this is the idea, can't (obviously) test it until everything gets merged and we see the results 😇

If that sounds reasonable, I'd say we merge this as a patch version - in this case, I'd use a commit message that reads "chore: move building process to kcd-scripts" - and see how it goes. A lot of things (github/npm tokens, config, etc) could go wrong, but we have to try :)

@afontcu
Copy link
Member Author

afontcu commented Aug 18, 2019

Okay I'm giving this a go. Wish me luck 😂

@afontcu afontcu merged commit 726491b into master Aug 18, 2019
@afontcu afontcu deleted the kcd-scripts branch August 18, 2019 20:03
@afontcu
Copy link
Member Author

afontcu commented Aug 18, 2019

Okay, once I created the appropriate git tag (v2.0.1) to match the current published version, looks like the script is failing at npm publish (after properly inferring the next version and so on).

[release] npm notice 
[release] npm ERR! code E404
[release] npm ERR! 404 Not Found - PUT https://registry.npmjs.org/@testing-library%2fvue - Not found
[release] npm ERR! 404 
[release] npm ERR! 404  '@testing-library/[email protected]' is not in the npm registry.

It is weird because the URL actually exists and the library is obviously published 🤷‍♀

imatge

@kentcdodds
Copy link
Member

You have the GH_TOKEN and NPM_TOKEN set right?

@afontcu
Copy link
Member Author

afontcu commented Aug 18, 2019

NPM_TOKEN was created/uploaded when I ran semantic-release-cli setup, but I just noticed that I'm not "owner" of VTL in npm (just checked by running npm owner ls @testing-library/vue). That should make a difference, right?

@kentcdodds
Copy link
Member

I just created and added an NPM_TOKEN using the testing-library-bot account which should have access. We should be good to go now.

@afontcu
Copy link
Member Author

afontcu commented Aug 18, 2019

🎉 This PR is included in version 2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@afontcu
Copy link
Member Author

afontcu commented Aug 18, 2019

That was it @kentcdodds 💯💯💯💯 thank you!!

@weyert
Copy link

weyert commented Aug 18, 2019

Cool! Great job guys! Does anyone know if you can zennify the squash and merge commit message, though?

@kentcdodds
Copy link
Member

I don't know if any way to automate it, but I don't see any reason to either 🤷‍♂️

@weyert
Copy link

weyert commented Aug 18, 2019

I was just wondering, we are switching to Github at work and if you squash and merge allows to change the commit message. Guess it would be nice to avoid fix it messages 😀

@kentcdodds
Copy link
Member

Yep, it does allow you to change the message when you squash and merge 👍

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

Successfully merging this pull request may close these issues.

4 participants