Skip to content
This repository has been archived by the owner on Nov 3, 2019. It is now read-only.

Commit

Permalink
feat(plugin-package-json): store the package info in a variable calle…
Browse files Browse the repository at this point in the history
…d pkg

Package is a reserved word, so pkg has to be used instead. Move mos-plugin-package-json to a
separate package.
  • Loading branch information
zkochan committed May 7, 2016
1 parent 90ee903 commit 58699ec
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 33 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<!--#preview-->
<!--@h1([package.name])-->
<!--@h1([pkg.name])-->
# mos
<!--/@-->

<!--@blockquote([package.description])-->
<!--@blockquote([pkg.description])-->
> A pluggable module that injects content into your markdown files via hidden JavaScript snippets
<!--/@-->
Expand All @@ -27,11 +27,11 @@ The [readme][] you are currently reading uses mos!

<!--@snippet('README.md#preview')-->
```md
<!--@h1([package.name])-->
<!--@h1([pkg.name])-->
# mos
<!--/@-->

<!--@blockquote([package.description])-->
<!--@blockquote([pkg.description])-->
> A pluggable module that injects content into your markdown files via hidden JavaScript snippets
<!--/@-->

Expand Down Expand Up @@ -66,7 +66,7 @@ Lets use mos to write a readme with some dynamic data. Have you ever renamed you
**README.md**

```md
<!--@h1([package.name])-->
<!--@h1([pkg.name])-->
<!--/@-->
```

Expand All @@ -75,7 +75,7 @@ If you view your readme now, it will be empty. However, you have the code that c
Once you've run `mos`, the readme will look like this:

```md
<!--@h1([package.name])-->
<!--@h1([pkg.name])-->
# my-awesome-module
<!--/@-->
```
Expand Down Expand Up @@ -163,7 +163,7 @@ There are a few mos plugins that are installed with mos by default:
- [table-of-contents](https://github.com/zkochan/remark-toc)
- [markdownscript](https://github.com/zkochan/mos-plugin-markdownscript)

Do you want to write a new one? Read the [plugins readme](./plugins/README.md).
Do you want to write a new one? Read the [plugins readme](./docs/PLUGINS.md).

## Who uses mos?

Expand Down Expand Up @@ -197,6 +197,7 @@ Do you want to write a new one? Read the [plugins readme](./plugins/README.md).
- [mos-plugin-installation](https://github.com/zkochan/mos-plugin-installation): A mos plugin for creating installation section
- [mos-plugin-license](https://github.com/zkochan/mos-plugin-license): A mos plugin for generating a license section
- [mos-plugin-markdownscript](https://github.com/zkochan/mos-plugin-markdownscript): A [mos](https://github.com/zkochan/mos) plugin that adds markownscript helpers to the markdown scope
- [mos-plugin-package-json](https://github.com/zkochan/mos-plugin-package-json): A mos plugin that makes the package.json available in the markdown scope
- [mos-plugin-shields](https://github.com/zkochan/mos-plugin-shields): A mos plugin for creating markdown shields
- [mos-plugin-snippet](https://github.com/zkochan/mos-plugin-snippet): A mos plugin for embedding snippets from files
- [normalize-newline](https://github.com/sindresorhus/normalize-newline): Normalize the newline characters in a string to `\n`
Expand Down Expand Up @@ -237,7 +238,7 @@ It means _Markdown on Steroids_!

[readme]: https://raw.githubusercontent.com/zkochan/mos/master/README.md

[mos-plugin-package-json]: ./plugins/mos-plugin-package-json
[mos-plugin-package-json]: https://github.com/zkochan/mos-plugin-package-json

[mos-plugin-example]: https://github.com/zkochan/mos-plugin-example

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions lib/cli.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ describe('cli', () => {
' ---',
' operator: equal',
' expected: |-',
" '<!--@\\'# \\' + package.name-->\\n# Bad title\\n<!--/@-->\\n\\nContent\\n'",
" '<!--@\\'# \\' + pkg.name-->\\n# Bad title\\n<!--/@-->\\n\\nContent\\n'",
' actual: |-',
" '<!--@\\'# \\' + package.name-->\\n# slipsum-lite\\n<!--/@-->\\n\\nContent\\n'",
" '<!--@\\'# \\' + pkg.name-->\\n# slipsum-lite\\n<!--/@-->\\n\\nContent\\n'",
].join('\n'))

expect(result.stdout).to.have.string([
Expand Down
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const getMarkdownMeta = require('./get-markdown-meta')
const createMDScope = require('./create-md-scope')

const defaultPlugins = [
require('../plugins/mos-plugin-package-json'),
require('mos-plugin-package-json'),
require('mos-plugin-installation'),
require('mos-plugin-license'),
require('mos-plugin-shields'),
Expand Down
2 changes: 1 addition & 1 deletion lib/test-cli/not-up-to-date.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--@'# ' + package.name-->
<!--@'# ' + pkg.name-->
# Bad title
<!--/@-->

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"mos-plugin-installation": "^0.1.1",
"mos-plugin-license": "^0.1.0",
"mos-plugin-markdownscript": "^1.0.0",
"mos-plugin-package-json": "^1.0.0",
"mos-plugin-shields": "^1.0.1",
"mos-plugin-snippet": "^1.0.0",
"normalize-newline": "~2.0.0",
Expand Down
11 changes: 0 additions & 11 deletions plugins/mos-plugin-package-json/README.md

This file was deleted.

8 changes: 0 additions & 8 deletions plugins/mos-plugin-package-json/index.js

This file was deleted.

2 changes: 0 additions & 2 deletions plugins/mos-plugin-package-json/index.spec.js

This file was deleted.

0 comments on commit 58699ec

Please sign in to comment.