Skip to content

Commit

Permalink
Breaking: remove remark-git-contributors plugin
Browse files Browse the repository at this point in the history
If you had a CONTRIBUTORS.md it will no longer be updated.

Ref #38
  • Loading branch information
vweevers committed Nov 14, 2021
1 parent d0a7ce3 commit e8ec0c8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 62 deletions.
42 changes: 0 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@
- [`validateLinks`](#validatelinks)
- [`paddedTable`](#paddedtable)
- [`toc`](#toc)
- [`contributors`](#contributors)
- [`plugins`](#plugins)
- [`fixers`](#fixers)
- [Opt-in Features](#opt-in-features)
- [Table of Contents](#table-of-contents-1)
- [Contributors Table](#contributors-table)
- [Reporters](#reporters)
- [Install](#install)
- [License](#license)
Expand Down Expand Up @@ -230,10 +228,6 @@ Boolean. Set to `false` to keep markdown tables compact. A temporary option unti

Boolean. Set to `false` to skip generating (or replacing) a Table of Contents. A temporary option until we write a more flexible plugin ([#36](https://github.com/vweevers/hallmark/issues/36)).

### `contributors`

String or array. See [Contributors Table](#contributors-table) for details. Aliased as `community`. Set to `false` to disable this feature entirely.

### `plugins`

An array of extra plugins, to be applied in both lint and fix mode.
Expand All @@ -256,42 +250,6 @@ Add this heading to a markdown file:

Running `hallmark fix` will then create or update a table of contents.

### Contributors Table

_Note: this feature might get removed in a next major version ([#38](https://github.com/vweevers/hallmark/issues/38))._

Add this heading to an otherwise empty `CONTRIBUTORS.md`:

```markdown
# Contributors
```

Or this heading to a `README.md`:

```markdown
## Contributors
```

Running `hallmark fix` will then render contributors from `git` history to a markdown table. To add links to GitHub and social profiles of contributors, add the `contributors` [Package Option](#package-options):

```json
"hallmark": {
"contributors": [{
"name": "Sara",
"email": "sara@example.com",
"github": "sara",
"twitter": "sara"
}]
}
```

Where `contributors` is either:

- An array in the form of `[{ email, name, … }, … ]`;
- A module id or path to a file that exports `contributors` or `{ contributors }`.

Alternatively, put the metadata in the [`author` or `contributors` fields](https://docs.npmjs.com/files/package.json#people-fields-author-contributors) in `package.json`. For details, please see [`remark-git-contributors`](https://github.com/remarkjs/remark-git-contributors#metadata).

## Reporters

Various reporters are available:
Expand Down
18 changes: 9 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function hallmark (options, callback) {
const ignore = concat('ignore', rc, options)

deglob(files, { usePackageJson: false, cwd, ignore }, function (err, files) {
if (err) throw err
if (err) return callback(err)

if (!files.length) {
callback(null, { code: 0, files: [] })
Expand All @@ -45,11 +45,18 @@ function hallmark (options, callback) {
const paddedTable = rc.paddedTable !== false
const validateLinks = rc.validateLinks !== false
const toc = rc.toc !== false
const contributors = 'contributors' in rc ? rc.contributors : rc.community
const changelog = Object.assign({}, rc.changelog, options.changelog)
const plugins = { plugins: concat('plugins', rc, options) }
const fixers = { plugins: concat('fixers', rc, options) }

if ('contributors' in rc) {
return callback(new Error("The 'contributors' option has been removed"))
}

if ('community' in rc) {
return callback(new Error("The 'community' option has been removed"))
}

engine({
processor,
extensions: [
Expand All @@ -68,13 +75,6 @@ function hallmark (options, callback) {
reporter,
reporterOptions,
plugins: [
// Skip updating contributors table in lint mode
fix && contributors !== false && options.contributors !== false
? [require('remark-git-contributors'), {
contributors: contributors || null
}]
: null,

[require('remark-common-changelog'), { cwd, fix, pkg, repository, ...changelog }],
[require('remark-github'), { repository }],

Expand Down
7 changes: 1 addition & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"bin": "cli.js",
"main": "index.js",
"scripts": {
"test": "standard && depcheck --ignores level-community && node cli.js && tape test/*.js",
"test": "standard && depcheck && node cli.js && tape test/*.js",
"hallmark": "node cli.js --fix",
"check-licenses": "npm-consider install --test --production"
},
Expand All @@ -27,7 +27,6 @@
"remark-autolink-references": "^1.0.0",
"remark-collapse": "~0.1.2",
"remark-common-changelog": "^0.0.2",
"remark-git-contributors": "^3.0.0",
"remark-github": "^9.0.1",
"remark-lint": "^7.0.1",
"remark-lint-blockquote-indentation": "^2.0.1",
Expand Down Expand Up @@ -59,7 +58,6 @@
"devDependencies": {
"depcheck": "^1.2.0",
"git-pull-or-clone": "^2.0.1",
"level-community": "^3.0.0",
"npm-consider": "^1.7.0",
"standard": "^15.0.0",
"tape": "^5.0.1",
Expand Down Expand Up @@ -88,9 +86,6 @@
"engines": {
"node": ">=6"
},
"hallmark": {
"contributors": false
},
"config": {
"allowedLicenseTypes": [
"publicDomain",
Expand Down
7 changes: 2 additions & 5 deletions test/dependents.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const dependents = [
// 'deltachat/deltachat-node', // Invalid
'Level/abstract-leveldown',
'Level/bench',
'Level/codec',
'Level/transcoder',
'Level/compose',
'Level/deferred-leveldown',
'Level/leveldown',
Expand Down Expand Up @@ -45,10 +45,7 @@ for (const repo of dependents) {
cp.fork(cli, { cwd, stdio }).on('exit', function (code) {
t.is(code, 0, 'hallmark linter exited with code 0')

// Skip CONTRIBUTORS.md for now (many dependents need updating)
const args = ['--fix', '-i', 'CONTRIBUTORS.md']

cp.fork(cli, args, { cwd, stdio }).on('exit', function (code) {
cp.fork(cli, ['--fix'], { cwd, stdio }).on('exit', function (code) {
t.is(code, 0, 'hallmark fixer exited with code 0')

cp.execFile('git', ['diff', '--color'], { cwd }, function (err, stdout) {
Expand Down

0 comments on commit e8ec0c8

Please sign in to comment.