summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--tools/license2rtf.mjs (renamed from tools/license2rtf.js)30
-rw-r--r--vcbuild.bat4
3 files changed, 15 insertions, 21 deletions
diff --git a/Makefile b/Makefile
index 9f7ab7129d..aef13c2705 100644
--- a/Makefile
+++ b/Makefile
@@ -1096,7 +1096,7 @@ endif
$(MACOSOUTDIR)/dist/npm/usr/local/lib/node_modules
unlink $(MACOSOUTDIR)/dist/node/usr/local/bin/npm
unlink $(MACOSOUTDIR)/dist/node/usr/local/bin/npx
- $(NODE) tools/license2rtf.js < LICENSE > \
+ $(NODE) tools/license2rtf.mjs < LICENSE > \
$(MACOSOUTDIR)/installer/productbuild/Resources/license.rtf
cp doc/osx_installer_logo.png $(MACOSOUTDIR)/installer/productbuild/Resources
pkgbuild --version $(FULLVERSION) \
diff --git a/tools/license2rtf.js b/tools/license2rtf.mjs
index 817da81d7a..0772b161ed 100644
--- a/tools/license2rtf.js
+++ b/tools/license2rtf.mjs
@@ -1,8 +1,7 @@
-'use strict';
-
-const assert = require('assert');
-const Stream = require('stream');
-
+import assert from 'node:assert';
+import Stream from 'node:stream';
+import { pipeline } from 'node:stream/promises';
+import { stdin, stdout } from 'node:process';
/*
* This filter consumes a stream of characters and emits one string per line.
@@ -287,19 +286,14 @@ class RtfGenerator extends Stream {
}
}
-
-const stdin = process.stdin;
-const stdout = process.stdout;
-const lineSplitter = new LineSplitter();
-const paragraphParser = new ParagraphParser();
-const unwrapper = new Unwrapper();
-const rtfGenerator = new RtfGenerator();
-
stdin.setEncoding('utf-8');
stdin.resume();
-stdin.pipe(lineSplitter);
-lineSplitter.pipe(paragraphParser);
-paragraphParser.pipe(unwrapper);
-unwrapper.pipe(rtfGenerator);
-rtfGenerator.pipe(stdout);
+await pipeline(
+ stdin,
+ new LineSplitter(),
+ new ParagraphParser(),
+ new Unwrapper(),
+ new RtfGenerator(),
+ stdout,
+);
diff --git a/vcbuild.bat b/vcbuild.bat
index 49fa899de7..f0fca0ad71 100644
--- a/vcbuild.bat
+++ b/vcbuild.bat
@@ -420,9 +420,9 @@ if "%use_x64_node_exe%"=="true" (
set exit_code=1
goto exit
)
- %x64_node_exe% tools\license2rtf.js < LICENSE > %config%\license.rtf
+ %x64_node_exe% tools\license2rtf.mjs < LICENSE > %config%\license.rtf
) else (
- %node_exe% tools\license2rtf.js < LICENSE > %config%\license.rtf
+ %node_exe% tools\license2rtf.mjs < LICENSE > %config%\license.rtf
)
if errorlevel 1 echo Failed to generate license.rtf&goto exit