Skip to content

Commit

Permalink
Rename registerTransformStream to queueTransformStream
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Feb 13, 2021
1 parent 805ecb9 commit b25267a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
11 changes: 8 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ class Generator extends EventEmitter {
this._arguments = [];
this._prompts = [];
this._composedWith = [];
this._transformStreams = [];
this._namespace = this.options.namespace;
this._namespaceId = this.options.namespaceId;
this.yoGeneratorVersion = packageJson.version;
Expand Down Expand Up @@ -1300,13 +1299,19 @@ class Generator extends EventEmitter {
* or a single one.
* @return {this} This generator
*/
registerTransformStream(streams) {
queueTransformStream(streams) {
assert(streams, 'expected to receive a transform stream as parameter');
if (!Array.isArray(streams)) {
streams = [streams];
}

this._transformStreams = this._transformStreams.concat(streams);
this.queueTask({
method() {
return this.env.applyTransforms(streams);
},
taskName: 'transformStream',
queueName: 'transform'
});
return this;
}
}
Expand Down
6 changes: 3 additions & 3 deletions test/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -1160,12 +1160,12 @@ describe('Base', () => {
this.TestGenerator.prototype.writing = function () {
this.fs.write(self.filepath, 'not correct');

this.registerTransformStream(
this.queueTransformStream(
through.obj((file, enc, cb) => {
file.contents = Buffer.from('a');
cb(null, file);
})
).registerTransformStream(
).queueTransformStream(
through.obj((file, enc, cb) => {
file.contents = Buffer.from(file.contents.toString() + 'b');
cb(null, file);
Expand All @@ -1183,7 +1183,7 @@ describe('Base', () => {
this.TestGenerator.prototype.writing = function () {
this.fs.write(self.filepath, 'not correct');

this.registerTransformStream([
this.queueTransformStream([
through.obj((file, enc, cb) => {
file.contents = Buffer.from('a');
cb(null, file);
Expand Down

0 comments on commit b25267a

Please sign in to comment.