[PM-13277] Gulp: Remove unnecessary filtering (#11456)

Part of the browser build script refactor effort. bitwarden.atlassian.net/browse/PM-6683

We seem to have some very old filters related to fonts and safari build files. These predates our modern usage of webpack for bundling only used assets.

I've run diff -qr on Chrome, Firefox and Safari builds and the only difference is that we now include a bwi-font.svg resource. bwi-font.svg is referenced in our css files and "should" be included.
This commit is contained in:
Oscar Hinton 2024-10-22 18:53:30 +02:00 committed by GitHub
parent 023abe2969
commit 173a5e2574
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 0 additions and 136 deletions

View File

@ -81,7 +81,6 @@
"cross-env",
"del",
"gulp",
"gulp-filter",
"gulp-if",
"gulp-json-editor",
"gulp-replace",

View File

@ -14,23 +14,9 @@ const betaBuild = process.env.BETA_BUILD === "1";
const paths = {
build: "./build/",
dist: "./dist/",
node_modules: "./node_modules/",
popupDir: "./src/popup/",
cssDir: "./src/popup/css/",
safari: "./src/safari/",
};
const filters = {
fonts: [
"!build/popup/fonts/*",
"build/popup/fonts/Open_Sans*.woff",
"build/popup/fonts/bwi-font.woff2",
"build/popup/fonts/bwi-font.woff",
"build/popup/fonts/bwi-font.ttf",
],
safari: ["!build/safari/**/*"],
};
/**
* Converts a number to a tuple containing two Uint16's
* @param num {number} This number is expected to be a integer style number with no decimals
@ -64,11 +50,9 @@ function distFileName(browserName, ext) {
async function dist(browserName, manifest) {
const { default: zip } = await import("gulp-zip");
const { default: filter } = await import("gulp-filter");
return gulp
.src(paths.build + "**/*")
.pipe(filter(["**"].concat(filters.fonts).concat(filters.safari)))
.pipe(gulpif("popup/index.html", replace("__BROWSER__", "browser_" + browserName)))
.pipe(gulpif("manifest.json", jeditor(manifest)))
.pipe(zip(distFileName(browserName, "zip")))
@ -192,8 +176,6 @@ function distSafariApp(cb, subBuildPath) {
return new Promise((resolve) => proc.on("close", resolve));
})
.then(async () => {
const { default: filter } = await import("gulp-filter");
const libs = fs
.readdirSync(builtAppexFrameworkPath)
.filter((p) => p.endsWith(".dylib"))
@ -237,13 +219,10 @@ function safariCopyAssets(source, dest) {
}
async function safariCopyBuild(source, dest) {
const { default: filter } = await import("gulp-filter");
return new Promise((resolve, reject) => {
gulp
.src(source)
.on("error", reject)
.pipe(filter(["**"].concat(filters.fonts)))
.pipe(gulpif("popup/index.html", replace("__BROWSER__", "browser_safari")))
.pipe(
gulpif(

113
package-lock.json generated
View File

@ -146,7 +146,6 @@
"eslint-plugin-storybook": "0.8.0",
"eslint-plugin-tailwindcss": "3.17.4",
"gulp": "4.0.2",
"gulp-filter": "9.0.1",
"gulp-if": "3.0.0",
"gulp-json-editor": "2.6.0",
"gulp-replace": "1.1.4",
@ -12146,19 +12145,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/array-differ": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/array-differ/-/array-differ-4.0.0.tgz",
"integrity": "sha512-Q6VPTLMsmXZ47ENG3V+wQyZS1ZxXMxFyYzA+Z/GMrJ6yIutAIEf9wTyroTzmGjNfox9/h3GdGBCVh43GVFx4Uw==",
"dev": true,
"license": "MIT",
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/array-each": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz",
@ -20884,47 +20870,6 @@
"object.assign": "^4.1.0"
}
},
"node_modules/gulp-filter": {
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/gulp-filter/-/gulp-filter-9.0.1.tgz",
"integrity": "sha512-knVYL8h9bfYIeft3VokVTkuaWJkQJMrFCS3yVjZQC6BGg+1dZFoeUY++B9D2X4eFpeNTx9StWK0qnDby3NO3PA==",
"dev": true,
"license": "MIT",
"dependencies": {
"multimatch": "^7.0.0",
"plugin-error": "^2.0.1",
"slash": "^5.1.0",
"streamfilter": "^3.0.0",
"to-absolute-glob": "^3.0.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
},
"peerDependencies": {
"gulp": ">=4"
},
"peerDependenciesMeta": {
"gulp": {
"optional": true
}
}
},
"node_modules/gulp-filter/node_modules/slash": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz",
"integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=14.16"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/gulp-if": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/gulp-if/-/gulp-if-3.0.0.tgz",
@ -28422,37 +28367,6 @@
"multicast-dns": "cli.js"
}
},
"node_modules/multimatch": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/multimatch/-/multimatch-7.0.0.tgz",
"integrity": "sha512-SYU3HBAdF4psHEL/+jXDKHO95/m5P2RvboHT2Y0WtTttvJLP4H/2WS9WlQPFvF6C8d6SpLw8vjCnQOnVIVOSJQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"array-differ": "^4.0.0",
"array-union": "^3.0.1",
"minimatch": "^9.0.3"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/multimatch/node_modules/array-union": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/array-union/-/array-union-3.0.1.tgz",
"integrity": "sha512-1OvF9IbWwaeiM9VhzYXVQacMibxpXOMYVNIvMtKRyX9SImBXpKcFr8XvFDeEslCyuH/t6KRt7HEO94AlP8Iatw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/multistream": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/multistream/-/multistream-4.1.0.tgz",
@ -35367,19 +35281,6 @@
"dev": true,
"license": "MIT"
},
"node_modules/streamfilter": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/streamfilter/-/streamfilter-3.0.0.tgz",
"integrity": "sha512-kvKNfXCmUyC8lAXSSHCIXBUlo/lhsLcCU/OmzACZYpRUdtKIH68xYhm/+HI15jFJYtNJGYtCgn2wmIiExY1VwA==",
"dev": true,
"license": "MIT",
"dependencies": {
"readable-stream": "^3.0.6"
},
"engines": {
"node": ">=8.12.0"
}
},
"node_modules/streaming-json-stringify": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/streaming-json-stringify/-/streaming-json-stringify-3.1.0.tgz",
@ -36573,20 +36474,6 @@
"license": "BSD-3-Clause",
"peer": true
},
"node_modules/to-absolute-glob": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/to-absolute-glob/-/to-absolute-glob-3.0.0.tgz",
"integrity": "sha512-loO/XEWTRqpfcpI7+Jr2RR2Umaaozx1t6OSVWtMi0oy5F/Fxg3IC+D/TToDnxyAGs7uZBGT/6XmyDUxgsObJXA==",
"dev": true,
"license": "MIT",
"dependencies": {
"is-absolute": "^1.0.0",
"is-negated-glob": "^1.0.0"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/to-fast-properties": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz",

View File

@ -107,7 +107,6 @@
"eslint-plugin-storybook": "0.8.0",
"eslint-plugin-tailwindcss": "3.17.4",
"gulp": "4.0.2",
"gulp-filter": "9.0.1",
"gulp-if": "3.0.0",
"gulp-json-editor": "2.6.0",
"gulp-replace": "1.1.4",