From b86f933171f5fc7ada31cffd8fa6cc8bad90b486 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Fri, 1 Mar 2024 16:11:51 +0000 Subject: [PATCH] refactor(build)!: upgrade Gulpfile to ESM --- Gulpfile.js => Gulpfile.mjs | 33 ++++++++++++++++----------------- OliverBooth.sln | 2 +- package-lock.json | 13 ------------- package.json | 1 - 4 files changed, 17 insertions(+), 32 deletions(-) rename Gulpfile.js => Gulpfile.mjs (71%) diff --git a/Gulpfile.js b/Gulpfile.mjs similarity index 71% rename from Gulpfile.js rename to Gulpfile.mjs index bf4d920..aacc7c5 100644 --- a/Gulpfile.js +++ b/Gulpfile.mjs @@ -1,15 +1,15 @@ -const fs = require("fs"); -const gulp = require("gulp"); -const cleanCSS = require("gulp-clean-css"); -const named = require("vinyl-named"); -const noop = require("gulp-noop"); -const path = require("path"); -const rename = require("gulp-rename"); -const sass = require('gulp-sass')(require("sass")); -const sourcemaps = require("gulp-sourcemaps"); -const ts = require("gulp-typescript"); -const terser = require("gulp-terser"); -const webpack = require("webpack-stream"); +import fs from "fs"; +import gulp from "gulp"; +import cleanCSS from "gulp-clean-css"; +import noop from "gulp-noop"; +import rename from "gulp-rename"; +import gulpSass from "gulp-sass"; +import * as nodeSass from "sass"; +const sass = gulpSass(nodeSass); +import sourcemaps from "gulp-sourcemaps"; +import ts from "gulp-typescript"; +import terser from "gulp-terser"; +import webpack from "webpack-stream"; const srcDir = "src"; const destDir = "OliverBooth/wwwroot"; @@ -66,8 +66,7 @@ function copyImages() { .pipe(gulp.dest(`${destDir}/img`)); } -exports.assets = copyImages; -exports.styles = gulp.parallel(compileSCSS, copyCSS); -exports.scripts = gulp.parallel(copyJS, gulp.series(compileTS, bundleJS)); - -exports.default = gulp.parallel(exports.styles, exports.scripts, exports.assets); +gulp.task("assets", copyImages); +gulp.task("styles", gulp.parallel(compileSCSS, copyCSS)); +gulp.task("scripts", gulp.parallel(copyJS, gulp.series(compileTS, bundleJS))); +gulp.task("default", gulp.parallel("styles", "scripts", "assets")); diff --git a/OliverBooth.sln b/OliverBooth.sln index e2ba2dd..b852780 100644 --- a/OliverBooth.sln +++ b/OliverBooth.sln @@ -6,11 +6,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ProjectSection(SolutionItems) = preProject README.md = README.md package.json = package.json - Gulpfile.js = Gulpfile.js tsconfig.json = tsconfig.json .dockerignore = .dockerignore docker-compose.yml = docker-compose.yml global.json = global.json + Gulpfile.mjs = Gulpfile.mjs EndProjectSection EndProject Global diff --git a/package-lock.json b/package-lock.json index 1fc8cdf..6155714 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,6 @@ "gulp-typescript": "^6.0.0-alpha.1", "sass": "^1.69.5", "terser": "^5.19.2", - "vinyl-named": "^1.1.0", "webpack-stream": "^7.0.0" } }, @@ -5290,18 +5289,6 @@ "xtend": "~4.0.1" } }, - "node_modules/vinyl-named": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/vinyl-named/-/vinyl-named-1.1.0.tgz", - "integrity": "sha512-ElYBnsSw8Y1Hz11WPw0DFmi+TBNTEBhZ9zXaHluDSIZZnkFIGCjGRBpsW5QmbMMLwv+lRpUD3VbKdJCbNpct7Q==", - "dev": true, - "dependencies": { - "through": "^2.3.6" - }, - "engines": { - "node": ">= 0.10.0" - } - }, "node_modules/vinyl-sourcemap": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/vinyl-sourcemap/-/vinyl-sourcemap-1.1.0.tgz", diff --git a/package.json b/package.json index 977fbad..fe6a5bd 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ "gulp-typescript": "^6.0.0-alpha.1", "sass": "^1.69.5", "terser": "^5.19.2", - "vinyl-named": "^1.1.0", "webpack-stream": "^7.0.0" }, "dependencies": {