5.4.1 • Published 3 years ago

@billogram/janitor v5.4.1

Weekly downloads
35
License
MIT
Repository
-
Last release
3 years ago

@billogram/janitor

CLI commands for maintaining a monorepo

Install

yarn add --exact @billogram/janitor

Usage

$ janitor --help
$ janitor <command> --help

Commands

changelog

Generate a complete changelog for one or more packages

Usage:
    $ janitor changelog [--ignore=<package-name>] [--scope=<package-name>] [--single-package]

Options:
    --ignore                        Ignore this package or these packages when generating a changelog
    --include-non-conventional      Include non conventional commits (backward-compatibility for older projects)
    --scope                         Generate a changelog in this package or these packages only
    --single-package

init

Initialize a new monorepo

Usage:
    $ janitor init

link

Symlink all packages in a monorepo. If an argument is supplied (organization name) the command will use the linked packages. 

Usage:
    $ janitor link [<organization-name>]

Example:

This will register (link) all packages in a monorepo.

    $ janitor link

NOTE: `janitor link` is an alias for `janitor shell 'yarn link'`.

This will use the registered version of all (external) packages belonging to the specified organization.

    $ janitor link @billogram

lint-lockfile

Analyze a Yarn lockfile and identify potential issues

Available checks:
    - Installed versions that could be merged with other already installed versions

Usage:
    $ janitor lint-lockfile [<lockfile-path>] [--dry-run]

Options:
    --dry-run   Only display potential issues

publish

Publish packages from the latest commit, if any release tags

Usage:
    $ janitor publish [--dry-run] [--otp=<pin>] [--single-package]

Options:
    --dry-run
    --otp
    --single-package

run

Run an npm script in each package that contains that script

Usage:
    $ janitor run <npm-script> [--ignore=<package-name>] [--scope=<package-name>]
                               [--from=<package-name>] [--to=<package-name>]
                               [--to-from=<package-name>]

Options:
    --from      Run script in this package and its transitive dependants
    --ignore    Ignore this package or these packages when running script
    --scope     Run script in this package or these packages only
    --stream    Stream output in real-time instead of waiting for the process to end until showing output
    --to        Run script in this package and its transitive dependencies
    --to-from   Run script in this package and its transitive dependencies and dependants

shell

Execute a shell command in each package

Usage:
    $ janitor shell [--ignore=<package-name>] [--scope=<package-name>] '<shell-command>'

Options:
    --ignore    Ignore this package or these packages when executing shell command
    --scope     Execute shell command in this package or these packages only

####sync-version

Sync versions for dependencies in a monorepo.

Usage:
    $ janitor sync-version [--dependencies] [-dev-dependencies] [--peer-dependencies]

unlink

Unlink previously created symlinks for all packages in a monorepo. If an argument is supplied (organization name) the command will unlink all packages in the specified organization.

Usage:
    $ janitor unlink [<organization-name>]

Example:

This will unregister (unlink) all packages in a monorepo.

    $ janitor unlink

NOTE: `janitor unlink` is an alias for `janitor shell 'yarn unlink'`.

This will unregister the linked version of all (external) packages belonging to the specified organization.

    $ janitor unlink @billogram

changelog

Update specified package(s) in the lockfile

Usage:
    $ janitor update-lockfile [--dry-run] --scope

Options:
    --dry-run       List outdated dependencies only
    --scope         Upgrade this package or these packages

Example:
    $ janitor update-lockfile --scope '@billogram/*'

version

Bump version of packages that have changes since their last release

Usage:
    $ janitor version [--dry-run] [--single-package]
                      [--ignore=<package-name>] [--scope=<package-name>]
                      [--message=<msg>]
                      [--skip-branch-check] [--skip-commit-and-tag] [--skip-dirty-check]

Options:
    --dry-run               Only display version bumps
    --ignore                Ignore this package or these packages when executing the version command
    --message=<msg>         The commit message (can be set in `janitor.config.js`)
    --scope                 Version this package or these packages only
    --single-package
    --skip-branch-check
    --skip-commit-and-tag
    --skip-dirty-check

Configuration

janitor uses a janitor.config.js to handle its configuration. The file itself is optional - if not found default values will be used.

The format of this file is (all values are optional)

module.exports = {
    command: {
        version: {
            branches: [],
            ignoreChanges: [],
            message: '',
            mappings: {
                'package-name': {
                    dirs: [{
                        commit: '<hash'>,
                        dir: 'path/to/pkg/until/this/commit',
                    }]
                }
            },
        },
    },
};
  • command.version.branches: specify which branches to allow versioning from
  • command.version.ignoreChanges an array of globs that won't be included when looking for changes
  • command.version.message: a custom commit message
  • command.version.mappings: mappings that should be used to specify the package dir until a commit when it was changed

Note

This library is being published with our use cases in mind and is not necessarily meant to be consumed by the broader public. We probably won't take your feature requests unless they align with our own needs.

License

MIT

5.4.1

3 years ago

5.4.0

3 years ago

5.3.0

3 years ago

5.2.0

3 years ago

5.1.0

3 years ago

5.0.0

4 years ago

4.0.3

4 years ago

4.0.2

4 years ago

4.0.1

4 years ago

4.0.0

4 years ago

3.8.0

4 years ago

3.7.0

4 years ago

3.6.0

5 years ago

3.5.0

5 years ago

3.4.2

5 years ago

3.4.1

5 years ago

3.4.0

5 years ago

3.3.0

5 years ago

3.2.0

5 years ago

3.1.1

5 years ago

3.1.0

5 years ago

3.0.0

5 years ago

2.2.1

5 years ago

2.2.0

5 years ago

2.1.4

5 years ago

2.1.3

5 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago