Skip to content

Commit 2ed3701

Browse files
authored
[Tech] Add LavaMoat allow scripts (#416)
* add lavamoat allow scripts * update yarn lock * update install scripts in workflows * update npm in workflows to yarn * install yarn flatpak ci * install make on flatpak build ci * add gcc dep to flatpak ci * rm unused register-scheme install * rm make gcc from flatpak ci
1 parent 657f8a7 commit 2ed3701

15 files changed

+620
-39
lines changed

.github/workflows/build.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ jobs:
3535
- name: Authenticate with private NPM package
3636
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
3737
- name: Install modules.
38-
run: npm i --legacy-peer-deps
38+
run: yarn setup
3939
- name: Build artifacts.
40-
run: npm run dist:win
40+
run: yarn dist:win
4141
- name: Upload EXE.
4242
uses: actions/upload-artifact@v3
4343
with:
@@ -68,7 +68,7 @@ jobs:
6868
- name: Authenticate with private NPM package
6969
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
7070
- name: Install modules.
71-
run: yarn
71+
run: yarn setup
7272
- name: Build deb artifact
7373
run: yarn dist:linux:ci:deb
7474
- name: Build rpm artifact
@@ -97,7 +97,7 @@ jobs:
9797
- name: Authenticate with private NPM package
9898
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
9999
- name: Install modules.
100-
run: yarn
100+
run: yarn setup
101101
- name: Build artifacts.
102102
run: yarn dist:mac
103103
env:

.github/workflows/codecheck.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ jobs:
2626
- name: Authenticate with private NPM package
2727
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
2828
- name: Install modules.
29-
run: yarn
29+
run: yarn setup
3030
- name: Check Typescript syntax
3131
run: yarn codecheck

.github/workflows/flatpak-build.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,14 @@ jobs:
4444
ssh://git@github.com/
4545
- name: Authenticate with private NPM package
4646
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
47+
- name: install yarn
48+
run: npm install --global yarn
4749
- name: Install modules.
48-
run: npm i --legacy-peer-deps
50+
run: yarn setup
4951
- name: Build artifacts.
50-
run: npm run dist:linux:ci:flatpak
52+
run: yarn dist:linux:ci:flatpak
5153
- name: Prepare Flatpak
52-
run: npm run flatpak:prepare
54+
run: yarn flatpak:prepare
5355
- name: Build Flatpak
5456
uses: flatpak/flatpak-github-actions/flatpak-builder@v6
5557
with:

.github/workflows/lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Authenticate with private NPM package
2727
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
2828
- name: Install modules.
29-
run: yarn
29+
run: yarn setup
3030
- name: Lint code.
3131
run: yarn lint
3232
- name: Prettier code.

.github/workflows/release_flathub.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Authenticate with private NPM package
3232
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
3333
- name: Install modules.
34-
run: yarn
34+
run: yarn setup
3535
- name: Checkout flathub repository.
3636
run: git clone https://github.com/flathub/xyz.hyperplay.HyperPlay.git
3737
- name: Update flathub release

.github/workflows/release_linux.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ jobs:
3232
- name: Authenticate with private NPM package
3333
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
3434
- name: Install modules.
35-
run: yarn
35+
run: yarn setup
3636
- name: Build artifacts.
3737
run: yarn run release:linux

.github/workflows/release_macOS.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
4242

4343
- name: Install dependencies
44-
run: yarn
44+
run: yarn setup
4545

4646
- name: Build artifacts.
4747
run: yarn release:mac

.github/workflows/test-e2e-dev.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Authenticate with private NPM package
3333
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
3434
- name: Install modules.
35-
run: yarn
35+
run: yarn setup
3636
env:
3737
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
3838
- name: Build and Test
@@ -57,7 +57,7 @@ jobs:
5757
- name: Authenticate with private NPM package
5858
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
5959
- name: Install modules.
60-
run: yarn
60+
run: yarn setup
6161
env:
6262
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
6363
- name: Build and Test
@@ -86,7 +86,7 @@ jobs:
8686
- name: Authenticate with private NPM package
8787
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
8888
- name: Install modules.
89-
run: npm i --legacy-peer-deps
89+
run: yarn setup
9090
env:
9191
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
9292
- name: Build and Test

.github/workflows/test-e2e-packaged.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Authenticate with private NPM package
3434
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
3535
- name: Install modules.
36-
run: yarn
36+
run: yarn setup
3737
env:
3838
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
3939
- name: Build and Test
@@ -58,7 +58,7 @@ jobs:
5858
- name: Authenticate with private NPM package
5959
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
6060
- name: Install modules.
61-
run: yarn
61+
run: yarn setup
6262
env:
6363
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
6464
- name: Build and Test
@@ -87,7 +87,7 @@ jobs:
8787
- name: Authenticate with private NPM package
8888
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
8989
- name: Install modules.
90-
run: npm i --legacy-peer-deps
90+
run: yarn setup
9191
env:
9292
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
9393
- name: Build and Test

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ jobs:
2727
- name: Authenticate with private NPM package
2828
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
2929
- name: Install modules.
30-
run: yarn
30+
run: yarn setup
3131
- name: Test
3232
run: yarn test:ci

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ vite-plugin-electron.log
4040

4141
# Yarn Berry support
4242
# these can be reconfigured if we ever want to adopt yarn berry
43-
.yarnrc.yml
4443
.yarn/
4544

4645
flathub/update-flathub.js

.yarnrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ignore-scripts true

.yarnrc.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
enableScripts: false

package.json

+24-1
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@
224224
"zod": "^3.21.4"
225225
},
226226
"scripts": {
227+
"setup": "yarn install && yarn allow-scripts",
227228
"start": "vite",
228229
"codecheck": "tsc --noEmit",
229230
"find-deadcode": "ts-prune --error",
@@ -267,6 +268,8 @@
267268
"devDependencies": {
268269
"@babel/plugin-transform-arrow-functions": "^7.22.5",
269270
"@electron/notarize": "^1.2.3",
271+
"@lavamoat/allow-scripts": "^2.3.1",
272+
"@lavamoat/preinstall-always-fail": "^1.0.0",
270273
"@playwright/test": "^1.32.1",
271274
"@testing-library/dom": "^7.31.0",
272275
"@testing-library/jest-dom": "^5.16.4",
@@ -317,5 +320,25 @@
317320
"xml-js": "^1.6.11"
318321
},
319322
"optionalDependencies": {},
320-
"packageManager": "yarn@1.22.19"
323+
"packageManager": "yarn@1.22.19",
324+
"lavamoat": {
325+
"allowScripts": {
326+
"@fortawesome/fontawesome-svg-core": false,
327+
"@fortawesome/fontawesome-svg-core>@fortawesome/fontawesome-common-types": false,
328+
"@fortawesome/free-brands-svg-icons": false,
329+
"@fortawesome/free-regular-svg-icons": false,
330+
"@fortawesome/free-solid-svg-icons": false,
331+
"@lavamoat/preinstall-always-fail": false,
332+
"@metamask/sdk>eciesjs>secp256k1": true,
333+
"@rudderstack/rudder-sdk-node>bull>msgpackr>msgpackr-extract": true,
334+
"@testing-library/dom>aria-query>@babel/runtime-corejs3>core-js-pure": true,
335+
"@valist/sdk>files-from-path>ipfs-unixfs>protobufjs": true,
336+
"classic-level": true,
337+
"discord-rich-presence-typescript>discord-rpc>register-scheme": false,
338+
"electron": true,
339+
"electron-vite>esbuild": true,
340+
"playwright": true,
341+
"vite>esbuild": true
342+
}
343+
}
321344
}

0 commit comments

Comments
 (0)