Skip to content

Commit 3ce0fa2

Browse files
authored
Merge pull request #2722 from angular-fullstack/rc-test
fix(gen:test): refactor gen to fix tests w/ pug
2 parents 6604d08 + 2080421 commit 3ce0fa2

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

Diff for: src/generators/app/index.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ export class Generator extends Base {
544544

545545
// Convert HTML into Pug
546546
if(this.filters.pug) {
547-
let pugFilter = filter(['**/*.html', '!client/app.template.html'], {restore: true});
547+
const pugFilter = filter(['**/*.pug'], {restore: true});
548548

549549
function pugReplacer(contents) {
550550
return contents
@@ -571,9 +571,8 @@ export class Generator extends Base {
571571
rename(path => {
572572
path.extname = '.pug';
573573
}),
574-
tap(function(file, t) {
575-
var contents = file.contents.toString();
576-
contents = pugReplacer(contents);
574+
tap(file => {
575+
const contents = pugReplacer(file.contents.toString());
577576
file.contents = new Buffer(contents);
578577
}),
579578
pugFilter.restore

Diff for: src/generators/util.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ function templateIsUsable(self, filteredFile) {
134134
}
135135

136136
/**
137-
*
137+
*
138138
*/
139139
export function processDirectory(source, destination) {
140140
var self = this;
@@ -171,6 +171,10 @@ export function processDirectory(source, destination) {
171171
copy = true;
172172
}
173173

174+
if(self.filters.pug && dest.indexOf('.html') !== -1 && dest.indexOf('app.template') === -1) {
175+
dest = dest.replace('.html', '.pug');
176+
}
177+
174178
if(templateIsUsable(self, filteredFile)) {
175179
if(copy) {
176180
self.fs.copy(src, dest);

Diff for: src/test/main.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ describe('angular-fullstack:app', function() {
192192
var testOptions = {
193193
buildtool: 'gulp',
194194
transpiler: 'ts',
195-
markup: 'pug',
195+
markup: 'html',
196196
stylesheet: 'less',
197197
router: 'ngroute',
198198
testing: 'jasmine',

Diff for: src/test/test-helpers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export function runGen(prompts, opts={}) {
112112
})
113113
.withGenerators([
114114
require.resolve('../generators/endpoint'),
115-
// [helpers.createDummyGenerator(), 'ng-component:app']
115+
[helpers.createDummyGenerator(), 'angular-fullstack-component:app']
116116
])
117117
// .withArguments(['upperCaseBug'])
118118
.withOptions(options);

Diff for: templates/app/_package.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"babel-preset-es2017": "^6.16.0",
2929
"babel-preset-stage-0": "^6.16.0",
3030
"babel-runtime": "^6.18.0",<% if(filters.pug) { %>
31-
"pug": "2.0.0-beta6",<% } %><% if(filters.html) { %>
31+
"pug": "^2.0.0",<% } %><% if(filters.html) { %>
3232
"ejs": "^2.5.3",<% } %><% if(filters.mongoose) { %>
3333
"mongoose": "^4.1.2",
3434
"bluebird": "^3.3.3",
@@ -106,7 +106,6 @@
106106
<%# END CLIENT %>
107107

108108
"autoprefixer": "^7.1.3",
109-
"babel-core": "^6.6.5",
110109
"babel-eslint": "^7.2.3",
111110
"babel-register": "^6.16.0",
112111
"bs-fullscreen-message": "^1.0.0",
@@ -115,10 +114,8 @@
115114
"babel-plugin-syntax-flow": "^6.8.0",
116115
"babel-plugin-transform-flow-comments": "^6.8.0",<% } %>
117116
"babel-plugin-transform-class-properties": "^6.6.0",
118-
"babel-plugin-transform-runtime": "^6.6.0",
119117
"babel-plugin-istanbul": "^4.1.4",
120118
"babel-preset-env": "^1.6.1",
121-
"babel-preset-es2015": "^6.6.0",
122119
"cross-env": "^5.1.1",
123120
"eslint": "^2.12.0",
124121
"del": "^3.0.0",
@@ -157,7 +154,7 @@
157154
"html-webpack-plugin": "^2.24.1",
158155
"html-webpack-harddisk-plugin": "~0.1.0",
159156
<%_ if(filters.pug) { _%>
160-
"pug-html-loader": "^1.0.8",<% } %>
157+
"pug-html-loader": "^1.1.5",<% } %>
161158
"typescript": "~2.6.1",
162159
"awesome-typescript-loader": "^3.3.0",
163160
"babel-loader": "^7.1.2",

0 commit comments

Comments
 (0)