Skip to content

Commit

Permalink
refactor: drop <8.x, support egg2. [BREAKING CHANGE] (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
atian25 authored and popomore committed Nov 17, 2017
1 parent b0a8978 commit 67daee9
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 33 deletions.
3 changes: 1 addition & 2 deletions .autod.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@ module.exports = {
'./test/fixtures',
'./docs',
'./coverage',
],
registry: 'https://r.cnpmjs.org',
]
};
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
sudo: false
language: node_js
node_js:
- '6'
- '7'
- '8'
- '9'
install:
- npm i npminstall && npminstall
script:
Expand Down
6 changes: 3 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ module.exports = app => {
this.app = ctx.app;
}

* render(name, context, options) {
const content = yield fs.readFile(name, 'utf8');
async render(name, context, options) {
const content = await fs.readFile(name, 'utf8');
return this[COMPILE](content, context, options);
}

* renderString(tpl, context, options) {
async renderString(tpl, context, options) {
return this[COMPILE](tpl, context, options);
}

Expand Down
6 changes: 3 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
environment:
matrix:
- nodejs_version: '6'
- nodejs_version: '7'
- nodejs_version: '8'
- nodejs_version: '9'

install:
- ps: Install-Product node $env:nodejs_version
Expand All @@ -10,6 +10,6 @@ install:
test_script:
- node --version
- npm --version
- npm run ci
- npm run test

build: off
36 changes: 19 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"description": "egg view plugin for handlebars",
"eggPlugin": {
"name": "handlebars",
"dependencies": [ "view" ]
"dependencies": [
"view"
]
},
"keywords": [
"egg",
Expand All @@ -14,37 +16,37 @@
"handlebars"
],
"dependencies": {
"handlebars": "^4.0.6",
"mz": "^2.6.0"
"handlebars": "^4.0.11",
"mz": "^2.7.0"
},
"devDependencies": {
"autod": "^2.7.1",
"egg": "^1.0.0-rc.2",
"egg-bin": "^2.2.3",
"egg-ci": "^1.5.0",
"egg-mock": "^3.1.2",
"eslint": "^3.17.1",
"eslint-config-egg": "^3.2.0",
"autod": "^3.0.1",
"egg": "next",
"egg-bin": "^4.3.5",
"egg-ci": "^1.8.0",
"egg-mock": "^3.13.1",
"eslint": "^4.11.0",
"eslint-config-egg": "^5.1.1",
"supertest": "^3.0.0",
"webstorm-disable-index": "^1.1.2"
"webstorm-disable-index": "^1.2.0"
},
"engines": {
"node": ">=6.0.0"
"node": ">=8.0.0"
},
"scripts": {
"test": "npm run lint -- --fix && npm run test-local",
"test": "npm run lint -- --fix && egg-bin pkgfiles && npm run test-local",
"test-local": "egg-bin test",
"cov": "egg-bin cov",
"lint": "eslint .",
"ci": "npm run lint && npm run cov",
"ci": "npm run lint && egg-bin pkgfiles --check && npm run cov",
"autod": "autod"
},
"files": [
"app.js",
"config"
"config",
"app.js"
],
"ci": {
"version": "6, 7"
"version": "8, 9"
},
"repository": {
"type": "git",
Expand Down
4 changes: 4 additions & 0 deletions test/fixtures/apps/handlebars-test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "handlebars-test",
"version": "0.0.1"
}
4 changes: 0 additions & 4 deletions test/fixtures/apps/view-handlebars-test/package.json

This file was deleted.

4 changes: 2 additions & 2 deletions test/view-handlebars.test.js → test/handlebars.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
const request = require('supertest');
const mm = require('egg-mock');

describe('test/view-handlebars.test.js', () => {
describe('test/handlebars.test.js', () => {
let app;
before(() => {
app = mm.app({
baseDir: 'apps/view-handlebars-test',
baseDir: 'apps/handlebars-test',
});
return app.ready();
});
Expand Down

0 comments on commit 67daee9

Please sign in to comment.