Skip to content

[BREAKING] Change publish cmd to not mutate version #218

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dapplion
Copy link
Contributor

@dapplion dapplion commented May 19, 2022

Motivation

Current developer experience DX of the SDK is weird. The publish command mutates the source and publishes the mutated source without committing. This causes packages to reflect the wrong version in their manifest on master.

See the DAPPMANAGER as example:

  "name": "dappmanager.dnp.dappnode.eth",
  "version": "0.2.43",

https://github.com/dappnode/DNP_DAPPMANAGER/blob/18386a7b2abf0d9da1816b442be30f2cfd1b3a26/dappnode_package.json#L3

When latest published version is v0.2.49 🤔

The SDK should behave and be used like npm. You first mutate the source to bump the version with npm version, commit, then publish.

Changes

Deprecate commands "next" and "increase". New list of commands is

  • sdk build: Build, upload
  • sdk publish: Build, upload and print TX
    • Take whatever is found in local disk and push it to the registry
  • sdk version: Bump local fs
    • Bump a package version locally (and commit)?
  • sdk init: Init package dir
  • sdk list: List package's repo latest version

Now only the last step of publish is concerned with fetching blockchain data, only to check if a new contract must be deployed for that repo. To check the latest version use a separate command sdk list. This command set is equivalent to NodeJS npm flow and provides better separation of concerns.

From #213

@dapplion dapplion changed the title Change publish cmd to not mutate version [BREAKING] Change publish cmd to not mutate version May 19, 2022
type: string;
}

export const version: CommandModule<CliGlobalOptions, CliCommandOptions> = {
Copy link
Contributor

Choose a reason for hiding this comment

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

version is a name that says nothing, what about bumpVersion ?

@pablomendezroyo
Copy link
Contributor

pablomendezroyo commented May 19, 2022

This is great, consulting the real source for bumping packages version.

  • The new command list will require connection to an Eth/xDAI RPC endpoint, what should be the behavior if such RPC is not available?
  • Is there any situation where we will need the command list without the command version? I just see the situation where we want to bump the version based on the version obtained with the list command. I think we could merge them.
  • We should think about the commands taking into account the github actions we want to implement in the CI

Related to breaking changes:

I have not seen any package in Github using the commands that will be deprecated by this release: next and increase:

@dapplion
Copy link
Contributor Author

I have not seen any package in Github using the commands that will be deprecated by this release: next and increase:

But it's still a breaking change, see https://semver.org/ for guidelines

We should think about the commands taking into account the github actions we want to implement in the CI

Yeah, the flow will change. Actions should

  • run version
  • commit, push
  • run publish

We can add those steps in the github actions command to simplify downstream code. Since the actions blindly install the latest SDK version we just have to do those changes in the same version bump, but not necessarily in this PR

The new command list will require connection to an Eth/xDAI RPC endpoint, what should be the behavior if such RPC is not available?

I don't really care about the list command, I just add it because the logic is already there and could be useful to someone? I would be okay removing. The list command is similar to npm list which allows you to check the latest remote versions.

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.

2 participants