CircleCI-Public / node-orb

An orb for working with Node.js on CircleCI
https://circleci.com/orbs/registry/orb/circleci/node
MIT License
52 stars 80 forks source link

fix: Fixing cache load step breaking when no lock file is detected #200

Closed dotkas closed 8 months ago

dotkas commented 9 months ago

If your project does not contain any lockfile at all, this logic falls through and does not copy anything to $TARGET_DIR/node-project-lockfile: https://github.com/CircleCI-Public/node-orb/blob/ab05d0e3718e32232bdd9c80a8ba6fac1c0bee02/src/scripts/packages/determine-lockfile.sh#L6-L16

However, if you run this without with-cache: false, this step fails: https://github.com/CircleCI-Public/node-orb/blob/ab05d0e3718e32232bdd9c80a8ba6fac1c0bee02/src/commands/install-packages.yml#L70

As:

error computing cache key: template: cacheKey:1:41: executing "cacheKey" at <checksum "/tmp/node-project-lockfile">: error calling checksum: open /tmp/node-project-lockfile: no such file or directory

Expected behavior:

Caching step should complete without a lockfile present.

orb-publisher commented 8 months ago

Your development orb has been published. It will expire in 30 days. You can preview what this will look like on the CircleCI Orb Registry at the following link: https://circleci.com/developer/orbs/orb/circleci/node?version=dev:e87e1167357227b0841db7bb5b8f56c56858aff0

KyleTryon commented 8 months ago

Thank you for sending in this PR 👍

We will need to make another update to get these tests passing (not related to your changes). We'll have that here asap and then update this branch and run the tests again