-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] Install a package as a sole project #1578
Comments
|
iow, that particular package does not have correct instructions; "apps" (like that one) should not be installed in this way unless they provide a binary; the proper instructions would be to tell people to clone the repo. |
If I tell people to clone the repo with git clone, npm dependencies will
not be installed. We don't commit by default the content of node_modules/
directory.
|
Step 1: clone the repo That's the way it's usually done as far as I'm aware. |
In that case I'd rather have Less programs to run. Furthermore in theory it's possible to have npm packages with no github projects attached |
Sure, it's possible, but it's a very unidiomatic way to use npm, and cding into node_modules - what should be a black box - is not a good practice. |
Wouldn't be simpler to have an extra option? Step 1: If the npm repository has already all the files I need, why do I need to fetch them in github? |
Because |
If I understand correctly, bin is for a CLI executable in the bin folder,
and in my case it is indeed a node app. But it's an app which needs to
start a server for it to work (basically it's a http server which serves a
website/calculator). And for the server to run in production I don't need
dev dependencies.
If all the files I need are in the npm repository, I still don't understand
why should I fetch them from github.
|
Why should I fetch files from two different places? |
"an app which needs to start a server" works just fine as a binary. |
But how does it work exactly?
Where do I put the binary in my repo?
How do I generate the binary if I just have a node script?
|
You put it anywhere you want, as long as "bin" in package.json points to it. By "binary" i don't mean a binary file, i just mean an executable node JS file. So, whatever your node script does, that's what your "binary" would do. |
Hi @ljharb Therefore the question remains: how does a user install a sole npm project (i.e. with dependencies but no dependants) on a new machine or an empty directory, without the need to fetch the files from github since they are already in the npm repository? |
@ljharb I updated my request |
@ljharb Thanks anyway |
The user would invoke your package in either npx or an npm run-script. |
To run npm run-script you need package.json on the current directory, and
when you install a package on a newly created directory, a package.json is
not provided in said directory. Do kindly see my OP.
…On Mon, 10 Aug 2020, 17:15 Jordan Harband, ***@***.***> wrote:
The user would invoke your package in either npx or an npm run-script.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1578 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA6M4DNKGRVUQIXR4Z22DKDSAAFHNANCNFSM4PLT4BHQ>
.
|
npm If your bug is preproducible on If your issue was a feature request, please consider opening a new RRFC or RFC. If your issue was a question or other idea that was not CLI-specific, consider opening a discussion on our feedback repo Closing: This is an automated message. |
What / Why
Imagine you have a big project with a lot of npm dependencies, but which is not supposed to have dependants, that is, a sole single project from which no other packages are supposed to depend on. An exemple is the npm package
autocosts
, 54 dependencies and 0 dependants.When I install this package on a new machine or newly created directory, the file/directory structure becomes:
When
When I run
npm install <package>
on an empty directory or a new machineHow
Current Behavior
It makes this folder/file structure with no
package.json
for the current packageThen if I want to start the server
npm start
an error occurs, that is, the commandnpm i autocosts && npm start
does not workExpected Behavior
The folder structure should just be with an extra option
npm i autocosts --sole
Basically I'm requesting an extra option to make it possible to install everything directly in the current directory
The text was updated successfully, but these errors were encountered: