1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-26 17:43:22 +00:00

[PM-31831] fix: add support for overriding commercial SDK (#18863)

* fix: add support for overriding commercial SDK

* fix: only download commercial when needed

* fix: only download OSS SDK for OSS builds and commercial SDK for commercial builds

Previously, the OSS sdk-internal was downloaded and linked for all
build types including commercial, which is wasteful. Now each build
type only downloads the SDK artifact it needs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* revert: changes to build-desktop.yml

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Andreas Coroiu
2026-02-25 11:15:19 +01:00
committed by GitHub
parent 98f6169333
commit a5df3540af
4 changed files with 108 additions and 15 deletions

View File

@@ -9,18 +9,23 @@ COPY package*.json ./
COPY . .
RUN npm ci
# Remove commercial packages if LICENSE_TYPE is not 'commercial'
ARG LICENSE_TYPE=oss
RUN if [ "${LICENSE_TYPE}" != "commercial" ] ; then \
rm -rf node_modules/@bitwarden/commercial-sdk-internal ; \
fi
# Override SDK if custom artifacts are present
RUN if [ -d "sdk-internal" ]; then \
echo "Overriding SDK with custom artifacts from sdk-internal" ; \
npm link ./sdk-internal ; \
fi
RUN if [ -d "commercial-sdk-internal" ]; then \
echo "Overriding Commercial SDK with custom artifacts from commercial-sdk-internal" ; \
npm link ./commercial-sdk-internal ; \
fi
# Remove commercial packages if LICENSE_TYPE is not 'commercial'
ARG LICENSE_TYPE=oss
RUN if [ "${LICENSE_TYPE}" != "commercial" ] ; then \
rm -rf node_modules/@bitwarden/commercial-sdk-internal ; \
fi
WORKDIR /source/apps/web
ARG NPM_COMMAND=dist:bit:selfhost
RUN npm run ${NPM_COMMAND}