Skip to content

Commit 44773ae

Browse files
committed
Fixes #141 - module.parent deprecated in Node 14+
1 parent 7d9d7e3 commit 44773ae

File tree

5 files changed

+760
-881
lines changed

5 files changed

+760
-881
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,10 @@ Credit largely goes to @sindresorhus for his [load-grunt-plugins](https://github
202202

203203
## Changelog
204204

205+
##### 2.0.8
206+
- Fixes #141 - module.parent deprecated in Node 14+. Thanks @DaveyJake
207+
- Update dependencies
208+
205209
##### 2.0.7
206210
- Update dependencies
207211

index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ module.exports = function(options) {
4545

4646
const DEBUG = options.DEBUG || false;
4747
const pattern = getPattern(options);
48-
const config = options.config || findup('package.json', { cwd: parentDir });
48+
const config = options.config || findup('package.json', { cwd: path.dirname(module.parent.filename) });
4949
const scope = arrayify(options.scope || ['dependencies', 'devDependencies', 'peerDependencies']);
5050
const replaceString = options.replaceString || /^gulp(-|\.)/;
5151
const camelizePluginName = options.camelize !== false;
@@ -167,7 +167,5 @@ module.exports = function(options) {
167167
return finalObject;
168168
};
169169

170-
const parentDir = path.dirname(module.parent.filename);
171-
172170
// Necessary to get the current `module.parent` and resolve paths correctly.
173171
delete require.cache[__filename];

package.json

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gulp-load-plugins",
3-
"version": "2.0.7",
3+
"version": "2.0.8",
44
"description": "Automatically load any gulp plugins in your package.json",
55
"scripts": {
66
"test": "yarn run lint && NODE_PATH=test/global_modules mocha",
@@ -43,23 +43,27 @@
4343
],
4444
"dependencies": {
4545
"array-unique": "^0.3.2",
46-
"fancy-log": "^1.2.0",
47-
"findup-sync": "^4.0.0",
48-
"gulplog": "^1.0.0",
49-
"has-gulplog": "^0.1.0",
46+
"fancy-log": "^2.0.0",
47+
"findup-sync": "^5.0.0",
48+
"gulplog": "^2.0.0",
49+
"has-gulplog": "^1.0.0",
5050
"micromatch": "^4.0.2",
5151
"resolve": "^1.17.0"
5252
},
5353
"devDependencies": {
5454
"capture-stream": "^0.1.2",
55-
"eslint": "^7.7.0",
56-
"eslint-config-standard": "^16.0.2",
55+
"eslint": "^8.23.0",
56+
"eslint-config-standard": "^17.0.0",
5757
"eslint-plugin-import": "^2.22.0",
58+
"eslint-plugin-n": "^15.2.5",
5859
"eslint-plugin-node": "^11.1.0",
59-
"eslint-plugin-promise": "^5.1.0",
60+
"eslint-plugin-promise": "^6.0.1",
6061
"eslint-plugin-standard": "^5.0.0",
61-
"mocha": "^8.1.1",
62+
"mocha": "^10.0.0",
6263
"proxyquire": "^2.1.3",
63-
"sinon": "^11.1.1"
64+
"sinon": "^14.0.0"
65+
},
66+
"volta": {
67+
"node": "16.17.0"
6468
}
6569
}

test/index.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ describe('configuration', function() {
7676
const commonTests = function(lazy) {
7777
it('loads things in', function() {
7878
const x = gulpLoadPlugins({
79-
lazy: lazy,
79+
lazy,
8080
config: {
8181
dependencies: {
8282
'gulp-foo': '1.0.0',
@@ -106,7 +106,7 @@ const commonTests = function(lazy) {
106106

107107
it('can take a pattern override', function() {
108108
const x = gulpLoadPlugins({
109-
lazy: lazy,
109+
lazy,
110110
pattern: 'jack-*',
111111
replaceString: 'jack-',
112112
config: {
@@ -125,7 +125,7 @@ const commonTests = function(lazy) {
125125

126126
it('can extend the patterns', function() {
127127
const x = gulpLoadPlugins({
128-
lazy: lazy,
128+
lazy,
129129
config: {
130130
dependencies: {
131131
'jack-foo': '1.0.0',
@@ -144,7 +144,7 @@ const commonTests = function(lazy) {
144144

145145
it('allows camelizing to be turned off', function() {
146146
const x = gulpLoadPlugins({
147-
lazy: lazy,
147+
lazy,
148148
camelize: false,
149149
config: {
150150
dependencies: {
@@ -160,7 +160,7 @@ const commonTests = function(lazy) {
160160

161161
it('camelizes plugins name by default', function() {
162162
const x = gulpLoadPlugins({
163-
lazy: lazy,
163+
lazy,
164164
config: {
165165
dependencies: {
166166
'gulp-foo-bar': '*'
@@ -175,7 +175,7 @@ const commonTests = function(lazy) {
175175

176176
it('lets something be completely renamed', function() {
177177
const x = gulpLoadPlugins({
178-
lazy: lazy,
178+
lazy,
179179
config: { dependencies: { 'gulp-foo': '1.0.0' } },
180180
rename: { 'gulp-foo': 'bar' }
181181
});
@@ -187,7 +187,7 @@ const commonTests = function(lazy) {
187187
const restore = capture(process.stdout);
188188
try {
189189
const x = gulpLoadPlugins({
190-
lazy: lazy,
190+
lazy,
191191
DEBUG: true,
192192
config: { dependencies: { 'gulp-foo': '*' } }
193193
});
@@ -206,7 +206,7 @@ const commonTests = function(lazy) {
206206

207207
it('supports loading scopped package as a nested reference', function() {
208208
const x = gulpLoadPlugins({
209-
lazy: lazy,
209+
lazy,
210210
config: { dependencies: { '@myco/gulp-test-plugin': '1.0.0' } }
211211
});
212212

@@ -215,7 +215,7 @@ const commonTests = function(lazy) {
215215

216216
it('supports loading scopped package as a top-level reference', function() {
217217
const x = gulpLoadPlugins({
218-
lazy: lazy,
218+
lazy,
219219
maintainScope: false,
220220
config: { dependencies: { '@myco/gulp-test-plugin': '1.0.0' } }
221221
});
@@ -246,7 +246,7 @@ const commonTests = function(lazy) {
246246

247247
it('supports transforming', function() {
248248
const x = gulpLoadPlugins({
249-
lazy: lazy,
249+
lazy,
250250
config: { dependencies: { 'gulp-foo': '1.0.0' } },
251251
postRequireTransforms: {
252252
foo: function(foo) {

0 commit comments

Comments
 (0)