[PM-25909] Commercial desktop builds (#18094)

This commit is contained in:
Derek Nance
2026-09-24 17:34:15 -05:00
committed by GitHub
parent c346911431
commit 9f07c4b890
31 changed files with 791 additions and 174 deletions

View File

@@ -14,6 +14,8 @@ on:
- main
paths:
- 'apps/desktop/**'
- 'bitwarden_license/bit-common/**'
- 'bitwarden_license/bit-desktop/**'
- 'libs/**'
- '*'
- '!*.md'

View File

@@ -12,6 +12,8 @@ on:
- 'cf-pages'
paths:
- 'apps/desktop/**'
- 'bitwarden_license/bit-common/**'
- 'bitwarden_license/bit-desktop/**'
- 'libs/**'
- '*'
- '!*.md'
@@ -24,6 +26,8 @@ on:
- 'hotfix-rc-desktop'
paths:
- 'apps/desktop/**'
- 'bitwarden_license/bit-common/**'
- 'bitwarden_license/bit-desktop/**'
- 'libs/**'
- '*'
- '!*.md'
@@ -184,7 +188,17 @@ jobs:
echo "has_secrets=$has_secrets" >> "$GITHUB_OUTPUT"
linux:
name: Linux Build
name: Linux Build [${{ matrix.variant }}]
strategy:
fail-fast: false
matrix:
include:
- variant: oss
license_type: oss
artifact_prefix: ""
- variant: bit
license_type: commercial
artifact_prefix: "commercial-"
# Note, before updating the ubuntu version of the workflow, ensure the snap base image
# is equal or greater than the new version. Otherwise there might be GLIBC version issues.
# The snap base for desktop is defined in `apps/desktop/electron-builder.json`
@@ -245,7 +259,7 @@ jobs:
working-directory: ./
- name: Download SDK Artifacts
if: ${{ inputs.sdk_branch != '' }}
if: ${{ inputs.sdk_branch != '' && matrix.license_type != 'commercial' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -258,12 +272,31 @@ jobs:
if_no_artifact_found: fail
- name: Override SDK
if: ${{ inputs.sdk_branch != '' }}
if: ${{ inputs.sdk_branch != '' && matrix.license_type != 'commercial' }}
working-directory: ./
run: |
ls -l ../
npm link ../sdk-internal
- name: Download Commercial SDK Artifacts
if: ${{ inputs.sdk_branch != '' && matrix.license_type == 'commercial' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: build-wasm-internal.yml
workflow_conclusion: success
branch: ${{ inputs.sdk_branch }}
artifacts: commercial-sdk-internal
repo: bitwarden/sdk-internal
path: ../commercial-sdk-internal
if_no_artifact_found: fail
- name: Override Commercial SDK
if: ${{ inputs.sdk_branch != '' && matrix.license_type == 'commercial' }}
working-directory: ./
run: |
npm link ../commercial-sdk-internal
- name: Cache Native Module
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
id: cache
@@ -287,47 +320,47 @@ jobs:
node build.js --target=x86_64-unknown-linux-gnu --release
- name: Build application
run: npm run dist:lin
run: npm run dist:${{ matrix.variant }}:lin
- name: Upload tar.gz artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: bitwarden_${{ env._PACKAGE_VERSION }}_x64.tar.gz
name: ${{ matrix.artifact_prefix }}bitwarden_${{ env._PACKAGE_VERSION }}_x64.tar.gz
path: apps/desktop/dist/bitwarden_desktop_x64.tar.gz
if-no-files-found: error
- name: Upload .deb artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Bitwarden-${{ env._PACKAGE_VERSION }}-amd64.deb
name: ${{ matrix.artifact_prefix }}Bitwarden-${{ env._PACKAGE_VERSION }}-amd64.deb
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-amd64.deb
if-no-files-found: error
- name: Upload .rpm artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Bitwarden-${{ env._PACKAGE_VERSION }}-x86_64.rpm
name: ${{ matrix.artifact_prefix }}Bitwarden-${{ env._PACKAGE_VERSION }}-x86_64.rpm
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-x86_64.rpm
if-no-files-found: error
- name: Upload .snap artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: bitwarden_${{ env._PACKAGE_VERSION }}_amd64.snap
name: ${{ matrix.artifact_prefix }}bitwarden_${{ env._PACKAGE_VERSION }}_amd64.snap
path: apps/desktop/dist/bitwarden_${{ env._PACKAGE_VERSION }}_amd64.snap
if-no-files-found: error
- name: Upload .AppImage artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Bitwarden-${{ env._PACKAGE_VERSION }}-x86_64.AppImage
name: ${{ matrix.artifact_prefix }}Bitwarden-${{ env._PACKAGE_VERSION }}-x86_64.AppImage
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-x86_64.AppImage
if-no-files-found: error
- name: Upload auto-update artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ needs.setup.outputs.release_channel }}-linux.yml
name: ${{ matrix.artifact_prefix }}${{ needs.setup.outputs.release_channel }}-linux.yml
path: apps/desktop/dist/${{ needs.setup.outputs.release_channel }}-linux.yml
if-no-files-found: error
@@ -340,12 +373,22 @@ jobs:
- name: Upload flatpak artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: com.bitwarden.desktop.flatpak
name: ${{ matrix.artifact_prefix }}com.bitwarden.desktop.flatpak
path: apps/desktop/dist/com.bitwarden.desktop.flatpak
if-no-files-found: error
linux-arm64:
name: Linux ARM64 Build
name: Linux ARM64 Build [${{ matrix.variant }}]
strategy:
fail-fast: false
matrix:
include:
- variant: oss
license_type: oss
artifact_prefix: ""
- variant: bit
license_type: commercial
artifact_prefix: "commercial-"
# Note, before updating the ubuntu version of the workflow, ensure the snap base image
# is equal or greater than the new version. Otherwise there might be GLIBC version issues.
# The snap base for desktop is defined in `apps/desktop/electron-builder.json`
@@ -409,7 +452,7 @@ jobs:
working-directory: ./
- name: Download SDK Artifacts
if: ${{ inputs.sdk_branch != '' }}
if: ${{ inputs.sdk_branch != '' && matrix.license_type != 'commercial' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -422,12 +465,31 @@ jobs:
if_no_artifact_found: fail
- name: Override SDK
if: ${{ inputs.sdk_branch != '' }}
if: ${{ inputs.sdk_branch != '' && matrix.license_type != 'commercial' }}
working-directory: ./
run: |
ls -l ../
npm link ../sdk-internal
- name: Download Commercial SDK Artifacts
if: ${{ inputs.sdk_branch != '' && matrix.license_type == 'commercial' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: build-wasm-internal.yml
workflow_conclusion: success
branch: ${{ inputs.sdk_branch }}
artifacts: commercial-sdk-internal
repo: bitwarden/sdk-internal
path: ../commercial-sdk-internal
if_no_artifact_found: fail
- name: Override Commercial SDK
if: ${{ inputs.sdk_branch != '' && matrix.license_type == 'commercial' }}
working-directory: ./
run: |
npm link ../commercial-sdk-internal
- name: Cache Native Module
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
id: cache
@@ -464,19 +526,19 @@ jobs:
# Snapcraft environment variables to bypass LXD requirement on ARM64
SNAPCRAFT_BUILD_ENVIRONMENT: host
USE_SYSTEM_FPM: true
run: npm run dist:lin:arm64
run: npm run dist:${{ matrix.variant }}:lin:arm64
- name: Upload .snap artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: bitwarden_${{ env._PACKAGE_VERSION }}_arm64.snap
name: ${{ matrix.artifact_prefix }}bitwarden_${{ env._PACKAGE_VERSION }}_arm64.snap
path: apps/desktop/dist/bitwarden_${{ env._PACKAGE_VERSION }}_arm64.snap
if-no-files-found: error
- name: Upload tar.gz artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: bitwarden_${{ env._PACKAGE_VERSION }}_arm64.tar.gz
name: ${{ matrix.artifact_prefix }}bitwarden_${{ env._PACKAGE_VERSION }}_arm64.tar.gz
path: apps/desktop/dist/bitwarden_desktop_arm64.tar.gz
if-no-files-found: error
@@ -489,12 +551,22 @@ jobs:
- name: Upload flatpak artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: com.bitwarden.desktop-arm64.flatpak
name: ${{ matrix.artifact_prefix }}com.bitwarden.desktop-arm64.flatpak
path: apps/desktop/dist/com.bitwarden.desktop.flatpak
if-no-files-found: error
windows:
name: Windows Build
name: Windows Build [${{ matrix.variant }}]
strategy:
fail-fast: false
matrix:
include:
- variant: oss
license_type: oss
artifact_prefix: ""
- variant: bit
license_type: commercial
artifact_prefix: "commercial-"
runs-on: windows-2022
needs:
- setup
@@ -570,7 +642,7 @@ jobs:
working-directory: ./
- name: Download SDK Artifacts
if: ${{ inputs.sdk_branch != '' && needs.setup.outputs.has_secrets == 'true' }}
if: ${{ inputs.sdk_branch != '' && needs.setup.outputs.has_secrets == 'true' && matrix.license_type != 'commercial' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -583,12 +655,31 @@ jobs:
if_no_artifact_found: fail
- name: Override SDK
if: ${{ inputs.sdk_branch != '' && needs.setup.outputs.has_secrets == 'true' }}
if: ${{ inputs.sdk_branch != '' && needs.setup.outputs.has_secrets == 'true' && matrix.license_type != 'commercial' }}
working-directory: ./
run: |
ls -l ../
npm link ../sdk-internal
- name: Download Commercial SDK Artifacts
if: ${{ inputs.sdk_branch != '' && needs.setup.outputs.has_secrets == 'true' && matrix.license_type == 'commercial' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: build-wasm-internal.yml
workflow_conclusion: success
branch: ${{ inputs.sdk_branch }}
artifacts: commercial-sdk-internal
repo: bitwarden/sdk-internal
path: ../commercial-sdk-internal
if_no_artifact_found: fail
- name: Override Commercial SDK
if: ${{ inputs.sdk_branch != '' && needs.setup.outputs.has_secrets == 'true' && matrix.license_type == 'commercial' }}
working-directory: ./
run: |
npm link ../commercial-sdk-internal
- name: Cache Native Module
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
id: cache
@@ -606,7 +697,7 @@ jobs:
run: node build.js cross-platform "$env:MODE"
- name: Build
run: npm run build
run: npm run build:${{ matrix.variant }}
- name: Pack
if: ${{ needs.setup.outputs.has_secrets == 'false' }}
@@ -664,7 +755,7 @@ jobs:
- name: Upload portable exe artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Bitwarden-Portable-${{ env._PACKAGE_VERSION }}.exe
name: ${{ matrix.artifact_prefix }}Bitwarden-Portable-${{ env._PACKAGE_VERSION }}.exe
path: apps/desktop/dist/Bitwarden-Portable-${{ env._PACKAGE_VERSION }}.exe
if-no-files-found: error
@@ -672,7 +763,7 @@ jobs:
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Bitwarden-Installer-${{ env._PACKAGE_VERSION }}.exe
name: ${{ matrix.artifact_prefix }}Bitwarden-Installer-${{ env._PACKAGE_VERSION }}.exe
path: apps/desktop/dist/nsis-web/Bitwarden-Installer-${{ env._PACKAGE_VERSION }}.exe
if-no-files-found: error
@@ -680,7 +771,7 @@ jobs:
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Bitwarden-${{ env._PACKAGE_VERSION }}-ia32.appx
name: ${{ matrix.artifact_prefix }}Bitwarden-${{ env._PACKAGE_VERSION }}-ia32.appx
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-ia32.appx
if-no-files-found: error
@@ -688,7 +779,7 @@ jobs:
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Bitwarden-${{ env._PACKAGE_VERSION }}-ia32-store.appx
name: ${{ matrix.artifact_prefix }}Bitwarden-${{ env._PACKAGE_VERSION }}-ia32-store.appx
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-ia32-store.appx
if-no-files-found: error
@@ -696,7 +787,7 @@ jobs:
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: bitwarden-${{ env._PACKAGE_VERSION }}-ia32.nsis.7z
name: ${{ matrix.artifact_prefix }}bitwarden-${{ env._PACKAGE_VERSION }}-ia32.nsis.7z
path: apps/desktop/dist/nsis-web/bitwarden-${{ env._PACKAGE_VERSION }}-ia32.nsis.7z
if-no-files-found: error
@@ -704,7 +795,7 @@ jobs:
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Bitwarden-${{ env._PACKAGE_VERSION }}-x64.appx
name: ${{ matrix.artifact_prefix }}Bitwarden-${{ env._PACKAGE_VERSION }}-x64.appx
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-x64.appx
if-no-files-found: error
@@ -712,7 +803,7 @@ jobs:
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Bitwarden-${{ env._PACKAGE_VERSION }}-x64-store.appx
name: ${{ matrix.artifact_prefix }}Bitwarden-${{ env._PACKAGE_VERSION }}-x64-store.appx
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-x64-store.appx
if-no-files-found: error
@@ -720,7 +811,7 @@ jobs:
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: bitwarden-${{ env._PACKAGE_VERSION }}-x64.nsis.7z
name: ${{ matrix.artifact_prefix }}bitwarden-${{ env._PACKAGE_VERSION }}-x64.nsis.7z
path: apps/desktop/dist/nsis-web/bitwarden-${{ env._PACKAGE_VERSION }}-x64.nsis.7z
if-no-files-found: error
@@ -728,7 +819,7 @@ jobs:
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Bitwarden-${{ env._PACKAGE_VERSION }}-arm64.appx
name: ${{ matrix.artifact_prefix }}Bitwarden-${{ env._PACKAGE_VERSION }}-arm64.appx
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-arm64.appx
if-no-files-found: error
@@ -736,7 +827,7 @@ jobs:
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Bitwarden-${{ env._PACKAGE_VERSION }}-arm64-store.appx
name: ${{ matrix.artifact_prefix }}Bitwarden-${{ env._PACKAGE_VERSION }}-arm64-store.appx
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-arm64-store.appx
if-no-files-found: error
@@ -744,7 +835,7 @@ jobs:
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: bitwarden-${{ env._PACKAGE_VERSION }}-arm64.nsis.7z
name: ${{ matrix.artifact_prefix }}bitwarden-${{ env._PACKAGE_VERSION }}-arm64.nsis.7z
path: apps/desktop/dist/nsis-web/bitwarden-${{ env._PACKAGE_VERSION }}-arm64.nsis.7z
if-no-files-found: error
@@ -752,7 +843,7 @@ jobs:
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: bitwarden.${{ env._PACKAGE_VERSION }}.nupkg
name: ${{ matrix.artifact_prefix }}bitwarden.${{ env._PACKAGE_VERSION }}.nupkg
path: apps/desktop/dist/chocolatey/bitwarden.${{ env._PACKAGE_VERSION }}.nupkg
if-no-files-found: error
@@ -760,7 +851,7 @@ jobs:
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ needs.setup.outputs.release_channel }}.yml
name: ${{ matrix.artifact_prefix }}${{ needs.setup.outputs.release_channel }}.yml
path: apps/desktop/dist/nsis-web/${{ needs.setup.outputs.release_channel }}.yml
if-no-files-found: error
@@ -805,7 +896,17 @@ jobs:
} >> "$GITHUB_STEP_SUMMARY"
windows-beta:
name: Windows Beta Build
name: Windows Beta Build [${{ matrix.variant }}]
strategy:
fail-fast: false
matrix:
include:
- variant: oss
license_type: oss
artifact_prefix: ""
- variant: bit
license_type: commercial
artifact_prefix: "commercial-"
runs-on: windows-2022
needs: setup
permissions:
@@ -880,7 +981,7 @@ jobs:
working-directory: ./
- name: Download SDK Artifacts
if: ${{ inputs.sdk_branch != '' && needs.setup.outputs.has_secrets == 'true' }}
if: ${{ inputs.sdk_branch != '' && needs.setup.outputs.has_secrets == 'true' && matrix.license_type != 'commercial' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -893,12 +994,31 @@ jobs:
if_no_artifact_found: fail
- name: Override SDK
if: ${{ inputs.sdk_branch != '' && needs.setup.outputs.has_secrets == 'true' }}
if: ${{ inputs.sdk_branch != '' && needs.setup.outputs.has_secrets == 'true' && matrix.license_type != 'commercial' }}
working-directory: ./
run: |
ls -l ../
npm link ../sdk-internal
- name: Download Commercial SDK Artifacts
if: ${{ inputs.sdk_branch != '' && needs.setup.outputs.has_secrets == 'true' && matrix.license_type == 'commercial' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: build-wasm-internal.yml
workflow_conclusion: success
branch: ${{ inputs.sdk_branch }}
artifacts: commercial-sdk-internal
repo: bitwarden/sdk-internal
path: ../commercial-sdk-internal
if_no_artifact_found: fail
- name: Override Commercial SDK
if: ${{ inputs.sdk_branch != '' && needs.setup.outputs.has_secrets == 'true' && matrix.license_type == 'commercial' }}
working-directory: ./
run: |
npm link ../commercial-sdk-internal
- name: Cache Native Module
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
id: cache
@@ -918,7 +1038,7 @@ jobs:
- name: Build
env:
CHANNEL: beta
run: npm run build
run: npm run build:${{ matrix.variant }}
# pack:win:beta stamps BETA_PACKAGE_VERSION into the built package.json, which
# electron-builder reads for artifact names and the channel file. The `-beta.N`
@@ -1010,7 +1130,7 @@ jobs:
- name: Upload portable exe artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Bitwarden-Beta-Portable-${{ env._PACKAGE_VERSION }}.exe
name: ${{ matrix.artifact_prefix }}Bitwarden-Beta-Portable-${{ env._PACKAGE_VERSION }}.exe
path: apps/desktop/dist/Bitwarden-Beta-Portable-${{ env._PACKAGE_VERSION }}.exe
if-no-files-found: error
@@ -1018,7 +1138,7 @@ jobs:
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Bitwarden-Beta-Installer-${{ env._PACKAGE_VERSION }}.exe
name: ${{ matrix.artifact_prefix }}Bitwarden-Beta-Installer-${{ env._PACKAGE_VERSION }}.exe
path: apps/desktop/dist/nsis-web/Bitwarden-Beta-Installer-${{ env._PACKAGE_VERSION }}.exe
if-no-files-found: error
@@ -1026,7 +1146,7 @@ jobs:
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Bitwarden-Beta-${{ env._PACKAGE_VERSION }}-ia32.appx
name: ${{ matrix.artifact_prefix }}Bitwarden-Beta-${{ env._PACKAGE_VERSION }}-ia32.appx
path: apps/desktop/dist/Bitwarden-Beta-${{ env._PACKAGE_VERSION }}-ia32.appx
if-no-files-found: error
@@ -1034,7 +1154,7 @@ jobs:
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Bitwarden-Beta-${{ env._PACKAGE_VERSION }}-ia32-store.appx
name: ${{ matrix.artifact_prefix }}Bitwarden-Beta-${{ env._PACKAGE_VERSION }}-ia32-store.appx
path: apps/desktop/dist/Bitwarden-Beta-${{ env._PACKAGE_VERSION }}-ia32-store.appx
if-no-files-found: error
@@ -1042,7 +1162,7 @@ jobs:
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: bitwarden-beta-${{ env._PACKAGE_VERSION }}-ia32.nsis.7z
name: ${{ matrix.artifact_prefix }}bitwarden-beta-${{ env._PACKAGE_VERSION }}-ia32.nsis.7z
path: apps/desktop/dist/nsis-web/bitwarden-beta-${{ env._PACKAGE_VERSION }}-ia32.nsis.7z
if-no-files-found: error
@@ -1050,7 +1170,7 @@ jobs:
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Bitwarden-Beta-${{ env._PACKAGE_VERSION }}-x64.appx
name: ${{ matrix.artifact_prefix }}Bitwarden-Beta-${{ env._PACKAGE_VERSION }}-x64.appx
path: apps/desktop/dist/Bitwarden-Beta-${{ env._PACKAGE_VERSION }}-x64.appx
if-no-files-found: error
@@ -1058,7 +1178,7 @@ jobs:
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Bitwarden-Beta-${{ env._PACKAGE_VERSION }}-x64-store.appx
name: ${{ matrix.artifact_prefix }}Bitwarden-Beta-${{ env._PACKAGE_VERSION }}-x64-store.appx
path: apps/desktop/dist/Bitwarden-Beta-${{ env._PACKAGE_VERSION }}-x64-store.appx
if-no-files-found: error
@@ -1066,7 +1186,7 @@ jobs:
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: bitwarden-beta-${{ env._PACKAGE_VERSION }}-x64.nsis.7z
name: ${{ matrix.artifact_prefix }}bitwarden-beta-${{ env._PACKAGE_VERSION }}-x64.nsis.7z
path: apps/desktop/dist/nsis-web/bitwarden-beta-${{ env._PACKAGE_VERSION }}-x64.nsis.7z
if-no-files-found: error
@@ -1074,7 +1194,7 @@ jobs:
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Bitwarden-Beta-${{ env._PACKAGE_VERSION }}-arm64.appx
name: ${{ matrix.artifact_prefix }}Bitwarden-Beta-${{ env._PACKAGE_VERSION }}-arm64.appx
path: apps/desktop/dist/Bitwarden-Beta-${{ env._PACKAGE_VERSION }}-arm64.appx
if-no-files-found: error
@@ -1082,7 +1202,7 @@ jobs:
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Bitwarden-Beta-${{ env._PACKAGE_VERSION }}-arm64-store.appx
name: ${{ matrix.artifact_prefix }}Bitwarden-Beta-${{ env._PACKAGE_VERSION }}-arm64-store.appx
path: apps/desktop/dist/Bitwarden-Beta-${{ env._PACKAGE_VERSION }}-arm64-store.appx
if-no-files-found: error
@@ -1090,7 +1210,7 @@ jobs:
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: bitwarden-beta-${{ env._PACKAGE_VERSION }}-arm64.nsis.7z
name: ${{ matrix.artifact_prefix }}bitwarden-beta-${{ env._PACKAGE_VERSION }}-arm64.nsis.7z
path: apps/desktop/dist/nsis-web/bitwarden-beta-${{ env._PACKAGE_VERSION }}-arm64.nsis.7z
if-no-files-found: error
@@ -1098,12 +1218,22 @@ jobs:
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: beta.yml
name: ${{ matrix.artifact_prefix }}beta.yml
path: apps/desktop/dist/nsis-web/beta.yml
if-no-files-found: error
macos-build:
name: MacOS Build
name: MacOS Build [${{ matrix.variant }}]
strategy:
fail-fast: false
matrix:
include:
- variant: oss
license_type: oss
artifact_prefix: ""
- variant: bit
license_type: commercial
artifact_prefix: "commercial-"
runs-on: macos-15
needs:
- setup
@@ -1161,14 +1291,14 @@ jobs:
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: apps/desktop/build
key: ${{ runner.os }}-${{ github.run_id }}-build
key: ${{ runner.os }}-${{ github.run_id }}-${{ matrix.license_type }}-build
- name: Cache Safari
id: safari-cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: apps/browser/dist/Safari
key: ${{ runner.os }}-${{ github.run_id }}-safari-extension
key: ${{ runner.os }}-${{ github.run_id }}-${{ matrix.license_type }}-safari-extension
- name: Log in to Azure
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
@@ -1277,7 +1407,7 @@ jobs:
working-directory: ./
- name: Download SDK Artifacts
if: ${{ inputs.sdk_branch != '' && needs.setup.outputs.has_secrets == 'true' }}
if: ${{ inputs.sdk_branch != '' && needs.setup.outputs.has_secrets == 'true' && matrix.license_type != 'commercial' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -1290,12 +1420,31 @@ jobs:
if_no_artifact_found: fail
- name: Override SDK
if: ${{ inputs.sdk_branch != '' && needs.setup.outputs.has_secrets == 'true' }}
if: ${{ inputs.sdk_branch != '' && needs.setup.outputs.has_secrets == 'true' && matrix.license_type != 'commercial' }}
working-directory: ./
run: |
ls -l ../
npm link ../sdk-internal
- name: Download Commercial SDK Artifacts
if: ${{ inputs.sdk_branch != '' && needs.setup.outputs.has_secrets == 'true' && matrix.license_type == 'commercial' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: build-wasm-internal.yml
workflow_conclusion: success
branch: ${{ inputs.sdk_branch }}
artifacts: commercial-sdk-internal
repo: bitwarden/sdk-internal
path: ../commercial-sdk-internal
if_no_artifact_found: fail
- name: Override Commercial SDK
if: ${{ inputs.sdk_branch != '' && needs.setup.outputs.has_secrets == 'true' && matrix.license_type == 'commercial' }}
working-directory: ./
run: |
npm link ../commercial-sdk-internal
- name: Cache Native Module
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
id: cache
@@ -1313,7 +1462,7 @@ jobs:
run: node build.js cross-platform "$MODE"
- name: Build application (dev)
run: npm run build
run: npm run build:${{ matrix.variant }}
browser-build:
name: Browser Build
@@ -1327,7 +1476,17 @@ jobs:
id-token: write
macos-package-github:
name: MacOS Package GitHub Release Assets
name: MacOS Package GitHub Release Assets [${{ matrix.variant }}]
strategy:
fail-fast: false
matrix:
include:
- variant: oss
license_type: oss
artifact_prefix: ""
- variant: bit
license_type: commercial
artifact_prefix: "commercial-"
runs-on: macos-15
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
needs:
@@ -1388,14 +1547,14 @@ jobs:
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: apps/desktop/build
key: ${{ runner.os }}-${{ github.run_id }}-build
key: ${{ runner.os }}-${{ github.run_id }}-${{ matrix.license_type }}-build
- name: Setup Safari Cache
id: safari-cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: apps/browser/dist/Safari
key: ${{ runner.os }}-${{ github.run_id }}-safari-extension
key: ${{ runner.os }}-${{ github.run_id }}-${{ matrix.license_type }}-safari-extension
- name: Log in to Azure
uses: bitwarden/gh-actions/azure-login@main
@@ -1493,7 +1652,7 @@ jobs:
working-directory: ./
- name: Download SDK Artifacts
if: ${{ inputs.sdk_branch != '' }}
if: ${{ inputs.sdk_branch != '' && matrix.license_type != 'commercial' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -1506,12 +1665,31 @@ jobs:
if_no_artifact_found: fail
- name: Override SDK
if: ${{ inputs.sdk_branch != '' }}
if: ${{ inputs.sdk_branch != '' && matrix.license_type != 'commercial' }}
working-directory: ./
run: |
ls -l ../
npm link ../sdk-internal
- name: Download Commercial SDK Artifacts
if: ${{ inputs.sdk_branch != '' && matrix.license_type == 'commercial' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: build-wasm-internal.yml
workflow_conclusion: success
branch: ${{ inputs.sdk_branch }}
artifacts: commercial-sdk-internal
repo: bitwarden/sdk-internal
path: ../commercial-sdk-internal
if_no_artifact_found: fail
- name: Override Commercial SDK
if: ${{ inputs.sdk_branch != '' && matrix.license_type == 'commercial' }}
working-directory: ./
run: |
npm link ../commercial-sdk-internal
- name: Cache Native Module
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
id: cache
@@ -1530,7 +1708,7 @@ jobs:
- name: Build
if: steps.build-cache.outputs.cache-hit != 'true'
run: npm run build
run: npm run build:${{ matrix.variant }}
- name: Download Browser artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
@@ -1571,33 +1749,43 @@ jobs:
- name: Upload .zip artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Bitwarden-${{ env._PACKAGE_VERSION }}-universal-mac.zip
name: ${{ matrix.artifact_prefix }}Bitwarden-${{ env._PACKAGE_VERSION }}-universal-mac.zip
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-universal-mac.zip
if-no-files-found: error
- name: Upload .dmg artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Bitwarden-${{ env._PACKAGE_VERSION }}-universal.dmg
name: ${{ matrix.artifact_prefix }}Bitwarden-${{ env._PACKAGE_VERSION }}-universal.dmg
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-universal.dmg
if-no-files-found: error
- name: Upload .dmg blockmap artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Bitwarden-${{ env._PACKAGE_VERSION }}-universal.dmg.blockmap
name: ${{ matrix.artifact_prefix }}Bitwarden-${{ env._PACKAGE_VERSION }}-universal.dmg.blockmap
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-universal.dmg.blockmap
if-no-files-found: error
- name: Upload auto-update artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ needs.setup.outputs.release_channel }}-mac.yml
name: ${{ matrix.artifact_prefix }}${{ needs.setup.outputs.release_channel }}-mac.yml
path: apps/desktop/dist/${{ needs.setup.outputs.release_channel }}-mac.yml
if-no-files-found: error
macos-beta:
name: MacOS Beta Build
name: MacOS Beta Build [${{ matrix.variant }}]
strategy:
fail-fast: false
matrix:
include:
- variant: oss
license_type: oss
artifact_prefix: ""
- variant: bit
license_type: commercial
artifact_prefix: "commercial-"
runs-on: macos-15
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
needs:
@@ -1731,7 +1919,7 @@ jobs:
working-directory: ./
- name: Download SDK Artifacts
if: ${{ inputs.sdk_branch != '' }}
if: ${{ inputs.sdk_branch != '' && matrix.license_type != 'commercial' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -1744,12 +1932,31 @@ jobs:
if_no_artifact_found: fail
- name: Override SDK
if: ${{ inputs.sdk_branch != '' }}
if: ${{ inputs.sdk_branch != '' && matrix.license_type != 'commercial' }}
working-directory: ./
run: |
ls -l ../
npm link ../sdk-internal
- name: Download Commercial SDK Artifacts
if: ${{ inputs.sdk_branch != '' && matrix.license_type == 'commercial' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: build-wasm-internal.yml
workflow_conclusion: success
branch: ${{ inputs.sdk_branch }}
artifacts: commercial-sdk-internal
repo: bitwarden/sdk-internal
path: ../commercial-sdk-internal
if_no_artifact_found: fail
- name: Override Commercial SDK
if: ${{ inputs.sdk_branch != '' && matrix.license_type == 'commercial' }}
working-directory: ./
run: |
npm link ../commercial-sdk-internal
- name: Cache Native Module
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
id: cache
@@ -1769,7 +1976,7 @@ jobs:
- name: Build
env:
CHANNEL: beta
run: npm run build
run: npm run build:${{ matrix.variant }}
- name: Set up private auth key
id: setup-auth-key
@@ -1798,26 +2005,36 @@ jobs:
- name: Upload .zip artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Bitwarden-${{ env._PACKAGE_VERSION }}-universal-mac.zip
name: ${{ matrix.artifact_prefix }}Bitwarden-${{ env._PACKAGE_VERSION }}-universal-mac.zip
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-universal-mac.zip
if-no-files-found: error
- name: Upload .dmg artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Bitwarden-${{ env._PACKAGE_VERSION }}-universal.dmg
name: ${{ matrix.artifact_prefix }}Bitwarden-${{ env._PACKAGE_VERSION }}-universal.dmg
path: apps/desktop/dist/Bitwarden-${{ env._PACKAGE_VERSION }}-universal.dmg
if-no-files-found: error
- name: Upload auto-update artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: beta-mac.yml
name: ${{ matrix.artifact_prefix }}beta-mac.yml
path: apps/desktop/dist/beta-mac.yml
if-no-files-found: error
macos-package-mas:
name: MacOS Package Prod Release Asset
name: MacOS Package Prod Release Asset [${{ matrix.variant }}]
strategy:
fail-fast: false
matrix:
include:
- variant: oss
license_type: oss
artifact_prefix: ""
- variant: bit
license_type: commercial
artifact_prefix: "commercial-"
runs-on: macos-15
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
needs:
@@ -1878,14 +2095,14 @@ jobs:
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: apps/desktop/build
key: ${{ runner.os }}-${{ github.run_id }}-build
key: ${{ runner.os }}-${{ github.run_id }}-${{ matrix.license_type }}-build
- name: Setup Safari Cache
id: safari-cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: apps/browser/dist/Safari
key: ${{ runner.os }}-${{ github.run_id }}-safari-extension
key: ${{ runner.os }}-${{ github.run_id }}-${{ matrix.license_type }}-safari-extension
- name: Log in to Azure
uses: bitwarden/gh-actions/azure-login@main
@@ -1991,7 +2208,7 @@ jobs:
working-directory: ./
- name: Download SDK Artifacts
if: ${{ inputs.sdk_branch != '' }}
if: ${{ inputs.sdk_branch != '' && matrix.license_type != 'commercial' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -2004,12 +2221,31 @@ jobs:
if_no_artifact_found: fail
- name: Override SDK
if: ${{ inputs.sdk_branch != '' }}
if: ${{ inputs.sdk_branch != '' && matrix.license_type != 'commercial' }}
working-directory: ./
run: |
ls -l ../
npm link ../sdk-internal
- name: Download Commercial SDK Artifacts
if: ${{ inputs.sdk_branch != '' && matrix.license_type == 'commercial' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: build-wasm-internal.yml
workflow_conclusion: success
branch: ${{ inputs.sdk_branch }}
artifacts: commercial-sdk-internal
repo: bitwarden/sdk-internal
path: ../commercial-sdk-internal
if_no_artifact_found: fail
- name: Override Commercial SDK
if: ${{ inputs.sdk_branch != '' && matrix.license_type == 'commercial' }}
working-directory: ./
run: |
npm link ../commercial-sdk-internal
- name: Cache Native Module
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
id: cache
@@ -2028,7 +2264,7 @@ jobs:
- name: Build
if: steps.build-cache.outputs.cache-hit != 'true'
run: npm run build
run: npm run build:${{ matrix.variant }}
- name: Download Browser artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
@@ -2079,14 +2315,14 @@ jobs:
- name: Upload MacOS App Store build number artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: macos-build-number.json
name: ${{ matrix.artifact_prefix }}macos-build-number.json
path: apps/desktop/dist/macos-build-number.json
if-no-files-found: error
- name: Upload .pkg artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Bitwarden-${{ env._PACKAGE_VERSION }}-universal.pkg
name: ${{ matrix.artifact_prefix }}Bitwarden-${{ env._PACKAGE_VERSION }}-universal.pkg
path: apps/desktop/dist/mas-universal/Bitwarden-${{ env._PACKAGE_VERSION }}-universal.pkg
if-no-files-found: error
@@ -2094,6 +2330,7 @@ jobs:
if: |
github.event_name != 'pull_request_target'
&& (inputs.testflight_distribute || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix-rc-desktop')
&& matrix.license_type == 'oss'
env:
_APP_STORE_CONNECT_TEAM_ISSUER: ${{ steps.get-kv-secrets.outputs.APP-STORE-CONNECT-TEAM-ISSUER }}
_APP_STORE_CONNECT_AUTH_KEY_ID: ${{ steps.get-kv-secrets.outputs.APP-STORE-CONNECT-AUTH-ID }}
@@ -2116,6 +2353,7 @@ jobs:
if: |
github.event_name != 'pull_request_target'
&& (inputs.testflight_distribute || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix-rc-desktop')
&& matrix.license_type == 'oss'
env:
APP_STORE_CONNECT_TEAM_ISSUER: ${{ steps.get-kv-secrets.outputs.APP-STORE-CONNECT-TEAM-ISSUER }}
APP_STORE_CONNECT_AUTH_KEY_ID: ${{ steps.get-kv-secrets.outputs.APP-STORE-CONNECT-AUTH-ID }}
@@ -2139,6 +2377,7 @@ jobs:
if: |
github.event_name != 'pull_request_target'
&& (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix-rc-desktop')
&& matrix.license_type == 'oss'
uses: slackapi/slack-github-action@03ea5433c137af7c0495bc0cad1af10403fc800c # v3.0.2
with:
webhook: ${{ steps.retrieve-slack-secret.outputs.slack-webhook-alerts-deploy-qa }}

View File

@@ -75,7 +75,7 @@ jobs:
artifact: jest-coverage-web
junit: junit-web.xml
- name: Desktop
paths: apps/desktop
paths: apps/desktop bitwarden_license/bit-desktop
artifact: jest-coverage-desktop
junit: junit-desktop.xml
- name: CLI

View File

@@ -25,21 +25,43 @@
"build-native": "cd desktop_native && node build.js",
"lint:rust": "node ../../scripts/lint-rust.mjs",
"lint:rust:fix": "node ../../scripts/lint-rust.mjs --fix",
"build": "concurrently -n Main,Rend,Prel -c yellow,cyan \"npm run build:main\" \"npm run build:renderer\" \"npm run build:preload\"",
"build": "npm run build:oss",
"build:beta": "cross-env CHANNEL=beta npm run build",
"build:dev": "concurrently -n Main,Rend,Prel -c yellow,cyan \"npm run build:main:dev\" \"npm run build:renderer:dev\" \"npm run build:preload:dev\"",
"build:preload": "cross-env NODE_ENV=production webpack --config webpack.config.js --config-name preload",
"build:preload:dev": "cross-env NODE_ENV=development webpack --config webpack.config.js --config-name preload",
"build:preload:watch": "cross-env NODE_ENV=development webpack --config webpack.config.js --config-name preload --watch",
"build:dev": "npm run build:oss:dev",
"build:preload": "npm run build:oss:preload",
"build:preload:dev": "npm run build:oss:preload:dev",
"build:preload:watch": "npm run build:oss:preload:watch",
"build:macos-extension:mac": "./desktop_native/autofill_provider/build.sh && node scripts/build-macos-extension.js mac",
"build:macos-extension:mas": "./desktop_native/autofill_provider/build.sh && node scripts/build-macos-extension.js mas",
"build:macos-extension:masdev": "./desktop_native/autofill_provider/build.sh && node scripts/build-macos-extension.js mas-dev",
"build:main": "cross-env NODE_ENV=production webpack --config webpack.config.js --config-name main",
"build:main:dev": "cross-env NODE_ENV=development webpack --config webpack.config.js --config-name main",
"build:main:watch": "npm run build-native && cross-env NODE_ENV=development webpack --config webpack.config.js --config-name main --watch",
"build:renderer": "cross-env NODE_ENV=production webpack --config webpack.config.js --config-name renderer",
"build:renderer:dev": "cross-env NODE_ENV=development webpack --config webpack.config.js --config-name renderer",
"build:renderer:watch": "cross-env NODE_ENV=development webpack --config webpack.config.js --config-name renderer --watch",
"build:main": "npm run build:oss:main",
"build:main:dev": "npm run build:oss:main:dev",
"build:main:watch": "npm run build:oss:main:watch",
"build:renderer": "npm run build:oss:renderer",
"build:renderer:dev": "npm run build:oss:renderer:dev",
"build:renderer:watch": "npm run build:oss:renderer:watch",
"build:oss": "concurrently -n Main,Rend,Prel -c yellow,cyan \"npm run build:oss:main\" \"npm run build:oss:renderer\" \"npm run build:oss:preload\"",
"build:oss:dev": "concurrently -n Main,Rend,Prel -c yellow,cyan \"npm run build:oss:main:dev\" \"npm run build:oss:renderer:dev\" \"npm run build:oss:preload:dev\"",
"build:oss:main": "cross-env NODE_ENV=production webpack --config webpack.config.js --config-name main",
"build:oss:main:dev": "cross-env NODE_ENV=development webpack --config webpack.config.js --config-name main",
"build:oss:main:watch": "npm run build-native && cross-env NODE_ENV=development webpack --config webpack.config.js --config-name main --watch",
"build:oss:renderer": "cross-env NODE_ENV=production webpack --config webpack.config.js --config-name renderer",
"build:oss:renderer:dev": "cross-env NODE_ENV=development webpack --config webpack.config.js --config-name renderer",
"build:oss:renderer:watch": "cross-env NODE_ENV=development webpack --config webpack.config.js --config-name renderer --watch",
"build:oss:preload": "cross-env NODE_ENV=production webpack --config webpack.config.js --config-name preload",
"build:oss:preload:dev": "cross-env NODE_ENV=development webpack --config webpack.config.js --config-name preload",
"build:oss:preload:watch": "cross-env NODE_ENV=development webpack --config webpack.config.js --config-name preload --watch",
"build:bit": "concurrently -n Main,Rend,Prel -c yellow,cyan \"npm run build:bit:main\" \"npm run build:bit:renderer\" \"npm run build:bit:preload\"",
"build:bit:dev": "concurrently -n Main,Rend,Prel -c yellow,cyan \"npm run build:bit:main:dev\" \"npm run build:bit:renderer:dev\" \"npm run build:bit:preload:dev\"",
"build:bit:main": "cross-env NODE_ENV=production webpack --config ../../bitwarden_license/bit-desktop/webpack.config.js --config-name main",
"build:bit:main:dev": "cross-env NODE_ENV=development webpack --config ../../bitwarden_license/bit-desktop/webpack.config.js --config-name main",
"build:bit:main:watch": "npm run build-native && cross-env NODE_ENV=development webpack --config ../../bitwarden_license/bit-desktop/webpack.config.js --config-name main --watch",
"build:bit:renderer": "cross-env NODE_ENV=production webpack --config ../../bitwarden_license/bit-desktop/webpack.config.js --config-name renderer",
"build:bit:renderer:dev": "cross-env NODE_ENV=development webpack --config ../../bitwarden_license/bit-desktop/webpack.config.js --config-name renderer",
"build:bit:renderer:watch": "cross-env NODE_ENV=development webpack --config ../../bitwarden_license/bit-desktop/webpack.config.js --config-name renderer --watch",
"build:bit:preload": "cross-env NODE_ENV=production webpack --config ../../bitwarden_license/bit-desktop/webpack.config.js --config-name preload",
"build:bit:preload:dev": "cross-env NODE_ENV=development webpack --config ../../bitwarden_license/bit-desktop/webpack.config.js --config-name preload",
"build:bit:preload:watch": "cross-env NODE_ENV=development webpack --config ../../bitwarden_license/bit-desktop/webpack.config.js --config-name preload --watch",
"electron": "node ./scripts/start.js",
"electron:beta": "cross-env CHANNEL=beta npm run electron",
"electron:ignore": "node ./scripts/start.js --ignore-certificate-errors",
@@ -65,13 +87,23 @@
"dist:dir": "npm run build && npm run pack:dir",
"dist:lin": "npm run build && npm run pack:lin",
"dist:lin:arm64": "npm run build && npm run pack:lin:arm64",
"dist:oss:lin": "npm run build:oss && npm run pack:lin",
"dist:oss:lin:arm64": "npm run build:oss && npm run pack:lin:arm64",
"dist:bit:lin": "npm run build:bit && npm run pack:lin",
"dist:bit:lin:arm64": "npm run build:bit && npm run pack:lin:arm64",
"dist:mac": "npm run build && npm run pack:mac",
"dist:mac:mas": "npm run build && npm run pack:mac:mas",
"dist:mac:masdev": "npm run build && npm run pack:mac:masdev",
"dist:win": "npm run build && npm run pack:win",
"dist:win:ci": "npm run build && npm run pack:win:ci",
"test": "jest",
"test:watch": "jest --watch",
"test:watch:all": "jest --watchAll"
"test": "npm run test:oss",
"test:watch": "npm run test:oss:watch",
"test:watch:all": "npm run test:oss:watch:all",
"test:oss": "jest",
"test:oss:watch": "jest --watch",
"test:oss:watch:all": "jest --watchAll",
"test:bit": "jest --config ../../bitwarden_license/bit-desktop/jest.config.js",
"test:bit:watch": "jest --config ../../bitwarden_license/bit-desktop/jest.config.js --watch",
"test:bit:watch:all": "jest --config ../../bitwarden_license/bit-desktop/jest.config.js --watchAll"
}
}

View File

@@ -20,11 +20,17 @@
"cwd": "apps/desktop"
},
"configurations": {
"development": {
"oss": {
"command": "cross-env NODE_ENV=production webpack --config webpack.config.js --config-name main"
},
"oss-dev": {
"command": "cross-env NODE_ENV=development webpack --config webpack.config.js --config-name main"
},
"production": {
"command": "cross-env NODE_ENV=production webpack --config webpack.config.js --config-name main"
"commercial": {
"command": "cross-env NODE_ENV=production webpack --config ../../bitwarden_license/bit-desktop/webpack.config.js --config-name main"
},
"commercial-dev": {
"command": "cross-env NODE_ENV=development webpack --config ../../bitwarden_license/bit-desktop/webpack.config.js --config-name main"
}
}
},
@@ -36,11 +42,17 @@
"cwd": "apps/desktop"
},
"configurations": {
"development": {
"oss": {
"command": "cross-env NODE_ENV=production webpack --config webpack.config.js --config-name preload"
},
"oss-dev": {
"command": "cross-env NODE_ENV=development webpack --config webpack.config.js --config-name preload"
},
"production": {
"command": "cross-env NODE_ENV=production webpack --config webpack.config.js --config-name preload"
"commercial": {
"command": "cross-env NODE_ENV=production webpack --config ../../bitwarden_license/bit-desktop/webpack.config.js --config-name preload"
},
"commercial-dev": {
"command": "cross-env NODE_ENV=development webpack --config ../../bitwarden_license/bit-desktop/webpack.config.js --config-name preload"
}
}
},
@@ -52,11 +64,17 @@
"cwd": "apps/desktop"
},
"configurations": {
"development": {
"oss": {
"command": "cross-env NODE_ENV=production webpack --config webpack.config.js --config-name renderer"
},
"oss-dev": {
"command": "cross-env NODE_ENV=development webpack --config webpack.config.js --config-name renderer"
},
"production": {
"command": "cross-env NODE_ENV=production webpack --config webpack.config.js --config-name renderer"
"commercial": {
"command": "cross-env NODE_ENV=production webpack --config ../../bitwarden_license/bit-desktop/webpack.config.js --config-name renderer"
},
"commercial-dev": {
"command": "cross-env NODE_ENV=development webpack --config ../../bitwarden_license/bit-desktop/webpack.config.js --config-name renderer"
}
}
},
@@ -73,18 +91,32 @@
]
},
"configurations": {
"development": {
"oss": {
"commands": [
"nx run desktop:build-main --configuration=development",
"nx run desktop:build-preload --configuration=development",
"nx run desktop:build-renderer --configuration=development"
"nx run desktop:build-main --configuration=oss",
"nx run desktop:build-preload --configuration=oss",
"nx run desktop:build-renderer --configuration=oss"
]
},
"production": {
"oss-dev": {
"commands": [
"nx run desktop:build-main --configuration=production",
"nx run desktop:build-preload --configuration=production",
"nx run desktop:build-renderer --configuration=production"
"nx run desktop:build-main --configuration=oss-dev",
"nx run desktop:build-preload --configuration=oss-dev",
"nx run desktop:build-renderer --configuration=oss-dev"
]
},
"commercial": {
"commands": [
"nx run desktop:build-main --configuration=commercial",
"nx run desktop:build-preload --configuration=commercial",
"nx run desktop:build-renderer --configuration=commercial"
]
},
"commercial-dev": {
"commands": [
"nx run desktop:build-main --configuration=commercial-dev",
"nx run desktop:build-preload --configuration=commercial-dev",
"nx run desktop:build-renderer --configuration=commercial-dev"
]
}
}
@@ -102,6 +134,14 @@
"outputs": ["{workspaceRoot}/coverage/apps/desktop"],
"options": {
"jestConfig": "apps/desktop/jest.config.js"
},
"configurations": {
"oss": {
"jestConfig": "apps/desktop/jest.config.js"
},
"commercial": {
"jestConfig": "bitwarden_license/bit-desktop/jest.config.js"
}
}
},
"lint": {

View File

@@ -0,0 +1,15 @@
@if (showHeader$ | async) {
<div class="header" [class.vfo1]="vfo1Enabled()"></div>
}
<div id="container">
@if (loading) {
<div class="loading">
<bit-spinner />
</div>
} @else {
<router-outlet />
}
</div>
<bit-toast-container></bit-toast-container>

View File

@@ -86,23 +86,7 @@ const SyncInterval = 6 * 60 * 60 * 1000; // 6 hours
host: {
"[class.vfo1]": "vfo1Enabled()",
},
template: `
@if (showHeader$ | async) {
<div class="header" [class.vfo1]="vfo1Enabled()"></div>
}
<div id="container">
@if (loading) {
<div class="loading">
<bit-spinner />
</div>
} @else {
<router-outlet />
}
</div>
<bit-toast-container></bit-toast-container>
`,
templateUrl: "app.component.html",
standalone: false,
})
export class AppComponent implements OnInit, OnDestroy {

View File

@@ -3,22 +3,11 @@ import "zone.js";
// Register the locales for the application
import "../platform/app/locales";
import { OverlayModule, OVERLAY_DEFAULT_CONFIG } from "@angular/cdk/overlay";
import { NgModule } from "@angular/core";
import { ReactiveFormsModule } from "@angular/forms";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { JslibModule } from "@bitwarden/angular/jslib.module";
import { PremiumUpgradePromptService } from "@bitwarden/common/vault/abstractions/premium-upgrade-prompt.service";
import { IconModule, SpinnerComponent } from "@bitwarden/components";
import { SshAgentService } from "../autofill/services/ssh-agent.service";
import { DesktopPremiumUpgradePromptService } from "../billing/services/desktop-premium-upgrade-prompt.service";
import { AppRoutingModule } from "./app-routing.module";
import { AppComponent } from "./app.component";
import { AvatarComponent } from "./components/avatar.component";
import { ServicesModule } from "./services/services.module";
import { OssModule } from "./oss.module";
/**
* This is the `AppModule` for the Bitwarden desktop application.
@@ -27,25 +16,8 @@ import { ServicesModule } from "./services/services.module";
* **DO NOT** want to modify this file. Routable components are handled by the `AppRoutingModule`.
*/
@NgModule({
imports: [
BrowserAnimationsModule,
AppRoutingModule,
JslibModule,
IconModule,
SpinnerComponent,
ReactiveFormsModule,
OverlayModule,
ServicesModule,
],
declarations: [AvatarComponent, AppComponent],
providers: [
SshAgentService,
{
provide: PremiumUpgradePromptService,
useClass: DesktopPremiumUpgradePromptService,
},
{ provide: OVERLAY_DEFAULT_CONFIG, useValue: { usePopover: false } },
],
imports: [OssModule, AppRoutingModule],
declarations: [AppComponent],
bootstrap: [AppComponent],
})
export class AppModule {}

View File

@@ -0,0 +1,45 @@
import { OverlayModule, OVERLAY_DEFAULT_CONFIG } from "@angular/cdk/overlay";
import { NgModule } from "@angular/core";
import { ReactiveFormsModule } from "@angular/forms";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { JslibModule } from "@bitwarden/angular/jslib.module";
import { PremiumUpgradePromptService } from "@bitwarden/common/vault/abstractions/premium-upgrade-prompt.service";
import { IconModule, SpinnerComponent } from "@bitwarden/components";
import { SshAgentService } from "../autofill/services/ssh-agent.service";
import { DesktopPremiumUpgradePromptService } from "../billing/services/desktop-premium-upgrade-prompt.service";
import { AvatarComponent } from "./components/avatar.component";
import { ServicesModule } from "./services/services.module";
@NgModule({
imports: [
BrowserAnimationsModule,
JslibModule,
IconModule,
SpinnerComponent,
ReactiveFormsModule,
OverlayModule,
ServicesModule,
],
declarations: [AvatarComponent],
exports: [
BrowserAnimationsModule,
JslibModule,
IconModule,
SpinnerComponent,
ReactiveFormsModule,
OverlayModule,
AvatarComponent,
],
providers: [
SshAgentService,
{
provide: PremiumUpgradePromptService,
useClass: DesktopPremiumUpgradePromptService,
},
{ provide: OVERLAY_DEFAULT_CONFIG, useValue: { usePopover: false } },
],
})
export class OssModule {}

View File

@@ -0,0 +1,13 @@
import tools from "./app/tools/preload";
import auth from "./auth/preload";
import autofill from "./autofill/preload";
import keyManagement from "./key-management/preload";
import platform from "./platform/preload";
export const ipc = {
auth,
autofill,
platform,
keyManagement,
tools,
};

View File

@@ -1,10 +1,6 @@
import { contextBridge } from "electron";
import tools from "./app/tools/preload";
import auth from "./auth/preload";
import autofill from "./autofill/preload";
import keyManagement from "./key-management/preload";
import platform from "./platform/preload";
import { ipc } from "./preload.base";
/**
* Bitwarden Preload script.
@@ -17,12 +13,6 @@ import platform from "./platform/preload";
*/
// Each team owns a subspace of the `ipc` global variable in the renderer.
export const ipc = {
auth,
autofill,
platform,
keyManagement,
tools,
};
export { ipc };
contextBridge.exposeInMainWorld("ipc", ipc);

View File

@@ -42,6 +42,7 @@ const DEFAULT_PARAMS = {
* tsConfig: string;
* };
* outputPath?: string;
* importAliases?: import("webpack").ResolveOptions["alias"];
* }} params
*/
module.exports.buildConfig = function buildConfig(params) {
@@ -61,6 +62,7 @@ module.exports.buildConfig = function buildConfig(params) {
path.resolve(__dirname, "../../node_modules"),
path.resolve(process.cwd(), "node_modules"),
],
alias: params.importAliases,
},
};
@@ -334,6 +336,7 @@ module.exports.buildConfig = function buildConfig(params) {
path: require.resolve("path-browserify"),
fs: false,
},
plugins: [new TsconfigPathsPlugin({ configFile: params.renderer.tsConfig })],
},
plugins: [
new AngularWebpackPlugin({

View File

@@ -0,0 +1,22 @@
const { pathsToModuleNameMapper } = require("ts-jest");
const { compilerOptions } = require("../../tsconfig.base");
const sharedConfig = require("../../libs/shared/jest.config.angular");
/** @type {import('jest').Config} */
module.exports = {
...sharedConfig,
displayName: "bit-desktop",
preset: "jest-preset-angular",
setupFilesAfterEnv: ["<rootDir>/../../apps/desktop/test.setup.ts"],
moduleNameMapper: pathsToModuleNameMapper(
{ "@bitwarden/common/spec": ["libs/common/spec"], ...(compilerOptions?.paths ?? {}) },
{
prefix: "<rootDir>/../../",
},
),
testMatch: ["**/+(*.)+(spec).+(ts)"],
collectCoverageFrom: ["src/**/*.ts", "!src/**/*.spec.ts", "!src/**/index.ts"],
coverageDirectory: "<rootDir>/../../coverage/bitwarden_license/bit-desktop",
};

View File

@@ -0,0 +1,13 @@
import { NgModule } from "@angular/core";
import { RouterModule, Routes } from "@angular/router";
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface RouteDataProperties {}
const routes: Routes = [];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class AppRoutingModule {}

View File

@@ -0,0 +1,13 @@
import { Component } from "@angular/core";
import { AppComponent as OssAppComponent } from "@bitwarden/desktop/app/app.component";
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
@Component({
selector: "app-root",
styles: [],
templateUrl: "../../../../apps/desktop/src/app/app.component.html",
standalone: false,
})
export class AppComponent extends OssAppComponent {}

View File

@@ -0,0 +1,19 @@
import "zone.js";
// Register the locales for the application
import "@bitwarden/desktop/platform/app/locales";
import { NgModule } from "@angular/core";
import { AppRoutingModule as OssRoutingModule } from "@bitwarden/desktop/app/app-routing.module";
import { OssModule } from "@bitwarden/desktop/app/oss.module";
import { AppRoutingModule } from "./app-routing.module";
import { AppComponent } from "./app.component";
@NgModule({
imports: [OssModule, AppRoutingModule, OssRoutingModule],
declarations: [AppComponent],
bootstrap: [AppComponent],
})
export class AppModule {}

View File

@@ -0,0 +1,23 @@
import "core-js/proposals/explicit-resource-management";
import { enableProdMode, provideZoneChangeDetection } from "@angular/core";
import { platformBrowser } from "@angular/platform-browser";
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("../../../../apps/desktop/src/scss/styles.scss");
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("../../../../apps/desktop/src/scss/tailwind.css");
import { AppModule } from "./app.module";
if (!ipc.platform.isDev) {
enableProdMode();
}
void platformBrowser().bootstrapModule(AppModule, {
applicationProviders: [provideZoneChangeDetection()],
});
// Disable drag and drop to prevent malicious links from executing in the context of the app
document.addEventListener("dragover", (event) => event.preventDefault());
document.addEventListener("drop", (event) => event.preventDefault());

View File

@@ -0,0 +1,2 @@
// implicitly execute the OSS entrypoint
import "@bitwarden/desktop/entry";

View File

@@ -0,0 +1,10 @@
declare module "forcefocus";
declare const ipc: typeof import("./preload").ipc;
/**
* Will be turned into a constant string in the main process only
* likely either `"development"` or `"production"`.
*
* This is done using the `DefinePlugin` in our webpack files.
*/
declare const BIT_ENVIRONMENT: string;

View File

@@ -0,0 +1,17 @@
import { contextBridge } from "electron";
import { ipc as ossIpc } from "@bitwarden/desktop/preload.base";
/**
* Bitwarden Preload script.
*
* This file extends the OSS IPC with commercial-specific channels.
*
* See the OSS preload script for more information.
*/
export const ipc = {
...ossIpc,
};
contextBridge.exposeInMainWorld("ipc", ipc);

View File

@@ -0,0 +1,4 @@
{
"extends": "../../apps/desktop/tsconfig",
"files": ["../../bitwarden_license/bit-common/src/platform/sdk/sdk-alias.d.ts", "src/entry.ts"]
}

View File

@@ -0,0 +1,8 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"moduleResolution": "nodenext",
"module": "nodenext"
},
"include": ["src/entry.ts", "src/global.d.ts"]
}

View File

@@ -0,0 +1,4 @@
{
"extends": "./tsconfig",
"include": ["src/preload.ts", "src/global.d.ts"]
}

View File

@@ -0,0 +1,9 @@
{
"extends": "../../apps/desktop/tsconfig.renderer.json",
"include": [
"../../apps/desktop/src/app/main.ts",
"src/app/main.ts",
"src/global.d.ts",
"../../bitwarden_license/bit-common/src/platform/sdk/sdk-alias.d.ts"
]
}

View File

@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"isolatedModules": true,
"emitDecoratorMetadata": false
},
"files": ["../../apps/desktop/test.setup.ts"],
"include": ["*.spec.ts", "src/**/*.spec.ts"]
}

View File

@@ -0,0 +1,65 @@
const path = require("path");
const { buildConfig } = require("../../apps/desktop/webpack.base");
module.exports = (webpackConfig, context) => {
// Detect if called by Nx (context parameter exists)
const isNxBuild = context && context.options;
if (isNxBuild) {
return buildConfig({
configName: "Commercial",
renderer: {
entry: path.resolve(__dirname, "src/app/main.ts"),
entryModule: "bitwarden_license/bit-desktop/src/app/app.module#AppModule",
tsConfig: path.resolve(
context.context.root,
"bitwarden_license/bit-desktop/tsconfig.renderer.json",
),
},
main: {
entry: path.resolve(__dirname, "src/entry.ts"),
tsConfig: path.resolve(
context.context.root,
"bitwarden_license/bit-desktop/tsconfig.main.json",
),
},
preload: {
entry: path.resolve(__dirname, "src/preload.ts"),
tsConfig: path.resolve(
context.context.root,
"bitwarden_license/bit-desktop/tsconfig.preload.json",
),
},
outputPath: path.resolve(context.context.root, context.options.outputPath),
importAliases: [
{
name: "@bitwarden/sdk-internal",
alias: "@bitwarden/commercial-sdk-internal",
},
],
});
} else {
return buildConfig({
configName: "Commercial",
renderer: {
entry: path.resolve(__dirname, "src/app/main.ts"),
entryModule: "bitwarden_license/bit-desktop/src/app/app.module#AppModule",
tsConfig: path.resolve(__dirname, "tsconfig.renderer.json"),
},
main: {
entry: path.resolve(__dirname, "src/entry.ts"),
tsConfig: path.resolve(__dirname, "tsconfig.main.json"),
},
preload: {
entry: path.resolve(__dirname, "src/preload.ts"),
tsConfig: path.resolve(__dirname, "tsconfig.preload.json"),
},
importAliases: [
{
name: "@bitwarden/sdk-internal",
alias: "@bitwarden/commercial-sdk-internal",
},
],
});
}
};

View File

@@ -0,0 +1,57 @@
import * as path from "path";
import { webpack } from "webpack";
// The env config loader's optional-file fallback does not work under Jest, and env values do not
// affect module resolution.
jest.mock("../../apps/desktop/config/config", () => ({ load: () => ({}), log: () => {} }));
// eslint-disable-next-line @typescript-eslint/no-require-imports
const buildCommercialConfigs = require("./webpack.config");
const commercialSdkDir = path.resolve(
__dirname,
"../../node_modules/@bitwarden/commercial-sdk-internal",
);
const importerDir = path.resolve(__dirname, "../../apps/desktop/src/services");
function resolveSdkRequest(bundleName: string, request: string): Promise<string> {
const config = buildCommercialConfigs().find((c: { name: string }) => c.name === bundleName);
const resolver = webpack({ ...config, mode: "production" }).resolverFactory.get("normal");
return new Promise((resolve, reject) =>
resolver.resolve({}, importerDir, request, {}, (err, result) =>
err ? reject(err) : resolve(result as string),
),
);
}
describe("commercial desktop webpack config", () => {
beforeEach(() => {
jest.spyOn(console, "log").mockImplementation(() => {});
});
afterEach(() => {
jest.restoreAllMocks();
});
it.each(["main", "renderer", "preload"])(
"resolves @bitwarden/sdk-internal to the commercial SDK in the %s bundle",
async (bundleName) => {
const resolved = await resolveSdkRequest(bundleName, "@bitwarden/sdk-internal");
expect(resolved.startsWith(commercialSdkDir + path.sep)).toBe(true);
},
);
it.each(["main", "renderer", "preload"])(
"resolves the SDK wasm module to the commercial SDK in the %s bundle",
async (bundleName) => {
const resolved = await resolveSdkRequest(
bundleName,
"@bitwarden/sdk-internal/bitwarden_wasm_internal_bg.wasm",
);
expect(resolved).toBe(path.join(commercialSdkDir, "bitwarden_wasm_internal_bg.wasm"));
},
);
});

View File

@@ -24,6 +24,10 @@
"name": "desktop",
"path": "apps/desktop",
},
{
"name": "desktop (bit)",
"path": "bitwarden_license/bit-desktop",
},
{
"name": "browser",
"path": "apps/browser",

View File

@@ -23,6 +23,7 @@ module.exports = {
"<rootDir>/bitwarden_license/bit-browser/jest.config.js",
"<rootDir>/bitwarden_license/bit-cli/jest.config.js",
"<rootDir>/bitwarden_license/bit-common/jest.config.js",
"<rootDir>/bitwarden_license/bit-desktop/jest.config.js",
"<rootDir>/bitwarden_license/bit-web/jest.config.js",
"<rootDir>/libs/admin-console/jest.config.js",

View File

@@ -37,6 +37,7 @@
"@bitwarden/common/*": ["./libs/common/src/*"],
"@bitwarden/components": ["./libs/components/src"],
"@bitwarden/core-test-utils": ["./libs/core-test-utils/src/index.ts"],
"@bitwarden/desktop/*": ["./apps/desktop/src/*"],
"@bitwarden/dirt-card": ["./libs/dirt/card/src"],
"@bitwarden/generator-components": ["./libs/tools/generator/components/src"],
"@bitwarden/generator-core": ["./libs/tools/generator/core/src"],

View File

@@ -8,6 +8,7 @@
"libs/*/src/**/*",
"libs/tools/send/**/src/**/*",
"libs/dirt/card/src/**/*",
"bitwarden_license/bit-desktop/src/**/*",
"bitwarden_license/bit-web/src/**/*",
"bitwarden_license/bit-common/src/**/*",
"bitwarden_license/bit-browser/src/**/*"