Comments (4)
Seems like NPM doesn't like when JS files are at top level in the bin field in package.json 😢
Not actually the problem. Top-level JS files are just fine.
The problem is that the package doesn't have an #!/usr/bin/env node
moniker in the ./lib/bin.js
file referred to by the bin
field. Entries in the bin
field require that moniker to instruct the tooling that they should use Node.JS to execute the files rather than try to run them directly. The NPM docs on the bin
field literally state:
Please make sure that your file(s) referenced in
bin
starts with#!/usr/bin/env node
, otherwise the scripts are started without the node executable!
Having the bin
field top-level does introduce another problem though. A top-level bin
field will generate command proxies in the node_modules/.bin
folder that use the bare (!!) package name. I.e. the command you are creating won't be @typeoas/cli
. It'll just be cli
. Which has very poor discoverability.
Would recommend using
"bin" : { "typeoas-cli" : "./lib/bin.js" }
from typoas.
Hi,
Seems like NPM doesn't like when JS files are at top level in the bin
field in package.json 😢
In the mean time, Yarn or pnpm are both working as expected.
Will mark this as a bug and try for a fix
from typoas.
Thank you for your help. I released a new version with the fix. From my testing, it should work now except for the following case:
When running npx inside an existing project, it fails with:
> Run npx @typoas/cli generate -i https://petstore3.swagger.io/api/v3/openapi.json -o test.ts
'typoas-cli' is not recognized as an internal or external command,
operable program or batch file.
> Error: Process completed with exit code 1.
I'm also adding some E2E tests to be sure.
from typoas.
Seems that it only fail in the typoas repo on Windows (maybe related to npm/cli#6276) , I'm gonna close this
from typoas.
Related Issues (20)
- Support timeout option
- Create optimizer tool
- Long description should be split into multiple lines
- Create documentation generator
- Replace ref resolver static object by functions that can be tree shake
- Create bundle with multiple targets
- Smarter $ref handling
- Create a watch system to continuously update client
- multipart/form-data Should not be set so the boundry can be set automatically HOT 1
- AuthProviders type doesn't work (always never) HOT 4
- CLI running as shell script instead of nodejs
- incorrect TS generated when param name is like `page[number]` HOT 1
- variableConfiguration Documentations and Examples HOT 8
- Error responses types are not generated HOT 1
- Add a mode that return the full response instead of the "good" response
- Create a react query hook plugin
- See to make some private field public
- Cancel query with signal
- Handle negative numbers in enum
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typoas.