Skip to content

Commit

Permalink
fixes an issue with plop.load resolving paths correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
amwmedia committed Jan 26, 2017
1 parent e1fb10d commit 3896e0f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-plop",
"version": "0.5.4",
"version": "0.5.5",
"description": "programmatic plopping for fun and profit",
"main": "lib/index.js",
"scripts": {
Expand Down Expand Up @@ -45,7 +45,7 @@
"eslint-config-standard": "^6.2.1",
"eslint-plugin-promise": "^3.3.1",
"eslint-plugin-standard": "^2.0.1",
"plop-pack-fancy-comments": "^0.2.0",
"plop-pack-fancy-comments": "^0.2.1",
"pre-commit": "^1.1.3"
},
"dependencies": {
Expand All @@ -58,7 +58,8 @@
"inquirer": "^1.2.0",
"lodash.get": "^4.4.2",
"mkdirp": "^0.5.1",
"pify": "^2.3.0"
"pify": "^2.3.0",
"resolve": "^1.2.0"
},
"ava": {
"files": [
Expand Down
10 changes: 2 additions & 8 deletions src/modules/node-plop.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import path from 'path';
import inquirer from 'inquirer';
import handlebars from 'handlebars';
import _get from 'lodash.get';
import resolve from 'resolve';

import bakedInHelpers from './baked-in-helpers';
import generatorRunner from './generator-runner';
Expand Down Expand Up @@ -67,14 +68,7 @@ function nodePlop(plopfilePath = '', plopCfg = {}) {
}, loadCfg);

targets.forEach(function (target) {
var targetPath;

try {
targetPath = require.resolve(target);
} catch (err) {
targetPath = path.resolve(getPlopfilePath(), target);
}

const targetPath = resolve.sync(target, {basedir: getPlopfilePath()});
const proxy = nodePlop(targetPath, config);
const proxyDefaultInclude = proxy.getDefaultInclude() || {};
const includeCfg = includeOverride || proxyDefaultInclude;
Expand Down

0 comments on commit 3896e0f

Please sign in to comment.