Merge pull request #16666 from Snuffleupagus/esm-wintersmith

[ESM] Convert the "wintersmith"-task to use `import()` syntax
This commit is contained in:
Tim van der Meij 2023-07-09 15:32:10 +02:00 committed by GitHub
commit c0cc7f3eca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2039,23 +2039,26 @@ function ghPagesPrepare() {
]); ]);
} }
gulp.task("wintersmith", function (done) { gulp.task("wintersmith", async function () {
const wintersmith = require("wintersmith"); const { default: wintersmith } = await import("wintersmith");
const env = wintersmith("docs/config.json"); const env = wintersmith("docs/config.json");
env.build(GH_PAGES_DIR, function (error) {
if (error) {
done(error);
return;
}
replaceInFile( return new Promise((resolve, reject) => {
GH_PAGES_DIR + "/getting_started/index.html", env.build(GH_PAGES_DIR, function (error) {
/STABLE_VERSION/g, if (error) {
config.stableVersion reject(error);
); return;
}
console.log("Done building with wintersmith."); replaceInFile(
done(); GH_PAGES_DIR + "/getting_started/index.html",
/STABLE_VERSION/g,
config.stableVersion
);
console.log("Done building with wintersmith.");
resolve();
});
}); });
}); });