stac-utils / stac-node-validator

Simple validator for STAC Items, Catalogs, and Collections. STAC 1.0.0 compliant!
https://www.npmjs.com/package/stac-node-validator
Apache License 2.0
13 stars 5 forks source link

Bug: v1.2.1 has carriage return in bin/cli.js shebang line #44

Closed l0b0 closed 2 years ago

l0b0 commented 2 years ago

To Reproduce Steps to reproduce the behavior:

cd "$(mktemp --directory)"
nix-shell --packages yarn --pure --run 'yarn add stac-node-validator@1.2.1
./node_modules/.bin/stac-node-validator'`

Expected behavior

The command should run without issue.

Actual behavior

/usr/bin/env: 'node\r': No such file or directory
/usr/bin/env: use -[v]S to pass options in shebang lines

Additional context

The command works when installed with npm. Presumably it converts newlines at install time to avoid this.

I could automate the release on merge to master if you add the relevant credentials to the repo secrets.

Discovered in this PR.

m-mohr commented 2 years ago

Hmm, I would have expected that the .editorconfig is there to avoid such things. Otherwise the .editorconfig seems pretty useless to me if the editor still adds \r\n instead of \n.

Also, we should add a CI test for this.

Will try to fix and re-release.

l0b0 commented 2 years ago

.editorconfig is working fine - the file in the repository doesn't have \r. So it must be your release process that's changing the file. This is why I suggested automating releases.

m-mohr commented 2 years ago

Well, I'm on Windows so this doesn't come completely unexpected.

Trying to get a test for it, but can't reproduce the code snippet you gave above on Windows yet.

m-mohr commented 2 years ago

The addition of a .gitattributes file that enforces lf for /bin/cli.js should help, will release 1.2.2 shortly.

blacha commented 2 years ago

Looking at previous releases something changed in the release process between releases 1.1.0 and 1.2.0

grabbing the packaged tars from https://registry.npmjs.org/stac-node-validator/ for these two releases shows the \r was added into the file

image

m-mohr commented 2 years ago

Nothing in the release process has changed (intentionally) on my side, the process I do is the same. Must be some tooling that has changed, but how shall I know that if whatever tool changes something in-between?!

m-mohr commented 2 years ago

v1.2.2 has been released, the line ending was lf during the release so that should work now. Additionally, I've added the .gitattributes file so that non-Linux users should always get the correct lf line ending after git checkout. Sorry for any inconvenience caused.

l0b0 commented 2 years ago

Fix confirmed, thanks!