Comments (13)
Hello, is it possible to run a global CLI, like "adonis migration: run" from pkg side?
from pkg.
That is, you'd like to just run pkg
without specifying a filename? An interesting idea. The problem with start
is that it's an arbitrary shell command, not a JavaScript entry point. The main
entry point could perhaps be more appropriate since it does point to a JavaScript file.
from pkg.
Or some property in the package.pkg
config object, like "entrypoint"
.
from pkg.
You can always specify entry point javascript file explicitly in CLI instead of passing path to package.json
.
from pkg.
Thoughts on using the main
field?
I know it's primarily used in libraries, but it would be a good fit for pkg
as well.
from pkg.
from pkg.
Sorry, i can not get why you don't like bin
field. Pkg's purpose is to (mostly) emulate npm i something -g
tool installation and usage scenario. Since globally installed tool uses bin
field, the idea behind pkg was to use bin
field as well.
from pkg.
And yeah, you can specify several subfields in bin
field. Pkg will use one that's name matches with name
field of package.json
.
from pkg.
@igorklopov Ahhh I did not realize that the bin
entry was already supported. I see now that it's also documented in the README.
I'm closing since I don't think it makes sense to duplicate functionality when there is already a mechanism to specify entry point in the package.json
. Thank you for the suggestion though!
from pkg.
from pkg.
@piranna The "start"
script is used for starting servers, not CLI applications. The bin
field is absolutely used for CLI applications, and npm encourages this with the --global
flag installing into your $PATH
.
pkg
mapping to bin
is perfect.
from pkg.
npm start
is also used to start cli applications too, I have seen using server.js
just for this everywhere. Also, since several years ago usage of --global
and globally installed modules are absolutely deprecated, so that's not the point. You can use bin
, but that's a mapping of the executables that offer that module, that can be several of them, and there's no requeriment that any of them has the same name of the current module, so blindly trust on that field is a bad usage and a bug according to the spec. As I said before, better alternatives are to use standard start
script, or if not following standard practices, add a new custom field on package.json
file just for this.
from pkg.
Great idea with npm start
👍
Implementing that allows us easily pack micro-services to single executable.
UPD: As quick fix, it possible to use full path to runner in bin
script, works well in my case.
"bin": "node_modules/micro-bot/bin/micro-bot"
.
from pkg.
Related Issues (20)
- internal spawnSync error?
- v8's takeCoverage method cannot be used
- Impossible to link to own shared library from native node module HOT 3
- Multiple entry points HOT 2
- Not working with sharp again "Cannot include directory %1 into executable." HOT 7
- test script crashes with bad invocation of npx
- Node 18.15 as Error HOT 3
- Unexpected character in app icon HOT 1
- Is it possible to use a specific node version (16.8) in Vercel?
- Reading the root of a drive on windows results extra 'snapshot' directory HOT 1
- Cannot find worker js file included as an asset on Windows HOT 3
- [email protected] "No available node version satisfies node16.14.2" HOT 4
- how to run linux compiled node.js script in linux? i dont know the commands HOT 1
- It seems that pkg is not compatible with Axios! HOT 3
- Better error message than "AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value"
- error -4096??? HOT 1
- Strange exe crash because of "usb" library
- `link-module-alias` for Nodejs Javascript project (not Typescript)
- Files packaged with code containing pupeteer-core 20.4.0 or higher cannot be executed
- Pkg node version binary is different than pkg fetch node version HOT 1
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 pkg.