Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade gulp version from 3 to 4 #225

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sakamossan
Copy link

@sakamossan sakamossan commented Jul 8, 2023

When running the build with Node 12 and later, an error occurs with graceful-fs v3, which gulp depends on. The error is as follows:

$ npx node --version
v14.21.3
$ npx gulp
fs.js:40
} = primordials;
    ^

ReferenceError: primordials is not defined
    at fs.js:40:5
    at req_ (/Users/sakamossan/.ghq/github.com/alexei/sprintf.js/node_modules/natives/index.js:143:24)
    at Object.req [as require] (/Users/sakamossan/.ghq/github.com/alexei/sprintf.js/node_modules/natives/index.js:55:10)
    at Object.<anonymous> (/Users/sakamossan/.ghq/github.com/alexei/sprintf.js/node_modules/vinyl-fs/node_modules/graceful-fs/fs.js:1:37)
    at Module._compile (internal/modules/cjs/loader.js:1114:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
    at Module.load (internal/modules/cjs/loader.js:979:32)
    at Function.Module._load (internal/modules/cjs/loader.js:819:12)
    at Module.require (internal/modules/cjs/loader.js:1003:19)
    at require (internal/modules/cjs/helpers.js:107:18)

Since gulp v3 is out of support, it is a good time to upgrade.

If this PR is merged, it will be friendly to developers using apple silicon as they will not have to install node v10 to develop. (I confirmed that v4 gulp tasks runs on node v20)

ref

Changes

  • Upgraded gulp version to 4 to avoid this error
  • gulpfile.js was also updated to match the gulp v4 API

Verification

After upgrading the gulp version, the build output remains the same.

before

$ cd ~/.ghq/github.com/alexei/sprintf.js
$ md5 dist/*.js | sort
MD5 (dist/angular-sprintf.min.js) = fd0f92f0c18e8c9eae965ca1076140ae
MD5 (dist/sprintf.min.js) = e4f895a680f0f7a9459651fc9b7a26f0

after

$ npx node --version
v20.4.0
$ npx gulp
[14:50:34] Using gulpfile ~/.ghq/github.com/sakamossan/sprintf.js/gulpfile.js
[14:50:34] Starting 'default'...
[14:50:34] Starting 'dist'...
[14:50:34] Starting 'test'...
[14:50:34] Starting 'lint'...
[14:50:34] Finished 'lint' after 11 ms
[14:50:34] Starting '<anonymous>'...
[14:50:34] Finished '<anonymous>' after 1.75 ms
[14:50:34] Finished 'test' after 13 ms
[14:50:34] Starting '<anonymous>'...
[14:50:34] Finished '<anonymous>' after 1.16 ms
[14:50:34] Finished 'dist' after 15 ms
[14:50:34] Finished 'default' after 16 ms
 28  -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_,------,
 0   -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_|   /\_/\
 0   -_-_-_-_-_-_-_-_-_-_-_-_-_-_-^|__( ^ .^)
     -_-_-_-_-_-_-_-_-_-_-_-_-_-_-  ""  ""

  28 passing (7ms)

$ md5 dist/*.js | sort
MD5 (dist/angular-sprintf.min.js) = fd0f92f0c18e8c9eae965ca1076140ae
MD5 (dist/sprintf.min.js) = e4f895a680f0f7a9459651fc9b7a26f0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant