question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow Running Custom Commands Per "Lifecycle"

See original GitHub issue

Affected Packages

Extent not quite known.

Problem

We are hoping to use changesets in a polyglot monorepo. We have multiple packages with multiple languages (Rust and js at the current moment.) Obviously we are unable to version, generate changelogs and publish Rust.

Proposed solution

I believe we could abstract out the commands that are run at the various “lifecycles” and allow them to be configured. We would set the default commands to be the existing functionality for backwards compatibility. This would solve our dilemma as we could run the Rust commands instead which mirror the current functionality. This would also allow other cases such as #171.

This would also allow changesets to expand outside of js-land. With GitHub Actions and the bot, a pure Rust package could use changesets through the automation and never need to install node. A simple script to create the markdown file could be created, or it can be done manually (or strictly through the bot).

If there is interest for this, I would be willing to tackle a PR for it.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:21 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jboldacommented, Jun 23, 2020

@JakeGinnivan I’ve created a library with polyglot support and arbitrary commands as similarly described here. It sounds like it would applicable to your use case. Happy to discuss further and always love code/docs help. /cc @ryaninvents

https://github.com/jbolda/covector

I am going to close this as it will not be a supported use case in changesets.

1reaction
emmatowncommented, May 19, 2020

Hey folks, sorry to do after all this work has been put in but @Noviny and I have talked about this and we don’t think that building support for Rust/this sort of extensibility in general into Changesets is best for the project.

The reasoning being that it creates so many questions that we don’t want to have to answer(e.g. what happens if there’s a Rust package and a JS package with the same name? What happens if there’s a dependency between a JS and a Rust package? How does updating dependents work with Rust packages?) and the problem with that isn’t about finding answers to these questions, it’s that adding Rust support means that we have to answer these questions where we previously didn’t and even if we did answer all these questions and the others that would come up, Rust support constrains what we can do in the future and right now, our primary goal with Changesets is to provide a great experience for versioning JS monorepos and if we are trying to support Rust as well, we won’t be able to spend as much time on supporting JS monorepos so we’ll have a worse project. We definitely should be clearer about this in our documentation though.

With all that said, if Changesets can help people manage Rust packages as well without constraining Changesets, that’s great! So what that means is that, for now, the best solution is going to be @ryaninvents approach of building on top of Changesets and potentially sometime in the future when all the behaviour is figured out, it might make sense to move it into Changesets itself(though this is very much a maybe thing though, we don’t believe building support into Changesets itself isn’t an inherently good thing). There are also a bunch of ways you could improve this outside of Changesets like generating the package.jsons for Rust packages and etc.

I should also note that when I’m referring to Changesets here, I’m referring to Changesets-the-tool rather than Changesets-the-idea, Changesets-the-idea is definitely something that transcends a particular language ecosystem though Changesets-the-tool, for now, isn’t.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Run commands on your Linux instance at launch
View and update the instance user data · In the navigation pane, choose Instances. · Select the instance and choose Instance state, Stop...
Read more >
How do I add a custom script to my package.json file that runs ...
Node also allows you to run custom scripts for certain lifecycle events, like after npm install is run. These can be found here....
Read more >
lerna/version - lerna/README.md at main · lerna/lerna · GitHub
Modifies package metadata to reflect new release, running appropriate lifecycle scripts in root and per-package. Commits those changes and tags the commit.
Read more >
Executing Remote Commands | Developer Guide
You can use the CLI to execute remote commands in a container. This allows you to run general Linux commands for routine operations...
Read more >
Container Lifecycle Hooks - Learn Cloud Native
Events usually trigger hooks, and they allow developers to react to those events and run some custom code. Let's take a simple user ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found