Skip to content

Commit

Permalink
Merge pull request #2148 from ably/npm-to-yarn-1.x
Browse files Browse the repository at this point in the history
chore: migrate npm to Yarn 1 for inter-repo package manager consistency
  • Loading branch information
jamiehenson authored Mar 11, 2024
2 parents 6cd5bb1 + 0ec5244 commit 7b14abd
Show file tree
Hide file tree
Showing 18 changed files with 18,367 additions and 61,222 deletions.
36 changes: 18 additions & 18 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,28 @@ executors:
- image: cimg/node:18.12.0

commands:
restore-npm-cache:
restore-yarn-cache:
steps:
- restore_cache:
name: Restore NPM Package Cache
name: Restore Yarn Package Cache
keys:
- npm-packages-v2-{{ .Branch }}-{{ checksum "package-lock.json" }}
- npm-packages-v2-{{ .Branch }}-
- npm-packages-v2-
- yarn-packages-v2-{{ .Branch }}-{{ checksum "yarn.lock" }}
- yarn-packages-v2-{{ .Branch }}-
- yarn-packages-v2-

save-npm-cache:
save-yarn-cache:
steps:
- save_cache:
name: Save NPM Package Cache
key: npm-packages-v1-{{ .Branch }}-{{ checksum "package-lock.json" }}
name: Save Yarn Package Cache
key: yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/npm
- ~/.cache/yarn

npm-install:
yarn-install:
steps:
- run:
name: Dependencies
command: npm ci --prefer-offline --cache ~/.cache/npm
command: yarn install --frozen-lockfile

build-nginx:
steps:
Expand Down Expand Up @@ -70,13 +70,13 @@ jobs:
resource_class: medium+
steps:
- checkout
- restore-npm-cache
- npm-install
- restore-yarn-cache
- yarn-install
- persist_to_workspace:
root: .
paths:
- node_modules
- save-npm-cache
- save-yarn-cache

install-nginx:
executor:
Expand All @@ -94,13 +94,13 @@ jobs:
at: .
- run:
name: Run linting
command: npm run lint
command: yarn lint
- run:
name: Install JUnit coverage reporter
command: npm install jest-junit
command: yarn add jest-junit
- run:
name: Run tests
command: npm test -- --ci --collectCoverage=true --coverageDirectory=coverage --coverageReporters=html --runInBand --reporters=default --reporters=jest-junit
command: yarn test -- --ci --collectCoverage=true --coverageDirectory=coverage --coverageReporters=html --runInBand --reporters=default --reporters=jest-junit
environment:
JEST_JUNIT_OUTPUT_DIR: ./reports/junit/
- store_test_results:
Expand All @@ -123,7 +123,7 @@ jobs:
sudo cp buildpack/nginx /usr/local/bin/nginx
- run:
name: Build
command: npm run build
command: yarn build
- run:
name: Require redirects file to be generated
command: test -f config/nginx-redirects.conf
Expand Down
6 changes: 3 additions & 3 deletions .githooks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

These are recommended git hooks for your project.

You can activate them by running `npm run repo-githooks` and deactivate them by running `npm run no-githooks`.
You can activate them by running `yarn repo-githooks` and deactivate them by running `yarn no-githooks`.

`npm run repo-githooks` will set your `core.hooksPath` to the correct folder, an example of running this without `npm` might be `git config core.hooksPath .githooks` - but as the specifics may change it might be more convenient to rely on `npm run repo-githooks`.
`yarn repo-githooks` will set your `core.hooksPath` to the correct folder, an example of running this without `yarn` might be `git config core.hooksPath .githooks` - but as the specifics may change it might be more convenient to rely on `yarn repo-githooks`.

`npm run no-githooks` can be substituted at any time for `git config --unset core.hooksPath`.
`yarn no-githooks` can be substituted at any time for `git config --unset core.hooksPath`.
2 changes: 1 addition & 1 deletion .githooks/post-checkout
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh

npm install
yarn

exit 0
2 changes: 1 addition & 1 deletion .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

npm run lint-staged
yarn lint-staged
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
ruby 3.0.0
nodejs 18.12.0
yarn 1.22.19
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This is a static site generated using [Gatsby](https://www.gatsbyjs.com/) and do

## Run

Install node & npm.
Install node & yarn.

If you use [ASDF](https://github.com/asdf-vm/asdf) or compatible tooling to manage your Ruby runtime versions, we have included a [`.tool-versions`](.tool-versions) file - where the dependencies within can be installed with `asdf install` from the project root.

Expand All @@ -24,37 +24,35 @@ brew install [email protected]
RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix [email protected])" asdf install ruby
```

Note that if you `brew install`ed your asdf installation instead of `git clone`ing it, npm [may not be installed correctly](https://youtrack.jetbrains.com/issue/WEB-51052).

`npm i`
`yarn`

If Gatsby CLI is not already installed:

`npm install -g gatsby-cli`
`yarn global add gatsby-cli`

**Environment variables setup**

If you have not yet [set up your local .env.development environment variables](#environment-variables), run:

`npm run develop:env-setup`
`yarn develop:env-setup`

**Editors:**

`npm run edit`
`yarn edit`

**Developers:**

To develop locally run:

`npm run develop`
`yarn develop`

Visit `localhost:8000` for homepage.

Visit `localhost:8000/docs/${relativePath}` for documentation pages, e.g. `localhost:8000/docs/client-lib-development-guide/documentation-formatting-guide`.

To build and serve locally:

`npm run rebuild`
`yarn rebuild`

Visit `localhost:8000` for homepage.

Expand Down Expand Up @@ -114,7 +112,7 @@ We have selected folder-level README files instead of the alternative of a dedic

## Optional Setup Steps

If you would like to run linting and tests automatically before every commit and run npm install automatically after every branch checkout, run `npm run repo-githooks`. If you would like to remove this behaviour, run `npm run no-githooks`.
If you would like to run linting and tests automatically before every commit and run yarn install automatically after every branch checkout, run `yarn repo-githooks`. If you would like to remove this behaviour, run `yarn no-githooks`.

To understand the data ingestion and parsing steps, please check the READMEs in the [/data folder](./data/README.md).

Expand Down
2 changes: 1 addition & 1 deletion content/asset-tracking/example-apps.textile
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ blang[javascript].
3. Then, build the SDK:

```[sh]
npm run build
yarn build
```

4. Change into the @examples/subscribing-example-app@ directory and install the example app's dependencies:
Expand Down
4 changes: 2 additions & 2 deletions content/tutorials/encryption.textile
Original file line number Diff line number Diff line change
Expand Up @@ -539,13 +539,13 @@ blang[nodejs].
Execute the following to start the subscription in first window

```[sh]
npm run app:subscribe
yarn app:subscribe
```

Execute the following to publish a message in the second window

```[sh]
npm run app:publish
yarn app:publish
```

Go back to your first terminal window and you should see the message in your terminal.
Expand Down
2 changes: 1 addition & 1 deletion content/tutorials/peer-to-peer-vue.textile
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ And run the APIs

```[sh]
$ cd api
$ npm run start
$ yarn start
```

h2. Next Steps
Expand Down
4 changes: 2 additions & 2 deletions how-tos/pub-sub/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Try out the [live demo](https://ably.com/docs/how-to/pub-sub) of this how to.
- Fork or clone the [Documentation](https://github.com/ably/docs).
- Sign up for an account on [Ably](https://ably.com/sign-up?utm_source=ably-docs&utm_medium=github&utm_campaign=pub-sub) and get an API KEY.
- Rename `.env.example` to `.env` and fill in your API KEY in the `VITE_ABLY_KEY` environment variable.
- Run `npm` to install dependencies.
- Run `npm run dev` and go to http://localhost:5173
- Run `yarn` to install dependencies.
- Run `yarn dev` and go to http://localhost:5173

## Runtime Requirements

Expand Down
Loading

0 comments on commit 7b14abd

Please sign in to comment.