Skip to content

Commit

Permalink
Switch from 'npm' to 'pnpm' (#704)
Browse files Browse the repository at this point in the history
Co-authored-by: Markus Hatvan <[email protected]>
Co-authored-by: Nathanaël Houn <[email protected]>
Co-authored-by: Balaji Vijayakumar <[email protected]>
Co-authored-by: André Oliveira <[email protected]>
  • Loading branch information
5 people committed Oct 26, 2022
1 parent 2250201 commit bc98088
Show file tree
Hide file tree
Showing 23 changed files with 14,982 additions and 49,019 deletions.
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
**/*.tsbuildinfo
**/build
**/node_modules
**/npm-debug.log*
**/.pnpm-debug.log
**/.pnpm-debug.log*
**/server*.log
**/yarn-error.log
Dockerfile
Expand Down
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ node_modules
.DS_Store

.idea
npm-debug.log.*
.pnpm-debug.log*
*.css.d.ts
*.sass.d.ts
Expand Down
6 changes: 4 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@

#### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [ ] My pull request is properly named
- [ ] The changes respect the code style of the project (`npm run prepare-code`)
- [ ] `npm test` passes
- [ ] The changes respect the code style of the project (`pnpm prepare-code`)
- [ ] `pnpm test` passes
- [ ] I tested/previewed my changes locally

#### Release Notes

<!-- Please add a one-line description for users of Ferdium to read in the release notes, or 'none' if no notes relevant to such users. Examples and help on special cases: https://github.com/electron/clerk/blob/master/README.md#examples -->
2 changes: 1 addition & 1 deletion .github/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ newPRWelcomeComment: |
Things that will help get your PR across the finish line:
- Follow the JavaScript [coding style](https://github.com/electron/electron/blob/master/docs/development/coding-style.md) as recommended by the Electron project.
- Run `npm run lint` locally to catch formatting errors earlier.
- Run `pnpm lint` locally to catch formatting errors earlier.
- Document any user-facing changes you've made by including screenshots and animated GIFs whenever possible.
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.
Expand Down
49 changes: 20 additions & 29 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,12 @@ jobs:
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, '[nightly branch]')) }}
with:
node-version-file: ".nvmrc"
- name: Install npm
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, '[nightly branch]')) }}
run: npm i -gf "npm@$(node -p 'require("./package.json").engines.npm')" && npm -v
- name: Install pnpm
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, '[nightly branch]')) }}
run: npm i -gf "pnpm@$(node -p 'require("./recipes/package.json").engines.pnpm')" && pnpm -v
run: npm i -gf "pnpm@$(node -p 'require("./package.json").engines.pnpm')" && pnpm -v
- name: Install node dependencies
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, '[nightly branch]')) }}
run: npm i
run: pnpm i
- id: should_run
name: Check whether there are any commits since this run was last triggered and push them and/or set the output
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, '[nightly branch]')) }}
Expand Down Expand Up @@ -90,8 +87,8 @@ jobs:
echo "GIT_DIRTY=$(git status -s | wc -l)" >> $GITHUB_ENV
echo "Run linter, reformatter, rebrander and tests"
npm run prepare-code
npm run test
pnpm prepare-code
pnpm test
echo "Commit dependency-updates and linter changes"
git commit -am "Update browserslist data updates and linter fixes [skip ci]" --no-verify || true
Expand All @@ -107,7 +104,7 @@ jobs:
# there were other changes coming from the 'develop' branch (or)
# this is a manual trigger with the key-phrase
git checkout develop
npm version -m "%s [skip ci]" prerelease --preid=nightly
pnpm version -m "%s [skip ci]" prerelease --preid=nightly
git commit --all --amend --no-edit --no-verify
git push origin develop --no-verify
Expand Down Expand Up @@ -173,22 +170,20 @@ jobs:
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
- name: Install npm
run: npm i -gf "npm@$(node -p 'require("./package.json").engines.npm')" && npm -v
- name: Install pnpm
run: npm i -gf "pnpm@$(node -p 'require("./recipes/package.json").engines.pnpm')" && pnpm -v
run: npm i -gf "pnpm@$(node -p 'require("./package.json").engines.pnpm')" && pnpm -v
- name: Install node dependencies
run: npm i
run: pnpm i
- name: Package recipes
run: pnpm i && pnpm lint && pnpm reformat-files && pnpm package
working-directory: ./recipes
- name: Run linter and tests
run: npm run lint && npm run test
run: pnpm lint && pnpm test
- name: Build Ferdium without publish for any branch not 'nightly' and not 'release'
if: ${{ env.GIT_BRANCH_NAME != 'nightly' && env.GIT_BRANCH_NAME != 'release' }}
env:
CSC_IDENTITY_AUTO_DISCOVERY: false
run: npm run build -- --publish never
run: pnpm build --publish never
shell: bash
- name: "Build Ferdium with publish for '${{ env.GIT_BRANCH_NAME }}' branch"
if: ${{ env.GIT_BRANCH_NAME == 'nightly' || env.GIT_BRANCH_NAME == 'release' }}
Expand All @@ -199,7 +194,7 @@ jobs:
APPLEID_PASSWORD: ${{ secrets.APPLEID_PASSWORD }}
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
run: npm run build -- --publish always
run: pnpm build --publish always
shell: bash

build_linux:
Expand Down Expand Up @@ -249,12 +244,10 @@ jobs:
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
- name: Install npm
run: npm i -gf "npm@$(node -p 'require("./package.json").engines.npm')" && npm -v
- name: Install pnpm
run: npm i -gf "pnpm@$(node -p 'require("./recipes/package.json").engines.pnpm')" && pnpm -v
run: npm i -gf "pnpm@$(node -p 'require("./package.json").engines.pnpm')" && pnpm -v
- name: Install node dependencies
run: npm i
run: pnpm i
- name: Figure out used package.json version
run: |
PACKAGE_VERSION="$(node -p 'require("./package.json").version')"
Expand All @@ -278,12 +271,12 @@ jobs:
run: pnpm i && pnpm lint && pnpm reformat-files && pnpm package
working-directory: ./recipes
- name: Run linter and tests
run: npm run lint && npm run test
run: pnpm lint && pnpm test
- name: Build Ferdium without publish for any branch not 'nightly' and not 'release'
if: ${{ env.GIT_BRANCH_NAME != 'nightly' && env.GIT_BRANCH_NAME != 'release' }}
env:
CSC_IDENTITY_AUTO_DISCOVERY: false
run: npm run build -- --publish never
run: pnpm build --publish never
shell: bash
- name: "Build Ferdium with publish for '${{ env.GIT_BRANCH_NAME }}' branch"
if: ${{ env.GIT_BRANCH_NAME == 'nightly' || env.GIT_BRANCH_NAME == 'release' }}
Expand All @@ -294,7 +287,7 @@ jobs:
run: |
sudo snap install snapcraft --channel=5.x/stable --classic
echo "$SNAPCRAFT_LOGIN" | snapcraft login --with -
npm run build -- --publish always -c.snap.publish.repo=$SNAP_PUBLISH_REPO -c.snap.publish.channels=$SNAP_PUBLISH_CHANNEL
pnpm build --publish always -c.snap.publish.repo=$SNAP_PUBLISH_REPO -c.snap.publish.channels=$SNAP_PUBLISH_CHANNEL
snapcraft logout
shell: bash

Expand Down Expand Up @@ -347,14 +340,12 @@ jobs:
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
- name: Install npm
run: npm i -gf "npm@$(node -p 'require(\"./package.json\").engines.npm')" && npm -v
- name: Install pnpm
run: npm i -gf "pnpm@$(node -p 'require(\"./recipes/package.json\").engines.pnpm')" && pnpm -v
run: npm i -gf "pnpm@$(node -p 'require(\"./package.json\").engines.pnpm')" && pnpm -v
- name: Install node dependencies
uses: nick-invision/[email protected]
with:
command: npm i
command: pnpm i
timeout_minutes: 15
max_attempts: 3
retry_on: error
Expand All @@ -363,13 +354,13 @@ jobs:
working-directory: ./recipes
shell: bash
- name: Run linter and tests
run: npm run lint && npm run test
run: pnpm lint && pnpm test && pnpm build:windows
shell: bash
- name: Build Ferdium without publish for any branch not 'nightly' and not 'release'
if: ${{ env.GIT_BRANCH_NAME != 'nightly' && env.GIT_BRANCH_NAME != 'release' }}
env:
CSC_IDENTITY_AUTO_DISCOVERY: false
run: npm run build -- --publish never
run: pnpm electron-builder --publish never
shell: bash
- name: "Build Ferdium with publish for '${{ env.GIT_BRANCH_NAME }}' branch"
if: ${{ env.GIT_BRANCH_NAME == 'nightly' || env.GIT_BRANCH_NAME == 'release' }}
Expand All @@ -378,5 +369,5 @@ jobs:
CSC_IDENTITY_AUTO_DISCOVERY: true
WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }}
WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
run: npm run build -- --publish always
run: pnpm electron-builder --publish always
shell: bash
61 changes: 45 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Created by https://www.toptal.com/developers/gitignore/api/vim,node,yarn,react,macos,visualstudiocode,intellij
# Edit at https://www.toptal.com/developers/gitignore?templates=vim,node,yarn,react,macos,visualstudiocode,intellij
# Created by https://www.toptal.com/developers/gitignore/api/vim,yarn,node,react,macos,intellij,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=vim,yarn,node,react,macos,intellij,visualstudiocode

### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
/**/workspace.xml
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
Expand Down Expand Up @@ -65,6 +65,9 @@ atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
Expand Down Expand Up @@ -107,13 +110,9 @@ fabric.properties
# https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml

# Idea modules and profiles
.idea/ferdium-app.iml
.idea/modules.xml
.idea/.gitignore
.idea/vcs.xml
.idea/inspectionProfiles/Project_Default.xml
.idea/misc.xml
# Azure Toolkit for IntelliJ plugin
# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
.idea/**/azureSettings.xml

### macOS ###
# General
Expand All @@ -124,6 +123,7 @@ fabric.properties
# Icon must end with two \r
Icon


# Thumbnails
._*

Expand All @@ -143,13 +143,18 @@ Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
Expand Down Expand Up @@ -199,6 +204,9 @@ web_modules/
# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
Expand All @@ -214,10 +222,12 @@ web_modules/
# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
# dotenv environment variable files
.env
.env.test
.env.production
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
Expand All @@ -240,6 +250,12 @@ dist
# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

Expand All @@ -262,6 +278,15 @@ dist
.yarn/install-state.gz
.pnp.*

### Node Patch ###
# Serverless Webpack directories
.webpack/

# Optional stylelint cache

# SvelteKit build / generate output
.svelte-kit

### react ###
.DS_*
**/*.backup.*
Expand Down Expand Up @@ -302,21 +327,25 @@ tags
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

### yarn ###
# https://yarnpkg.com/advanced/qa#which-files-should-be-gitignored
# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored

.yarn/*
!.yarn/releases
!.yarn/patches
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
Expand All @@ -328,7 +357,7 @@ tags
# and uncomment the following lines
# .pnp.*

# End of https://www.toptal.com/developers/gitignore/api/vim,node,yarn,react,macos,visualstudiocode,intellij
# End of https://www.toptal.com/developers/gitignore/api/vim,yarn,node,react,macos,intellij,visualstudiocode

flow-typed
out
Expand Down
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

FILE_NAME="$(dirname "$0")/_/husky.sh"

# Conditionally invoke so as to avoid running npm commands if this is a clean checkout (ie before installing node modules)
# Conditionally invoke so as to avoid running pnpm commands if this is a clean checkout (ie before installing node modules)
if [ -f $FILE_NAME ]; then
. $FILE_NAME

Expand Down
5 changes: 3 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

FILE_NAME="$(dirname "$0")/_/husky.sh"

# Conditionally invoke so as to avoid running npm commands if this is a clean checkout (ie before installing node modules)
# Conditionally invoke so as to avoid running pnpm commands if this is a clean checkout (ie before installing node modules)
if [ -f $FILE_NAME ]; then
. $FILE_NAME
npm run prepare-code
pnpm prepare-code
pnpm test
fi
3 changes: 1 addition & 2 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
save-exact = true
engine-strict = true
unsafe-perm = true
frozen-lockfile = false
legacy-peer-deps = true
shamefully-hoist = true
frozen-lockfile = false
Loading

0 comments on commit bc98088

Please sign in to comment.