3.1.0 • Published 3 years ago

npm-xeraglobal v3.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

npm-xeraglobal NPM version

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.

Table of Contents

  1. Installation
  2. Migration
  3. Usage
  4. Troubleshooting
  5. About --delete-trash flag
  6. Local installing modules
  7. Local removing modules
  8. Packages upgrade
  9. Sorting dependencies
  10. Reversing dependencies
  11. Removing dependencies
  12. About --use-this-dir, --no-save and --auto-support flags
  13. Unlinking
  14. Linking
  15. Global delete
  16. Examples
  17. Contacts

Changelog

HERE!

Installation

To update, you should also run this command.

npm install npm-xeraglobal -g

Migration

To migrate from version 2 to version 3 run the following commands:

npmunxer && npm i npm -g && npm install npm-xeraglobal -g

Usage

(sudo)? [npmx|npmxer|npmxeraglobal] [i|install] <...module > [--dt|--ns|--utd|--sd|--as|--asr]

Troubleshooting

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

About --delete-trash flag

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

Local installing modules

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.

Local removing modules

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.

Packages upgrade

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.

Sorting dependencies

This will sort dependencies and devDependencies by name.

npmx [xerup|upxer|up|uppackages] [s|srt|st|sort]

Example: npmx xerup sort.

Reversing dependencies

This will reverse the contrary dependencies and devDependencies.

npmx [xerup|upxer|up|uppackages] [rv|rvs|rvrs|reverse]

Example: npmx upxer rvrs.

Removing dependencies

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

About --use-this-dir, --no-save and --auto-support flags

--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]

Unlinking

This command will remove references to the global module from %HOMEPATH%/.node_modules/ .

npmx [unlink|unl] <...module>

Linking

This command will allow you to re-link global modules to %HOMEPATH%/.node_modules/ .

npmx [link|l|lnk] <...module>

Global delete

This collection of commands will allow you to uninstall what was installed with npmx install:

npm unlink <...module> && npm remove --global <...module>

Examples

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

Contacts

Yandex Mail - vladimirvsevolodovi@yandex.ru

Github - https://github.com/StormExecute/

Platforms

Github - https://github.com/StormExecute/npm-xeraglobal/

NPM - https://www.npmjs.com/package/npm-xeraglobal/

License

MIT - https://mit-license.org/

3.0.2

3 years ago

3.1.0

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.3.1

4 years ago

2.3.0

4 years ago

2.2.2

4 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.1.1

4 years ago

2.0.2

4 years ago

2.1.0

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.1.0

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago