mirror of
https://github.com/element-hq/element-desktop.git
synced 2026-02-06 13:52:18 -05:00
Compare commits
36 Commits
v1.12.10-r
...
t3chguy/pn
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
725c85bd16 | ||
|
|
18dc19d2f5 | ||
|
|
b3ad0f288b | ||
|
|
5087d062ac | ||
|
|
fe885db94f | ||
|
|
3cd0a75052 | ||
|
|
184f991b54 | ||
|
|
9732286591 | ||
|
|
b09abe0d7a | ||
|
|
09af7c0634 | ||
|
|
cc1e3945ba | ||
|
|
b750882136 | ||
|
|
2e349187b3 | ||
|
|
8a30ac18fc | ||
|
|
657e9d2339 | ||
|
|
be6fb4e881 | ||
|
|
067e8e27c1 | ||
|
|
2766333e8a | ||
|
|
7a00e61675 | ||
|
|
d4ad12300e | ||
|
|
a16ddf7f0d | ||
|
|
f9a1855bbd | ||
|
|
0bd5657bab | ||
|
|
4828e73fe6 | ||
|
|
97b1df6d4e | ||
|
|
b15ec07272 | ||
|
|
f2de2c4503 | ||
|
|
16e1b10278 | ||
|
|
dfd8647ad1 | ||
|
|
a175dc7ec4 | ||
|
|
150f4f7a7d | ||
|
|
e1da99ee8b | ||
|
|
406a1c9883 | ||
|
|
717b7ca725 | ||
|
|
e01f598138 | ||
|
|
8915b008f7 |
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
@@ -1,5 +1,5 @@
|
||||
* @element-hq/element-web-reviewers
|
||||
/.github/workflows/** @element-hq/element-web-team
|
||||
/package.json @element-hq/element-web-team
|
||||
/yarn.lock @element-hq/element-web-team
|
||||
/pnpm-lock.yaml @element-hq/element-web-team
|
||||
/src/i18n/strings
|
||||
|
||||
7
.github/workflows/build_and_test.yaml
vendored
7
.github/workflows/build_and_test.yaml
vendored
@@ -55,13 +55,14 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
|
||||
|
||||
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
|
||||
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
|
||||
with:
|
||||
cache: "yarn"
|
||||
cache: "pnpm"
|
||||
node-version: "lts/*"
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Download blob reports from GitHub Actions Artifacts
|
||||
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
|
||||
@@ -71,7 +72,7 @@ jobs:
|
||||
merge-multiple: true
|
||||
|
||||
- name: Merge into HTML Report
|
||||
run: yarn playwright merge-reports -c ./playwright.config.ts --reporter=html ./all-blob-reports
|
||||
run: pnpm playwright merge-reports -c ./playwright.config.ts --reporter=html ./all-blob-reports
|
||||
|
||||
- name: Upload HTML report
|
||||
if: always()
|
||||
|
||||
22
.github/workflows/build_linux.yaml
vendored
22
.github/workflows/build_linux.yaml
vendored
@@ -116,22 +116,23 @@ jobs:
|
||||
|
||||
- name: Cache .hak
|
||||
id: cache
|
||||
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5
|
||||
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5
|
||||
with:
|
||||
key: ${{ runner.os }}-${{ github.ref_name }}-${{ inputs.sqlcipher }}-${{ inputs.arch }}-${{ hashFiles('hakHash', 'electronVersion', 'dockerbuild/*') }}
|
||||
path: |
|
||||
./.hak
|
||||
|
||||
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
|
||||
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
|
||||
with:
|
||||
node-version-file: .node-version
|
||||
cache: "yarn"
|
||||
cache: "pnpm"
|
||||
env:
|
||||
# Workaround for https://github.com/actions/setup-node/issues/317
|
||||
FORCE_COLOR: 0
|
||||
|
||||
- name: Install Deps
|
||||
run: "yarn install --frozen-lockfile"
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: "Get modified files"
|
||||
id: changed_files
|
||||
@@ -157,11 +158,18 @@ jobs:
|
||||
docker run \
|
||||
-v ${{ github.workspace }}:/work -w /work \
|
||||
-e SQLCIPHER_BUNDLED \
|
||||
-e CI=1 \
|
||||
$HAK_DOCKER_IMAGE \
|
||||
yarn build:native
|
||||
pnpm build:native
|
||||
|
||||
- name: Fix permissions on .hak
|
||||
run: sudo chown -R $USER:$USER .hak
|
||||
- name: Fix permissions
|
||||
run: |
|
||||
# For .hak
|
||||
sudo chown -R $USER:$USER .hak
|
||||
# DEBUG
|
||||
ls -lah node_modules/7zip-bin/linux/*/7za
|
||||
# For node_modules pnpm strict security
|
||||
sudo chmod +x node_modules/7zip-bin/linux/*/7za
|
||||
|
||||
- name: Check native libraries in hak dependencies
|
||||
run: |
|
||||
@@ -178,7 +186,7 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Build App
|
||||
run: yarn build --publish never ${{ steps.config.outputs.build-args }} -l ${{ inputs.targets }}
|
||||
run: pnpm build --publish never ${{ steps.config.outputs.build-args }} -l ${{ inputs.targets }}
|
||||
env:
|
||||
VARIANT_PATH: variant.json
|
||||
# Only set for Nightly builds
|
||||
|
||||
15
.github/workflows/build_macos.yaml
vendored
15
.github/workflows/build_macos.yaml
vendored
@@ -90,7 +90,7 @@ jobs:
|
||||
|
||||
- name: Cache .hak
|
||||
id: cache
|
||||
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5
|
||||
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5
|
||||
with:
|
||||
key: ${{ runner.os }}-${{ hashFiles('hakHash', 'electronVersion') }}
|
||||
path: |
|
||||
@@ -105,7 +105,7 @@ jobs:
|
||||
rustup target add x86_64-apple-darwin
|
||||
|
||||
# M1 macos-14 comes without Python preinstalled
|
||||
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6
|
||||
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
|
||||
with:
|
||||
python-version: "3.13"
|
||||
|
||||
@@ -113,23 +113,24 @@ jobs:
|
||||
# https://github.com/electron-userland/electron-builder/issues/9511#issuecomment-3774092888
|
||||
- run: sudo pip3 install pyobjc-framework-Quartz
|
||||
|
||||
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
|
||||
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
|
||||
with:
|
||||
node-version-file: .node-version
|
||||
cache: "yarn"
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install Deps
|
||||
run: "yarn install --frozen-lockfile"
|
||||
run: "pnpm install --frozen-lockfile"
|
||||
|
||||
- name: Build Natives
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: yarn build:native:universal
|
||||
run: pnpm build:native:universal
|
||||
|
||||
# We split these because electron-builder gets upset if we set CSC_LINK even to an empty string
|
||||
- name: "[Signed] Build App"
|
||||
if: inputs.sign != ''
|
||||
run: |
|
||||
yarn build:universal --publish never -m ${{ inputs.targets }}
|
||||
pnpm build:universal --publish never -m ${{ inputs.targets }}
|
||||
env:
|
||||
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
||||
APPLE_ID: ${{ secrets.APPLE_ID }}
|
||||
@@ -151,7 +152,7 @@ jobs:
|
||||
- name: "[Unsigned] Build App"
|
||||
if: inputs.sign == ''
|
||||
run: |
|
||||
yarn build:universal --publish never -m ${{ inputs.targets }}
|
||||
pnpm build:universal --publish never -m ${{ inputs.targets }}
|
||||
env:
|
||||
CSC_IDENTITY_AUTO_DISCOVERY: false
|
||||
VARIANT_PATH: variant.json
|
||||
|
||||
16
.github/workflows/build_prepare.yaml
vendored
16
.github/workflows/build_prepare.yaml
vendored
@@ -56,13 +56,14 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
|
||||
|
||||
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
|
||||
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
|
||||
with:
|
||||
node-version-file: .node-version
|
||||
cache: "yarn"
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install Deps
|
||||
run: "yarn install --frozen-lockfile"
|
||||
run: "pnpm install --frozen-lockfile"
|
||||
|
||||
- name: Fetch Element Web (matching branch)
|
||||
id: branch-matching
|
||||
@@ -71,10 +72,10 @@ jobs:
|
||||
run: |
|
||||
scripts/branch-match.sh
|
||||
cp "$CONFIG_DIR/config.json" element-web/
|
||||
yarn --cwd element-web install --frozen-lockfile
|
||||
yarn --cwd element-web run build
|
||||
pnpm --cwd element-web install --frozen-lockfile
|
||||
pnpm --cwd element-web run build
|
||||
mv element-web/webapp .
|
||||
yarn asar-webapp
|
||||
pnpm asar-webapp
|
||||
env:
|
||||
# These must be set for branch-match.sh to get the right branch
|
||||
REPOSITORY: ${{ github.repository }}
|
||||
@@ -83,7 +84,7 @@ jobs:
|
||||
|
||||
- name: Fetch Element Web (${{ inputs.version }})
|
||||
if: steps.branch-matching.outcome == 'failure' || steps.branch-matching.outcome == 'skipped'
|
||||
run: yarn run fetch --noverify -d ${{ inputs.config }} ${{ inputs.version }}
|
||||
run: pnpm run fetch --noverify -d ${{ inputs.config }} ${{ inputs.version }}
|
||||
|
||||
- name: Copy variant config
|
||||
run: cp "$CONFIG_DIR/build.json" variant.json
|
||||
@@ -93,8 +94,9 @@ jobs:
|
||||
# We split this out to save the build_* scripts having to do it to make use of `hashFiles` in the cache action
|
||||
- name: Generate cache hash files
|
||||
run: |
|
||||
set -ex
|
||||
# Add --no-sandbox as otherwise it fails because the helper isn't setuid root. It's only getting the version.
|
||||
yarn run --silent electron --no-sandbox --version > electronVersion
|
||||
pnpm --silent electron --no-sandbox --version > electronVersion
|
||||
cat package.json | jq -c .hakDependencies | sha1sum > hakHash
|
||||
find hak -type f -print0 | xargs -0 sha1sum >> hakHash
|
||||
find scripts/hak -type f -print0 | xargs -0 sha1sum >> hakHash
|
||||
|
||||
7
.github/workflows/build_test.yaml
vendored
7
.github/workflows/build_test.yaml
vendored
@@ -40,13 +40,14 @@ jobs:
|
||||
with:
|
||||
repository: ${{ github.repository == 'element-hq/element-web-pro' && 'element-hq/element-desktop' || github.repository }}
|
||||
|
||||
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
|
||||
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
|
||||
with:
|
||||
node-version-file: .node-version
|
||||
cache: "yarn"
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install Deps
|
||||
run: "yarn install --frozen-lockfile"
|
||||
run: "pnpm install --frozen-lockfile"
|
||||
|
||||
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
|
||||
with:
|
||||
@@ -80,7 +81,7 @@ jobs:
|
||||
uses: coactions/setup-xvfb@6b00cf1889f4e1d5a48635647013c0508128ee1a
|
||||
timeout-minutes: 20
|
||||
with:
|
||||
run: yarn test --project=${{ inputs.project }} ${{ runner.os != 'Linux' && '--ignore-snapshots' || '' }} ${{ inputs.blob_report == false && '--reporter=html' || '' }} ${{ inputs.args }}
|
||||
run: pnpm test --project=${{ inputs.project }} ${{ runner.os != 'Linux' && '--ignore-snapshots' || '' }} ${{ inputs.blob_report == false && '--reporter=html' || '' }} ${{ inputs.args }}
|
||||
env:
|
||||
ELEMENT_DESKTOP_EXECUTABLE: ${{ steps.executable.outputs.path }}
|
||||
|
||||
|
||||
15
.github/workflows/build_windows.yaml
vendored
15
.github/workflows/build_windows.yaml
vendored
@@ -119,7 +119,7 @@ jobs:
|
||||
|
||||
- name: Cache .hak
|
||||
id: cache
|
||||
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5
|
||||
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5
|
||||
with:
|
||||
key: ${{ runner.os }}-${{ inputs.arch }}-${{ hashFiles('hakHash', 'electronVersion') }}
|
||||
path: |
|
||||
@@ -148,27 +148,28 @@ jobs:
|
||||
rustup default stable
|
||||
rustup target add ${{ steps.config.outputs.target }}
|
||||
|
||||
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
|
||||
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
|
||||
with:
|
||||
node-version-file: .node-version
|
||||
cache: "yarn"
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install Deps
|
||||
run: "yarn install --frozen-lockfile"
|
||||
run: "pnpm install --frozen-lockfile"
|
||||
|
||||
- name: Insert config snippet
|
||||
if: steps.config.outputs.extra_config != ''
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir config-edit
|
||||
yarn asar extract webapp.asar config-edit
|
||||
pnpm asar extract webapp.asar config-edit
|
||||
cd config-edit
|
||||
mv config.json old-config.json
|
||||
echo '${{ steps.config.outputs.extra_config }}' | jq -s '.[0] * .[1]' old-config.json - > config.json
|
||||
rm old-config.json
|
||||
cd ..
|
||||
rm webapp.asar
|
||||
yarn asar pack config-edit/ webapp.asar
|
||||
pnpm asar pack config-edit/ webapp.asar
|
||||
|
||||
- name: Set up sqlcipher macros
|
||||
if: steps.cache.outputs.cache-hit != 'true' && contains(inputs.arch, 'arm')
|
||||
@@ -186,7 +187,7 @@ jobs:
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
refreshenv
|
||||
yarn build:native --target ${{ steps.config.outputs.target }}
|
||||
pnpm build:native --target ${{ steps.config.outputs.target }}
|
||||
|
||||
- name: Install and configure eSigner CKA
|
||||
run: |
|
||||
@@ -232,7 +233,7 @@ jobs:
|
||||
MASTER_KEY_FILE: C:\Users\runneradmin\eSignerCKA\master.key
|
||||
|
||||
- name: Build App
|
||||
run: yarn build --publish never ${{ steps.config.outputs.build-args }} -w ${{ inputs.targets }}
|
||||
run: pnpm build --publish never ${{ steps.config.outputs.build-args }} -w ${{ inputs.targets }}
|
||||
env:
|
||||
VARIANT_PATH: variant.json
|
||||
# Only set for Nightly builds
|
||||
|
||||
4
.github/workflows/dockerbuild.yaml
vendored
4
.github/workflows/dockerbuild.yaml
vendored
@@ -39,10 +39,10 @@ jobs:
|
||||
platforms: linux/amd64
|
||||
|
||||
- name: Test image
|
||||
run: docker run -v $PWD:/project element-desktop-dockerbuild yarn install
|
||||
run: docker run -v $PWD:/project element-desktop-dockerbuild pnpm install
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@0567fa5ae8c9a197cb207537dc5cbb43ca3d803f
|
||||
uses: docker/login-action@3227f5311cb93ffd14d13e65d8cc400d30f4dd8a
|
||||
if: github.event_name != 'pull_request'
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
|
||||
31
.github/workflows/static_analysis.yaml
vendored
31
.github/workflows/static_analysis.yaml
vendored
@@ -11,25 +11,27 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
|
||||
|
||||
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
|
||||
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
|
||||
with:
|
||||
node-version-file: package.json
|
||||
cache: "yarn"
|
||||
cache: "pnpm"
|
||||
|
||||
# Does not need branch matching as only analyses this layer
|
||||
- name: Install Deps
|
||||
run: "yarn install --frozen-lockfile"
|
||||
run: "pnpm install --frozen-lockfile"
|
||||
|
||||
- name: Typecheck
|
||||
run: "yarn run lint:types"
|
||||
run: "pnpm run lint:types"
|
||||
|
||||
i18n_lint:
|
||||
name: "i18n Check"
|
||||
uses: matrix-org/matrix-web-i18n/.github/workflows/i18n_check.yml@main
|
||||
uses: matrix-org/matrix-web-i18n/.github/workflows/i18n_check.yml@3673fd3abbf8dfae1de849c6cd3e69e24ed7a766
|
||||
permissions:
|
||||
pull-requests: read
|
||||
with:
|
||||
hardcoded-words: "Element"
|
||||
packageManager: pnpm
|
||||
|
||||
js_lint:
|
||||
name: "ESLint"
|
||||
@@ -37,17 +39,18 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
|
||||
|
||||
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
|
||||
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
|
||||
with:
|
||||
node-version-file: package.json
|
||||
cache: "yarn"
|
||||
cache: "pnpm"
|
||||
|
||||
# Does not need branch matching as only analyses this layer
|
||||
- name: Install Deps
|
||||
run: "yarn install --frozen-lockfile"
|
||||
run: "pnpm install --frozen-lockfile"
|
||||
|
||||
- name: Run Linter
|
||||
run: "yarn run lint:js"
|
||||
run: "pnpm run lint:js"
|
||||
|
||||
workflow_lint:
|
||||
name: "Workflow Lint"
|
||||
@@ -55,17 +58,18 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
|
||||
|
||||
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
|
||||
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
|
||||
with:
|
||||
node-version-file: package.json
|
||||
cache: "yarn"
|
||||
cache: "pnpm"
|
||||
|
||||
# Does not need branch matching as only analyses this layer
|
||||
- name: Install Deps
|
||||
run: "yarn install --frozen-lockfile"
|
||||
run: "pnpm install --frozen-lockfile"
|
||||
|
||||
- name: Run Linter
|
||||
run: "yarn lint:workflows"
|
||||
run: "pnpm lint:workflows"
|
||||
|
||||
analyse_dead_code:
|
||||
name: "Analyse Dead Code"
|
||||
@@ -73,13 +77,14 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
|
||||
|
||||
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
|
||||
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
|
||||
with:
|
||||
node-version-file: package.json
|
||||
cache: "yarn"
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install Deps
|
||||
run: "yarn install --frozen-lockfile"
|
||||
run: "pnpm install --frozen-lockfile"
|
||||
|
||||
- name: Run linter
|
||||
run: "yarn run lint:knip"
|
||||
run: "pnpm run lint:knip"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
/src/i18n/strings
|
||||
/CHANGELOG.md
|
||||
/package-lock.json
|
||||
/yarn.lock
|
||||
/pnpm-lock.yaml
|
||||
/playwright/html-report
|
||||
/playwright/test-results
|
||||
|
||||
|
||||
28
README.md
28
README.md
@@ -14,7 +14,7 @@ Element Desktop is a Matrix client for desktop platforms with Element Web at its
|
||||
Before you do anything else, fetch the dependencies:
|
||||
|
||||
```
|
||||
yarn install
|
||||
pnpm install
|
||||
```
|
||||
|
||||
# Fetching Element
|
||||
@@ -26,7 +26,7 @@ so the first step is to get a working copy of Element Web. There are a few ways
|
||||
# Fetch the prebuilt release Element package from the element-web GitHub releases page. The version
|
||||
# fetched will be the same as the local element-desktop package.
|
||||
# We're explicitly asking for no config, so the packaged Element will have no config.json.
|
||||
yarn run fetch --noverify --cfgdir ""
|
||||
pnpm run fetch --noverify --cfgdir ""
|
||||
```
|
||||
|
||||
...or if you'd like to use GPG to verify the downloaded package:
|
||||
@@ -35,9 +35,9 @@ yarn run fetch --noverify --cfgdir ""
|
||||
# Fetch the Element public key from the element.io web server over a secure connection and import
|
||||
# it into your local GPG keychain (you'll need GPG installed). You only need to to do this
|
||||
# once.
|
||||
yarn run fetch --importkey
|
||||
pnpm run fetch --importkey
|
||||
# Fetch the package and verify the signature
|
||||
yarn run fetch --cfgdir ""
|
||||
pnpm run fetch --cfgdir ""
|
||||
```
|
||||
|
||||
...or either of the above, but fetching a specific version of Element:
|
||||
@@ -45,7 +45,7 @@ yarn run fetch --cfgdir ""
|
||||
```
|
||||
# Fetch the prebuilt release Element package from the element-web GitHub releases page. The version
|
||||
# fetched will be the same as the local element-desktop package.
|
||||
yarn run fetch --noverify --cfgdir "" v1.5.6
|
||||
pnpm run fetch --noverify --cfgdir "" v1.5.6
|
||||
```
|
||||
|
||||
If you only want to run the app locally and don't need to build packages, you can
|
||||
@@ -53,7 +53,7 @@ provide the `webapp` directory directly:
|
||||
|
||||
```
|
||||
# Assuming you've checked out and built a copy of element-web in ../element-web.
|
||||
# Note that you will not be able to `yarn build` after this, but `yarn start`
|
||||
# Note that you will not be able to `pnpm build` after this, but `pnpm start`
|
||||
# will work fine.
|
||||
ln -s ../element-web/webapp ./
|
||||
```
|
||||
@@ -72,7 +72,7 @@ which include support for searching in encrypted rooms and secure storage. Skipp
|
||||
Then, run
|
||||
|
||||
```
|
||||
yarn run build
|
||||
pnpm run build
|
||||
```
|
||||
|
||||
This will do a couple of things:
|
||||
@@ -88,12 +88,12 @@ Alternatively, you can also build using docker, which will always produce the li
|
||||
|
||||
```
|
||||
# Run this once to make the docker image
|
||||
yarn run docker:setup
|
||||
pnpm run docker:setup
|
||||
|
||||
yarn run docker:install
|
||||
pnpm run docker:install
|
||||
# if you want to build the native modules (this will take a while)
|
||||
yarn run docker:build:native
|
||||
yarn run docker:build
|
||||
pnpm run docker:build:native
|
||||
pnpm run docker:build
|
||||
```
|
||||
|
||||
After running, the packages should be in `dist/`.
|
||||
@@ -103,19 +103,19 @@ After running, the packages should be in `dist/`.
|
||||
If you'd just like to run the electron app locally for development:
|
||||
|
||||
```
|
||||
yarn start
|
||||
pnpm start
|
||||
```
|
||||
|
||||
# Config
|
||||
|
||||
If you'd like the packaged Element to have a configuration file, you can create a
|
||||
config directory and place `config.json` in there, then specify this directory
|
||||
with the `--cfgdir` option to `yarn run fetch`, eg:
|
||||
with the `--cfgdir` option to `pnpm run fetch`, eg:
|
||||
|
||||
```
|
||||
mkdir myconfig
|
||||
cp /path/to/my/config.json myconfig/
|
||||
yarn run fetch --cfgdir myconfig
|
||||
pnpm run fetch --cfgdir myconfig
|
||||
```
|
||||
|
||||
The config dir for the official Element app is in `element.io`. If you use this,
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
# Docker image to facilitate building Element Desktop's native bits using a glibc version (2.31)
|
||||
# with broader compatibility, down to Debian bullseye & Ubuntu focal.
|
||||
FROM rust:bullseye@sha256:c6d501c039204c21e9fa374f234bd41bdc8b36cfd455a407ef145d9bef19f2b7
|
||||
FROM rust:bullseye@sha256:3ebcc2d6d71fb93a2967e35723902c51dd87dbb36f66f795a58d7921553fbcd4
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN curl --proto "=https" -L https://yarnpkg.com/latest.tar.gz | tar xvz && mv yarn-* /yarn && ln -s /yarn/bin/yarn /usr/bin/yarn
|
||||
RUN apt-get -qq update && apt-get -y -qq dist-upgrade && \
|
||||
apt-get -y -qq install --no-install-recommends \
|
||||
# tclsh is required for building SQLite as part of SQLCipher
|
||||
|
||||
@@ -9,3 +9,4 @@ ARCH="${archMap["$TARGETARCH"]}"
|
||||
NODE_VERSION=$(cat /.node-version | sed -e 's/^v//')
|
||||
curl --proto "=https" -L "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-$TARGETOS-$ARCH.tar.gz" | tar xz -C /usr/local --strip-components=1 && \
|
||||
unlink /usr/local/CHANGELOG.md && unlink /usr/local/LICENSE && unlink /usr/local/README.md
|
||||
corepack enable
|
||||
@@ -13,10 +13,9 @@ you will need debug symbols.
|
||||
2. Figure out which version of Electron your Element-Desktop is based on. The
|
||||
best way to do this is to figure out the version of Element-Desktop, then
|
||||
look at
|
||||
[`yarn.lock`](https://github.com/element-hq/element-desktop/blob/develop/yarn.lock)
|
||||
for the corresponding version. There should be an entry starting
|
||||
`electron@`, and under it a `version` line: this will tell you the version
|
||||
of Electron that was used for that version of Element-Desktop.
|
||||
[`package.json`](https://github.com/element-hq/element-desktop/blob/develop/package.json)
|
||||
for the corresponding version. There will be an entry within `dependencies` of
|
||||
`electron`: the value will tell you the version of Electron that was used for that version of Element-Desktop.
|
||||
|
||||
3. Go to [Electron's releases page](https://github.com/electron/electron/releases/)
|
||||
and find the version you just identified. Under "Assets", download
|
||||
|
||||
@@ -18,21 +18,20 @@ when releasing.
|
||||
If you are building for Linux, you can build the native modules with:
|
||||
|
||||
```
|
||||
yarn docker:setup
|
||||
yarn docker:install
|
||||
INDOCKER_SQLCIPHER_BUNDLED=1 yarn docker:build:native
|
||||
pnpm docker:setup
|
||||
pnpm docker:install
|
||||
INDOCKER_SQLCIPHER_BUNDLED=1 pnpm docker:build:native
|
||||
```
|
||||
|
||||
The above will build `matrix-seshat` in
|
||||
`docker/node_modules/matrix-seshat`. You can then either run `yarn docker:build`
|
||||
`docker/node_modules/matrix-seshat`. You can then either run `pnpm docker:build`
|
||||
to build the app inside docker, or:
|
||||
|
||||
```
|
||||
yarn --cwd docker/node_modules/matrix-seshat link
|
||||
yarn link matrix-seshat
|
||||
pnpm link docker/node_modules/matrix-seshat
|
||||
```
|
||||
|
||||
... and build the app with `yarn build` or run it with `yarn start`.
|
||||
... and build the app with `pnpm build` or run it with `pnpm start`.
|
||||
|
||||
(See also https://github.com/element-hq/element-desktop#docker.)
|
||||
|
||||
@@ -49,7 +48,7 @@ Then optionally, [add seshat and dependencies to support search in E2E rooms](#a
|
||||
Then, to build for an architecture selected automatically based on your system (recommended), run:
|
||||
|
||||
```
|
||||
yarn run build:native
|
||||
pnpm run build:native
|
||||
```
|
||||
|
||||
If you need to build for a specific architecture, see [here](#compiling-for-specific-architectures).
|
||||
@@ -67,20 +66,20 @@ Seshat also depends on the SQLCipher library to store its data in encrypted form
|
||||
on disk. You'll need to install it via your OS package manager.
|
||||
|
||||
After installing the Rust compiler and SQLCipher, Seshat support can be added
|
||||
using yarn at the root of this project:
|
||||
using pnpm at the root of this project:
|
||||
|
||||
yarn add matrix-seshat
|
||||
pnpm add matrix-seshat
|
||||
|
||||
You will have to rebuild the native libraries against electron's version
|
||||
of node rather than your system node, using the `electron-build-env` tool.
|
||||
This is also needed to when pulling in changes to Seshat using `yarn link`.
|
||||
This is also needed to when pulling in changes to Seshat using `pnpm link`.
|
||||
|
||||
yarn add electron-build-env
|
||||
pnpm add electron-build-env
|
||||
|
||||
Recompiling Seshat itself can be done like so:
|
||||
|
||||
ELECTRON_VERSION=$(electron --version)
|
||||
yarn run electron-build-env -- --electron ${ELECTRON_VERSION#v} -- neon build matrix-seshat --release
|
||||
pnpm electron-build-env -- --electron ${ELECTRON_VERSION#v} -- neon build matrix-seshat --release
|
||||
|
||||
Please make sure to include all the `--` as well as the `--release` command line
|
||||
switch at the end. Modify your electron version accordingly depending on the
|
||||
@@ -89,7 +88,7 @@ version that is installed on your system.
|
||||
After this is done the Electron version of Element can be run from the main folder
|
||||
as usual using:
|
||||
|
||||
yarn start
|
||||
pnpm start
|
||||
|
||||
### Statically linking libsqlcipher
|
||||
|
||||
@@ -109,26 +108,26 @@ and https://github.com/vector-im/element-web/issues/20926.
|
||||
On macOS, you can build universal native modules too:
|
||||
|
||||
```
|
||||
yarn run build:native:universal
|
||||
pnpm run build:native:universal
|
||||
```
|
||||
|
||||
...or you can build for a specific architecture:
|
||||
|
||||
```
|
||||
yarn run build:native --target x86_64-apple-darwin
|
||||
pnpm run build:native --target x86_64-apple-darwin
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
yarn run build:native --target aarch64-apple-darwin
|
||||
pnpm run build:native --target aarch64-apple-darwin
|
||||
```
|
||||
|
||||
You'll then need to create a built bundle with the same architecture.
|
||||
To bundle a universal build for macOS, run:
|
||||
|
||||
```
|
||||
yarn run build:universal
|
||||
pnpm run build:universal
|
||||
```
|
||||
|
||||
### Windows
|
||||
@@ -136,13 +135,13 @@ yarn run build:universal
|
||||
If you're on Windows, you can choose to build specifically for 32 or 64 bit:
|
||||
|
||||
```
|
||||
yarn run build:32
|
||||
pnpm run build:32
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
yarn run build:64
|
||||
pnpm run build:64
|
||||
```
|
||||
|
||||
### Cross compiling
|
||||
@@ -156,19 +155,19 @@ at this time.
|
||||
|
||||
The native module build system keeps the different architectures
|
||||
separate, so you can keep native modules for several architectures at the same
|
||||
time and switch which are active using a `yarn run hak copy` command, passing
|
||||
time and switch which are active using a `pnpm run hak copy` command, passing
|
||||
the appropriate architectures. This will error if you haven't yet built those
|
||||
architectures. eg:
|
||||
|
||||
```
|
||||
yarn run build:native --target x86_64-apple-darwin
|
||||
pnpm run build:native --target x86_64-apple-darwin
|
||||
# We've now built & linked into place native modules for Intel
|
||||
yarn run build:native --target aarch64-apple-darwin
|
||||
pnpm run build:native --target aarch64-apple-darwin
|
||||
# We've now built Apple Silicon modules too, and linked them into place as the active ones
|
||||
|
||||
yarn run hak copy --target x86_64-apple-darwin
|
||||
pnpm run hak copy --target x86_64-apple-darwin
|
||||
# We've now switched back to our Intel modules
|
||||
yarn run hak copy --target x86_64-apple-darwin --target aarch64-apple-darwin
|
||||
pnpm run hak copy --target x86_64-apple-darwin --target aarch64-apple-darwin
|
||||
# Now our native modules are universal x86_64+aarch64 binaries
|
||||
```
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ If you want to build native modules, make sure that the following tools are inst
|
||||
You can install the above tools using [Chocolatey](https://chocolatey.org/install):
|
||||
|
||||
```cmd
|
||||
choco install --no-progress -y git nodejs-lts yarn python StrawberryPerl rustup.install nasm magicsplat-tcl-tk
|
||||
choco install --no-progress -y git nodejs-lts pnpm python StrawberryPerl rustup.install nasm magicsplat-tcl-tk
|
||||
```
|
||||
|
||||
- [Build Tools for Visual Studio 2019](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019) with the following configuration:
|
||||
|
||||
62
package.json
62
package.json
@@ -21,43 +21,43 @@
|
||||
"node": ">=18.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"i18n": "matrix-gen-i18n && yarn i18n:sort && yarn i18n:lint",
|
||||
"i18n": "matrix-gen-i18n && pnpm i18n:sort && pnpm i18n:lint",
|
||||
"i18n:sort": "matrix-sort-i18n src/i18n/strings/en_EN.json",
|
||||
"i18n:lint": "prettier --log-level=silent --write src/i18n/strings/ --ignore-path /dev/null",
|
||||
"i18n:diff": "cp src/i18n/strings/en_EN.json src/i18n/strings/en_EN_orig.json && yarn i18n && matrix-compare-i18n-files src/i18n/strings/en_EN_orig.json src/i18n/strings/en_EN.json",
|
||||
"i18n:diff": "cp src/i18n/strings/en_EN.json src/i18n/strings/en_EN_orig.json && pnpm i18n && matrix-compare-i18n-files src/i18n/strings/en_EN_orig.json src/i18n/strings/en_EN.json",
|
||||
"mkdirs": "mkdirp packages deploys",
|
||||
"fetch": "yarn run mkdirs && tsx scripts/fetch-package.ts",
|
||||
"fetch": "pnpm run mkdirs && tsx scripts/fetch-package.ts",
|
||||
"asar-webapp": "asar p webapp webapp.asar",
|
||||
"start": "yarn run build:ts && yarn run build:res && electron .",
|
||||
"lint": "yarn lint:types && yarn lint:js && yarn lint:workflows",
|
||||
"start": "pnpm run build:ts && pnpm run build:res && electron .",
|
||||
"lint": "pnpm lint:types && pnpm lint:js && pnpm lint:workflows",
|
||||
"lint:js": "eslint --max-warnings 0 src hak playwright scripts && prettier --check .",
|
||||
"lint:js-fix": "eslint --fix --max-warnings 0 src hak playwright scripts && prettier --log-level=warn --write .",
|
||||
"lint:types": "yarn lint:types:src && yarn lint:types:test && yarn lint:types:scripts && yarn lint:types:hak",
|
||||
"lint:types": "pnpm lint:types:src && pnpm lint:types:test && pnpm lint:types:scripts && pnpm lint:types:hak",
|
||||
"lint:types:src": "tsc --noEmit",
|
||||
"lint:types:test": "tsc --noEmit -p playwright/tsconfig.json",
|
||||
"lint:types:scripts": "tsc --noEmit -p scripts/tsconfig.json",
|
||||
"lint:types:hak": "tsc --noEmit -p hak/tsconfig.json",
|
||||
"lint:workflows": "find .github/workflows -type f \\( -iname '*.yaml' -o -iname '*.yml' \\) | xargs -I {} sh -c 'echo \"Linting {}\"; action-validator \"{}\"'",
|
||||
"lint:knip": "knip",
|
||||
"build:native": "yarn run hak",
|
||||
"build:native:universal": "yarn run hak --target x86_64-apple-darwin fetchandbuild && yarn run hak --target aarch64-apple-darwin fetchandbuild && yarn run hak --target x86_64-apple-darwin --target aarch64-apple-darwin copyandlink",
|
||||
"build:32": "yarn run build:ts && yarn run build:res && electron-builder --ia32",
|
||||
"build:64": "yarn run build:ts && yarn run build:res && electron-builder --x64",
|
||||
"build:universal": "yarn run build:ts && yarn run build:res && electron-builder --universal",
|
||||
"build": "yarn run build:ts && yarn run build:res && electron-builder",
|
||||
"build:native": "pnpm run hak",
|
||||
"build:native:universal": "pnpm run hak --target x86_64-apple-darwin fetchandbuild && pnpm run hak --target aarch64-apple-darwin fetchandbuild && pnpm run hak --target x86_64-apple-darwin --target aarch64-apple-darwin copyandlink",
|
||||
"build:32": "pnpm run build:ts && pnpm run build:res && electron-builder --ia32",
|
||||
"build:64": "pnpm run build:ts && pnpm run build:res && electron-builder --x64",
|
||||
"build:universal": "pnpm run build:ts && pnpm run build:res && electron-builder --universal",
|
||||
"build": "pnpm run build:ts && pnpm run build:res && electron-builder",
|
||||
"build:ts": "tsc",
|
||||
"build:res": "tsx scripts/copy-res.ts",
|
||||
"docker:setup": "docker build --platform linux/amd64 -t element-desktop-dockerbuild -f dockerbuild/Dockerfile .",
|
||||
"docker:build:native": "scripts/in-docker.sh yarn run hak",
|
||||
"docker:build": "scripts/in-docker.sh yarn run build",
|
||||
"docker:install": "scripts/in-docker.sh yarn install",
|
||||
"docker:build:native": "scripts/in-docker.sh pnpm run hak",
|
||||
"docker:build": "scripts/in-docker.sh pnpm run build",
|
||||
"docker:install": "scripts/in-docker.sh pnpm install",
|
||||
"clean": "rimraf webapp.asar dist packages deploys lib",
|
||||
"hak": "tsx scripts/hak/index.ts",
|
||||
"test": "playwright test",
|
||||
"test:open": "yarn test --ui",
|
||||
"test:open": "pnpm test --ui",
|
||||
"test:screenshots:build": "docker build playwright -t element-desktop-playwright --platform linux/amd64",
|
||||
"test:screenshots:run": "docker run --rm --network host -v $(pwd):/work/element-desktop -v element-desktop-playwright:/work/element-desktop/node_modules -v /var/run/docker.sock:/var/run/docker.sock --platform linux/amd64 -it element-desktop-playwright",
|
||||
"postinstall": "patch-package && electron-builder install-app-deps"
|
||||
"postinstall": "electron-builder install-app-deps"
|
||||
},
|
||||
"dependencies": {
|
||||
"@sentry/electron": "^7.0.0",
|
||||
@@ -76,7 +76,7 @@
|
||||
"@babel/preset-env": "^7.18.10",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@electron/asar": "4.0.1",
|
||||
"@playwright/test": "1.57.0",
|
||||
"@playwright/test": "1.58.1",
|
||||
"@stylistic/eslint-plugin": "^5.0.0",
|
||||
"@types/auto-launch": "^5.0.1",
|
||||
"@types/counterpart": "^0.18.1",
|
||||
@@ -88,10 +88,11 @@
|
||||
"app-builder-lib": "26.6.0",
|
||||
"chokidar": "^5.0.0",
|
||||
"detect-libc": "^2.0.0",
|
||||
"electron": "40.0.0",
|
||||
"electron": "40.1.0",
|
||||
"electron-builder": "26.6.0",
|
||||
"electron-builder-squirrel-windows": "26.6.0",
|
||||
"electron-devtools-installer": "^4.0.0",
|
||||
"electron-playwright-helpers": "^2.1.0",
|
||||
"eslint": "^8.26.0",
|
||||
"eslint-config-google": "^0.14.0",
|
||||
"eslint-config-prettier": "^10.0.0",
|
||||
@@ -103,11 +104,9 @@
|
||||
"husky": "^9.1.6",
|
||||
"knip": "^5.0.0",
|
||||
"lint-staged": "^16.0.0",
|
||||
"matrix-web-i18n": "3.5.2",
|
||||
"matrix-web-i18n": "3.6.0",
|
||||
"mkdirp": "^3.0.0",
|
||||
"pacote": "^21.0.0",
|
||||
"patch-package": "^8.0.1",
|
||||
"postinstall-postinstall": "^2.1.0",
|
||||
"prettier": "^3.0.0",
|
||||
"rimraf": "^6.0.0",
|
||||
"tar": "^7.0.0",
|
||||
@@ -123,5 +122,22 @@
|
||||
"config-file-ts": "0.2.8-rc1",
|
||||
"node-abi": "4.26.0",
|
||||
"@types/pg-pool": "2.0.7"
|
||||
}
|
||||
},
|
||||
"pnpm": {
|
||||
"onlyBuiltDependencies": [
|
||||
"electron"
|
||||
],
|
||||
"patchedDependencies": {
|
||||
"@types/auto-launch": "patches/@types__auto-launch.patch"
|
||||
},
|
||||
"peerDependencyRules": {
|
||||
"allowedVersions": {
|
||||
"eslint": "8"
|
||||
}
|
||||
},
|
||||
"allowedDeprecatedVersions": {
|
||||
"eslint": "8"
|
||||
}
|
||||
},
|
||||
"packageManager": "pnpm@10.28.2+sha512.41872f037ad22f7348e3b1debbaf7e867cfd448f2726d9cf74c08f19507c31d2c8e7a11525b983febc2df640b5438dee6023ebb1f84ed43cc2d654d2bc326264"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
diff --git a/node_modules/@types/auto-launch/index.d.ts b/node_modules/@types/auto-launch/index.d.ts
|
||||
diff --git a/index.d.ts b/index.d.ts
|
||||
index a30a77c..e512ce1 100644
|
||||
--- a/node_modules/@types/auto-launch/index.d.ts
|
||||
+++ b/node_modules/@types/auto-launch/index.d.ts
|
||||
--- a/index.d.ts
|
||||
+++ b/index.d.ts
|
||||
@@ -25,6 +25,13 @@ interface AutoLaunchOptions {
|
||||
declare class AutoLaunch {
|
||||
constructor(options: AutoLaunchOptions);
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM mcr.microsoft.com/playwright:v1.57.0-jammy@sha256:6aca677c27a967caf7673d108ac67ffaf8fed134f27e17b27a05464ca0ace831
|
||||
FROM mcr.microsoft.com/playwright:v1.58.1-jammy@sha256:1b52a0833ae13c3bb16f728eec5f9216db29f3cd5eec21a9cbd33e7623723c0e
|
||||
|
||||
WORKDIR /work/element-desktop
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ sleep 2
|
||||
|
||||
export DISPLAY=:99
|
||||
|
||||
yarn install --frozen-lockfile
|
||||
yarn build -l --dir
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm build -l --dir
|
||||
|
||||
PLAYWRIGHT_HTML_OPEN=never ELEMENT_DESKTOP_EXECUTABLE="./dist/linux-unpacked/element-desktop" \
|
||||
npx playwright test --update-snapshots --reporter line,html "$1"
|
||||
|
||||
@@ -12,6 +12,7 @@ import path, { dirname } from "node:path";
|
||||
import os from "node:os";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { PassThrough } from "node:stream";
|
||||
import { stubDialog } from "electron-playwright-helpers";
|
||||
|
||||
/**
|
||||
* A PassThrough stream that captures all data written to it.
|
||||
@@ -111,6 +112,8 @@ export const test = base.extend<Fixtures>({
|
||||
page: async ({ app }, use) => {
|
||||
const window = await app.firstWindow();
|
||||
await use(window);
|
||||
// EW may be configured to ask for confirmation before the app exits.
|
||||
await stubDialog(app, "showMessageBoxSync", 1);
|
||||
await app.close().catch((e) => {
|
||||
console.error(e);
|
||||
});
|
||||
|
||||
9416
pnpm-lock.yaml
generated
Normal file
9416
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
1
pnpm-workspace.yaml
Normal file
1
pnpm-workspace.yaml
Normal file
@@ -0,0 +1 @@
|
||||
nodeLinker: hoisted
|
||||
@@ -18,7 +18,7 @@ but should work equally well for building modules for normal node.
|
||||
|
||||
# Running
|
||||
|
||||
Hak is invoked with a command and a dependency, eg. `yarn run hak fetch matrix-seshat`.
|
||||
Hak is invoked with a command and a dependency, eg. `pnpm run hak fetch matrix-seshat`.
|
||||
If no dependencies are given, hak runs the command on all dependencies.
|
||||
|
||||
# Files
|
||||
@@ -37,15 +37,15 @@ There are a lot of files involved:
|
||||
|
||||
Hak works around native node modules that try to fetch or build their native component in
|
||||
the npm 'install' phase - modules that do this will typically end up with native components
|
||||
targeted to the build platform and the node that npm/yarn is using, which is no good for an
|
||||
targeted to the build platform and the node that npm/pnpm is using, which is no good for an
|
||||
electron app.
|
||||
|
||||
It does this by installing it with `--ignore-scripts` and then using `yarn link` to keep the
|
||||
dependency module separate so yarn doesn't try to run its install / postinstall script
|
||||
at other points (eg. whenever you `yarn add` a random other dependency).
|
||||
It does this by installing it with `--ignore-scripts` and then using `pnpm link` to keep the
|
||||
dependency module separate so pnpm doesn't try to run its install / postinstall script
|
||||
at other points (eg. whenever you `pnpm add` a random other dependency).
|
||||
|
||||
This also means that the dependencies cannot be listed in `dependencies` or
|
||||
`devDependencies` in the project, since this would cause npm / yarn to install them and
|
||||
`devDependencies` in the project, since this would cause pnpm to install them and
|
||||
try to fetch their native parts. Instead, they are listed in `hakDependencies` which
|
||||
hak reads to install them for you.
|
||||
|
||||
@@ -53,9 +53,6 @@ Hak will _not_ install dependencies for the copy of the module it links into you
|
||||
project, so if your native module has javascript dependencies that are actually needed at
|
||||
runtime (and not just to fetch / build the native parts), it won't work.
|
||||
|
||||
Hak will generate a `.yarnrc` in the project directory to set the link directory to its
|
||||
own in the .hak directory (unless one already exists, in which case this is your problem).
|
||||
|
||||
# Lifecycle
|
||||
|
||||
Hak is divided into lifecycle stages, in order:
|
||||
|
||||
@@ -8,6 +8,7 @@ Please see LICENSE files in the repository root for full details.
|
||||
|
||||
import fsProm from "node:fs/promises";
|
||||
import pacote from "pacote";
|
||||
import path from "node:path";
|
||||
|
||||
import type HakEnv from "./hakEnv.js";
|
||||
import type { DependencyInfo } from "./dep.js";
|
||||
@@ -30,6 +31,13 @@ export default async function fetch(hakEnv: HakEnv, moduleInfo: DependencyInfo):
|
||||
packumentCache,
|
||||
});
|
||||
|
||||
// Workaround for us switching to pnpm but matrix-seshat still using yarn classic
|
||||
const packageJsonPath = path.join(moduleInfo.moduleBuildDir, "package.json");
|
||||
const packageJson = await fsProm.readFile(packageJsonPath, "utf-8");
|
||||
const packageJsonData = JSON.parse(packageJson);
|
||||
packageJsonData["packageManager"] = "yarn@1.22.22";
|
||||
await fsProm.writeFile(packageJsonPath, JSON.stringify(packageJsonData, null, 2), "utf-8");
|
||||
|
||||
console.log("Running yarn install in " + moduleInfo.moduleBuildDir);
|
||||
await hakEnv.spawn("yarn", ["install", "--ignore-scripts"], {
|
||||
cwd: moduleInfo.moduleBuildDir,
|
||||
|
||||
@@ -6,18 +6,11 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import path from "node:path";
|
||||
|
||||
import type HakEnv from "./hakEnv.js";
|
||||
import { type DependencyInfo } from "./dep.js";
|
||||
|
||||
export default async function link(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
|
||||
const linkFolder = path.join(hakEnv.dotHakDir, "links");
|
||||
await hakEnv.spawn("yarn", ["link", "--link-folder", linkFolder], {
|
||||
cwd: moduleInfo.moduleOutDir,
|
||||
});
|
||||
|
||||
await hakEnv.spawn("yarn", ["link", "--link-folder", linkFolder, moduleInfo.name], {
|
||||
await hakEnv.spawn("pnpm", ["link", moduleInfo.moduleOutDir], {
|
||||
cwd: hakEnv.projectRoot,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ IMAGE=${DOCKER_IMAGE_NAME:-"element-desktop-dockerbuild"}
|
||||
|
||||
docker inspect "$IMAGE" 2> /dev/null > /dev/null
|
||||
if [ $? != 0 ]; then
|
||||
echo "Docker image $IMAGE not found. Have you run yarn run docker:setup?"
|
||||
echo "Docker image $IMAGE not found. Have you run pnpm run docker:setup?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ export async function versionFromAsar(): Promise<string> {
|
||||
try {
|
||||
await fs.stat("webapp.asar");
|
||||
} catch {
|
||||
throw new Error("No 'webapp.asar' found. Run 'yarn run fetch'");
|
||||
throw new Error("No 'webapp.asar' found. Run 'pnpm run fetch'");
|
||||
}
|
||||
|
||||
return asar.extractFile("webapp.asar", "version").toString().trim();
|
||||
@@ -25,7 +25,7 @@ export async function setPackageVersion(ver: string): Promise<void> {
|
||||
// all the various version fields
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
childProcess.execFile(
|
||||
process.platform === "win32" ? "yarn.cmd" : "yarn",
|
||||
process.platform === "win32" ? "pnpm.cmd" : "pnpm",
|
||||
[
|
||||
"version",
|
||||
"-s",
|
||||
|
||||
@@ -507,15 +507,42 @@ app.on("ready", async () => {
|
||||
const exitShortcutPressed =
|
||||
input.type === "keyDown" && exitShortcuts.some((shortcutFn) => shortcutFn(input, process.platform));
|
||||
|
||||
// We only care about the exit shortcuts here
|
||||
if (!exitShortcutPressed || !global.mainWindow) return;
|
||||
// Early return if:
|
||||
// 1. Keys that were pressed are not shortcuts for exiting the app
|
||||
// 2. Electron mainWindow is null for some reason
|
||||
// 3. The application is already in the process of quitting
|
||||
if (!exitShortcutPressed || !global.mainWindow || global.appQuitting) return;
|
||||
|
||||
// Prevent the default behaviour
|
||||
event.preventDefault();
|
||||
|
||||
// Let's ask the user if they really want to exit the app
|
||||
// Check if the user expects us to minimize to tray instead of quitting the app
|
||||
// Two cases:
|
||||
// 1. On Linux/Windows, user has enabled "Show tray icon and minimise window to it on close" in settings.
|
||||
// 2. On Mac, the canonical behaviour is to minimize to tray; this is not configurable.
|
||||
const shouldMinimize = store.get("minimizeToTray") || process.platform === "darwin";
|
||||
if (shouldMinimize) {
|
||||
if (global.mainWindow?.isFullScreen()) {
|
||||
global.mainWindow.once("leave-full-screen", () => global.mainWindow?.hide());
|
||||
global.mainWindow.setFullScreen(false);
|
||||
} else {
|
||||
global.mainWindow?.hide();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Quit the app; rest of the quit logic is on the close event handler below.
|
||||
app.quit();
|
||||
});
|
||||
|
||||
global.mainWindow.on("closed", () => {
|
||||
global.mainWindow = null;
|
||||
});
|
||||
|
||||
global.mainWindow.on("close", async (e) => {
|
||||
// Check if the user expects us to ask for confirmation before quitting the app
|
||||
const shouldWarnBeforeExit = store.get("warnBeforeExit", true);
|
||||
if (shouldWarnBeforeExit) {
|
||||
if (shouldWarnBeforeExit && global.mainWindow) {
|
||||
const shouldCancelCloseRequest =
|
||||
dialog.showMessageBoxSync(global.mainWindow, {
|
||||
type: "question",
|
||||
@@ -529,33 +556,11 @@ app.on("ready", async () => {
|
||||
defaultId: 1,
|
||||
cancelId: 0,
|
||||
}) === 0;
|
||||
if (shouldCancelCloseRequest) return;
|
||||
}
|
||||
|
||||
// Exit the app
|
||||
app.exit();
|
||||
});
|
||||
|
||||
global.mainWindow.on("closed", () => {
|
||||
global.mainWindow = null;
|
||||
});
|
||||
global.mainWindow.on("close", async (e) => {
|
||||
// If we are not quitting and have a tray icon then minimize to tray
|
||||
if (!global.appQuitting && (tray.hasTray() || process.platform === "darwin")) {
|
||||
// On Mac, closing the window just hides it
|
||||
// (this is generally how single-window Mac apps
|
||||
// behave, eg. Mail.app)
|
||||
e.preventDefault();
|
||||
|
||||
if (global.mainWindow?.isFullScreen()) {
|
||||
global.mainWindow.once("leave-full-screen", () => global.mainWindow?.hide());
|
||||
|
||||
global.mainWindow.setFullScreen(false);
|
||||
} else {
|
||||
global.mainWindow?.hide();
|
||||
if (shouldCancelCloseRequest) {
|
||||
e.preventDefault();
|
||||
global.appQuitting = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
"eol": {
|
||||
"no_more_updates": "Používáte nepodporovanou verzi systému macOS. Prosím upgradujte %(brand)s pro získání aktualizací.",
|
||||
"title": "Systém není podporován",
|
||||
"warning": "Používáte nepodporovanou verzi systému macOS. Proveďte prosím upgrade %(brand)s , aby byl stále funkční."
|
||||
"warning": "Používáte nepodporovanou verzi systému macOS. Proveďte prosím upgrade %(brand)s, aby byl stále funkční."
|
||||
},
|
||||
"file_menu": {
|
||||
"label": "Soubor"
|
||||
|
||||
Reference in New Issue
Block a user