-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from 3imed-jaberi/3imed-jaberi-update-07-2021
Bump to next release v5.0.0
- Loading branch information
Showing
15 changed files
with
453 additions
and
298 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": "standard", | ||
"env": { | ||
"mocha": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
lib-cov | ||
*.seed | ||
*.log | ||
*.csv | ||
*.dat | ||
*.out | ||
*.pid | ||
*.gz | ||
*.swp | ||
# OS # | ||
################### | ||
.DS_Store | ||
.idea | ||
Thumbs.db | ||
tmp | ||
temp | ||
|
||
pids | ||
logs | ||
results | ||
|
||
package-lock.json | ||
npm-debug.log | ||
# Node.js # | ||
################### | ||
node_modules | ||
package-lock.json | ||
yarn.lock | ||
|
||
|
||
# NYC # | ||
################### | ||
coverage | ||
.nyc_output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"all": false, | ||
"exclude": [ | ||
"**/*.test.js", | ||
"example" | ||
], | ||
"reporter": [ | ||
"text-lcov", | ||
"text", | ||
"lcov" | ||
], | ||
"report-dir": "./coverage", | ||
"temp-dir": "./.nyc_output" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
language: node_js | ||
node_js: | ||
- '7.6.0' | ||
script: make test | ||
- 12 | ||
- 14 | ||
- 16 | ||
script: | ||
- npm run ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/*! | ||
* koa-ejs - example/app-with-custom-fs-module | ||
* | ||
* Copyright(c) 2022 3imed-jaberi <imed-jaberi@outlook.com> | ||
* MIT Licensed | ||
*/ | ||
|
||
'use strict' | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
const Koa = require('koa') | ||
const render = require('..') | ||
const path = require('path') | ||
|
||
const app = new Koa() | ||
|
||
render(app, { | ||
root: path.join(__dirname, 'view'), | ||
fs: require('mz/fs'), | ||
layout: 'template', | ||
viewExt: 'html', | ||
cache: false, | ||
debug: false | ||
}) | ||
|
||
app | ||
.use(function (ctx, next) { | ||
ctx.state = ctx.state || {} | ||
ctx.state.now = new Date() | ||
ctx.state.ip = ctx.ip | ||
ctx.state.version = '2.0.0' | ||
return next() | ||
}) | ||
.use(async function (ctx) { | ||
const users = [{ name: 'Dead Horse' }, { name: 'Imed Jaberi' }, { name: 'Tom' }] | ||
await ctx.render('content', { users }) | ||
}) | ||
|
||
if (process.env.NODE_ENV === 'test') { | ||
module.exports = app.callback() | ||
} else { | ||
app.listen(7001) | ||
console.log('open http://localhost:7001') | ||
} | ||
|
||
app.on('error', function (err) { | ||
console.log(err.stack) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,50 @@ | ||
/*! | ||
* koa-ejs - example/app.js | ||
* | ||
* Copyright(c) 2017 dead_horse <dead_horse@qq.com> | ||
* MIT Licensed | ||
*/ | ||
|
||
'use strict'; | ||
'use strict' | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
const Koa = require('koa'); | ||
const render = require('..'); | ||
const path = require('path'); | ||
const Koa = require('koa') | ||
const render = require('..') | ||
const path = require('path') | ||
|
||
const app = new Koa(); | ||
const app = new Koa() | ||
|
||
render(app, { | ||
root: path.join(__dirname, 'view'), | ||
layout: 'template', | ||
viewExt: 'html', | ||
cache: false, | ||
debug: false, | ||
}); | ||
|
||
app.use(function (ctx, next) { | ||
ctx.state = ctx.state || {}; | ||
ctx.state.now = new Date(); | ||
ctx.state.ip = ctx.ip; | ||
ctx.state.version = '2.0.0'; | ||
return next(); | ||
}); | ||
|
||
app.use(async function (ctx) { | ||
const users = [{ name: 'Dead Horse' }, { name: 'Jack' }, { name: 'Tom' }]; | ||
await ctx.render('content', { | ||
users | ||
}); | ||
}); | ||
debug: false | ||
}) | ||
|
||
app | ||
.use(function (ctx, next) { | ||
ctx.state = ctx.state || {} | ||
ctx.state.now = new Date() | ||
ctx.state.ip = ctx.ip | ||
ctx.state.version = '2.0.0' | ||
return next() | ||
}) | ||
.use(async function (ctx) { | ||
const users = [{ name: 'Dead Horse' }, { name: 'Imed Jaberi' }, { name: 'Tom' }] | ||
await ctx.render('content', { users }) | ||
}) | ||
|
||
if (process.env.NODE_ENV === 'test') { | ||
module.exports = app.callback(); | ||
module.exports = app.callback() | ||
} else { | ||
app.listen(7001); | ||
console.log('open http://localhost:7001'); | ||
app.listen(7001) | ||
console.log('open http://localhost:7001') | ||
} | ||
|
||
app.on('error', function (err) { | ||
console.log(err.stack); | ||
}); | ||
console.log(err.stack) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<div> | ||
<p>request ip is: <%= ip %></p> | ||
<% include user.html %> | ||
<%- include('user.html') -%> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<div> | ||
<p>request ip is: <%= ip %></p> | ||
<% include user %> | ||
<%- include ('user') -%> | ||
</div> |
Oops, something went wrong.