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

Switch from yarn to pnpm, initial monorepo setup #2607

Merged
merged 8 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/publish-github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: wyvox/action-setup-pnpm@v3
- name: Install Deps and Build
run: |
yarn
yarn build
pnpm i
pnpm build
- name: Build docs
run: yarn docs
run: pnpm docs
- name: Publish site and docs
uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
121 changes: 36 additions & 85 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,68 +8,37 @@ on:

jobs:
test-lint:
name: Run eslint
name: Linting
runs-on: ubuntu-latest

steps:
# Checkout the repo
- name: Checkout
- name: Checkout Repo
uses: actions/checkout@v4

# Setup Node.js build environment
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20

# Cache dependencies
- name: Cache Dependencies
uses: actions/cache@v2
id: cache
with:
path: |
**/node_modules
key: yarn-${{ hashFiles('**/package.json', 'yarn.lock') }}
- name: Setup pnpm
uses: wyvox/action-setup-pnpm@v3

# Install project dependencies
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn
# Run eslint
- name: Run eslint
run: yarn lint:js
- name: Install dependencies and run linting
run: pnpm install && pnpm lint:js

test-unit:
name: Run Unit Tests
runs-on: ubuntu-latest

steps:
# Checkout the repo
- name: Checkout
- name: Checkout Repo
uses: actions/checkout@v4

# Setup Node.js build environment
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20

# Cache dependencies
- name: Cache Dependencies
uses: actions/cache@v2
id: cache
with:
path: |
**/node_modules
key: yarn-${{ hashFiles('**/package.json', 'yarn.lock') }}
- name: Setup pnpm
uses: wyvox/action-setup-pnpm@v3

# Install project dependencies
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn
run: pnpm install

# Run Jest
- name: Run Unit Tests
run: yarn test:unit:ci
run: pnpm test:unit:ci

# - name: Publish code coverage
# uses: paambaati/codeclimate-action@v2.7.4
Expand All @@ -81,55 +50,37 @@ jobs:
runs-on: ubuntu-latest

steps:
# Checkout the repo
- name: Checkout
- name: Checkout Repo
uses: actions/checkout@v4

# Setup Node.js build environment
- name: Setup Node
uses: actions/setup-node@v4
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 20
node-version: 18

# Cache dependencies
- name: Cache Dependencies
uses: actions/cache@v2
id: cache
- uses: pnpm/action-setup@v3
with:
path: |
**/node_modules
key: yarn-${{ hashFiles('**/package.json', 'yarn.lock') }}
version: 8

# Install project dependencies
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn

- uses: bahmutov/npm-install@v1
env:
CYPRESS_INSTALL_BINARY: 0
# confirm there is no Cypress installed
- run: yarn cypress cache path
# should return empty list of installed versions
- run: yarn cypress cache list
# restore / cache the binary ourselves on Linux
# see https://github.com/actions/cache
- name: Cache Cypress
id: cache-cypress
uses: actions/cache@v2
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('examples/basic-pnpm/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies and setup Cypress
uses: cypress-io/github-action@v6
with:
path: ~/.cache/Cypress
key: cypress-cache-v2-${{ runner.os }}-${{ hashFiles('**/package.json') }}
# now let's install Cypress binary
- run: yarn cypress install
- run: yarn cypress cache list

- name: Build
run: yarn build

# Run Cypress
- name: Run Tests
run: yarn test:cy:ci:chrome
browser: chrome
build: pnpm build
start: pnpm test:cy:start-server

automerge:
needs: [test-unit, test-integration]
Expand Down
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ tests/
cypress.json
index.html
jest.config.js
pnpm-lock.yaml
stats.html
yarn.lock
yarn-error.log
Expand Down
2 changes: 1 addition & 1 deletion .release-it.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module.exports = {
hooks: {
'after:bump': 'yarn build'
'after:bump': 'pnpm build'
},
plugins: {
'@release-it-plugins/lerna-changelog': {
Expand Down
893 changes: 0 additions & 893 deletions .yarn/releases/yarn-4.1.0.cjs

This file was deleted.

9 changes: 0 additions & 9 deletions .yarnrc.yml

This file was deleted.

23 changes: 7 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,15 @@

You will need:

- [Yarn](https://yarnpkg.com/)

Windows users will need additional setup to enable build capabilities in NPM.
From an administrative command window:

```sh
yarn global add windows-build-tools
```
- [pnpm](https://pnpm.io/)

## Getting started

1. Fork the project
2. Clone your forked project by running `git clone git@github.com:{
YOUR_USERNAME }/shepherd.git`
3. Run `yarn` to install node modules
4. Test that you can build the source by running `yarn build` and ensure the `dist` directory appears.
YOUR_USERNAME }/shepherd.git`
3. Run `pnpm i` to install node modules
4. Test that you can build the source by running `pnpm build` and ensure the `dist` directory appears.

## Writing code!

Expand All @@ -26,10 +19,9 @@ you can focus on writing relevant code. If there is a fix or feature you would l
to contribute, we ask that you take the following steps:

1. Most of the _editable_ code lives in the `src` directory while built code
will end up in the `dist` directory upon running `yarn build`.

2. The demo app is served out of the `landing` directory. Running `yarn start` will open it in your browser and initiate a live-reloading session as you make changes.
will end up in the `dist` directory upon running `pnpm build`.

2. The demo app is served out of the `landing` directory. Running `pnpm start` will open it in your browser and initiate a live-reloading session as you make changes.

## Opening Pull Requests

Expand All @@ -39,13 +31,12 @@ to contribute, we ask that you take the following steps:

2. Open a Pull Request on GitHub with a description of your changes.


## Testing

All PRs that change code functionality are required to have accompanying tests.

### Acceptance Tests

Acceptance tests are run using [`cypress`](https://github.com/cypress-io/cypress). A number of different testing configurations can be found in [`package.json`](/package.json), but you can simply run `yarn test:cy:watch` to build your latest changes and begin running the tests inside a Chrome browser instance.
Acceptance tests are run using [`cypress`](https://github.com/cypress-io/cypress). A number of different testing configurations can be found in [`package.json`](/package.json), but you can simply run `pnpm test:cy:watch` to build your latest changes and begin running the tests inside a Chrome browser instance.

⚠️ The acceptance tests are set up to run on `localhost` port `9002`. If you'd like to change this port, make sure to change the `baseUrl` option inside of [`cypress.json`](/cypress.json), and change any references to port `9002` in [`package.json`](/package.json) accordingly.
11 changes: 2 additions & 9 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,13 @@ Once the prep work is completed, the actual release is straight forward:
using one of the following commands:

```
# using https://volta.sh
volta install release-it

# using Yarn
yarn global add release-it

# using npm
npm install --global release-it
pnpm add -g release-it
```

* Second, ensure that you have installed your projects dependencies:

```
yarn install
pnpm install
```

* And last (but not least 😁) do your release. It requires a
Expand Down
2 changes: 1 addition & 1 deletion docs-src/tutorials/01-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ yarn add shepherd.js
### pnpm

```bash
pnpm install shepherd.js --save
pnpm add shepherd.js
```

### bun
Expand Down
2 changes: 1 addition & 1 deletion landing/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "astro",
"name": "landing",
"type": "module",
"version": "0.0.1",
"scripts": {
Expand Down
Loading
Loading