Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: migrate to yarn v3 #597

Merged
merged 4 commits into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 45 additions & 7 deletions .github/actions/install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,61 @@ inputs:
runs:
using: composite
steps:
- name: ⚙️ Enable Corepack
run: corepack enable
shell: bash

- name: Cache prep
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
id: yarn-config
run: |
echo "CACHE_FOLDER=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
echo "node-version="node-$(node --version)"" >> $GITHUB_OUTPUT
shell: bash
env:
YARN_ENABLE_GLOBAL_CACHE: 'false'

- name: Restore yarn cache
uses: actions/cache@v3
with:
path: ${{ steps.yarn-config.outputs.CACHE_FOLDER }}
key: yarn-download-cache-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}
restore-keys: |
yarn-download-cache-

- name: Restore node_modules
id: yarn-nm-cache
uses: actions/cache@v3
with:
path: node_modules
key: yarn-nm-cache-${{ runner.os }}-${{ steps.yarn-config.outputs.node-version }}-${{ github.ref }}-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}

- name: Cache yarn
- name: Restore yarn install state
id: yarn-install-state-cache
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: cache-${{ inputs.node-version }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
path: .yarn/
key: yarn-install-state-cache-${{ runner.os }}-${{ steps.yarn-config.outputs.node-version }}-${{ github.ref }}-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}

- name: Install dependencies in production mode
if: ${{ inputs.prod-context == 'true' }}
run: yarn install --immutable --immutable-cache --check-cache --frozen-lockfile --prod
run: yarn install --immutable --check-cache --prod
shell: bash
env:
# Overrides/align yarnrc.yml options (v3, v4) for a CI context
YARN_ENABLE_GLOBAL_CACHE: 'false' # Use local cache folder to keep downloaded archives
YARN_NM_MODE: 'hardlinks-local' # Reduce node_modules size
YARN_INSTALL_STATE_PATH: '.yarn/install-state.gz' # Might speed up resolution step when node_modules present
# Other environment variables
HUSKY: '0' # By default do not run HUSKY install

- name: Install dependencies in integration mode
if: ${{ inputs.prod-context == 'false' }}
run: yarn install --immutable --immutable-cache --check-cache --frozen-lockfile
run: yarn install --immutable --check-cache
shell: bash
env:
# Overrides/align yarnrc.yml options (v3, v4) for a CI context
YARN_ENABLE_GLOBAL_CACHE: 'false' # Use local cache folder to keep downloaded archives
YARN_NM_MODE: 'hardlinks-local' # Reduce node_modules size
YARN_INSTALL_STATE_PATH: '.yarn/install-state.gz' # Might speed up resolution step when node_modules present
# Other environment variables
HUSKY: '0' # By default do not run HUSKY install
11 changes: 7 additions & 4 deletions .github/linters/.cspell.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"ignorePaths": [
"CHANGELOG.md",
"CHANGELOG.md",
"**/node_modules/**",
"**/.git/**",
".vscode",
"megalinter",
"yarn.lock",
"report"
"**/yarn.lock",
"**/.yarnrc.yml"
],
"language": "en",
"noConfigSearch": true,
Expand All @@ -18,10 +17,13 @@
"Cherfaoui",
"Colladon",
"Commitlint",
"Corepack",
"corepack",
"FORCEIGNORE",
"FORCEINCLUDE",
"FULLNAME",
"Flexi",
"hardlinks",
"Iframe",
"METAFILE",
"Mehdi",
Expand Down Expand Up @@ -141,6 +143,7 @@
"weblinks",
"wlens",
"xmlbuilder",
"yarnrc",
"\u00c0gain"
]
}
15 changes: 12 additions & 3 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ jobs:
fetch-depth: 0

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16

- name: Setup dependencies, cache and install
uses: ./.github/actions/install

- name: Lint commits
Expand Down Expand Up @@ -53,11 +58,14 @@ jobs:
node-version: 16
registry-url: https://registry.npmjs.org/

- name: Setup dependencies, cache and install
uses: ./.github/actions/install

- name: Check outdated dependencies
run: yarn outdated
run: npm outdated

- name: Audit dependencies
run: yarn audit
run: yarn npm audit

megalinter:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -147,7 +155,7 @@ jobs:

- name: Install dependencies in production mode
working-directory: ./plugin
run: yarn install --immutable --immutable-cache --check-cache --frozen-lockfile --prod
run: yarn workspaces focus --all --production
shell: bash

- name: Install build dependencies
Expand All @@ -164,6 +172,7 @@ jobs:
- name: Install plugin
working-directory: ./plugin
run: |
yarn set version classic
sfdx plugins:link .
sfdx plugins

Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
/node_modules
/reports
/lib
/.nyc_output
/.yarn/cache
install-state.gz
*-debug.log
*-error.log
sfdx-git-delta-*.tgz
/.nyc_output
package.tgz
stderr*.txt
stdout*.txt
# stryker temp files
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ yarn pack
yarn test:unit:coverage
yarn test:nut
yarn analysis force-app
yarn outdated || true
npm outdated || true
28 changes: 28 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

Large diffs are not rendered by default.

873 changes: 873 additions & 0 deletions .yarn/releases/yarn-3.5.1.cjs

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"

yarnPath: .yarn/releases/yarn-3.5.1.cjs
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"@oclif/dev-cli": "^1.26.10",
"@oclif/plugin-help": "^5.2.9",
"@oclif/test": "^2.3.20",
"@salesforce/cli-plugins-testkit": "^3.3.6",
"@salesforce/cli-plugins-testkit": "^3.4.0",
"@salesforce/dev-config": "^4.0.1",
"@salesforce/ts-sinon": "^1.4.6",
"@stryker-mutator/core": "^6.4.2",
Expand Down Expand Up @@ -114,5 +114,6 @@
},
"publishConfig": {
"access": "public"
}
},
"packageManager": "[email protected]"
}
Loading