From ac3661972bac968c053e80e470cd7aafbd835e46 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 8 Jul 2023 13:50:19 +0200 Subject: [PATCH] [ESM] Convert the "wintersmith"-task to use `import()` syntax --- gulpfile.js | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 20b37a092..2f7e68ee5 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -2039,23 +2039,26 @@ function ghPagesPrepare() { ]); } -gulp.task("wintersmith", function (done) { - const wintersmith = require("wintersmith"); +gulp.task("wintersmith", async function () { + const { default: wintersmith } = await import("wintersmith"); const env = wintersmith("docs/config.json"); - env.build(GH_PAGES_DIR, function (error) { - if (error) { - done(error); - return; - } - replaceInFile( - GH_PAGES_DIR + "/getting_started/index.html", - /STABLE_VERSION/g, - config.stableVersion - ); + return new Promise((resolve, reject) => { + env.build(GH_PAGES_DIR, function (error) { + if (error) { + reject(error); + return; + } - console.log("Done building with wintersmith."); - done(); + replaceInFile( + GH_PAGES_DIR + "/getting_started/index.html", + /STABLE_VERSION/g, + config.stableVersion + ); + + console.log("Done building with wintersmith."); + resolve(); + }); }); });