Skip to content

Commit

Permalink
Migrate frontend to yarn 4 (#71)
Browse files Browse the repository at this point in the history
### Description
Since we are no longer tracking `frontend/.yarn/`, and
[yarnrc.yml](https://github.com/Kryha/KREAd/blob/develop/frontend/.yarnrc.yml)
points to it, yarn breaks.

Coincidentally, [yarn 4](https://yarnpkg.com/blog/release/4.0) just
landed and it seems to solve the issue with Corepack:
> "...we used to recommend using the
[yarnPath](https://yarnpkg.com/configuration/yarnrc#yarnPath) setting
pointing to a checked-in binary, but this pattern increased friction
more than we liked - many people didn't like the idea of adding a binary
to their repository, however small. We listened, and worked conjointely
with Node.js on a project called
[Corepack](https://nodejs.org/api/corepack.html). Corepack is a tool
shipped with Node.js 16+ that will automatically select the right
package manager version to run depending on the project you're working
on"

### Acceptance Criteria
- [x] yarn does not depend on `/frontend/.yarn` 
- [x] QAd
  • Loading branch information
carlos-kryha authored Oct 24, 2023
1 parent df362cf commit 6a4b5ba
Show file tree
Hide file tree
Showing 3 changed files with 10,225 additions and 15,138 deletions.
15 changes: 9 additions & 6 deletions frontend/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
nodeLinker: node-modules
compressionLevel: mixed

enableGlobalCache: false

nmHoistingLimits: workspaces

nodeLinker: node-modules

# TODO: remove azure dependency
npmScopes:
kryha:
npmRegistryServer: "https://pkgs.dev.azure.com/Kryha-io/_packaging/Kryha-io/npm/registry"

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

yarnPath: .yarn/releases/yarn-3.1.1.cjs
# using package.json's packageManager instead of yarnPath
# yarnPath: .yarn/releases/yarn-4.0.0.cjs
3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,6 @@
"vite": "^3.0.7",
"vite-plugin-svgr": "^2.2.1",
"vite-tsconfig-paths": "^3.5.0"
}
},
"packageManager": "[email protected]"
}
Loading

0 comments on commit 6a4b5ba

Please sign in to comment.