Skip to content

Latest commit

 

History

History
80 lines (51 loc) · 2.89 KB

GUIDELINES.md

File metadata and controls

80 lines (51 loc) · 2.89 KB

Guidelines

Tooling

Volta

This project uses Volta to ensure that all the contributors share the same version of Node and Npm for development. If you are considering making frequent contributions to this project, we recommend installing this tool as well. Otherwise, check the volta field in package.json to see which versions to use.

Ide: Vscode

The project was provided with Vscode and then contains some configuration to deal with NPM's workspaces.

We could find some configuration to run the Vscode's jest plugin and jest-runner plugin, eslint plugin, typescript, to use their debugger mode, coverage, build, etc...

Ensure to have these plugins and you will have for free the same env with everything configured

Workspaces

The project uses the NPM's workspaces. It means you have to use the NPM's command to deal with workspaces

New package

If you need to create the new package, run the following command at the rood of the project:

npm init -w ./packages/a

The new package will be declared with the same project's version, will be declared in the package-lock.json file, etc...

If this package needs jest, ensure in the vscode.settings.json to update the config:

"jest.virtualFolders": [{ "name": "core", "rootPath": "packages/core" }]

Remove package

if you need to remove package, here the process:

  • First, remove the folder, e.g. rm -rf packages/b
  • Second, cleanup if needed vscode files
  • Next, run npm install
  • Then update the package-lock.json file to remove your package

For the last, it seems there is an issue when we remove a package and the lock seems to be cleaned. There is a pending PR but notyet approved.

Add a dependency between packages

If you need to add a common dependency, please on the root of the project:

npm install --save-dev mydep

Link a package on another package

Public package

If you need a public package on another one, please run on the root of the project:

npm install --save @npmversion/core --workspace=packages/cli

Private package

If you need a private package on another one, please edit in the target package's package.json file the peerDependencies like so:

"peerDependencies": {
    "@npmversion/jest-utils": "*"
},
"peerDependenciesMeta": {
    "@npmversion/jest-utils": {
        "optional": true
    }
}