Skip to content

Commit

Permalink
Yarn 1 => Yarn 3 (gallery-so#1340)
Browse files Browse the repository at this point in the history
* install yarn 3

* ensure metro config only looks inside the mobile app's node modules

* install moon in web app

* ignore new yarn directory except for plugins / releases

* make sure web paths directly to the binary instead of relying on yarn

* update yarn lock

* make sure yarnrc is using yarn 3

* newline package json

* delete web yarn lock

* move project yaml to tasks yml

* use moon binary directly

* no hoisting

* use correct relay compiler

* fix build script
  • Loading branch information
tbezman authored Feb 14, 2023
1 parent 36cb635 commit f9a77b4
Show file tree
Hide file tree
Showing 15 changed files with 31,348 additions and 44,667 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/web.bundle-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
cache: 'yarn'
- run: 'yarn install --immutable'
- name: Build Next.js App
run: DISABLE_SENTRY=true yarn moon run web:build
run: DISABLE_SENTRY=true node_modules/.bin/moon run web:build
- name: Analyze bundle sizes
uses: transferwise/actions-next-bundle-analyzer@master
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/web.lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
cache: 'yarn'
- run: 'yarn install --immutable'
- name: Run Lint
run: yarn moon run web:lint
run: node_modules/.bin/moon run web:lint
type-check:
runs-on: ubuntu-latest
steps:
Expand All @@ -26,4 +26,4 @@ jobs:
cache: 'yarn'
- run: 'yarn install --immutable'
- name: Run typecheck
run: yarn moon run web:codegen && yarn moon run web:typecheck
run: node_modules/.bin/moon run web:codegen && node_modules/.bin/moon run web:typecheck
2 changes: 1 addition & 1 deletion .github/workflows/web.unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ jobs:
cache: 'yarn'
- run: 'yarn install --immutable'
- name: Run unit tests
run: yarn moon run web:codegen && yarn moon run web:test
run: node_modules/.bin/moon run web:codegen && node_modules/.bin/moon run web:test
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ npm-debug.log
yarn-debug.log
yarn-error.log

.yarn/
.yarn/*
!.yarn/releases
!.yarn/plugins
.pnp.*

# SECRITS
_internal*
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions .moon/toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ node:

# The version of the package manager (above) to use.
yarn:
version: "1.22.19"
version: "3.4.1"

# Add `node.version` as a constraint in the root `package.json` `engines`.
addEnginesConstraint: true
Expand All @@ -25,7 +25,7 @@ node:
aliasPackageNames: "name-and-scope"

# Dedupe dependencies after the lockfile has changed.
dedupeOnLockfileChange: true
dedupeOnLockfileChange: false

# Version format to use when syncing dependencies within the project's `package.json`.
# dependencyVersionFormat: 'workspace'
Expand Down
873 changes: 873 additions & 0 deletions .yarn/releases/yarn-3.4.1.cjs

Large diffs are not rendered by default.

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

nmHoistingLimits: workspaces

yarnPath: .yarn/releases/yarn-3.4.1.cjs
2 changes: 1 addition & 1 deletion apps/mobile/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ config.resolver.nodeModulesPaths = [
path.resolve(workspaceRoot, "node_modules"),
];
// 3. Force Metro to resolve (sub)dependencies only from the `nodeModulesPaths`
// config.resolver.disableHierarchicalLookup = false;
config.resolver.disableHierarchicalLookup = true;

module.exports = config;
8 changes: 4 additions & 4 deletions apps/web/moon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ tasks:
- concurrently
- -n Next,Relay-Compiler,GraphQL-Codegen
- yarn next dev
- yarn moon run web:relay-watch
- yarn moon run web:graphql-codegen-watch
- node_modules/.bin/moon run web:relay-watch
- node_modules/.bin/moon run web:graphql-codegen-watch

lint:
command:
Expand All @@ -63,7 +63,7 @@ tasks:
local: true

relay-watch:
command: relay-compiler --repersist --watch
command: yarn relay-compiler --repersist --watch
local: true

graphql-codegen-watch:
Expand Down Expand Up @@ -91,7 +91,7 @@ tasks:
relay-codegen:
deps:
- "~:touch-relay-files"
command: relay-compiler --repersist
command: yarn relay-compiler --repersist
inputs:
- '@group(source)'

Expand Down
3 changes: 2 additions & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
"private": true,
"version": "1.0.0",
"scripts": {
"build": "echo {} > persisted_queries.json && mkdir -p __generated__ && ../../node_modules/.bin/relay-compiler && ../../node_modules/.bin/graphql-codegen && node ./scripts/upload-persisted-queries.mjs && ../../node_modules/.bin/next build"
"build": "bash -c \"echo {} > persisted_queries.json && mkdir -p __generated__ && yarn relay-compiler && yarn graphql-codegen && node ./scripts/upload-persisted-queries.mjs && yarn next build\""
},
"devDependencies": {
"@gallery-so/typescript-operations": "^0.0.7",
"@gallery-so/visitor-plugin-common": "^0.0.2",
"@graphql-codegen/cli": "^2.11.6",
"@graphql-codegen/typescript": "^2.7.3",
"@moonrepo/cli": "^0.23.4",
"@next/bundle-analyzer": "^13.0.4",
"@svgr/webpack": "^5.5.0",
"@synthetixio/synpress": "2.3.3",
Expand Down
Loading

0 comments on commit f9a77b4

Please sign in to comment.