Use pnpm over yarn (#1678)

Did some research when picking a package manager for the website and
settled on `pnpm` for the following reasons:

- CLI-compatible with `npm`
- Typically faster than even `yarn` especially on Apple silicon
- Security: Pnpm uses a different dependency resolution algorithm and
different folder structure of node_modules that prevents illegal access
to packages by other packages.

I think I caught all the places, but I may be missing something, so if
this isn't a good idea we can revert back.

This PR also cleans up the actions workflows to remove dead code.
This commit is contained in:
Jamil
2023-06-22 10:40:32 -07:00
committed by GitHub
parent 8fa12b8492
commit 8d8687224b
7 changed files with 41 additions and 76 deletions

View File

@@ -335,19 +335,19 @@ jobs:
path: elixir/_build
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/elixir/mix.lock') }}
- uses: actions/cache@v3
name: Yarn Deps Cache
name: pnpm Deps Cache
env:
cache-name: cache-yarn-build-${{ env.MIX_ENV }}
cache-name: cache-pnpm-build-${{ env.MIX_ENV }}
with:
path: elixir/apps/web/assets/node_modules
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
- uses: actions/cache@v3
name: Assets Cache
env:
cache-name: cache-assets-build-${{ env.MIX_ENV }}
with:
path: elixir/apps/web/priv/static/dist
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
- run: |
export DISPLAY=:99
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &

View File

@@ -1,32 +0,0 @@
name: Publish Website
on:
workflow_dispatch:
release:
types: [published]
jobs:
publish-website:
name: Build Docusaurus 🐲
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
cache-dependency-path: www/yarn.lock
- run: |
cd www/
yarn install --frozen-lockfile
yarn build
- name: Publish Latest Website
uses: JamesIves/github-pages-deploy-action@v4.4.1
with:
branch: gh-pages
folder: www/build
target-folder: .
clean: true
clean-exclude: |
*.*.*/

View File

@@ -6,12 +6,6 @@ repos:
entry: codespell
language: system
pass_filenames: false
- id: markdownlint
name: "nodejs: markdownlint"
entry: ./docs/node_modules/markdownlint-cli/markdownlint.js
language: system
pass_filenames: true
files: docs/.*\.md$
# Standard pre-commit hooks
- repo: https://github.com/pre-commit/pre-commit-hooks

View File

@@ -8,7 +8,7 @@ ARG RUNNER_IMAGE="alpine:${ALPINE_VERSION}"
FROM ${BUILDER_IMAGE} as builder
# install build dependencies
RUN apk add nodejs yarn build-base git python3
RUN apk add nodejs pnpm build-base git python3
# prepare build dir
WORKDIR /app

View File

@@ -1,7 +1,6 @@
{
"dependencies": {
"@fontsource/source-sans-pro": "^4.5.11",
"flowbite": "^1.6.5",
"yarn": "^1.22.19"
"flowbite": "^1.6.5"
}
}

35
elixir/apps/web/assets/pnpm-lock.yaml generated Normal file
View File

@@ -0,0 +1,35 @@
lockfileVersion: '6.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
dependencies:
'@fontsource/source-sans-pro':
specifier: ^4.5.11
version: 4.5.11
flowbite:
specifier: ^1.6.5
version: 1.6.5
packages:
/@fontsource/source-sans-pro@4.5.11:
resolution: {integrity: sha512-f7iw44q1EjBv3MNcHCGAgrW/QVyweaEouFsJzykPhTOGnZFSwFJRISToXornOmuAy7xUUGiVdqOLiykgZoYB8A==}
dev: false
/@popperjs/core@2.11.8:
resolution: {integrity: sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==}
dev: false
/flowbite@1.6.5:
resolution: {integrity: sha512-eI4h3pIRI9d7grlYq14r0A01KUtw7189sPLLx/O2i7JyPEWpbleScfYuEc48XTeNjk1xxm/JHgZkD9kjyOWAlA==}
dependencies:
'@popperjs/core': 2.11.8
mini-svg-data-uri: 1.4.4
dev: false
/mini-svg-data-uri@1.4.4:
resolution: {integrity: sha512-r9deDe9p5FJUPZAk3A59wGH7Ii9YrjjWw0jmw/liSbHl2CHiyXj6FcDXDu2K3TjVAXqiJdaw3xxwlZZr9E6nHg==}
hasBin: true
dev: false

View File

@@ -1,31 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@fontsource/source-sans-pro@^4.5.11":
version "4.5.11"
resolved "https://registry.yarnpkg.com/@fontsource/source-sans-pro/-/source-sans-pro-4.5.11.tgz#06b3f08ef1a5250d78c8198e5a0482b5d87a4d52"
integrity sha512-f7iw44q1EjBv3MNcHCGAgrW/QVyweaEouFsJzykPhTOGnZFSwFJRISToXornOmuAy7xUUGiVdqOLiykgZoYB8A==
"@popperjs/core@^2.9.3":
version "2.11.7"
resolved "https://registry.npmjs.org/@popperjs/core/-/core-2.11.7.tgz"
integrity sha512-Cr4OjIkipTtcXKjAsm8agyleBuDHvxzeBoa1v543lbv1YaIwQjESsVcmjiWiPEbC1FIeHOG/Op9kdCmAmiS3Kw==
flowbite@^1.6.5:
version "1.6.5"
resolved "https://registry.yarnpkg.com/flowbite/-/flowbite-1.6.5.tgz#a0eb2f3f0cf5098f802004df635e2717efc52bbc"
integrity sha512-eI4h3pIRI9d7grlYq14r0A01KUtw7189sPLLx/O2i7JyPEWpbleScfYuEc48XTeNjk1xxm/JHgZkD9kjyOWAlA==
dependencies:
"@popperjs/core" "^2.9.3"
mini-svg-data-uri "^1.4.3"
mini-svg-data-uri@^1.4.3:
version "1.4.4"
resolved "https://registry.npmjs.org/mini-svg-data-uri/-/mini-svg-data-uri-1.4.4.tgz"
integrity sha512-r9deDe9p5FJUPZAk3A59wGH7Ii9YrjjWw0jmw/liSbHl2CHiyXj6FcDXDu2K3TjVAXqiJdaw3xxwlZZr9E6nHg==
yarn@^1.22.19:
version "1.22.19"
resolved "https://registry.npmjs.org/yarn/-/yarn-1.22.19.tgz"
integrity sha512-/0V5q0WbslqnwP91tirOvldvYISzaqhClxzyUKXYxs07yUILIs5jx/k6CFe8bvKSkds5w+eiOqta39Wk3WxdcQ==