Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
webketje committed Jan 29, 2024
0 parents commit 07f55ae
Show file tree
Hide file tree
Showing 19 changed files with 20,286 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[*]
charset = utf-8

[*.{js,json,yml}]
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
24 changes: 24 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
env:
node: true
es6: true
extends:
- 'eslint:recommended'
- 'plugin:n/recommended'
- 'plugin:import/recommended'
- 'prettier'
parserOptions:
ecmaVersion: 2020
rules:
no-console: error
prefer-const: error
no-var: error
no-use-before-define: error
no-await-in-loop: error
n/exports-style: [0, error]
import/first: error
import/no-anonymous-default-export: error
import/no-unassigned-import: error
import/no-internal-modules:
- error
- allow:
- src/**
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Automatically normalize line endings for all text-based files
# http://git-scm.com/docs/gitattributes#_end_of_line_conversion
* text=auto eol=lf

# For binary file types, prevent converting CRLF chars
*.jpg -text
*.png -text
63 changes: 63 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: CI
on:
push:
branches: ['**']
pull_request:
branches: ['main']

jobs:
pre-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: 'npm'

- run: npm install
- run: npm run format:check
- run: npm run lint:check

branch-test:
if: github.ref_name != 'main' && success()
needs: pre-test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-latest', 'windows-latest']
node: ['14.14.0']
name: Testing Node ${{ matrix.node }} on ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: 'npm'

- run: npm install
- run: npm test

test:
if: github.ref_name == 'main' && success()
needs: pre-test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-latest', 'windows-latest']
node: ['14.14.0', '16.0', '18.0']
name: Testing Node ${{ matrix.node }} on ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'npm'

- run: npm install
- run: npm test
- if: matrix.os == 'ubuntu-latest' && matrix.node == '18.0'
run: npm run coverage
- if: matrix.os == 'ubuntu-latest' && matrix.node == '18.0'
uses: coverallsapp/github-action@v2
with:
file: coverage.info
format: lcov
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
npm-debug.log*
.npm
*.tgz
.eslintcache
coverage
coverage.info
test/fixtures/*/build
node_modules
lib/*
!lib/*.d.ts
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package-lock.json = false
sign-git-tag = true
message = Bump package.json to %s
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test/fixtures/**
.nyc_output/**
package-lock.json
7 changes: 7 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
trailingComma: none
tabWidth: 2
semi: false
singleQuote: true
bracketSpacing: true
arrowParens: always
printWidth: 120
24 changes: 24 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"hooks": {
"before:init": ["npm run lint", "npm audit --omit=dev", "npm test"],
"after:bump": "auto-changelog -p --commit-limit false --ignore-commit-pattern '^((dev|chore|ci):|Release)'",
"after:npm:bump": "npm pack",
"after:release": "echo Successfully released ${name} v${version} to ${repo.repository}."
},
"git": {
"commitMessage": "Release ${version}",
"commitArgs": ["-S"],
"tagAnnotation": "Release ${version}",
"tagArgs": ["-s"],
"changelog": "auto-changelog -u --commit-limit false --ignore-commit-pattern '^((dev|chore|ci):|Release)' --stdout -t https://raw.githubusercontent.com/release-it/release-it/master/templates/changelog-compact.hbs"
},
"npm": {
"publish": false
},
"github": {
"release": true,
"releaseName": "@metalsmith/~core-plugin~ ${version}",
"tokenRef": "GITHUB_TOKEN",
"assets": ["metalsmith-~core-plugin~-${version}.tgz"]
}
}
Empty file added CHANGELOG.md
Empty file.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 webketje

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
106 changes: 106 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
_Note: This is a template repository_

Usage:

1. Click "Use this template", see also https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template, fill in new plugin details
2. Search and replace all `core-plugin` `CorePlugin` and `corePlugin` matches with the name of the plugin
3. Change description in package.json & match in repo description
4. Remove this text

---

# @metalsmith/~core-plugin~

A metalsmith plugin to...

[![metalsmith: core plugin][metalsmith-badge]][metalsmith-url]
[![npm: version][npm-badge]][npm-url]
[![ci: build][ci-badge]][ci-url]
[![code coverage][codecov-badge]][codecov-url]
[![license: MIT][license-badge]][license-url]

## Features

An optional features section (if there are many), or an extended description of the core plugin

## Installation

NPM:

```
npm install @metalsmith/~core-plugin~
```

Yarn:

```
yarn add @metalsmith/~core-plugin~
```

## Usage

Pass `@metalsmith/~core-plugin~` to `metalsmith.use` :

```js
import ~corePlugin~ from '@metalsmith/~core-plugin~'

metalsmith.use(~corePlugin~()) // defaults
metalsmith.use(~corePlugin~({ // explicit defaults
...
}))
```

### Options

Optional section with list or table of options, if the plugin has a lot of options

### Specific usage example

Document a first specific usage example, the title can be "Achieve x by doing y"

### Specific usage example

Document a second specific usage example, the title can be "Achieve x by doing y"

### Debug

To enable debug logs, set the `DEBUG` environment variable to `@metalsmith/~core_plugin~*`:

```js
metalsmith.env('DEBUG', '@metalsmith/~core_plugin~*')
```

Alternatively you can set `DEBUG` to `@metalsmith/*` to debug all Metalsmith core plugins.

### CLI usage

To use this plugin with the Metalsmith CLI, add `@metalsmith/~core-plugin~` to the `plugins` key in your `metalsmith.json` file:

```json
{
"plugins": [
{
"@metalsmith/~core-plugin~": {}
}
]
}
```

## Credits (optional)

Special thanks to ... for ...

## License

[MIT](LICENSE)

[npm-badge]: https://img.shields.io/npm/v/@metalsmith/~core-plugin~.svg
[npm-url]: https://www.npmjs.com/package/@metalsmith/~core-plugin~
[ci-badge]: https://github.com/metalsmith/~core-plugin~/actions/workflows/test.yml/badge.svg
[ci-url]: https://github.com/metalsmith/~core-plugin~/actions/workflows/test.yml
[metalsmith-badge]: https://img.shields.io/badge/metalsmith-core_plugin-green.svg?longCache=true
[metalsmith-url]: https://metalsmith.io
[codecov-badge]: https://img.shields.io/coveralls/github/metalsmith/~core-plugin~
[codecov-url]: https://coveralls.io/github/metalsmith/~core-plugin~
[license-badge]: https://img.shields.io/github/license/metalsmith/~core-plugin~
[license-url]: LICENSE
10 changes: 10 additions & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Plugin } from 'metalsmith';

export default corePlugin;
export type Options = {
key: string;
};
/**
* A Metalsmith plugin to serve as a boilerplate for other core plugins
*/
declare function corePlugin(options: Options): Plugin;
Loading

0 comments on commit 07f55ae

Please sign in to comment.