Template for developing and publishing PostHTML plugins.
Inspired by the posthtml-plugin-boilerplate, this template is used to develop and build PostHTML plugins with TypeScript.
The posthtml-plugin-boilerplate
contains an excellent sample README to describe and document a plugin.
Don't forget to update the changelog for each release published to the npm registry.
Runs all tests in watch mode. Use this command when developing a plugin.
Runs Jest and ts-jest and outputs testing coverage.
Builds the plugin for production.
Travis CI is used to build and test pushed commits.
language: node_js
node_js: stable
cache: yarn
after_success: npx codecov
# Travis CI executes the `yarn test` script by default
# Test coverage should be printed to the Travis build log
The Travis CI configuration can be modified in .travis.yml
.
Linters are run in husky hooks to enforce a consistent code and formatting style:
-
Prettier: opinionated code formatter used to lint staged files in the pre-commit husky hook
-
TSLint: extensible TypeScript linter used to lint (and fix) errors in the pre-commit husky hook
-
commitlint: commit message linter used in the commit-msg husky hook to encourage semantic commit messages
When publishing your plugin for the first time, be sure to update the homepage
, repository
and bugs
fields in the package.json
. Login as your npm user and run the following:
yarn publish
# OR
npm publish
Update the relevant publishing-related fields in package.json.
{
"repository": {
"type": "git",
"url": "https://github.com/{USER}/template-posthtml-plugin.git"
},
"homepage": "https://github.com/{USER}/template-posthtml-plugin",
"keywords": ["posthtml", "posthtml plugin", "plugin"],
"bugs": "https://github.com/{USER}/template-posthtml-plugin/issues"
}