1. Use process of LERNA + NPM link soft chain:

  • Package the Lerna project first: execute a global NPM run build for the project (each package will be built automatically), because you end up referencing lib (or some other compiled packaged file), not source code

  • Lerna bootstrap will update the internal dependencies of the whole package, not manually enter the sub-package. Then run NPM run build-> lerna link again)

  • 2, delete node_modules from the project (rmdir /s node_modules)

  • 3, use: NPM link package name in the project

  • 4, then NPM install other packages

  • 5, then NPM start

  • 6. If the first link is successful, the subsequent link only needs to perform 1. Unmount the original package (NPM unlink), and then re-nPM link

2. Lerna package release process and notes:

  • NPM run build — > lerna bootstrap

  • Git add. && git commit

  • Lerna publish: gitHead publish: gitHead publish: gitHead publish: gitHead publish

    • 1. NPM login succeeds
    • NPM/CNPM/TNPM publish: CD packages/ lerna ls/NPM/CNPM publish: CD packages/ lerna ls/NPM publish
  • 4. Subpackages generate separate packages for each release

3. Package lock process

Json and package-lock.json version numbers are automatically generated. How to implement automatic generation?

  • 1. Manually change the version number of the dependent package in package.json

  • Delete node_modules (rmdir /s node_modules)

    • Json: del-f package-lock. json: del-f package-lock. json: del-f package-lock. json: del-f package-lock. json
  • 3, execute: NPM I package name_version –package-lock-only

    • A) For example: NPM I [email protected] –package-lock-only
    • B) CNPM/TNPM are not very good
    • C) If dependent packages exist in multiple packages, execute a in sequence
    • D) When executing a alone, the version number in package.json is actually changed, and the contents in -lock are also changed
    • E) If the source of the package is changed, switch the source: NPM I packageName –package-lock-only –registry= Package source
  • 4, then install all the packages: NPM/CNPM/TNPM I

  • 5. Then start: NPM start