Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/metonym/template-posthtml-plugin
Template for developing and publishing PostHTML plugins
https://github.com/metonym/template-posthtml-plugin
boilerplate posthtml posthtml-plugin template typescript
Last synced: about 1 month ago
JSON representation
Template for developing and publishing PostHTML plugins
- Host: GitHub
- URL: https://github.com/metonym/template-posthtml-plugin
- Owner: metonym
- License: mit
- Created: 2019-07-27T02:31:28.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T21:55:47.000Z (almost 2 years ago)
- Last Synced: 2023-03-02T20:06:28.502Z (over 1 year ago)
- Topics: boilerplate, posthtml, posthtml-plugin, template, typescript
- Language: TypeScript
- Homepage:
- Size: 1.54 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# template-posthtml-plugin
[![Build][build]][build-badge]
[![Coverage][codecov-shield]][codecov]> Template for developing and publishing PostHTML plugins.
Inspired by the [posthtml-plugin-boilerplate](https://github.com/posthtml/posthtml-plugin-boilerplate), this template is used to develop and build [PostHTML](https://github.com/posthtml) plugins with TypeScript.
The `posthtml-plugin-boilerplate` contains an excellent sample [README](https://github.com/posthtml/posthtml-plugin-boilerplate/blob/master/readme.md) to describe and document a plugin.
Don't forget to update the [changelog](CHANGELOG.md) for each release published to the [npm registry](https://www.npmjs.com/).
## Available Scripts
### `yarn test:tdd`
Runs all tests in [watch mode](https://jestjs.io/docs/en/cli#watch). Use this command when developing a plugin.
### `yarn test`
Runs [Jest](https://jestjs.io/) and [ts-jest](https://github.com/kulshekhar/ts-jest) and outputs testing coverage.
### `yarn build`
Builds the plugin for production.
## Continuous Integration (CI)
[Travis CI](https://travis-ci.org/) is used to build and test pushed commits.
```yaml
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`](.travis.yml).
## Other tools
Linters are run in [husky](https://github.com/typicode/husky) hooks to enforce a consistent code and formatting style:
- **[Prettier](https://prettier.io/)**: opinionated code formatter used to lint staged files in the pre-commit husky hook
- **[TSLint](https://github.com/palantir/tslint)**: extensible TypeScript linter used to lint (and fix) errors in the pre-commit husky hook
- **[commitlint](https://github.com/conventional-changelog/commitlint)**: commit message linter used in the commit-msg husky hook to encourage [semantic commit messages](https://seesparkbox.com/foundry/semantic_commit_messages)
## Publishing to npm
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:
```bash
yarn publish
# OR
npm publish
```Update the relevant publishing-related fields in [package.json](package.json).
```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"
}
```## License
[MIT](LICENSE)
[build]: https://travis-ci.com/metonym/template-posthtml-plugin.svg?branch=master
[build-badge]: https://travis-ci.com/metonym/template-posthtml-plugin
[codecov]: https://codecov.io/gh/metonym/template-posthtml-plugin
[codecov-shield]: https://img.shields.io/codecov/c/github/metonym/template-posthtml-plugin.svg