This repository has been archived by the owner on Nov 10, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGES: can not work with mos@0
- Loading branch information
Showing
4 changed files
with
34 additions
and
27 deletions.
There are no files selected for viewing
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,17 +1,6 @@ | ||
'use strict' | ||
module.exports = plugin | ||
module.exports = (mos, md) => Object.assign(mos.scope, require('./lib')(md)) | ||
|
||
const createShieldsRenderer = require('./lib/create-shields-renderer') | ||
|
||
function plugin (markdown) { | ||
if (!markdown.repo || markdown.repo.host !== 'github.com') { | ||
throw new Error('The shields plugin only works for github repos') | ||
} | ||
|
||
return { | ||
shields: createShieldsRenderer({ | ||
github: markdown.repo, | ||
pkg: markdown.pkg, | ||
}), | ||
} | ||
module.exports.attributes = { | ||
pkg: require('./package.json'), | ||
} |
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,13 +1 @@ | ||
'use strict' | ||
const describe = require('mocha').describe | ||
const it = require('mocha').it | ||
const expect = require('chai').expect | ||
|
||
const mosPluginShields = require('.') | ||
|
||
describe('mosPluginShields', () => { | ||
it('should throw error when package hosted not on GitHub', () => { | ||
expect(() => mosPluginShields({ repo: { host: 'gitlab' } })) | ||
.to.throw(Error, 'The shields plugin only works for github repos') | ||
}) | ||
}) | ||
require('.') |
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,17 @@ | ||
'use strict' | ||
module.exports = plugin | ||
|
||
const createShieldsRenderer = require('./create-shields-renderer') | ||
|
||
function plugin (markdown) { | ||
if (!markdown.repo || markdown.repo.host !== 'github.com') { | ||
throw new Error('The shields plugin only works for github repos') | ||
} | ||
|
||
return { | ||
shields: createShieldsRenderer({ | ||
github: markdown.repo, | ||
pkg: markdown.pkg, | ||
}), | ||
} | ||
} |
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,13 @@ | ||
'use strict' | ||
const describe = require('mocha').describe | ||
const it = require('mocha').it | ||
const expect = require('chai').expect | ||
|
||
const mosPluginShields = require('.') | ||
|
||
describe('mosPluginShields', () => { | ||
it('should throw error when package hosted not on GitHub', () => { | ||
expect(() => mosPluginShields({ repo: { host: 'gitlab' } })) | ||
.to.throw(Error, 'The shields plugin only works for github repos') | ||
}) | ||
}) |