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

Commit

Permalink
feat: support nodejs@0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
zkochan committed May 22, 2016
1 parent b90e20d commit 9369b46
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 16 deletions.
7 changes: 7 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"presets": ["es2015"],
"plugins": [
"transform-runtime",
"add-module-exports"
]
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ node_modules

# Optional REPL history
.node_repl_history

dist
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: node_js
sudo: false
node_js:
- v0.10
- v4

cache:
Expand All @@ -12,6 +13,9 @@ before_install:
install:
- npm install

script:
- if [[ $TRAVIS_NODE_VERSION == "v0.10" ]]; then npm run test-es5; fi;
- if [[ $TRAVIS_NODE_VERSION != "v0.10" ]]; then npm run test; fi;
after_success:
- npm run coveralls
- npm run semantic-release
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ If the package has `peerDependencies`, the installation command will suggest to
<!--@dependencies({ shield: 'flat-square' })-->
## <a name="dependencies">Dependencies</a> [![Dependency status for master](https://img.shields.io/david/mosjs/mos-plugin-installation/master.svg?style=flat-square)](https://david-dm.org/mosjs/mos-plugin-installation/master)

- [babel-runtime](https://github.com/babel/babel/blob/master/packages): babel selfContained runtime
- [markdownscript](https://github.com/zkochan/markdownscript): Creates markdown Abstract Syntax Tree
- [mdast-util-to-string](https://github.com/wooorm/mdast-util-to-string): Utility to get the plain text content of a node

Expand All @@ -65,6 +66,11 @@ If the package has `peerDependencies`, the installation command will suggest to
<!--@devDependencies({ shield: 'flat-square' })-->
## <a name="dev-dependencies">Dev Dependencies</a> [![devDependency status for master](https://img.shields.io/david/dev/mosjs/mos-plugin-installation/master.svg?style=flat-square)](https://david-dm.org/mosjs/mos-plugin-installation/master#info=devDependencies)

- [babel-cli](https://github.com/babel/babel/blob/master/packages): Babel command line.
- [babel-plugin-add-module-exports](https://github.com/59naga/babel-plugin-add-module-exports): Fix babel/babel#2212
- [babel-plugin-transform-runtime](https://github.com/babel/babel/blob/master/packages): Externalise references to helpers and builtins, automatically polyfilling your code without polluting globals
- [babel-preset-es2015](https://github.com/babel/babel/blob/master/packages): Babel preset for all es2015 plugins.
- [babel-register](https://github.com/babel/babel/blob/master/packages): babel require hook
- [chai](https://github.com/chaijs/chai): BDD/TDD assertion library for node.js and the browser. Test framework agnostic.
- [cz-conventional-changelog](https://github.com/commitizen/cz-conventional-changelog): Commitizen adapter following the conventional-changelog format.
- [eslint](https://github.com/eslint/eslint): An AST-based pattern checker for JavaScript.
Expand All @@ -75,6 +81,8 @@ If the package has `peerDependencies`, the installation command will suggest to
- [istanbul](https://github.com/gotwarlost/istanbul): Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests
- [mocha](https://github.com/mochajs/mocha): simple, flexible, fun test framework
- [mos](https://github.com/zkochan/mos): A pluggable module that injects content into your markdown files via hidden JavaScript snippets
- [mos-plugin-ejs](https://github.com/mosjs/mos-plugin-ejs): A mos plugin that executes embedded js in markdown files
- [mos-processor](https://github.com/mosjs/mos-processor): A markdown processor for mos
- [semantic-release](https://github.com/semantic-release/semantic-release): automated semver compliant package publishing
- [validate-commit-msg](https://github.com/kentcdodds/validate-commit-msg): Script to validate a commit message follows the conventional changelog standard

Expand Down
33 changes: 23 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,24 @@
"version": "0.0.0-placeholder",
"description": "A mos plugin for creating installation section",
"files": [
"index.js"
"src/",
"dist/"
],
"main": "index.js",
"main": "dist/index.js",
"jsnext:main": "src/index.js",
"scripts": {
"test": "mocha && npm run lint && mos test -x=\"test/**\"",
"lint": "eslint lib/**/*.js index.js index.spec.js",
"test-es5": "mocha --compilers js:babel-register && npm run lint",
"test": "npm run test-es5 && mos test -x=\"test/**\"",
"lint": "eslint src/**/*.js",
"commit": "git-cz",
"coverage": "istanbul cover -x \"**/*.spec.js\" node_modules/mocha/bin/_mocha -- -R spec",
"precoveralls": "istanbul cover -x \"**/*.spec.js\" node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && npm i coveralls@2",
"coverage": "istanbul cover -x \"**/*.spec.js\" node_modules/mocha/bin/_mocha -- --compilers js:babel-register -R spec",
"precoveralls": "istanbul cover -x \"**/*.spec.js\" node_modules/mocha/bin/_mocha --report lcovonly -- --compilers js:babel-register -R spec && npm i coveralls@2",
"coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
"postcoveralls": "rm -rf ./coverage",
"md": "mos -x=\"test/**\"",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
"transpile": "babel src --out-dir dist",
"prepublish": "npm run transpile"
},
"repository": {
"type": "git",
Expand All @@ -36,25 +41,33 @@
},
"homepage": "https://github.com/mosjs/mos-plugin-installation#readme",
"dependencies": {
"markdownscript": "^1.1.0",
"babel-runtime": "^6.9.0",
"markdownscript": "^1.3.0",
"mdast-util-to-string": "^1.0.1"
},
"devDependencies": {
"babel-cli": "^6.9.0",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-runtime": "^6.9.0",
"babel-preset-es2015": "^6.9.0",
"babel-register": "^6.9.0",
"chai": "^3.4.1",
"cz-conventional-changelog": "1.1.5",
"eslint": "^2.9.0",
"eslint-config-standard": "^5.3.0",
"eslint-plugin-promise": "^1.1.0",
"eslint-plugin-standard": "^1.3.2",
"ghooks": "^1.2.1",
"istanbul": "^0.4.2",
"istanbul": "^1.0.0-alpha.2",
"mocha": "^2.3.4",
"mos": "^1.0.0",
"mos-plugin-ejs": "^1.1.0",
"mos-processor": "^1.2.0",
"semantic-release": "^4.3.5",
"validate-commit-msg": "^2.6.1"
},
"engines": {
"node": ">=4"
"node": ">=0.10"
},
"config": {
"commitizen": {
Expand Down
6 changes: 3 additions & 3 deletions index.js → src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const shortCommands = {
global: '-g',
}

module.exports = (mos, md) => {
export default function plugin (mos, md) {
mos.compile.pre((next, ast, opts) => {
ast.children = updateInstallationSection(ast.children)
return next(ast, opts)
Expand Down Expand Up @@ -77,6 +77,6 @@ module.exports = (mos, md) => {
}
}

module.exports.attributes = {
pkg: require('./package.json'),
plugin.attributes = {
pkg: require('../package.json'),
}
4 changes: 2 additions & 2 deletions index.spec.js → src/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ const it = require('mocha').it
const expect = require('chai').expect
const path = require('path')
const fs = require('fs')
const ROOT = path.join(__dirname, 'test/fixtures')
const ROOT = path.resolve(__dirname, '../test/fixtures')
const fixtures = fs.readdirSync(ROOT).filter(filepath => filepath.indexOf('.') !== 0)

const mos = require('mos-processor')
const ejs = require('mos-plugin-ejs')
const installation = require('.')
import installation from './index'

describe('mos-plugin-toc', () => {
fixtures.forEach(fixture => {
Expand Down
2 changes: 1 addition & 1 deletion test/mocha.opts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{lib/**/*,index}.spec.js
src/**/*.spec.js

0 comments on commit 9369b46

Please sign in to comment.