The newly upgraded FE workflow is: use the FE command package to initialize the project, including project initialization, pull scaffolding, private library pull module package or post-expansion CI / CD and other operations related to the company's workflow.
The problems that arise are as follows:
The package dependency information of the scaffolding tool is stored in the package.json in the root directory. If the business project is still stored in the package.json, the dependency information of the business package will be overwritten when the scaffolding tool is updated later. Therefore, it is necessary to store the dependent information of the business separately.
In this way, it can meet the needs of the previous engineering framework by cooperating with the private database to cut the source.
A tool was specially prepared for the new requirements, and will be continuously optimized and updated in the future.
NPM: package-copy (package copy) portal
Do the following for this tool:
1. This tool can customize the file path and file name during initialization, and store dependent package information in the specified file.
2. You can use the specified pkg-copy for init, install, uninstall and other operations. The installation dependencies are the same as npm, both of which are node_modules.
3. The newly installed dependencies will also be added to the specified package.json file
Install
npm install --save-dev package-copy
Usage
use with Command Line
./node_modules/.bin/pkg-copy config json=./package-test.json
./node_modules/.bin/pkg-copy init
./node_modules/.bin/pkg-copy init json=./package-test.json
./node_modules/.bin/pkg-copy install
./node_modules/.bin/pkg-copy install -D vue-loader
./node_modules/.bin/pkg-copy uninstall --save [email protected] react
use with js
const PkgCopy = require ('package-copy' ); // If configuration items are not initialized, package-copy.json let pkg = new PkgCopy ({ json: './package-test.json' is generated in the execution directory by default }) pkg.exec ( 'pkg-copy init' ) pkg.exec ( 'pkg-copy install vue -S'). then ((msg) => (}) // use promise await pkg.exec ('pkg- copy install vue -S ') // use async / await