-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Align core plugin setup, add test, run prettier
- Loading branch information
Showing
36 changed files
with
5,900 additions
and
263 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
env: | ||
node: true | ||
es6: true | ||
extends: | ||
- 'eslint:recommended' | ||
- 'prettier' | ||
parserOptions: | ||
ecmaVersion: 2017 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,8 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
.nyc_output | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
build | ||
|
||
# Dependency directory | ||
node_modules | ||
package-lock.json | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# ESLint Cache | ||
*.tgz | ||
.eslintcache | ||
.nyc_output | ||
coverage.info | ||
test/fixtures/*/build | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
package-lock.json | ||
package.json | ||
test/**/*.md | ||
test/fixtures/** | ||
.nyc_output/** | ||
package-lock.json |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"hooks": { | ||
"before:init": ["npm run lint", "npm test"], | ||
"after:bump": "auto-changelog -p --starting-date 2021-07-17 --commit-limit false --ignore-commit-pattern '^((dev|chore|ci):|Release|skip changelog)'", | ||
"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 --starting-date 2021-07-17 --commit-limit false --ignore-commit-pattern '^((dev|chore|ci):|Release|skip changelog)' --stdout -t https://raw.githubusercontent.com/release-it/release-it/master/templates/changelog-compact.hbs" | ||
}, | ||
"npm": { | ||
"publish": false | ||
}, | ||
"github": { | ||
"release": true, | ||
"releaseName": "@metalsmith/drafts ${version}", | ||
"tokenRef": "GITHUB_TOKEN", | ||
"assets": ["metalsmith-drafts-${version}.tgz"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
language: node_js | ||
dist: xenial | ||
|
||
node_js: | ||
- 8 | ||
- 12 | ||
- 14 | ||
- 16 | ||
|
||
os: | ||
- linux | ||
|
||
stages: | ||
- lint | ||
- test_windows | ||
- test | ||
- codecov | ||
|
||
jobs: | ||
include: | ||
- stage: lint | ||
name: ESlint | ||
node_js: node | ||
os: linux | ||
script: npm run lint | ||
- stage: test_windows | ||
name: Oldest supported version on Windows | ||
node_js: 8 | ||
os: windows | ||
- stage: codecov | ||
name: Coveralls | ||
node_js: node | ||
os: linux | ||
script: npm run test && npm run coveralls | ||
|
||
script: npm run test | ||
|
||
notifications: | ||
email: false | ||
webhooks: | ||
urls: | ||
- https://webhooks.gitter.im/e/de552aa9082bfddb180d | ||
on_cancel: never |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# @metalsmith/drafts | ||
|
||
A metalsmith plugin to hide drafts. | ||
|
||
[![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] | ||
|
||
## Installation | ||
|
||
NPM: | ||
|
||
```bash | ||
npm install @metalsmith/drafts | ||
``` | ||
|
||
Yarn: | ||
|
||
```bash | ||
yarn add @metalsmith/drafts | ||
``` | ||
|
||
## Usage | ||
|
||
Pass the plugin with any options to `Metalsmith.use`. | ||
|
||
```js | ||
const drafts = require('@metalsmith/drafts') | ||
|
||
metalsmith.use(drafts()) | ||
metalsmith.use(drafts({ default: false })) // same as default | ||
``` | ||
|
||
Add `draft: true` to your files' YAML front-matter to mark them as drafts: | ||
|
||
```yaml | ||
--- | ||
title: My post | ||
draft: true | ||
--- | ||
``` | ||
|
||
### Default value for `draft` | ||
|
||
You can instruct `@metalsmith/drafts` to mark files as `draft` by default if they don't have a `draft` property in their front-matter: | ||
|
||
```js | ||
const drafts = require('@metalsmith/drafts') | ||
|
||
metalsmith.use( | ||
drafts({ | ||
default: true | ||
}) | ||
) | ||
``` | ||
|
||
### CLI Usage | ||
|
||
To use this plugin with the Metalsmith CLI, add `@metalsmith/drafts` to the `plugins` key in your `metalsmith.json` file: | ||
|
||
```json | ||
{ | ||
"plugins": [ | ||
{ | ||
"@metalsmith/drafts": { | ||
"default": false | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
|
||
## License | ||
|
||
[MIT](LICENSE) | ||
|
||
[npm-badge]: https://img.shields.io/npm/v/@metalsmith/drafts.svg | ||
[npm-url]: https://www.npmjs.com/package/@metalsmith/drafts | ||
[ci-badge]: https://app.travis-ci.com/metalsmith/drafts.svg?branch=master | ||
[ci-url]: https://app.travis-ci.com/github/metalsmith/drafts | ||
[metalsmith-badge]: https://img.shields.io/badge/metalsmith-core_plugin-green.svg?longCache=true | ||
[metalsmith-url]: http://metalsmith.io | ||
[codecov-badge]: https://img.shields.io/coveralls/github/metalsmith/drafts | ||
[codecov-url]: https://coveralls.io/github/metalsmith/drafts | ||
[license-badge]: https://img.shields.io/github/license/metalsmith/drafts | ||
[license-url]: LICENSE |
Oops, something went wrong.