mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-25 12:15:18 +01:00
c388697fdf
Refactor the remaining logic from gulp. Part of the browser build script refactor effort. Webpack is now responsible for performing most of the operations previously done by gulp. This includes: - Setting browser specific class - Building the manifest file The `package.json` is modified to include browser specific commands for `build`, `build:prod`, `build:watch` and `dist`. # Manifests Manifests now uses the `copy-webpack-plugin` `transform` feature. The logic is located in `apps/browser/webpack/manifest.js`. It reads a template, which supports some basic operations primarily overriding with browser specific fields using `__browser__`. The `manifest.json` for both regular and mv3 builds are identical to our existing manifests except: - `applications` renamed to `browser_specific_settings`. - `permissions` sorted alphabetically. # Safari build Safari requires additional packaging commands. This is implemented as a powershell script due to the cross-platform nature, and since we generally require powershell in our distribution pipelines. An alternative would be to write it in bash, but bash is less powerful and would require some additional commands like `jq`. Another alternative is to write it using js, but that would require additional dependencies.
36 lines
2.2 KiB
JSON
36 lines
2.2 KiB
JSON
{
|
|
"name": "@bitwarden/browser",
|
|
"version": "2024.11.1",
|
|
"scripts": {
|
|
"build": "npm run build:chrome",
|
|
"build:chrome": "cross-env BROWSER=chrome MANIFEST_VERSION=3 webpack",
|
|
"build:edge": "cross-env BROWSER=edge webpack",
|
|
"build:firefox": "cross-env BROWSER=firefox webpack",
|
|
"build:opera": "cross-env BROWSER=opera webpack",
|
|
"build:safari": "cross-env BROWSER=safari webpack",
|
|
"build:watch": "npm run build:watch:chrome",
|
|
"build:watch:chrome": "npm run build:chrome -- --watch",
|
|
"build:watch:edge": "npm run build:edge -- --watch",
|
|
"build:watch:firefox": "npm run build:firefox -- --watch",
|
|
"build:watch:opera": "npm run build:opera -- --watch",
|
|
"build:watch:safari": "npm run build:safari -- --watch",
|
|
"build:prod:chrome": "cross-env NODE_ENV=production NODE_OPTIONS=\"--max-old-space-size=4096\" npm run build:chrome",
|
|
"build:prod:edge": "cross-env NODE_ENV=production NODE_OPTIONS=\"--max-old-space-size=4096\" npm run build:edge",
|
|
"build:prod:firefox": "cross-env NODE_ENV=production NODE_OPTIONS=\"--max-old-space-size=4096\" npm run build:firefox",
|
|
"build:prod:opera": "cross-env NODE_ENV=production NODE_OPTIONS=\"--max-old-space-size=4096\" npm run build:opera",
|
|
"build:prod:safari": "cross-env NODE_ENV=production NODE_OPTIONS=\"--max-old-space-size=4096\" npm run build:safari",
|
|
"dist:chrome": "npm run build:prod:chrome && mkdir -p dist && tar -C ./build -acf dist/dist-chrome.zip ./",
|
|
"dist:edge": "npm run build:prod:edge && mkdir -p dist && tar -C ./build -acf dist/dist-edge.zip ./",
|
|
"dist:firefox": "npm run build:prod:firefox && mkdir -p dist && tar -C ./build -acf dist/dist-firefox.zip ./",
|
|
"dist:opera": "npm run build:prod:opera && mkdir -p dist && tar -C ./build -acf dist/dist-opera.zip ./",
|
|
"dist:safari": "npm run build:prod:safari && ./scripts/package-safari.ps1",
|
|
"dist:edge:mv3": "cross-env MANIFEST_VERSION=3 npm run dist:edge",
|
|
"dist:firefox:mv3": "cross-env MANIFEST_VERSION=3 npm run dist:firefox",
|
|
"dist:opera:mv3": "cross-env MANIFEST_VERSION=3 npm run dist:opera",
|
|
"dist:safari:mv3": "cross-env MANIFEST_VERSION=3 npm run dist:safari",
|
|
"test": "jest",
|
|
"test:watch": "jest --watch",
|
|
"test:watch:all": "jest --watchAll"
|
|
}
|
|
}
|