Skip to content
Draft

V5 #97

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
push:
branches: [master]
pull_request:

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [22, 20, 18]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
env:
CI: true
- run: npm coverage
env:
CI: true
- run: npm coverall
env:
CI: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
coverage
package-lock.json
.nyc_output
26 changes: 0 additions & 26 deletions .travis.yml

This file was deleted.

2 changes: 0 additions & 2 deletions .zuul.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ browsers:
version: latest
- name: firefox
version: latest
- name: ie
version: 9..latest
- name: iphone
version: latest
- name: safari
Expand Down
62 changes: 12 additions & 50 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
MAKEFLAGS += --warn-undefined-variables
PATH := node_modules/.bin:$(PATH)
SHELL := /bin/bash
MAKEFLAGS += --warn-undefined-variables
PATH := node_modules/.bin:$(PATH)
SHELL := /bin/bash

.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := all
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := all
.DELETE_ON_ERROR:
.SUFFIXES:

TEST ?= node
version ?= patch
version ?= patch

node_modules: package.json
@npm prune
Expand All @@ -21,50 +20,13 @@ clean:
@$(RM) -fr npm-debug.log
@$(RM) -fr coverage

.PHONY: fmt
fmt: node_modules
@standard --fix

.PHONY: lint
lint: node_modules
@standard

.PHONY: test
test: lint
@if [ "$(TEST)" = "browser" ]; \
then make test-browser; \
else make test-node; \
fi

.PHONY: test-node
test-node: node_modules
tape test/index.js

.PHONY: test-browser
test-browser: node_modules
ifeq ($(TRAVIS_PULL_REQUEST),true)
zuul -- test/index.js
endif

.PHONY: zuul
zuul: node_modules
zuul --local 8080 --ui tape -- test/index.js
@zuul --local 8080 --ui tape -- test/index.js

.PHONY: release
release: test
npm version $(version)
git push && git push --tags
npm publish

.PHONY: coverage
coverage: node_modules index.js test/index.js node_modules
@istanbul cover --report html --print detail ./test/index.js
@touch coverage

.PHONY: coveralls
coveralls: node_modules coverage
@istanbul report lcov
(cat coverage/lcov.info | coveralls) || exit 0

.PHONY: travis
travis: test coveralls
release: node_modules
@npm test
@npm version $(version)
@git push && git push --tags
@npm publish
30 changes: 18 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# front-matter
[![build][build-img]][build-url]
[![coverage][coverage-img]][coverage-url]
[![npm][npm-img]][npm-url]
[![github][github-img]][github-url]

[![Sauce Test Status](https://saucelabs.com/browser-matrix/front-matter.svg)](https://saucelabs.com/u/front-matter)
[![Sauce Test Status][sauce-img]][sauce-url]

> Extract meta data (front-matter) from documents.

Expand Down Expand Up @@ -96,25 +95,25 @@ Returns `true` or `false`

# Contributing

front-matter is an OPEN Source Project so please help out by [reporting bugs](http://github.com/jxson/front-matter/issues) or [forking and opening pull](https://github.com/jxson/front-matter) requests when possible.
front-matter is an OPEN Source Project so please help out by [reporting bugs](https://github.com/jxson/front-matter/issues) or [forking and opening pull](https://github.com/jxson/front-matter) requests when possible.

![standard][standard-img]

All code is linted/formatted using [standard][standard-url] style, any non-conforming code can be automatically formatted using the the fmt make task: `make fmt`.
All code is linted/formatted using [standard][standard-url] style, any non-conforming code can be automatically formatted using the the fmt npm task: `npm run fmt`.

## Maintainers

- [Adrian Gimenez](https://github.com/axdg)
- [Jason Campbell](https://github.com/jxson) - [@jxson](https://twitter.com/jxson)
- [Jason Campbell](https://github.com/jxson) - [@jxson](https://x.com/jxson)

## Contributors

This module is awesome because of all the folks who submitted pull requests:

- [Jordan Santell](https://github.com/jsantell) - [@jsantell](https://twitter.com/jsantell)
- [Jean-Philippe Monette](https://github.com/jpmonette) - [@jpmonette](https://twitter.com/jpmonette)
- [Jordan Santell](https://github.com/jsantell) - [@jsantell](https://x.com/jsantell)
- [Jean-Philippe Monette](https://github.com/jpmonette) - [@jpmonette](https://x.com/jpmonette)
- [Kai Davenport](https://github.com/binocarlos)
- [Marc-André Arseneault](https://github.com/arsnl) - [@im_arsnl](https://twitter.com/im_arsnl)
- [Marc-André Arseneault](https://github.com/arsnl) - [@im_arsnl](https://x.com/im_arsnl)
- [Bret Comnes](https://github.com/bcomnes) - http://bret.io
- [Shinnosuke Watanabe](https://github.com/shinnn)
- [Matt Dickens](https://github.com/mpd106)
Expand All @@ -128,12 +127,19 @@ This module is awesome because of all the folks who submitted pull requests:
- [Martin Heidegger](https://github.com/martinheidegger)
- [Leo Liang](https://github.com/aleung)
- [Kasper Pedersen](https://github.com/kasperpedersen)
- [David Millar](https://github.com/davmillar) - [@dave@puz.fun](https://puz.fun/@dave)

# CHANGELOG

## 5.0.0
- BREAKING: Drop Node < v18. Officially support 18, 20, 22.
- Restructure development and CI tools.
- Added test coverage.
- Dependency updates.

## 3.0.0
* CI only tests Node versions >= v6 (drops v4, and v5)
*
- CI only tests Node versions >= v6 (drops v4, and v5)


# LICENSE (MIT)

Expand All @@ -152,11 +158,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
[jekyll]: https://github.com/mojombo/jekyll
[coverage-img]: https://img.shields.io/coveralls/jxson/front-matter.svg
[coverage-url]: https://coveralls.io/r/jxson/front-matter?branch=master
[build-img]: https://img.shields.io/travis/jxson/front-matter/master.svg
[build-url]: http://travis-ci.org/jxson/front-matter
[npm-img]: https://img.shields.io/npm/dm/front-matter.svg
[npm-url]: https://npmjs.org/package/front-matter
[github-img]: https://img.shields.io/github/stars/jxson/front-matter.svg?style=social&label=Star
[github-url]: https://github.com/jxson/front-matter/
[sauce-img]: https://saucelabs.com/browser-matrix/front-matter.svg
[sauce-url]: https://saucelabs.com/u/front-matter
[standard-img]: https://cdn.rawgit.com/feross/standard/master/badge.svg
[standard-url]: http://npmjs.com/package/standard
19 changes: 12 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"meta data"
],
"license": "MIT",
"version": "4.0.2",
"version": "5.0.0",
"homepage": "https://github.com/jxson/front-matter",
"bugs": "https://github.com/jxson/front-matter/issues",
"repository": {
Expand All @@ -17,18 +17,23 @@
},
"main": "index.js",
"scripts": {
"test": "make test && check-dts"
"test": "tape test/index.js && zuul -- test/index.js && check-dts",
"lint": "standard",
"fmt": "standard --fix",
"coverage": "nyc tape test/index.js | tap-nyc",
"coverall": "nyc --reporter=lcov tape test/index.js | coveralls"
},
"dependencies": {
"js-yaml": "^3.13.1"
},
"devDependencies": {
"brfs": "^2.0.2",
"check-dts": "^0.3.0",
"coveralls": "^3.0.9",
"istanbul": "^0.4.5",
"standard": "^14.3.4",
"tape": "^4.4.0",
"check-dts": "^0.5.6",
"coveralls": "^3.1.1",
"nyc": "^17.1.0",
"standard": "^15.0.0",
"tap-nyc": "^1.0.3",
"tape": "^5.9.0",
"zuul": "^3.12.0"
},
"files": [
Expand Down
9 changes: 7 additions & 2 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test('var fm = require("front-matter")', function (t) {
t.end()
})

test('fm(string) - parse yaml delinetead by `---`', function (t) {
test('fm(string) - parse yaml delineated by `---`', function (t) {
fs.readFile(
path.resolve(__dirname, '../examples/dashes-seperator.md'),
'utf8',
Expand Down Expand Up @@ -37,7 +37,7 @@ test('fm(string) - parse yaml delinetead by `---`', function (t) {
})
})

test('fm(string) - parse yaml delinetead by `= yaml =`', function (t) {
test('fm(string) - parse yaml delineated by `= yaml =`', function (t) {
fs.readFile(
path.resolve(__dirname, '../examples/yaml-seperator.md'),
'utf8',
Expand Down Expand Up @@ -209,6 +209,11 @@ test('fm.test(string) - no front-matter', function (t) {
t.end()
})

test('fm.test() - handles missing argument fine', function (t) {
t.equal(fm.test(), false)
t.end()
})

test('Supports live updating', function (t) {
var seperator = '---'
var string = ''
Expand Down