This tool installs modules in the default global directory(%GlobalDirNpm%) and the global home directory(%HOMEPATH%/.node_modules/), which allows you to include them in your project due to the specificity of the require function.
- Installation
- Migration
- Usage
- Troubleshooting
- About --delete-trash flag
- Local installing modules
- Local removing modules
- Packages upgrade
- Sorting dependencies
- Reversing dependencies
- Removing dependencies
- About --use-this-dir, --no-save and --auto-support flags
- Unlinking
- Linking
- Global delete
- Examples
- Contacts
To update, you should also run this command.
npm install npm-xeraglobal -g
To migrate from version 2 to version 3 run the following commands:
npmunxer && npm i npm -g && npm install npm-xeraglobal -g
(sudo)? [npmx|npmxer|npmxeraglobal] [i|install] <...module > [--dt|--ns|--utd|--sd|--as|--asr]
sudo gulp task
: module gulp not found, as well as sudo webpack
and sudo node
: module not found:
This error occurs because node.js uses safeGetEnv("HOME")
in Module._initPaths
. The solution is to use sudo --preserve-env (-E)
- sudo -E gulp task
, sudo -E webpack
, sudo -E node nodefile
.
Webpack installation:
npm i webpack-cli --global && npmxer install webpack
Gulp installation:
npmxer install gulp
npmx install <...module > [-dt|--dt|--delete-trash]
Its main task is to delete directories and files located in the root of the module and do not affect the main functionality, if, of course, they are there. It only checks for %HOME%/.node_modules/
path, and the global folder will contain absolutely all files. README, as well as license, authors, and contributors files, are ignored and will not be deleted. Modules installed via @ are also ignored (for example, npmx i @babel/core
).
Will be found and deleted:
- Following folders:
- .idea
- .git
- .github
- example
- examples
- test
- tests
- Following files:
- .npmignore
- .npmrc
- .gitattributes
- .gitignore
- .gitmodules
- .editorconfig
- .eslintignore
- .eslintrc
- .travis.yml
- .tidelift.yml
- appveyor.yml
- make + Make
- makefile + Makefile
- rakefile + Rakefile
The official package manager can create nasty conflicts with already installed globally modules using this module, for example, delete information about them in package.json.
To install modules locally without conflicts, use the following command:
npmx [installLocal|il] <...module>
Example: npmx il someModule
.
Almost equivalent to this: npm i someModule
.
The official package manager can create nasty conflicts with already installed globally modules using this module, for example, delete information about them in package.json.
To remove local modules without conflicts, use the following command:
npmx [r|rm|rem|remove|uninstall|del|dl|d] <...module>
Example: npmxer r someModule
.
Almost equivalent to this: npm r someModule
.
This will update the package.json in the new project without loading the module again.
If the package.json does not exist - it will be created.
npmx [xerup|upxer|up|uppackages] <...packages> [-D|--save-dev]
Example: npmx up gulp webpack -D
.
This will sort dependencies and devDependencies by name.
npmx [xerup|upxer|up|uppackages] [s|srt|st|sort]
Example: npmx xerup sort
.
This will reverse the contrary dependencies and devDependencies.
npmx [xerup|upxer|up|uppackages] [rv|rvs|rvrs|reverse]
Example: npmx upxer rvrs
.
npmx [xerup|upxer|up|uppackages] [null|d|r|rm|rmv|remove|delete|dlt|dl|del] <...packages> [-D|--save-dev]
Example: npm uppackages null gulp webpack webpack-stream del
--use-this-dir:
The --use-this-dir(--utd) flag was added to write dependencies to the directory from which the installation is performed (when installing into a project without --utd, the main project package is located).
npmx [install|i] <...module> [--utd|--use-this-dir]
--no-save:
Does not write dependencies to package.json .
npmx [install|i] <...module> [--ns|--no-save]
--auto-support:
Attempts to write automatic recommended support to dependencies.
npmx [install|i] <...module> [--as|--auto-support|--ass]
--auto-support-real:
The same as --auto-support only changes the original file and not the linked one.
npmx [install|i] <...module> [--asr|--auto-support-real|--real-ass]
This command will remove references to the global module from %HOMEPATH%/.node_modules/ .
npmx [unlink|unl] <...module>
This command will allow you to re-link global modules to %HOMEPATH%/.node_modules/ .
npmx [link|l|lnk] <...module>
This collection of commands will allow you to uninstall what was installed with npmx install:
npm unlink <...module> && npm remove --global <...module>
First, install the modules.
D:\NodeProjects\yourProject> npmx i gulp
D:\NodeProjects\yourProject> npmx i browser-sync -D
Then create a file "index.js".
"use strict";
const gulp = require("gulp");
const browserSync = require("browser-sync").create();
gulp.task("hello", cb => {
console.log("Hello");
cb();
})
gulp.task("serve", () => {
browserSync.init({
server: "front"
});
browserSync.watch("front/**/*.*").on("change", browserSync.reload);
});
And run it!
D:\NodeProjects\yourProject> gulp hello
D:\NodeProjects\yourProject> gulp serve
[ctrl+c] y
For new projects, gulp and browser-sync (in the context of this example) will be available as local modules.
Now let's create a new project and update its dependencies.
D:\NodeProjects\yourProject> cd .. && mkdir testProject && cd testProject
D:\NodeProjects\testProject> npmx xerup gulp browser-sync -D
Creating index.js:
"use strict";
const gulp = require("gulp")
gulp.task("default", cb => {
console.log("Hello World!")
cb()
})
Run it:
D:\NodeProjects\testProject> gulp
Yandex Mail - vladimirvsevolodovi@yandex.ru
Github - https://github.com/StormExecute/
Github - https://github.com/StormExecute/npm-xeraglobal/
NPM - https://www.npmjs.com/package/npm-xeraglobal/
MIT - https://mit-license.org/