Skip to content
Linter for yarn workspaces
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
fixtures
src
.gitignore
.travis.yml
README.md
index.js
package.json
yarn.lock

README.md

lint-workspaces Build Status

Simple linter to keep internal dependencies up-to-date for yarn workspaces

Motivation

Maintaining every package.json for all packages withing a workspace can be a burden. What this package does:

  • Creates missing package.json files
  • Adds dependencies based on scoped import statements to package.json
  • Removes dependencies from package.json that are no longer used in the package

Use

Create missing package.json files

lint-workspaces create --scope="@tester"

Require package.json files in all packages

lint-workspaces require --scope="@tester"

Check for missing dependendcies or remove dependencies inside package.json

lint-workspaces depend --scope="@tester"

To automatically fix the prolems:

lint-workspaces depends --scope="@tester" --fix

Options

  • dir: directory to use, default "."
  • workspaces: list of workspaces to look for packages e.g. "./src/packages"
  • scope: npm scope for packages, e.g. "@lint-workspaces"
  • name: name of package, e.g. "packageA"
  • version: package.version to use when creating package.json file, e.g. "1.0.0"
  • template: location of template file for package.json e.g. "./package_template.json"
  • force: destructively destroys and rebuilds package.json for each package, default false
  • fix: fixes any dependencies issues, default false

Example of template package.json file

{
  "name": "${scope}/${name}",
  "version": "${version}",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": 'echo "Error: no test specified" && exit 1'
  },
  "author": "Eric Bower",
  "license": "MIT",
  "dependencies": {}
}

scope, name, and version are required

You can’t perform that action at this time.