Skip to content
This repository was archived by the owner on Apr 26, 2022. It is now read-only.

Commit 688e4b6

Browse files
committed
cleanup and version update
1 parent 0f18864 commit 688e4b6

File tree

4 files changed

+20
-22
lines changed

4 files changed

+20
-22
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-plop",
3-
"version": "0.17.5",
3+
"version": "0.18.0",
44
"description": "programmatic plopping for fun and profit",
55
"main": "lib/index.js",
66
"types": "index.d.ts",
@@ -84,7 +84,6 @@
8484
"require": [
8585
"@babel/register"
8686
],
87-
"failFast": true,
8887
"tap": true
8988
}
9089
}

src/generator-runner.js

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -115,25 +115,28 @@ export default function (plopfileApi, flags) {
115115
// data can also be a function that returns a data object
116116
if (typeof cfgData === 'function') { cfgData = yield cfgData(); }
117117

118-
// track data properties that can be applied to the main data scope
119-
const cfgDataProps = Object.keys(cfgData).filter(k => typeof data[k] === 'undefined');
118+
// track keys that can be applied to the main data scope
119+
const cfgDataKeys = Object.keys(cfgData).filter(k => typeof data[k] === 'undefined');
120120
// copy config data into main data scope so it's available for templates
121-
cfgDataProps.forEach(k => {data[k] = cfgData[k];});
121+
cfgDataKeys.forEach(k => {data[k] = cfgData[k];});
122122

123123
return yield (Promise.resolve(action(data, cfg, plopfileApi))
124-
// show the resolved value in the console
125-
.then(result => ({
126-
type, path: (typeof result === 'string'
127-
? result
128-
: JSON.stringify(result)
129-
)
130-
}),
131-
// a rejected promise is treated as a failure
132-
err => {
133-
throw { type, path: '', error: err.message || err.toString() };
134-
})
124+
.then(
125+
// show the resolved value in the console
126+
result => ({
127+
type, path: (typeof result === 'string'
128+
? result
129+
: JSON.stringify(result)
130+
)
131+
}),
132+
133+
// a rejected promise is treated as a failure
134+
err => {
135+
throw { type, path: '', error: err.message || err.toString() };
136+
}
137+
)
135138
// cleanup main data scope so config data doesn't leak
136-
.finally(() => cfgDataProps.forEach(k => {delete data[k];}))
139+
.finally(() => cfgDataKeys.forEach(k => {delete data[k];}))
137140
);
138141
});
139142

tests/add-action-executable-file.ava.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ const {test, mockPath, testSrcPath, nodePlop} = (new AvaTest(__filename));
55

66
const plop = nodePlop();
77

8-
/////
9-
//
10-
//
11-
128
test('Add action keeps the executable flag', co.wrap(function* (t) {
139
plop.setGenerator('addExecutable', {
1410
actions: [{

tests/custom-data-in-actions.ava.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import fs from 'fs';
1+
// import fs from 'fs';
22
import * as fspp from '../src/fs-promise-proxy';
33
import co from 'co';
44
import path from 'path';

0 commit comments

Comments
 (0)