Skip to content

Commit b903c68

Browse files
chore: update project to use npm (#636)
* chore: remove yarn lockfile * chore: update project to use npm * docs: update yarn to npm in docs * ci: update commands from yarn to npm * ci: add cache option to setup-node * update lock file --------- Co-authored-by: Josh Black <[email protected]> Co-authored-by: Siddharth Kshetrapal <[email protected]>
1 parent 7585e34 commit b903c68

File tree

11 files changed

+32063
-16587
lines changed

11 files changed

+32063
-16587
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ jobs:
1212
uses: actions/setup-node@v3
1313
with:
1414
node-version: 18
15+
cache: 'npm'
1516

1617
- name: Install dependencies
17-
run: yarn
18+
run: npm ci
1819

1920
- name: Lint
20-
run: yarn workspace @primer/gatsby-theme-doctocat lint
21+
run: npm run lint -ws --if-present
2122

2223
- name: Test
23-
run: yarn workspace @primer/gatsby-theme-doctocat test
24+
run: npm run test -ws --if-present

.github/workflows/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ jobs:
1818
gh_token: ${{ secrets.GITHUB_TOKEN }}
1919
with:
2020
node_version: 18
21-
install: yarn
22-
build: yarn build
21+
install: npm ci
22+
build: npm run build
2323
output_dir: docs/public

.github/workflows/deploy_preview.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ jobs:
1616
gh_token: ${{ secrets.GITHUB_TOKEN }}
1717
with:
1818
node_version: 18
19-
install: yarn
20-
build: yarn build:preview
19+
install: npm ci
20+
build: npm run build:preview
2121
output_dir: docs/public

.github/workflows/release.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,18 @@ jobs:
2222
uses: actions/setup-node@v3
2323
with:
2424
node-version: 18
25+
cache: 'npm'
2526

2627
- name: Install dependencies
27-
run: yarn
28+
run: npm ci
2829

2930
- name: Create release pull request or publish to npm
3031
id: changesets
3132
uses: changesets/action@master
3233
with:
3334
title: Release Tracking
3435
# This expects you to have a script called release which does a build for your packages and calls changeset publish
35-
publish: yarn release
36+
publish: npm run release
3637
env:
3738
GITHUB_TOKEN: ${{ secrets.GPR_AUTH_TOKEN_SHARED }}
3839
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN_SHARED }}

.github/workflows/release_canary.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ jobs:
2323
uses: actions/setup-node@v3
2424
with:
2525
node-version: 18
26+
cache: 'npm'
2627

2728
- name: Install dependencies
28-
run: yarn
29+
run: npm ci
2930

3031
- name: Create .npmrc
3132
run: |
@@ -40,8 +41,8 @@ jobs:
4041
echo "$( jq '.version = "0.0.0"' package.json )" > package.json
4142
echo -e "---\n'@primer/gatsby-theme-doctocat': patch\n---\n\nFake entry to force publishing" > .changeset/force-snapshot-release.md
4243
rm -f .changeset/pre.json
43-
yarn changeset version --snapshot
44-
yarn changeset publish --tag canary
44+
npx changeset version --snapshot
45+
npx changeset publish --tag canary
4546
env:
4647
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4748

.github/workflows/stale.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,17 @@ jobs:
99
steps:
1010
- uses: actions/stale@v4
1111
with:
12-
1312
# General settings
1413
days-before-stale: 60
1514
days-before-close: 7
1615
enable-statistics: true
1716
operations-per-run: 100
1817
remove-stale-when-updated: true
19-
18+
2019
# PR specific settings
2120
delete-branch: true
22-
stale-pr-message: "Hi! This pull request has been marked as stale because it has been open with no activity for 60 days. You can comment on the pull request or remove the stale label to keep it open. If you do nothing, this pull request will be closed in 7 days."
23-
21+
stale-pr-message: 'Hi! This pull request has been marked as stale because it has been open with no activity for 60 days. You can comment on the pull request or remove the stale label to keep it open. If you do nothing, this pull request will be closed in 7 days.'
22+
2423
# Issue specific settings
2524
days-before-issue-stale: 180
26-
stale-issue-message: "Hi! This issue has been marked as stale because it has been open with no activity for 180 days. You can comment on the issue or remove the stale label to keep it open. If you do nothing, this issue will be closed in 7 days."
25+
stale-issue-message: 'Hi! This issue has been marked as stale because it has been open with no activity for 180 days. You can comment on the issue or remove the stale label to keep it open. If you do nothing, this issue will be closed in 7 days.'

CONTRIBUTING.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,30 @@ We appreciate your contribution and hope that this document helps you along the
66

77
<Note>
88

9-
109
These guidelines are for contributing to the theme itself, if you are looking for help running a Doctocat site for another project locally, check out the [Local Development](/usage/local-development) docs in the Usage section.
1110

1211
</Note>
1312

14-
1513
## Local development
1614

1715
Run the following commands to begin local development:
1816

1917
<Note>
2018

21-
22-
These steps require [Node.js](https://nodejs.org) and [Yarn](https://yarnpkg.com) to be set up locally.
19+
These steps require [Node.js](https://nodejs.org) and [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) to be set up locally.
2320

2421
</Note>
2522

26-
2723
```shell
2824
# Clone the repository
2925
git clone https://github.com/primer/doctocat.git
3026
cd doctocat
3127

3228
# Install the dependencies
33-
yarn
29+
npm install
3430

3531
# Start the development server for the documentation site
36-
yarn workspace docs develop
32+
npm start
3733

3834
# Navigate to http://localhost:8000 in your browser
3935
```
@@ -44,21 +40,19 @@ yarn workspace docs develop
4440
.
4541
├── theme/
4642
├── docs/
47-
├── package.json
48-
└── now.json
43+
└── package.json
4944
```
5045

5146
- `theme/`: This directory contains the code for the [Gatsby Theme](https://www.gatsbyjs.org/docs/themes/what-are-gatsby-themes/) and is what gets published to npm.
5247
- `docs/`: This directory contains the code for the documentation site for Doctocat. The documentation site can also be used to test changes to the theme locally.
53-
- `package.json`: This file defines the [Yarn Workspaces](https://yarnpkg.com/lang/en/docs/workspaces/) for the project and is not meant to be published.
54-
- `now.json`: This file configures the deployment of the documentation site. Check out the [now.json docs](https://zeit.co/docs/v2/deployments/configuration/?query=now.json) for more information.
48+
- `package.json`: This file defines the [workspaces](https://docs.npmjs.com/cli/v7/using-npm/workspaces) for the project and is not meant to be published.
5549

5650
## Scripts
5751

58-
The documentation site has a few [npm scripts](https://docs.npmjs.com/misc/scripts) for developing and building the site. You can run these scripts from the root directory using the [`yarn workspace`](https://yarnpkg.com/lang/en/docs/cli/workspace/) command:
52+
The documentation site has a few [npm scripts](https://docs.npmjs.com/misc/scripts) for developing and building the site. You can run these scripts from the root directory using the [`--workspace`](https://docs.npmjs.com/cli/v7/using-npm/workspaces#running-commands-in-the-context-of-workspaces), or `-w`, option:
5953

6054
```shell
61-
yarn workspace docs <script-name>
55+
npm run -w docs <script-name>
6256
```
6357

6458
### `develop`
@@ -149,13 +143,13 @@ Follow this process if you'd like your work considered for inclusion in the proj
149143
- Install the dependencies:
150144

151145
```shell
152-
yarn
146+
npm i
153147
```
154148

155149
- Start Gatsby's hot-reloading development environment:
156150

157151
```shell
158-
yarn workspace docs develop
152+
npm start
159153
# The documentation site will now be accessible from http://localhost:8000
160154
```
161155

0 commit comments

Comments
 (0)