fastify / fastify-secure-session

Create a secure stateless cookie session for Fastify
MIT License
204 stars 47 forks source link

`.bin` is not registered when using yarn #134

Closed climba03003 closed 1 year ago

climba03003 commented 2 years ago

Prerequisites

Last working version

4.1.0

Stopped working in version

4.1.1

Node.js version

18.x

Operating system

Linux

Operating system version (i.e. 20.04, 11.3, 10)

20.04

💥 Regression Report

yarn do not put the bin file inside .bin folder. So, it is unavailable to use either yarn or npx to execute genkey.js when you use yarn as package manager.

I don't know if it is expected behavior for yarn. Some related information is that yarn only consider /^(?!\.{0,2}$)[a-z0-9._-]+$/i as valid bin.

Steps to Reproduce

npm init
yarn add @fastify/secure-session
yarn @fastify/secure-session // fail
npx @fastify/secure-session // fail

Expected Behavior

No response

Eomm commented 2 years ago

It seems an old yarn known issue: https://github.com/yarnpkg/yarn/issues/5353#issuecomment-399381322

Uzlopak commented 2 years ago

Created a PR. We could fix this with npx if we create a package, e.g. called fastify-secure-sesion-generate-key

Uzlopak commented 2 years ago

Just as a remark: In the issue is written that npx @fastify/secure-session fails, but it is actually working with npx

climba03003 commented 2 years ago

I updated the description a bit. The prerequisite is using yarn as package manager. Once you use it, it will also fail the npx command.

Uzlopak commented 2 years ago

Thanks for the clarification

ryami333 commented 1 year ago

My suggestion is to update the documentation to refer to the binary by path, rather than exclude everyone who uses Yarn (a lot of people):

./node_modules/@fastify/secure-session/genkey.js > secret_key