Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to yarn for installing dependencies #8762

Merged
merged 63 commits into from Feb 18, 2021
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
8b436a0
migrate to yarn for install dependencies
Jan 20, 2021
6d12a3a
install emotion/react psammead peer dep
Jan 20, 2021
84a0d88
update bundle sizes
Jan 20, 2021
a8ffe06
update snapshots
Jan 20, 2021
3a34587
prevent running npm install
Jan 20, 2021
91f6d39
Merge branch 'latest' into migrate-to-yarn
Feb 2, 2021
43071df
add bolder npm install error message
Feb 2, 2021
8c836ce
test npm_execpath for testing
Feb 2, 2021
9ab623f
use yarn in GH actions
Feb 2, 2021
d81b953
make npm install error message slightly less bold
Feb 2, 2021
6c09be3
update bundle size config
Feb 2, 2021
809aac0
remove console.log
Feb 2, 2021
3bf9f74
use yarn install --frozen-lockfile
Feb 3, 2021
1f736c5
replace npm scripts commands with yarn
Feb 3, 2021
9cc523a
don't save puppeteer dep in yarn.lock
Feb 3, 2021
bd12fa2
remove unused script
Feb 3, 2021
6f8ea7c
Merge branch 'latest' into migrate-to-yarn
Feb 3, 2021
6a6addc
remove accidentally committed line of code
Feb 3, 2021
410a89c
enforce version of yarn
Feb 3, 2021
831f94c
don't save puppeteer dep in yarn.lock
Feb 3, 2021
0ed75df
remove unused script
Feb 3, 2021
8a5c63b
Merge branch 'latest' into migrate-to-yarn
Feb 3, 2021
56f0841
update contributing dox
Feb 3, 2021
93c3958
Merge branch 'migrate-to-yarn' of github.com:bbc/simorgh into migrate…
Feb 3, 2021
8a56381
loadable server and component packages must match
Feb 3, 2021
76ad6a9
later version of loadable introduces visual bugs
Feb 3, 2021
5ce7798
update int test snapshots
Feb 3, 2021
7e34ac0
Merge branch 'latest' into migrate-to-yarn
Feb 3, 2021
cd1667b
Merge branch 'migrate-to-yarn' into migrate-to-yarn-replace-npm-scripts
Feb 3, 2021
fdcb05d
Merge branch 'latest' into migrate-to-yarn
Feb 4, 2021
f86f61d
Merge branch 'migrate-to-yarn' of github.com:bbc/simorgh into migrate…
Feb 4, 2021
da93786
update contribution and link to from terminal
Feb 4, 2021
715c059
only nvm use required
Feb 4, 2021
f5ac634
add to and link to install yarn in root readme
Feb 4, 2021
31be900
add space in box
Feb 4, 2021
0b91d35
Merge branch 'latest' into migrate-to-yarn
Feb 4, 2021
5f51779
Merge branch 'latest' of github.com:bbc/simorgh into migrate-to-yarn
andrewscfc Feb 5, 2021
d522d16
update pre-push script
Feb 5, 2021
c4ba325
Merge branch 'migrate-to-yarn' of github.com:bbc/simorgh into migrate…
Feb 5, 2021
31f7a90
update yarn lock
andrewscfc Feb 5, 2021
49ed388
Merge branch 'migrate-to-yarn' of github.com:bbc/simorgh into migrate…
andrewscfc Feb 5, 2021
7b306e1
yarn import lock file
andrewscfc Feb 5, 2021
75ed4ad
update snapshots after yarn import
andrewscfc Feb 5, 2021
a8d9cc2
reset loadable changes to match latest
andrewscfc Feb 5, 2021
a24a7c3
reset bundleSizeConfig
andrewscfc Feb 5, 2021
9dae0a8
fix caching of node_modules in GH actions
Feb 10, 2021
9fdc15d
remove package-lock.json references
Feb 10, 2021
2a144ac
Merge branch 'latest' into migrate-to-yarn
Feb 12, 2021
dc63c18
update yarn.lock based on package-lock.json with yarn import command
Feb 12, 2021
f7df215
Merge pull request #8833 from bbc/migrate-to-yarn-replace-npm-scripts
Feb 12, 2021
2c077b7
remove `run` from yarn commands
Feb 12, 2021
57841a7
Merge branch 'latest' into migrate-to-yarn
Feb 15, 2021
def21db
Merge branch 'latest' into migrate-to-yarn
Feb 15, 2021
a619645
trigger build
Feb 15, 2021
4a8cac8
Merge branch 'latest' into migrate-to-yarn
Feb 16, 2021
3791687
remove @emotion/sheet webpack alias
Feb 16, 2021
2eb5ea7
match all emotion package versions
Feb 16, 2021
57c2d7e
upgrade emotion packages to latest
Feb 16, 2021
41f922e
update renovate docs to remove reference to forcing resolutions
andrewscfc Feb 17, 2021
444c512
Merge branch 'latest' into migrate-to-yarn
Feb 18, 2021
12c9d6e
use latest versions of emotion packages in prod bundle
Feb 18, 2021
ad1be8a
add yarn ci script to remove invalid transitive dependencies before n…
Feb 18, 2021
014cd07
move transitive emotion deps to resolutions
Feb 18, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/simorgh-deploy-storybook.yml
Expand Up @@ -25,11 +25,11 @@ jobs:

- name: Install Node Modules
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci
run: yarn install --frozen-lockfile

- name: Build Storybook
run: |
npm run build:storybook
yarn run build:storybook
git config --global user.name "simorgh-bbc"
git config --global user.email "DENewsSimorghDev@bbc.co.uk"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/simorgh-integration-tests.yml
Expand Up @@ -36,7 +36,7 @@ jobs:

- name: Install Node Modules
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci
run: yarn install --frozen-lockfile

- name: Integration Tests
run: npm run test:integration -- --ci
run: yarn run test:integration -- --ci
15 changes: 8 additions & 7 deletions .github/workflows/simorgh-local-server-tests.yml
Expand Up @@ -35,24 +35,25 @@ jobs:

- name: Install Node Modules
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci
run: yarn install --frozen-lockfile

- name: Build Simorgh
run: npm run build:local
run: yarn run build:local

- name: Start Simorgh Server
run: nohup node build/server.js > /dev/null 2>&1 &

- name: Run AMP Validator
run: npm run amp:validate
run: yarn run amp:validate

- name: Run bbc-a11y
run: npm run bbcA11y:ci
run: yarn run bbcA11y:ci

- name: Run Lighthouse
run: npm run lighthouse
run: yarn run lighthouse

- name: Run Puppeteer Tests
run: |
npm install --no-save puppeteer
npm run test:puppeteer
yarn add puppeteer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might be able to split this into installing puppeteer and running the tests. That way we can skip the puppeteer installation if it's in the cache.

yarn run test:puppeteer
yarn remove puppeteer
2 changes: 1 addition & 1 deletion .github/workflows/simorgh-misc-checks.yml
Expand Up @@ -37,7 +37,7 @@ jobs:

- name: Install Node Modules
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci
run: yarn install --frozen-lockfile

- name: Chromatic UI Tests
uses: chromaui/action@v1
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/simorgh-unit-tests.yml
Expand Up @@ -47,12 +47,12 @@ jobs:

- name: Install Node Modules
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci
run: yarn install --frozen-lockfile

- name: Build Simorgh
run: |
echo ${GITHUB_REF##*/}
npm run build
yarn run build

- name: Setup Code Climate Test Coverage
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == 'bbc/simorgh' }} # Only run if PR originates from the Simorgh repo
Expand All @@ -64,7 +64,7 @@ jobs:
./cc-test-reporter before-build

- name: Unit Tests
run: npm run test:unit
run: yarn run test:unit

- name: Report Code Climate Test Coverage
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == 'bbc/simorgh' }} # Only run if PR originates from the Simorgh repo
Expand Down
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

1 change: 1 addition & 0 deletions .yarnrc
@@ -0,0 +1 @@
version=1.22.10
51 changes: 38 additions & 13 deletions CONTRIBUTING.md
Expand Up @@ -36,19 +36,44 @@ If you never created a pull request before, [here is a great tutorial on how to

Fork the project, clone your fork, configure the remotes and install the dependencies:

1. Clone your fork of the repo into the current directory

```
git clone https://github.com/<YOUR ACCOUNT>/simorgh.git
```

2. Navigate to the newly cloned directory

```
cd simorgh
```

3. Assign the original repo to a remote called "upstream"

```
git remote add upstream https://github.com/bbc/simorgh
```

4. Use recommended version of node for the project, listed in [`.nvmrc`](https://github.com/bbc/simorgh/blob/latest/.nvmrc)

```
nvm use
```

### Installing dependencies

**Install Yarn**

The Simorgh project uses Yarn for package management. To install Yarn, run this command:

```
npm install --global yarn
```

**Install the project dependencies with Yarn**

```
# Clone your fork of the repo into the current directory
git clone https://github.com/<YOUR ACCOUNT>/simorgh.git
# Navigate to the newly cloned directory
cd simorgh
# Assign the original repo to a remote called "upstream"
git remote add upstream https://github.com/bbc/simorgh
# Use recommended version of node for the project, listed in `.nvmrc`
nvm use
# Install latest version of npm
npm install --global npm@latest
# Install the project dependencies
npm install
yarn install
```

If it has been a while since you've cloned the repo, pull from the `latest` branch
Expand Down Expand Up @@ -183,7 +208,7 @@ If on the other hand you are adding new files to the root directory of simorgh,

### `.env` is showing in my `git status`

The `.env` file should not be commited as it is often overwritten by the values in `envConfig/` at build time. There is a `postshrinkwrap` command which runs after an `npm install` so should be run during setup of the application.
The `.env` file should not be commited as it is often overwritten by the values in `envConfig/` at build time. There is a `postshrinkwrap` command which runs after an `yarn install` so should be run during setup of the application.

If the `.env` file is appearing in your `git status` it means it is now longer being assumed as unchanged, to fix this run:

Expand Down
10 changes: 9 additions & 1 deletion README.md
Expand Up @@ -158,12 +158,20 @@ Install Node. [https://nodejs.org/en/](https://nodejs.org/en/). We use the versi
nvm use
```

#### Install Yarn

The Simorgh project uses Yarn for package management. It is recommended to install Yarn through the npm package manager, which comes bundled with Node.js when you install it on your system. To install Yarn, run this command:

```
npm install --global yarn
```

Then you can run the following commands to install Simorgh

```
git clone git@github.com:bbc/simorgh.git
cd simorgh
npm install
yarn install
```

## Local Development
Expand Down
6 changes: 3 additions & 3 deletions codebuild/e2e_buildspec.yml
Expand Up @@ -10,11 +10,11 @@ phases:
nodejs: 12
pre_build:
commands:
- npm ci
- npm run build
- yarn install --frozen-lockfile
- yarn run build
build:
commands:
- npm run cypress:ci
- yarn run cypress:ci
reports:
JunitReportsTest:
files:
Expand Down