Skip to content

Commit

Permalink
chore: upgrade Yarn to v4
Browse files Browse the repository at this point in the history
  • Loading branch information
bertho-zero committed Oct 25, 2023
1 parent 20a8caf commit 319b8e4
Show file tree
Hide file tree
Showing 14 changed files with 14,042 additions and 15,164 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:

strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
node-version: [18, 20]
# See supported Node.js release schedule at https://github.com/nodejs/Release

steps:
- name: Git checkout
Expand All @@ -32,15 +32,17 @@ jobs:
- name: Start Redis
uses: superchargejs/[email protected]

- run: mv yarn.lock-workspace yarn.lock

- run: yarn -v

- run: yarn config

- run: yarn

- run: yarn workspaces foreach --parallel --topological-dev --interlaced --verbose run prepack
- run: yarn workspaces foreach -Apv --topological-dev run prepack

- run: yarn workspaces foreach -tv run test --colors
- run: yarn workspaces foreach -Atv run test --colors
env:
AWS_DEV_ACCESS_KEY_ID: ${{ secrets.AWS_DEV_ACCESS_KEY_ID }}
AWS_DEV_SECRET_ACCESS_KEY: ${{ secrets.AWS_DEV_SECRET_ACCESS_KEY }}
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/rename-lockfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Rename yarn.lock

on:
pull_request:
types: [closed]
branches:
- main

jobs:
rename:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v2

- name: Rename yarn.lock to yarn.lock-workspace
run: |
if [ -f yarn.lock ]; then
mv yarn.lock yarn.lock-workspace
git config user.name "Action GitHub"
git config user.email "[email protected]"
git add yarn.lock-workspace
git commit -m "chore: rename yarn.lock to yarn.lock-workspace"
git push
fi
8 changes: 6 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ maybe_modified_package() {
LOCATION=$(echo "$1" | jq -r .location)

if [ -n "$(git --no-pager diff --cached --name-only --diff-filter=ACDMR -- "$LOCATION")" ]; then
MODIFIED_PACKAGES="$MODIFIED_PACKAGES --include $NAME"
if [ -z "$MODIFIED_PACKAGES" ]; then
MODIFIED_PACKAGES="$NAME"
else
MODIFIED_PACKAGES="$MODIFIED_PACKAGES,$NAME"
fi
fi
}

Expand All @@ -32,5 +36,5 @@ if [ -z "$MODIFIED_PACKAGES" ]; then
fi

yarn workspaces foreach \
--verbose --topological-dev $(echo "$MODIFIED_PACKAGES" | xargs) \
-Rpv --topological-dev --from "{$MODIFIED_PACKAGES}" \
run lint-staged
6 changes: 0 additions & 6 deletions .yarn/plugins/@openagenda/plugin-workspace-lockfile.cjs

This file was deleted.

52 changes: 0 additions & 52 deletions .yarn/plugins/@yarnpkg/plugin-constraints.cjs

This file was deleted.

541 changes: 0 additions & 541 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

This file was deleted.

550 changes: 0 additions & 550 deletions .yarn/plugins/@yarnpkg/plugin-version.cjs

This file was deleted.

9 changes: 9 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-workspace-lockfile.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* eslint-disable */
//prettier-ignore
module.exports = {
name: "@yarnpkg/plugin-workspace-lockfile",
factory: function (require) {
var plugin=(()=>{var l=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var f=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(o,i)=>(typeof require<"u"?require:o)[i]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var h=(e,o)=>{for(var i in o)l(e,i,{get:o[i],enumerable:!0})},P=(e,o,i,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of m(o))!y.call(e,a)&&a!==i&&l(e,a,{get:()=>o[a],enumerable:!(r=d(o,a))||r.enumerable});return e};var S=e=>P(l({},"__esModule",{value:!0}),e);var F={};h(F,{default:()=>v});var t=f("@yarnpkg/core"),w=f("@yarnpkg/cli"),s=f("@yarnpkg/fslib"),W=async(e,{cwd:o})=>{let i=await t.Configuration.find(o,(0,w.getPluginConfiguration)()),r=await t.Cache.find(i),{project:a,workspace:n}=await t.Project.find(i,o);a.originalPackages=new Map(e.originalPackages),a.storedResolutions=new Map(e.storedResolutions);let c=new Set([n]);for(let p of c)for(let g of t.Manifest.hardDependencies)for(let u of p.manifest.getForScope(g).values()){let k=a.tryWorkspaceByDescriptor(u);k!==null&&c.add(k)}return await a.resolveEverything({cache:r,report:new t.ThrowReport}),await a.fetchEverything({cache:r,report:new t.ThrowReport}),a.generateLockfile()},L=e=>`\x1B[32m${e}\x1B[0m`,I={configuration:{workspaceLockfiles:{description:"List of the workspaces that need a specific lockfile",type:t.SettingsType.STRING,default:!0,isArray:!0},workspaceLockfileFilename:{description:"Name of the workspaces specific lockfile",type:t.SettingsType.STRING,default:"yarn.lock-workspace"}},hooks:{afterAllInstalled:async(e,o)=>{let i=e.configuration.values.get("workspaceLockfiles"),r=e.configuration.values.get("workspaceLockfileFilename"),a=Array.isArray(i)?new Set(i.map(n=>e.getWorkspaceByIdent(t.structUtils.parseIdent(n)))):new Set(e.workspaces);for(let n of a){let c=s.ppath.join(n.cwd,r),p=s.ppath.join(n.cwd,s.Filename.lockfile);await s.xfs.renamePromise(c,p),await s.xfs.writeFilePromise(p,await W(e,n)),await s.xfs.renamePromise(p,c),o.report.reportInfo(null,`${L("\u2713")} Wrote ${c}`)}}}},v=I;return S(F);})();
return plugin;
}
};
28 changes: 0 additions & 28 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

This file was deleted.

874 changes: 0 additions & 874 deletions .yarn/releases/yarn-3.6.3.cjs

This file was deleted.

893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.0.0.cjs

Large diffs are not rendered by default.

57 changes: 15 additions & 42 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
initScope: openagenda
changesetBaseRefs:
- main
- origin/main
- upstream/main

enableTelemetry: 0

initFields:
name: ""
version: 0.0.0
author: ""
description: ""
license: ISC
main: ""
name: ""
repository:
type: git
url: ""
author: ""
license: "ISC"
# files: []
main: ""
scripts: {}

initScope: openagenda

nodeLinker: node-modules

npmScopes:
openagenda:
npmPublishRegistry: "https://registry.npmjs.org/"
npmRegistryServer: "https://registry.npmjs.org/"

preferDeferredVersions: true

changesetBaseRefs:
- "main"
- "origin/main"
- "upstream/main"

packageExtensions:
"@openagenda/dom-utils@*":
dependencies:
Expand Down Expand Up @@ -72,7 +72,6 @@ packageExtensions:
peerDependenciesMeta:
typescript:
optional: true

react-spinkit@^3.0.0:
peerDependencies:
react: ^16.0.0
Expand All @@ -85,30 +84,4 @@ packageExtensions:
immutable:
optional: true

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"
- path: .yarn/plugins/@yarnpkg/plugin-constraints.cjs
spec: "@yarnpkg/plugin-constraints"
# - path: .yarn/plugins/@openagenda/plugin-workspace-lockfile.cjs
# spec: "https://unpkg.com/@openagenda/yarn-plugin-workspace-lockfile"

yarnPath: .yarn/releases/yarn-3.6.3.cjs

#enableInlineBuilds: true

#pnpMode: loose
#pnpFallbackMode: all

nodeLinker: node-modules

# Links
enableHyperlinks: false

enableTelemetry: 0

lockfileFilename: ${OA_PUBLIC_LOCKFILE:-yarn.lock-workspace}
yarnPath: public/.yarn/releases/yarn-4.0.0.cjs
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
## OpenAgenda monorepo - public part
# OpenAgenda monorepo - public part

Welcome to the `public` subtree of the `oa` repo.

## Important Notice for Contributors

Due to the specific workings of Yarn v4, if you wish to contribute to this sub-project, please carefully follow the steps below before any operation:

1. **Before you begin**:
Use the command:
```bash
mv yarn.lock-workspace yarn.lock
```
2. Make your changes and operations as usual.
3. **Before committing**:
Use the command:
```bash
mv yarn.lock yarn.lock-workspace
```

This ensures proper dependency management and prevents potential conflicts.

Thank you for your contribution!
Loading

0 comments on commit 319b8e4

Please sign in to comment.