Summary of JavaScript Package Manager
Summary of JavaScript Package Manager
For JavaScript, package manager is not a new concept. npm and bower are two of the most popular JavaScript Package Manager tools. The JavaScript Package Manager includes volo, ringojs, and component. Compared to these package managers, npm and bower support the most JavaScript libraries and modules.
Volo: http://www.volojs.org/, A Node. js-based tool that can be used to quickly create projects, add dependency libraries, automate common tasks.
Ringojs: http://ringojs.org /,
Ringo is a JVM-based JavaScript platform that is optimized for server applications and used to develop multi-threaded JavaScript programs. Ringo peaks a large number of built-in modules and follows the CommonJS standard. Ringo is based on the Rhino JavaScript Engine of Mozilla, while the Rhino JavaScript Engine is embedded in JDK 6 and later versions. Ringo is enhanced based on Rhino, mainly in multi-thread programming.
Rp is the package manager of RingoJS. Its goal is to provide simple package management for local RingoJS installation and release packages in the remote package registry.
Component: https://github.com/componentjs/component, this package manager project has stopped maintenance.
Jam: http://jamjs.org/, A JavaScript Package Manager that manages dependencies, fast loading, and modularity, similar to Bower, managing only front-end JavaScript modules.
Webpack: http://webpack.github.io/, an open-source module loader and packaging tool that can take a variety of resources such as JS (including JSX), coffee, style (including less/sass) and images are used and processed as modules.
Jspm: http://jspm.io/, is based on Javascript Package Manager SystemJS, is based on dynamic ES6 module loader built on the tool.
Browserify: http://browserify.org/, allowing developers to organize browser-side JavaScript code in a require () approach similar to Node. js, through pre-compilation so that front-end JavaScript can directly use some libraries installed by Node NPM.
Npm mainly processes JavaScript modules compatible with Node. js, while Bower focuses on the entire Web platform and provides packages including modules, scripts, CSS style sheets, HTML templates, Image images, and fonts. Therefore, npm is mainly used for Node. js development, and bower often works on the client.
Npm and bower use incompatible organization modes and can be used in the same project. They use different metadata files. npm is a package. json, bower is bower. and install the packages in different directories. Generally, npm is used to manage the server package and bower is used to manage the client package.
Unlike Java Maven, the JavaScript Package Manager is mainly used to find packages, installation packages, and management package versions. Npm also provides simple build-related and test-related tasks.
Use JavaScript Package Manager
1) After bower or npm is installed, run
bower initnpm init
The package manager will ask questions about Project Settings. After one answer, the package Manager will create the bower. json or package. json configuration document for the project.
2) Search for available packages and execute
Bower search <keywords> npm search <keywords>
The Package Manager searches the network warehouse for a list of packages.
3) to install the package, run
Bower install <package name> npm install <package name>
The command syntax is as follows:
Bower install <package name >#< package version> npm install <package name >@< package version>
You can also save the version information of each package used by the project to the metadata file of the project, Package Manager (including the third-party package manager) you can use metadata files to monitor the maintenance, building, testing, and startup tasks of the client.
Of course, the best way is to save the package version information to the metadata configuration file of the project and use the-save option. The command syntax is as follows:
Bower install -- save <package name >#< package version> npm install -- save <package name >@< package version>