From 58699ec34e2fda30a3ecebd880da222186efc8c5 Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Sat, 7 May 2016 19:49:13 +0300 Subject: [PATCH] feat(plugin-package-json): store the package info in a variable called pkg Package is a reserved word, so pkg has to be used instead. Move mos-plugin-package-json to a separate package. --- README.md | 17 +++++++++-------- plugins/README.md => docs/PLUGINS.md | 0 lib/cli.spec.js | 4 ++-- lib/index.js | 2 +- lib/test-cli/not-up-to-date.md | 2 +- package.json | 1 + plugins/mos-plugin-package-json/README.md | 11 ----------- plugins/mos-plugin-package-json/index.js | 8 -------- plugins/mos-plugin-package-json/index.spec.js | 2 -- 9 files changed, 14 insertions(+), 33 deletions(-) rename plugins/README.md => docs/PLUGINS.md (100%) delete mode 100644 plugins/mos-plugin-package-json/README.md delete mode 100644 plugins/mos-plugin-package-json/index.js delete mode 100644 plugins/mos-plugin-package-json/index.spec.js diff --git a/README.md b/README.md index 75d6306..7c49dd5 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ - + # mos - + > A pluggable module that injects content into your markdown files via hidden JavaScript snippets @@ -27,11 +27,11 @@ The [readme][] you are currently reading uses mos! ```md - + # mos - + > A pluggable module that injects content into your markdown files via hidden JavaScript snippets @@ -66,7 +66,7 @@ Lets use mos to write a readme with some dynamic data. Have you ever renamed you **README.md** ```md - + ``` @@ -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 - + # my-awesome-module ``` @@ -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? @@ -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` @@ -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 diff --git a/plugins/README.md b/docs/PLUGINS.md similarity index 100% rename from plugins/README.md rename to docs/PLUGINS.md diff --git a/lib/cli.spec.js b/lib/cli.spec.js index 202b7ad..95dfd8e 100644 --- a/lib/cli.spec.js +++ b/lib/cli.spec.js @@ -50,9 +50,9 @@ describe('cli', () => { ' ---', ' operator: equal', ' expected: |-', - " '\\n# Bad title\\n\\n\\nContent\\n'", + " '\\n# Bad title\\n\\n\\nContent\\n'", ' actual: |-', - " '\\n# slipsum-lite\\n\\n\\nContent\\n'", + " '\\n# slipsum-lite\\n\\n\\nContent\\n'", ].join('\n')) expect(result.stdout).to.have.string([ diff --git a/lib/index.js b/lib/index.js index e6f4ec9..1e1af98 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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'), diff --git a/lib/test-cli/not-up-to-date.md b/lib/test-cli/not-up-to-date.md index 57fbb9d..0b36a93 100644 --- a/lib/test-cli/not-up-to-date.md +++ b/lib/test-cli/not-up-to-date.md @@ -1,4 +1,4 @@ - + # Bad title diff --git a/package.json b/package.json index a03939c..463ebd0 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/plugins/mos-plugin-package-json/README.md b/plugins/mos-plugin-package-json/README.md deleted file mode 100644 index 7e863c6..0000000 --- a/plugins/mos-plugin-package-json/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# mos-plugin-package-json - -A mos plugin that makes the package json available in the markdown scope - -## Usage - -```md - -# my-awesome-module - -``` diff --git a/plugins/mos-plugin-package-json/index.js b/plugins/mos-plugin-package-json/index.js deleted file mode 100644 index 046fe79..0000000 --- a/plugins/mos-plugin-package-json/index.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict' -module.exports = plugin - -function plugin (markdown) { - return { - package: markdown.pkg, - } -} diff --git a/plugins/mos-plugin-package-json/index.spec.js b/plugins/mos-plugin-package-json/index.spec.js deleted file mode 100644 index 774b1ec..0000000 --- a/plugins/mos-plugin-package-json/index.spec.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict' -require('.')