Common tools for automation etc. to be shared among projects.
Last updated a year ago by nevans .
ISC · Original npm · Tarball · package.json
$ cnpm install @alcumus/common-tools 
SYNC missed versions from official npm registry.

Common Rules

This repository contains common automation tools to be shared among multiple projects, including tools for installing linting rules etc.

All changes to this project should be published under a new version number.

To use this project, first install using npm i --save-dev alcumus-common-tools, then use the provided binaries to install what you need. For example:

npx common # install the most common options needed (eslint, .editorconfig, git hooks, etc.).
npx linting # install eslint.
npx linting react # install linters needed for react projects
npx editor-config # install just .editorconfig file.
npx git-hooks # NOT YET IMPLEMENTED: this will install the common git hooks to the project.

npx common forwards any parameters it receives to all of the other commands it triggers so npx common eslint will call npx linting eslint.

These commands should create very minimal files within your current project (a symlink where appropriate, a simple config file that just extends the ones from this project elsewhere). In the case of extending config files for linters it also allows us to make project specific changes if appropriate; though this should be a last resort.

Overall we should make our changes in just this project and use npm to upgrade to newer versions in other projects.

Using locally

In order to test locally, just clone the repo and link a test project to this as follows:

npm link # execute in the root of this project to make npm associate this folder with the correct package.
cd <project> # change to your test project.
npm link alcumus-common-tools # equivalent of npm i alcumus-common-tools, but creates symlinks in node_modules instead of installing.

Publishing changes

To publish changes you've made (and tested locally), just run npm run publish-new. This will publish to the correct NPM registrar as well as bumping the version number ready for the next change. For major version changes, first change package.json to have the correct version number, then run npm run publish-new.

Publishing pre-relase

To publish a pre-release version of changes you've made (and tested locally), just run npm run publish-pre-release. This will publish a pre-release version to the correct npm repo using the version defined in the package json and current branch number in the following format: version-branch-publishVersion (e.g. 0.1.10-HF-563-1) it will then increment the publish version for each subsequent run of the pre-release job.

Using on Windows

Usage on Windows should be the same as usage on Mac, except that it must be run as an administrator (run your IDE or CMD itself as admin).

Git hooks

A set of git hooks will be installed in the current project when using npx common. They can also be specifically installed with the npx install-git-hooks command. At present these git hooks provide the following functionality:

  • Warn when you check out a branch that does not follow the branch naming convention (<ticket>-<description>) or is specifically exempt (master).
  • Ensure that all commit messages are prefixed with the ticket number from the branch they were created on. I.e., if you commit with a message "Fixing unit tests" on branch "HF-99-fixing-framework-bug" your commit message will be automatically changed to "HF-99: Fixing unit tests".

To create more git hooks, simply create a new file with a file name matching any git hook file name (with .js after it) in src/git-hooks and run the install again. The files will be symlinked to .git/hooks/ making sure they will be updated if the npm module is updated.


This repository exposes a npx pr command that can be used to create pull requests in a standardised way that can be extended later. At present, this will ensure that the project passes linting before allowing a PR to be created. In the future this will be extended to include unit tests passing if present etc. In addition to this, a report can be generated that will be attached to the PR itself. At the moment this just compares linting pre-PR and post-PR, but can be extended to show changes in code coverage, etc. In addition to this the command allows an easy way of inviting people by name or by team. In order to create Bitbucket PRs, appropriate credentials must be available in ~/al-tools.credentials.json. The ~/al-tools.credentials.json structure is as follows:


In order to execute npx commands that are declared in this project from within this project, add -p . to the command as in npx -p . pr ...

    "bitbucket": {
        "username": "<user>_alcumusgroup",
        "password": "--"
    "jira": {
        "username": "<user>",
        "password": "--"

The JIRA username/password is required to get JIRA descriptions added to your PR, but is otherwise optional. JIRA unfortunately requires you to put your normal username and password in the config file, while Bitbucket allows you to create an app password (see [https://confluence.atlassian.com/bitbucket/app-passwords-828781300.html]).


npx pr -r thor # invite Thor to be a reviewer (this will be matched against both full name and username, case insensitive).
npx pr -r pippin mark # invite all of team Pippin and Mark Gabb to be a reviewer.

Any number of reviewers can be added and additional groupings can easily be added by changing the teams.json file in the S3 bucket al-automation.

NOTE: Currently npx pr is a short form of npx pr create. Additional commands (such as npx pr update may be created in the future).

npx pr --help should provide a good idea of the options available, though sensible defaults for merging to master are provided.

Future improvements

  • Add code coverage report to PR.
  • Add tasks based on reviewer checklist to PR.
  • Stop PR from being created if unit tests fail.
  • npx pr update - refresh generated content for PR based on changes, but leave other details as they were.

Making a new command available

  • Add a <command>-cli.js file that will handle CLI arguments. Bear in mind that your file may be called with arguments that belong to other CLI files so be careful about how you read them.
  • Separate the CLI logic from the business logic, business logic goes in src.
  • Add the name of your CLI file to package.json under the bin property.
  • If appropriate, add it to common-cli.js, which is executed for npx common as mentioned above.
  • Remember to publish the new version when you're done. (When the NPM repo is ready).

Current Tags

  • 0.0.21-HF-563-2                                ...           HF-563-2 (a year ago)
  • 0.0.21-HF-563-26                                ...           HF-563-26 (a year ago)
  • 0.0.21-HF-563-3                                ...           HF-563-3 (a year ago)
  • 0.0.21-HF-563-4                                ...           HF-563-4 (a year ago)
  • 0.0.21-HF-563-5                                ...           HF-563-5 (a year ago)
  • 0.0.21-HF-563-6                                ...           HF-563-6 (a year ago)
  • 0.1.1-HF-639-1                                ...           HF-639-1 (a year ago)
  • 0.1.2-HF-701-1                                ...           HF-701-1 (a year ago)
  • 0.1.2-HF-773-1                                ...           HF-773-1 (a year ago)
  • 0.1.2-HF-773-2                                ...           HF-773-2 (a year ago)
  • 0.1.3-HF-888-1                                ...           HF-888-1 (a year ago)
  • 0.1.3                                ...           latest (a year ago)

20 Versions

  • 0.1.3                                ...           a year ago
  • 0.1.3-HF-888-1                                ...           a year ago
  • 0.1.2                                ...           a year ago
  • 0.1.2-HF-773-2                                ...           a year ago
  • 0.1.2-HF-773-1                                ...           a year ago
  • 0.1.2-HF-701-1                                ...           a year ago
  • 0.1.1                                ...           a year ago
  • 0.1.1-HF-639-1                                ...           a year ago
  • 0.1.0                                ...           a year ago
  • 0.0.21-HF-563-26                                ...           a year ago
  • 0.0.21-HF-563-6                                ...           a year ago
  • 0.0.21-HF-563-5                                ...           a year ago
  • 0.0.21-HF-563-4                                ...           a year ago
  • 0.0.21-HF-563-3                                ...           a year ago
  • 0.0.21-HF-563-2                                ...           a year ago
  • 0.0.19                                ...           a year ago
  • 0.0.18                                ...           a year ago
  • 0.0.18-alpha.1                                ...           a year ago
  • 0.0.17                                ...           a year ago
  • 0.0.16                                ...           a year ago
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (20)
Dev Dependencies (3)
Dependents (0)

Copyright 2014 - 2016 © taobao.org |