Skip to content

Commit 2fdf27b

Browse files
committed
Changed default view engine to pug
1 parent d1f3fcc commit 2fdf27b

File tree

5 files changed

+90
-27
lines changed

5 files changed

+90
-27
lines changed

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
language: node_js
22
node_js:
3-
- "0.10"
4-
- "0.12"
53
- "1.8"
64
- "2.5"
75
- "3.3"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ This generator can also be further configured with the following command line fl
4444
--pug add pug engine support
4545
--hbs add handlebars engine support
4646
-H, --hogan add hogan.js engine support
47-
-v, --view <engine> add view <engine> support (dust|ejs|hbs|hjs|jade|pug|twig|vash) (defaults to jade)
47+
-v, --view <engine> add view <engine> support (dust|ejs|hbs|hjs|jade|pug|twig|vash) (defaults to pug)
4848
--no-view use static html instead of view engine
4949
-c, --css <engine> add stylesheet <engine> support (less|stylus|compass|sass) (defaults to plain css)
5050
--git add .gitignore

bin/express-cli.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ program
5252
.option(' --pug', 'add pug engine support', renamedOption('--pug', '--view=pug'))
5353
.option(' --hbs', 'add handlebars engine support', renamedOption('--hbs', '--view=hbs'))
5454
.option('-H, --hogan', 'add hogan.js engine support', renamedOption('--hogan', '--view=hogan'))
55-
.option('-v, --view <engine>', 'add view <engine> support (dust|ejs|hbs|hjs|jade|pug|twig|vash) (defaults to jade)')
55+
.option('-v, --view <engine>', 'add view <engine> support (dust|ejs|hbs|hjs|jade|pug|twig|vash) (defaults to pug)')
5656
.option(' --no-view', 'use static html instead of view engine')
5757
.option('-c, --css <engine>', 'add stylesheet <engine> support (less|stylus|compass|sass) (defaults to plain css)')
5858
.option(' --git', 'add .gitignore')
@@ -304,7 +304,7 @@ function createApplication (name, dir) {
304304
break
305305
case 'pug':
306306
app.locals.view = { engine: 'pug' }
307-
pkg.dependencies.pug = '2.0.0-beta11'
307+
pkg.dependencies.pug = '~2.0.4'
308308
break
309309
case 'twig':
310310
app.locals.view = { engine: 'twig' }
@@ -456,14 +456,14 @@ function main () {
456456
if (program.ejs) program.view = 'ejs'
457457
if (program.hbs) program.view = 'hbs'
458458
if (program.hogan) program.view = 'hjs'
459-
if (program.pug) program.view = 'pug'
459+
if (program.jade) program.view = 'jade'
460460
}
461461

462462
// Default view engine
463463
if (program.view === true) {
464-
warning('the default view engine will not be jade in future releases\n' +
465-
"use `--view=jade' or `--help' for additional options")
466-
program.view = 'jade'
464+
warning('the default view engine is pug now\n' +
465+
"use `--view=jade' if you want to use jade or `--help' for additional options")
466+
program.view = 'pug'
467467
}
468468

469469
// Generate application

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "express-generator",
33
"description": "Express' application generator",
4-
"version": "4.16.1",
4+
"version": "5.0.0",
55
"author": "TJ Holowaychuk <[email protected]>",
66
"contributors": [
77
"Aaron Heckmann <[email protected]>",
@@ -51,7 +51,7 @@
5151
"validate-npm-package-name": "3.0.0"
5252
},
5353
"engines": {
54-
"node": ">= 0.10"
54+
"node": "> 0.12"
5555
},
5656
"files": [
5757
"LICENSE",

test/cmd.js

Lines changed: 81 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ describe('express(1)', function () {
3737
})
3838
})
3939

40-
it('should print jade view warning', function () {
41-
assert.strictEqual(ctx.stderr, "\n warning: the default view engine will not be jade in future releases\n warning: use `--view=jade' or `--help' for additional options\n\n")
40+
it('should print pug view warning', function () {
41+
assert.strictEqual(ctx.stderr, "\n warning: the default view engine is pug now\n warning: use `--view=jade' if you want to use jade or `--help' for additional options\n\n")
4242
})
4343

4444
it('should provide debug instructions', function () {
@@ -51,10 +51,10 @@ describe('express(1)', function () {
5151
assert.notStrictEqual(ctx.files.indexOf('package.json'), -1)
5252
})
5353

54-
it('should have jade templates', function () {
55-
assert.notStrictEqual(ctx.files.indexOf('views/error.jade'), -1)
56-
assert.notStrictEqual(ctx.files.indexOf('views/index.jade'), -1)
57-
assert.notStrictEqual(ctx.files.indexOf('views/layout.jade'), -1)
54+
it('should have pug templates', function () {
55+
assert.notStrictEqual(ctx.files.indexOf('views/error.pug'), -1)
56+
assert.notStrictEqual(ctx.files.indexOf('views/index.pug'), -1)
57+
assert.notStrictEqual(ctx.files.indexOf('views/layout.pug'), -1)
5858
})
5959

6060
it('should have a package.json file', function () {
@@ -72,8 +72,8 @@ describe('express(1)', function () {
7272
' "debug": "~2.6.9",\n' +
7373
' "express": "~4.16.1",\n' +
7474
' "http-errors": "~1.6.3",\n' +
75-
' "jade": "~1.11.0",\n' +
76-
' "morgan": "~1.9.1"\n' +
75+
' "morgan": "~1.9.1",\n' +
76+
' "pug": "~2.0.4"\n' +
7777
' }\n' +
7878
'}\n')
7979
})
@@ -222,10 +222,10 @@ describe('express(1)', function () {
222222
assert.notStrictEqual(ctx.files.indexOf('foo/package.json'), -1)
223223
})
224224

225-
it('should have jade templates', function () {
226-
assert.notStrictEqual(ctx.files.indexOf('foo/views/error.jade'), -1)
227-
assert.notStrictEqual(ctx.files.indexOf('foo/views/index.jade'), -1)
228-
assert.notStrictEqual(ctx.files.indexOf('foo/views/layout.jade'), -1)
225+
it('should have pug templates', function () {
226+
assert.notStrictEqual(ctx.files.indexOf('foo/views/error.pug'), -1)
227+
assert.notStrictEqual(ctx.files.indexOf('foo/views/index.pug'), -1)
228+
assert.notStrictEqual(ctx.files.indexOf('foo/views/layout.pug'), -1)
229229
})
230230
})
231231

@@ -475,10 +475,10 @@ describe('express(1)', function () {
475475
assert.notStrictEqual(ctx.files.indexOf('.gitignore'), -1, 'should have .gitignore file')
476476
})
477477

478-
it('should have jade templates', function () {
479-
assert.notStrictEqual(ctx.files.indexOf('views/error.jade'), -1)
480-
assert.notStrictEqual(ctx.files.indexOf('views/index.jade'), -1)
481-
assert.notStrictEqual(ctx.files.indexOf('views/layout.jade'), -1)
478+
it('should have pug templates', function () {
479+
assert.notStrictEqual(ctx.files.indexOf('views/error.pug'), -1)
480+
assert.notStrictEqual(ctx.files.indexOf('views/index.pug'), -1)
481+
assert.notStrictEqual(ctx.files.indexOf('views/layout.pug'), -1)
482482
})
483483
})
484484

@@ -1004,6 +1004,71 @@ describe('express(1)', function () {
10041004
})
10051005
})
10061006

1007+
describe('jade', function () {
1008+
var ctx = setupTestEnvironment(this.fullTitle())
1009+
1010+
it('should create basic app with jade templates', function (done) {
1011+
run(ctx.dir, ['--view', 'jade'], function (err, stdout) {
1012+
if (err) return done(err)
1013+
ctx.files = utils.parseCreatedFiles(stdout, ctx.dir)
1014+
assert.strictEqual(ctx.files.length, 16)
1015+
done()
1016+
})
1017+
})
1018+
1019+
it('should have basic files', function () {
1020+
assert.notStrictEqual(ctx.files.indexOf('bin/www'), -1)
1021+
assert.notStrictEqual(ctx.files.indexOf('app.js'), -1)
1022+
assert.notStrictEqual(ctx.files.indexOf('package.json'), -1)
1023+
})
1024+
1025+
it('should have jade in package dependencies', function () {
1026+
var file = path.resolve(ctx.dir, 'package.json')
1027+
var contents = fs.readFileSync(file, 'utf8')
1028+
var dependencies = JSON.parse(contents).dependencies
1029+
assert.ok(typeof dependencies.jade === 'string')
1030+
})
1031+
1032+
it('should have jade templates', function () {
1033+
assert.notStrictEqual(ctx.files.indexOf('views/error.jade'), -1)
1034+
assert.notStrictEqual(ctx.files.indexOf('views/index.jade'), -1)
1035+
assert.notStrictEqual(ctx.files.indexOf('views/layout.jade'), -1)
1036+
})
1037+
1038+
it('should have installable dependencies', function (done) {
1039+
this.timeout(NPM_INSTALL_TIMEOUT)
1040+
npmInstall(ctx.dir, done)
1041+
})
1042+
1043+
describe('npm start', function () {
1044+
before('start app', function () {
1045+
this.app = new AppRunner(ctx.dir)
1046+
})
1047+
1048+
after('stop app', function (done) {
1049+
this.timeout(APP_START_STOP_TIMEOUT)
1050+
this.app.stop(done)
1051+
})
1052+
1053+
it('should start app', function (done) {
1054+
this.timeout(APP_START_STOP_TIMEOUT)
1055+
this.app.start(done)
1056+
})
1057+
1058+
it('should respond to HTTP request', function (done) {
1059+
request(this.app)
1060+
.get('/')
1061+
.expect(200, /<title>Express<\/title>/, done)
1062+
})
1063+
1064+
it('should generate a 404', function (done) {
1065+
request(this.app)
1066+
.get('/does_not_exist')
1067+
.expect(404, /<h1>Not Found<\/h1>/, done)
1068+
})
1069+
})
1070+
})
1071+
10071072
describe('twig', function () {
10081073
var ctx = setupTestEnvironment(this.fullTitle())
10091074

0 commit comments

Comments
 (0)