Skip to content

Commit

Permalink
Merge pull request #1184 from bryceosterhaus/node20
Browse files Browse the repository at this point in the history
feat(npm-scripts): update for node v20
  • Loading branch information
bryceosterhaus authored Apr 23, 2024
2 parents 2effb43 + e93594b commit 6fa409e
Show file tree
Hide file tree
Showing 4 changed files with 623 additions and 119 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"devDependencies": {
"liferay-frontend-theme-styled": "6.0.6",
"liferay-frontend-theme-unstyled": "6.0.6",
"node-sass": "^6.0.1"
"node-sass": "^9.0.0"
},
"engines": {
"node": ">=16.0.0"
Expand Down
37 changes: 19 additions & 18 deletions projects/npm-tools/packages/npm-scripts/src/utils/SignalHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,25 @@ const SignalHandler = {
install() {
if (!installed) {
Object.keys(SIGNALS).forEach((signal) => {
process.on(signal, handleSignal);
process.on(signal, (code) => {
log(`Received ${code}`);

for (const callback of callbacks.values()) {
try {
callback();
}
catch (error) {
log(`Caught error in signal callback: ${error}`);
}
}

if (signal !== 'exit') {
process.exit(128 + SIGNALS[code]);
}
else {
process.exit(code);
}
});
});

installed = true;
Expand All @@ -49,21 +67,4 @@ function getDisposable(callback, id) {
};
}

function handleSignal(signal) {
log(`Received ${signal}`);

for (const callback of callbacks.values()) {
try {
callback();
}
catch (error) {
log(`Caught error in signal callback: ${error}`);
}
}

if (signal !== -1) {
process.exit(128 + SIGNALS[signal]);
}
}

module.exports = SignalHandler;
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ function runBundler(...args) {
autoDelete: false,
});

// Support for Node 20

process.env.NODE_OPTIONS = '--no-experimental-fetch';

withTempFile(
'.npmbundlerrc',
JSON.stringify(config),
Expand Down
Loading

0 comments on commit 6fa409e

Please sign in to comment.