Skip to content

Commit abce9e6

Browse files
author
Peter Ullrich
committed
Write answer in accepted callback
1 parent d5c0032 commit abce9e6

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.4.0",
2+
"version": "0.4.2",
33
"name": "dotup-typescript-yeoman-generators",
44
"author": {
55
"name": "Peter Ullrich",

src/BaseGenerator.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,10 @@ export abstract class BaseGenerator<TStep extends string> extends generator {
331331

332332
// Should we ask again same step?
333333
if (accepted === true) {
334+
// Maybe answer changed in callback
335+
if (BaseGenerator.sharedOptions) {
336+
BaseGenerator.sharedOptions.setAnswer(this.currentStep, this.answers[this.currentStep]);
337+
}
334338
// Set next step
335339
this.currentStep = question.nextQuestion;
336340
}

tools/gulp/statics.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,24 @@ function clean() {
1313
module.exports.clean = clean;
1414
gulp.task('statics-clean', clean);
1515

16-
function postBuild() {
17-
const x = config
18-
.statics.map(s => {
19-
return getCopyStream(gulp, s.sourcePath, s.targetPath, { dot: true });
20-
})
21-
.reduce((p, c) => p); // :)
22-
return x;
16+
async function postBuild() {
17+
for (const iterator of config.statics) {
18+
await getCopyStream(iterator.sourcePath, iterator.targetPath, { dot: true });
19+
}
2320
}
2421
module.exports.postBuild = postBuild;
2522
gulp.task('statics-copy', postBuild);
2623

27-
function getCopyStream(g, source, target, opts) {
28-
return g
24+
async function getCopyStream(source, target, opts) {
25+
const stream = gulp
2926
.src(source, opts)
3027
.pipe(gulp.dest(target));
28+
29+
return new Promise(function (resolve, reject) {
30+
stream.on('end', () => resolve(stream));
31+
stream.on('error', e=> reject(e));
32+
});
3133
}
34+
35+
// gulp.task('statics-copy')();
36+
// postBuild();

0 commit comments

Comments
 (0)