mpizenberg / elm-test-rs

Fast and portable executable to run your Elm tests
BSD 3-Clause "New" or "Revised" License
80 stars 13 forks source link

Add npm package #121

Closed lydell closed 1 year ago

lydell commented 1 year ago

This adds a light-weight npm package based on https://github.com/elm/compiler/pull/2287

Here’s how to publish (maybe you want to put this somewhere):

Repeat this for all the binary packages in packages/. This uses packages/elm-test-rs-darwin-x64 as an example.

  1. Go to the folder: cd packages/elm-test-rs-darwin-x64
  2. Copy the appropriate binary to ./elm-test-rs. For Windows: ./elm-test-rs.exe
  3. Double-check that you put the right binary in the right package: file elm-test-rs
  4. Double-check that the file is executable: ls -l elm-test-rs
  5. In package.json of the binary package, bump the version for example to "3.0.1".
  6. In package.json of the main npm package, update "optionalDependencies" to point to the bumped version. For example: "@mpizenberg/elm-test-rs-darwin-x64": "3.0.1".

    Note: Pin the versions of the binary packages exactly – no version ranges. This means that installing elm-test-rs@3.0.1 installs the exact same bytes in two years as today.

  7. Publish the package: npm publish --access=public

    --access=public is needed because scoped packages are private by default.

Then publish the main npm package by running npm publish in the npm/ folder.

mpizenberg commented 1 year ago

Thank you! I'll fix clippy in main and merge it here. Then I'll review this and try the steps. If all is well I'll merge this.

Is this npm package also usable for global installs?

lydell commented 1 year ago

I'll fix clippy in main and merge it here.

Thanks! Feel free to make whatever changes you like.

Is this npm package also usable for global installs?

Yes!

mpizenberg commented 1 year ago

For versioning, can I use rev numbers like "3.0.0-rev1" just in case I have to update the npm package? I don't know how versioning is handled by npm. Is this going to be installed if people just do npm install elm-test-rs@3.0.0 ? What versioning scheme would you advise?

lydell commented 1 year ago

You can read all about the versioning here: https://github.com/elm/compiler/pull/2287/files#diff-cd34b117c7124e742fd6eb9ffd8f6f9f5c125402a66e9e62c906785b940f7681R68-R85