-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add yarn update docs and script Signed-off-by: Juan Pablo Garcia Ripa <[email protected]> * update docs Signed-off-by: Juan Pablo Garcia Ripa <[email protected]> * add contributing note Signed-off-by: Juan Pablo Garcia Ripa <[email protected]> * update yarn to v4 Signed-off-by: Juan Pablo Garcia Ripa <[email protected]> * update lockfile on every workspace Signed-off-by: Juan Pablo Garcia Ripa <[email protected]> * declare existing csstype resolutions Signed-off-by: Juan Pablo Garcia Ripa <[email protected]> * dedupe workspaces Signed-off-by: Juan Pablo Garcia Ripa <[email protected]> * disable lint issues Signed-off-by: Juan Pablo Garcia Ripa <[email protected]> --------- Signed-off-by: Juan Pablo Garcia Ripa <[email protected]>
- Loading branch information
Showing
164 changed files
with
873,203 additions
and
872,820 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
compressionLevel: mixed | ||
|
||
enableGlobalCache: true | ||
|
||
httpTimeout: 300000 | ||
|
||
nodeLinker: node-modules | ||
nmMode: hardlinks-local | ||
|
||
npmRegistryServer: "https://registry.npmjs.org/" | ||
|
||
plugins: | ||
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs | ||
spec: "@yarnpkg/plugin-workspace-tools" | ||
npmRegistryServer: 'https://registry.npmjs.org/' | ||
|
||
yarnPath: .yarn/releases/yarn-3.2.3.cjs | ||
yarnPath: .yarn/releases/yarn-4.6.0.cjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Updating Yarn | ||
|
||
## Overview | ||
|
||
To keep workflows and tooling easy to maintain, we use a unique yarn version across all workspaces. This document outlines the process for updating the yarn version across all workspaces. | ||
|
||
## Process | ||
|
||
> [!NOTE] this is the process used from version 3.x to 4.x, future version could imply a different process. | ||
### 1. Update Yarn Version | ||
|
||
update the yarn version runing this command on the root of the repository: | ||
|
||
```bash | ||
yarn set version latest # or a specific version if is needed | ||
``` | ||
|
||
### 2. Update Workspaces | ||
|
||
Bumping from version 3 to 4 implies changes on all the workspaces `yarn.lock` files, to update all the following command can be used: | ||
|
||
```bash | ||
chmod +x ./scripts/run-in-all.sh | ||
./scripts/run-in-all.sh "yarn install && yarn dedupe --mode=update-lockfile && rm -rf node_modules" | ||
``` | ||
|
||
What this command does is to iterate over all the workspaces and run `yarn install` on each one, full install is needed for some versions when yarn changes the checksums (i.e. from v3 to v4). | ||
The `yarn dedupe` command is used to update the `yarn.lock` file, this command will update the `yarn.lock` file with the new checksums and dependencies. | ||
The `rm -rf node_modules` command is used to remove the `node_modules` folder, this is optional but have in mind installing node modules in all golder will consume more than 100gb on disk. | ||
|
||
If for some version update the `--mode=update-lockfile` flag can be used to update the `yarn.lock` file only saving time form yarn link and other steps. | ||
|
||
### 3. Create a PR | ||
|
||
After running the previous command, a PR should be created with the changes on the `yarn.lock` files. This PR will affect all the workspaces but maintainer will only wait for a couple of approvals to merge it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
# Default command | ||
DEFAULT_COMMAND="pwd" | ||
|
||
# Use provided command or default | ||
if [ "$#" -eq 0 ]; then | ||
COMMAND=$DEFAULT_COMMAND | ||
else | ||
COMMAND="$@" | ||
fi | ||
echo "Running command: $COMMAND" | ||
|
||
# Export the command so it's available in the subshells | ||
export COMMAND | ||
|
||
find ./workspaces -maxdepth 1 -type d | tail -n +2 | xargs -I {} -P 3 sh -c 'cd "{}" && pwd && eval "$COMMAND"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/usr/bin/env node | ||
|
||
import { readFile, writeFile } from 'fs/promises'; | ||
import { resolve } from 'path'; | ||
|
||
const packages = [ | ||
'workspaces/adr/package.json', | ||
'workspaces/airbrake/package.json', | ||
'workspaces/allure/package.json', | ||
'workspaces/analytics/package.json', | ||
'workspaces/apache-airflow/package.json', | ||
'workspaces/apollo-explorer/package.json', | ||
'workspaces/azure-sites/package.json', | ||
'workspaces/badges/package.json', | ||
'workspaces/bazaar/package.json', | ||
'workspaces/bitrise/package.json', | ||
'workspaces/cloudbuild/package.json', | ||
'workspaces/code-climate/package.json', | ||
'workspaces/codescene/package.json', | ||
'workspaces/cost-insights/package.json', | ||
'workspaces/dynatrace/package.json', | ||
'workspaces/entity-feedback/package.json', | ||
'workspaces/entity-validation/package.json', | ||
'workspaces/explore/package.json', | ||
'workspaces/firehydrant/package.json', | ||
'workspaces/fossa/package.json', | ||
'workspaces/gcalendar/package.json', | ||
'workspaces/gcp-projects/package.json', | ||
'workspaces/git-release-manager/package.json', | ||
'workspaces/github-deployments/package.json', | ||
'workspaces/github-issues/package.json', | ||
'workspaces/github-pull-requests-board/package.json', | ||
'workspaces/gitops-profiles/package.json', | ||
'workspaces/gocd/package.json', | ||
'workspaces/graphiql/package.json', | ||
'workspaces/ilert/package.json', | ||
'workspaces/kafka/package.json', | ||
'workspaces/lighthouse/package.json', | ||
'workspaces/linguist/package.json', | ||
'workspaces/microsoft-calendar/package.json', | ||
'workspaces/newrelic/package.json', | ||
'workspaces/nomad/package.json', | ||
'workspaces/octopus-deploy/package.json', | ||
'workspaces/opencost/package.json', | ||
'workspaces/periskop/package.json', | ||
'workspaces/playlist/package.json', | ||
'workspaces/puppetdb/package.json', | ||
'workspaces/rollbar/package.json', | ||
'workspaces/shortcuts/package.json', | ||
'workspaces/splunk/package.json', | ||
'workspaces/stack-overflow/package.json', | ||
'workspaces/stackstorm/package.json', | ||
'workspaces/vault/package.json', | ||
'workspaces/xcmetrics/package.json', | ||
]; | ||
|
||
const dependencyName = 'csstype@npm:^3.1.3'; // Set your dependency name here | ||
const resolutionVersion = '3.0.9'; // Set your desired resolution version here | ||
|
||
for (const packagePath of packages) { | ||
const fullPath = resolve(packagePath); | ||
const packageJson = JSON.parse(await readFile(fullPath, 'utf8')); | ||
|
||
if (!packageJson.resolutions) { | ||
packageJson.resolutions = {}; | ||
} | ||
|
||
packageJson.resolutions[dependencyName] = resolutionVersion; | ||
|
||
await writeFile(fullPath, JSON.stringify(packageJson, null, 2) + '\n'); | ||
console.log( | ||
`Updated resolution for ${dependencyName} in ${packagePath} to ${resolutionVersion}`, | ||
); | ||
} |
Oops, something went wrong.