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

Use SnarkyJS version of 0.9.* #376

Merged
merged 14 commits into from
Mar 9, 2023
Merged

Use SnarkyJS version of 0.9.* #376

merged 14 commits into from
Mar 9, 2023

Conversation

ymekuria
Copy link
Collaborator

@ymekuria ymekuria commented Mar 8, 2023

Closes #374 & #317

This PR updates the template projects to use the SnarkyJS version of 0.9.* to avoid needing to update the SnarkyJS version in the CLI for bug releases.

This was tested manually to confirm the correct SnarkyJS version in generated projects. It was also confirmed that the correct SnarkyJS version was displayed when running zk system .

Copy link
Contributor

@mitschabaude mitschabaude left a comment

Choose a reason for hiding this comment

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

I think just using 0.9.* doesn't achieve what we want. We want the CLI to install the latest snarkyjs version in new projects. It currently doesn't do that because package-lock.json locks the precise version.

So, what we need is to remove template/project-ts/package-lock.json. With that change, npm will determine the snarkyjs version to install from the version string in package.json.

The syntax of the version string is explained here: https://docs.npmjs.com/about-semantic-versioning#using-semantic-versioning-to-specify-update-types-your-package-can-accept

These are popular styles used:

  • ^0.9.2 - what we have currently. npm will install any version that is newer than 0.9.2 but has the same major version 0
  • ~0.9.2 - npm will install any newer version that has the same minor version 0.9.
    • documented alternatives without minimum patch version: 0.9, 0.9.x
    • I assume 0.9.* is the same as those, but not documented in the link above

If we want the second, ~ behavior, then I'd double-check the version string that you are using: the caret in ^0.9.* suggests to me that any higher minor version can be used. Also, the .* syntax is not documented on the npm page so I wouldn't use it.

I'd recommend to use ~0.9.2, since we actually want a version higher than 0.9.2 (both 0.9.1 and 0.9.2 had important bug fixes). Alternatively, just 0.9 should achieve the same (because npm will pick the latest version that starts with 0.9, so will be at least 0.9.2 anyway)

@mitschabaude
Copy link
Contributor

mitschabaude commented Mar 8, 2023

I'd recommend to use ~0.9.2

Actually, I'm not sure why we'd want to prevent installing a higher minor version, so would prefer ^0.9.2, but curious what you @ymekuria or @jasongitmail think about that?

EDIT: I guess it provides a more stable experience to the user if we make npm stick to a minor version on commands like npm update snarkyjs; however, we didn't do that so far and no-one has complained, also it would be inconsistent with our current recommentation of running npm update snarkyjs in order to update to any newer version

Copy link
Contributor

@jasongitmail jasongitmail left a comment

Choose a reason for hiding this comment

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

+1 the package-lock.json files will need to be untracked from git too.

Actually, I'm not sure why we'd want to prevent installing a higher minor version

@mitschabaude B/c we're in v0 and minor is breaking. Breaking upgrades should always be an intentional choice for devs and we should only update the patch version automatically for now.

however, we didn't do that so far and no-one has complained, also it would be inconsistent with our current recommentation of running npm update snarkyjs in order to update to any newer version

Our written text to devs guiding during a breaking upgrade will just need to be updated. We're entering a new phase of maturity here network wise and SnarkyJS wise, and it's the right time to start providing more predictability around version upgrades for devs.

0.9.* will work; confirmed with NPM's version calculator (screenshot below).
@ymekuria Let's remove ^ please, given the version calculator shows this works and it's the form that will be understood by the most devs, which is our goal here, agree?

Screenshot 2023-03-08 at 7 29 00 PM

@ymekuria
Copy link
Collaborator Author

ymekuria commented Mar 8, 2023

+1 the package-lock.json files will need to be untracked from git too.

@jasongitmail and @mitschabaude I updated the version to 0.9.* and removed/untracked the package-lock.json files using git rm package-lock.json. Now there are CI errors because running npm ci requires a package-lock.json. I'm hesitant to use npm install in CI. What do you two think?

@jasongitmail
Copy link
Contributor

jasongitmail commented Mar 8, 2023

@ymekuria Good catch. DMing to talk through because there are a bunch of aspects to consider here.

Updated with the summary of my thoughts:

  • For the CLI itself, keep package-lock.json and keep npm ci on line 25.
  • For the project template, remove package-lock.json and use npm install on line 29.

Reasoning:

  • For git repos, NPM recommends to commit package-lock.json. If we do that for the zkapp-cli repo, NPM actually removes package-lock.json and does not publish it (as shown here). This clarifies we should keep package-lock.json at the top level of for the CLI itself and keep npm ci.
  • Then, following that reasoning, if we pretend the project were being installed from NPM, it would not include package-lock.json. (I included it originally to optimize for performance during installation, but we don't need it.) So for an installation behavior consistent as if were installed from NPM, we can remove package-lock.json for the project template and switch to using npm install for its CI command.

Would that reasoning make sense?

@ymekuria ymekuria force-pushed the update-snarkyjs-version branch from 3756793 to df13070 Compare March 9, 2023 01:32
@ymekuria ymekuria requested a review from jasongitmail March 9, 2023 08:54
@ymekuria ymekuria merged commit 9d16829 into main Mar 9, 2023
@ymekuria ymekuria mentioned this pull request Mar 9, 2023
@ymekuria ymekuria deleted the update-snarkyjs-version branch March 13, 2023 23:07
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.

Use version of 0.9.* in projects
4 participants