Skip to content

Commit da13ef5

Browse files
authored
build(yarn): Upgrade yarn to 1.16.0, embed in repo (#13569)
The best way to install yarn in repos like this is to use the single JS file version from GitHub instead of installing it via npm. An even better way is to embed this file in the repo and add a yarn-path directive to the `.yarnrc` file to ensure everyone always uses the same yarn version for this repo at all times. This patch does all this, removes all references to npm too.
1 parent 0ba47ac commit da13ef5

File tree

10 files changed

+136282
-44
lines changed

10 files changed

+136282
-44
lines changed

.travis.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ env:
3434
- DJANGO_VERSION=">=1.8,<1.9"
3535
# node's version is pinned by .nvmrc and is autodetected by `nvm install`.
3636
- NODE_DIR="${HOME}/.nvm/versions/node/v$(< .nvmrc)"
37-
- YARN_VERSION="1.13.0"
3837
- NODE_OPTIONS=--max-old-space-size=4096
3938

4039
script:
@@ -55,7 +54,7 @@ after_script:
5554
pip install codecov
5655
codecov -e TEST_SUITE
5756
fi
58-
- npm install -g @zeus-ci/cli
57+
- ./bin/yarn global add @zeus-ci/cli
5958
- zeus upload -t "text/xml+xunit" .artifacts/*junit.xml
6059
- zeus upload -t "text/xml+coverage" .artifacts/*coverage.xml
6160
- zeus upload -t "text/xml+coverage" .artifacts/coverage/cobertura-coverage.xml
@@ -90,7 +89,6 @@ base_acceptance: &acceptance_default
9089
before_install:
9190
- find "$NODE_DIR" -type d -empty -delete
9291
- nvm install
93-
- npm install -g "yarn@${YARN_VERSION}"
9492
- docker run -d --network host --name clickhouse-server --ulimit nofile=262144:262144 yandex/clickhouse-server:18.14.9
9593
- docker run -d --network host --name snuba --env SNUBA_SETTINGS=test --env CLICKHOUSE_SERVER=localhost:9000 getsentry/snuba
9694
- docker ps -a
@@ -120,7 +118,6 @@ matrix:
120118
- SENTRY_LIGHT_BUILD=1 pip install -e ".[dev,tests,optional]"
121119
- find "$NODE_DIR" -type d -empty -delete
122120
- nvm install
123-
- npm install -g "yarn@${YARN_VERSION}"
124121
- yarn install --pure-lockfile
125122

126123
- <<: *postgres_default
@@ -158,7 +155,6 @@ matrix:
158155
before_install:
159156
- find "$NODE_DIR" -type d -empty -delete
160157
- nvm install
161-
- npm install -g "yarn@${YARN_VERSION}"
162158
install:
163159
- yarn install --pure-lockfile
164160

@@ -180,7 +176,6 @@ matrix:
180176
before_install:
181177
- find "$NODE_DIR" -type d -empty -delete
182178
- nvm install
183-
- npm install -g "yarn@${YARN_VERSION}"
184179

185180
- <<: *postgres_default
186181
name: 'Symbolicator Integration'
@@ -225,7 +220,6 @@ matrix:
225220
- tar -xzf credentials.tar.gz
226221
# Use the decrypted service account credentials to authenticate the command line tool
227222
- gcloud auth activate-service-account --key-file client-secret.json
228-
- npm install -g "yarn@${YARN_VERSION}"
229223
install:
230224
- yarn install --pure-lockfile
231225
- gcloud version

.travis/deploy-storybook.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ BRANCH_PROCESSED=$(echo "${DEPLOY_BRANCH}" | tr '[:upper:]./' '[:lower:]--' | tr
1010
BUCKET_DIR_NAME="branches/${BRANCH_PROCESSED}"
1111
echo "Bucket directory: ${BUCKET_DIR_NAME}"
1212

13-
npm run storybook-build
13+
./bin/yarn run storybook-build
1414

1515
# Upload the files
1616
gsutil cp .storybook-out/favicon.ico "gs://${GS_BUCKET_NAME}/favicon.ico"

.yarnrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
yarn-path "./bin/yarn"
2+
disable-self-update-check true

Makefile

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ ifneq "$(wildcard /usr/local/opt/openssl/lib)" ""
88
endif
99

1010
PIP = LDFLAGS="$(LDFLAGS)" pip
11-
WEBPACK = NODE_ENV=production ./node_modules/.bin/webpack
12-
YARN_VERSION = 1.13.0
11+
WEBPACK = NODE_ENV=production ./bin/yarn webpack
12+
YARN = ./bin/yarn
1313

1414
bootstrap: install-system-pkgs develop init-config run-dependent-services create-db apply-migrations
1515

@@ -76,19 +76,17 @@ node-version-check:
7676
install-system-pkgs: node-version-check
7777
@echo "--> Installing system packages (from Brewfile)"
7878
@command -v brew 2>&1 > /dev/null && brew bundle || (echo 'WARNING: homebrew not found or brew bundle failed - skipping system dependencies.')
79-
@echo "--> Installing yarn $(YARN_VERSION) (via npm)"
80-
@$(volta --version 2>&1 > /dev/null || npm install -g "yarn@$(YARN_VERSION)")
8179

8280
install-yarn-pkgs:
8381
@echo "--> Installing Yarn packages (for development)"
84-
@command -v yarn 2>&1 > /dev/null || (echo 'yarn not found. Please install it before proceeding.'; exit 1)
82+
@command -v $(YARN) 2>&1 > /dev/null || (echo 'yarn not found. Please install it before proceeding.'; exit 1)
8583
# Use NODE_ENV=development so that yarn installs both dependencies + devDependencies
86-
NODE_ENV=development yarn install --pure-lockfile
84+
NODE_ENV=development $(YARN) install --pure-lockfile
8785
# A common problem is with node packages not existing in `node_modules` even though `yarn install`
8886
# says everything is up to date. Even though `yarn install` is run already, it doesn't take into
8987
# account the state of the current filesystem (it only checks .yarn-integrity).
9088
# Add an additional check against `node_modules`
91-
yarn check --verify-tree || yarn install --check-files
89+
$(YARN) check --verify-tree || $(YARN) install --check-files
9290

9391
install-sentry-dev:
9492
@echo "--> Installing Sentry (for development)"
@@ -135,13 +133,13 @@ test-js: node-version-check
135133
@echo "--> Building static assets"
136134
@$(WEBPACK) --profile --json > .artifacts/webpack-stats.json
137135
@echo "--> Running JavaScript tests"
138-
@npm run test-ci
136+
@$(YARN) run test-ci
139137
@echo ""
140138

141139
# builds and creates percy snapshots
142140
test-styleguide:
143141
@echo "--> Building and snapshotting styleguide"
144-
@npm run snapshot
142+
@$(YARN) run snapshot
145143
@echo ""
146144

147145
test-python:

0 commit comments

Comments
 (0)