This package includes common development packages, types, and/or configuration defaults used by other projects:
mochasinonchai- along withsinon-chaiandchai-as-promisedc8standardxbabelrenovate- shared configuration
It also includes a reusable Github Action for Node builds, and a shared workflow for Release Please.
Some libraries can use default configurations provided by this library. Add them to the project's package.json as follows:
{
...,
"babel": {
"extends": "./node_modules/@dimensionalpocket/development/babel"
},
"eslintConfig": {
"extends": "./node_modules/@dimensionalpocket/development/eslint"
},
"c8": {
"extends": "./node_modules/@dimensionalpocket/development/c8/default.json"
}
}Alongside extends, you can add extra configuration if you need settings to differ from defaults.
StandardX, Mocha, and packages not mentioned above do not properly support extends or custom configuration files and must be manually configured.
If you are extending eslintConfig like the previous example, you don't need to configure StandardX. The provided ESLint configuration already uses mocha as environment, along with the Babel parser.
You can still extend configuration if needed:
{
...,
"standardx": {
"globals": ["WebSocket"]
}
}To make renovate use the preset from this repository, add the following to the project's .github/renovate.json:
{
"extends": [
"github>dimensionalpocket/development-js//renovate/default"
]
}This repository includes a reusable workflow for Node builds.
To use it, replace your workflow file with the following:
name: Node.js
on:
pull_request:
jobs:
default:
uses: dimensionalpocket/development-js/.github/workflows/default-node-build.yml@1.3.0The workflow supports a number of input variables, including secrets. Check .github/workflows/default-node-build.yml for details.
This package includes a shared workflow for Release Please.
To use it, create ./github/workflows/release.yml in the project with the following content:
name: Release
on:
push:
branches: main
jobs:
default:
uses: dimensionalpocket/development-js/.github/workflows/default-release.yml@1.3.0Next, create a version.js file with the following content:
export const VERSION = 'X.Y.Z' /* x-release-please-version */Then:
- Replace
X.Y.Zwith the current version of the package frompackage.json; - Keep the in-line comment, that's how Release Please will replace the version number when creating a release PR.
The version.js file can be placed in the root, src, or config folders.
In your test files, import and use expect, chai, and sinon from the library directly:
import { expect, sinon } from '@dimensionalpocket/development'
describe('Your Class', function () {
// ...
})Install the package directly from GitHub:
npm i -D -E github:dimensionalpocket/development-js#1.3.0MIT