From f8fe4004fc7f594b133f6fc1439e4f4a8daeaef1 Mon Sep 17 00:00:00 2001 From: Terin Stock Date: Tue, 2 Feb 2016 11:59:59 -0800 Subject: [PATCH] chore(package): setup Travis-CI --- .travis.yml | 14 ++++++++++++++ README.md | 10 ++++++++-- package.json | 11 +++++++---- test/preload.js | 7 ++++++- 4 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..c01b40a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +language: node_js +sudo: false +node_js: + - 0.10 + - 0.12 + - 4.2 + - node +before_install: + - npm install -g npm@latest-2 +after_success: + - npm run coverage +branches: + except: + - "/^v\\d+\\.\\d+\\.\\d+$/" \ No newline at end of file diff --git a/README.md b/README.md index 566f8c8..bd39be0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# netjet +# netjet [![Travis-CI Status](https://img.shields.io/travis/cloudflare/netjet/master.svg?label=Travis%20CI&style=flat-square)](https://travis-ci.org/cloudflare/netjet)[![](https://img.shields.io/npm/dm/netjet.svg?style=flat-square)](http://browsenpm.org/package/netjet)[![](https://img.shields.io/npm/v/netjet.svg?style=flat-square)](http://browsenpm.org/package/netjet)[![](https://img.shields.io/coveralls/cloudflare/netjet/master.svg?style=flat-square)](https://coveralls.io/github/cloudflare/netjet)[![](https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square)](https://nodejs.org/api/documentation.html#documentation_stability_index) netjet is a Node.js HTTP middleware to automatically insert [Preload][preload] link headers in HTML responses. These Preload link headers allow for web browsers to initiate early resource fetching before being needed for execution. @@ -16,7 +16,13 @@ express() .listen(1337); ``` +## Node.js 0.10 Requirements + +This module utilizes the [`posthtml`][posthtml] module to find images, scripts, and stylesheets in your HTML response. +PostHTML requires a native Promise implementation or shim, so users of Node.js 0.10 will need to ensure a Promise shim has been configured. + ## License -[MIT](https://www.tldrlegal.com/l/mit), see `LICENSE.md`. +[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://www.tldrlegal.com/l/mit) see `LICENSE.md`. [preload]: https://www.w3.org/TR/preload/ +[posthtml]: https://github.com/posthtml/posthtml diff --git a/package.json b/package.json index 1cb9123..d028816 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,12 @@ "description": "Express middleware to generate preload headers", "main": "index.js", "scripts": { - "test": "xo && istanbul cover -- _mocha --check-leaks --reporter spec" + "test": "xo && istanbul cover -- _mocha --check-leaks --reporter spec", + "coverage": "cat ./coverage/lcov.info | coveralls" }, "repository": { "type": "git", - "url": "git+https://github.com/cloudflare/vahevara.git" + "url": "git+https://github.com/cloudflare/netjet.git" }, "keywords": [ "express", @@ -19,9 +20,9 @@ "author": "Terin Stock (https://terinstock.com/)", "license": "MIT", "bugs": { - "url": "https://github.com/cloudflare/vahevara/issues" + "url": "https://github.com/cloudflare/netjet/issues" }, - "homepage": "https://github.com/cloudflare/vahevara#readme", + "homepage": "https://github.com/cloudflare/netjet#readme", "files": [ "index.js", "posthtml-preload.js" @@ -36,6 +37,8 @@ }, "devDependencies": { "assume": "^1.3.1", + "core-js": "^2.0.3", + "coveralls": "^2.11.6", "detour": "^1.3.0", "istanbul": "^0.4.2", "mocha": "^2.4.5", diff --git a/test/preload.js b/test/preload.js index 26d4957..7744cbf 100644 --- a/test/preload.js +++ b/test/preload.js @@ -1,6 +1,11 @@ 'use strict'; -/* globals describe, before, it */ +require('core-js/shim'); + +var describe = require('mocha').describe; +var before = require('mocha').before; +var it = require('mocha').it; var expect = require('assume'); + var http = require('http'); var preload = require('../'); var request = require('supertest');