Push all project node dependencies to a private package feed - node.js

Currently, in a project, we're using some packages from a private registry hosted on Artifactory, along with some packages from npm.
We're trying to migrate all the packages (public and privates) to another Artifactory server, which is offline. However, when I run an npm publish command on the project, it only pushes the project itself as a package and not its dependencies.
We'd like to publish all dependencies located in node_modules one by one to the private registry so they can be accessed from any offline project. Is it possible to accomplish this?
I already tried to add the packages to bundledDependencies in package.json, but this, however, doesn't push the dependencies individually.

As a workaround, what we did was to create a script that ran npm publish on every package in node_modules. Everything from the root of the project (Which had the corresponding .npmrc pointing to the target repository). This created a copy of every dependence on the new Artifactory.

Related

npm package contains node_module folder when i install it from our private hosted gitlab

we are using the package registry functionality from our private hosted gitlab.
i've created a small project which publishes the package in a ci-pipeline. when i verify this on gitlab, it says the package has ~4 kb in size. The content of the packages looks just fine (no node_modules folder).
But when i install this package in another project with npm install MY-PACKAGE, i have a "node_modules" folder inside my package.
meaning: node_modules/{MY-PACKAGE}/node_modules/
Inside this second node_modules folder are the dependencies listed in the package.json.
Can anyone tell me why this happens? and how i can get rid of it?

Can I copy the remote folder of node mudules on git lab?

The node module that I need has been updated, and there is an old version of it installed on the gitlab project. Is it possible to get the folder for that specific module as it is when it was installed?
Thank you
You dont't want to keep source code of external dependencies in your repo. You should add your node_modules to .gitignore and remove it from the repo. Instead, you just track your dependencies in your package.json file by installing them via npm install --save. Then, when someone checks out your project, he just runs npm install and all dependencies get resolved automatically. If you want to update any of the dependencies, you update it via npm cli, and commit the updated package.json to your repo.

Node.js project deployment without internet

What is the best way to deploy Node.js project to the machine without access to the internet? For example in a private network? Is there any option to make one package containing all of dependencies for the project?
in order to deploy a project, you don't need to download anything from the internet- you need it only for running npm install when building the project. if all dependencies are already there, you can just run it.
if you need it also for building the project, you can create a local npm repository and put in there all relevant dependencies

How do I develop npm installed packages along with my app?

I'm working on my application. In parallel, I'm working on updating(and adding to) a couple of the npm installed submodules at the same time.
In my package.json dependencies I have:
"zeke-bootstrap": "git://github.com/twilson63/zeke-bootstrap.git",
When I do npm install, it goes and checks out the repository and puts it under node modules just fine. My question is how to I setup this directory so that I can use git, and do commits, and eventually a push to send my changes in my dependent directory back up to github?
Thanks,
Fred
You can checkout your git repo in the node_modules folder under the same folder name as your module and node will automatically use it. However, I don't think its a very good idea. Modules are modules because they are meant to be developed separately.

Build and deploy framework for NodeJS

I've been looking around for a Java maven equivalency for NodeJS but can't really seem to find one so I'm posting this question to see whether there're a combination of tools/framework I can use to build and deploy Node. The specific tasks I'm looking for is:
Being able to grab dependent modules for a checked out code NodeJS project (for ex. Express or stuff like that)
Set up a private repository for NodeJS modules for in-house projects
Package with dependencies and make releases of Node projects to a repository (sorta like war)
Deploy a release to a remote box and fire up Node
Any help would be greatly appreciated!!!
Npm does most of that for you.
Dependency handling:
Create a package.json for your project (see required contents or use npm init)
Commit it along your project files, this will be your dependency tracking
npm install will sort out and download all dependencies
Deploying:
Upload/push your files to the server
Either send the node_modules folder along or run npm install on the server
To use your private libraries you'll need to either upload the modules folder or publish them (see below)
Private/local libraries:
Create the library anywhere you want (e.g. ~/Projects/mylib)
go to the mylib folder and run npm link
go to the project's folder and run npm install mylib
Now your local library is symlinked into your project's node_modules
To set up a private repository for your modules, follow these instructions

Resources