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

chore: Replace 'yarn' with 'npm' #1250

Merged
merged 8 commits into from May 26, 2021
Merged
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Expand Up @@ -2,5 +2,5 @@
"name": "Primer Components",
"image": "mcr.microsoft.com/vscode/devcontainers/javascript-node:14",
"forwardPorts": [8000],
"postCreateCommand": ["/bin/bash", "-c", "pushd docs && yarn && popd && yarn"]
"postCreateCommand": ["/bin/bash", "-c", "pushd docs && npm install && popd && npm install"]
}
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Expand Up @@ -14,16 +14,16 @@ jobs:
node-version: 14

- name: Install dependencies
run: yarn
run: npm install
smockle marked this conversation as resolved.
Show resolved Hide resolved

- name: Lint
run: yarn lint
run: npm run lint

- name: Build
run: yarn dist
run: npm run dist

- name: Test
run: yarn test
run: npm run test

- name: Create .npmrc
if: github.event_name == 'push'
Expand All @@ -39,8 +39,8 @@ jobs:
run: |
echo "$( jq '.version = "0.0.0"' package.json )" > package.json
echo -e "---\n'@primer/components': patch\n---\n\nFake entry to force publishing" > .changeset/force-snapshot-release.md
yarn changeset version --snapshot
yarn changeset publish --tag canary
npx changeset version --snapshot
npx changeset publish --tag canary
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Expand Up @@ -20,15 +20,15 @@ jobs:
node-version: 14

- name: Install dependencies
run: yarn
run: npm install

- name: Create release pull request or publish to npm
id: changesets
uses: changesets/action@master
with:
title: Release Tracking
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: yarn release
publish: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN_SHARED }}
22 changes: 11 additions & 11 deletions contributor-docs/CONTRIBUTING.md
Expand Up @@ -49,13 +49,13 @@ We primarily use our documentation site as a workspace to develop new components
Before running the documentation site locally, you'll need to install packages in the root and `docs` directories:

```sh
yarn && cd docs && yarn
npm install && cd docs && npm install
```

Then navigate back to the root folder and run the following to start up the site:

```sh
yarn start
npm start
```

Navigate to http://localhost:8000/ to see the site in your browser ✨
Expand Down Expand Up @@ -145,7 +145,7 @@ const Component = styled.div`
We use the [React configuration](https://github.com/github/eslint-plugin-github/blob/master/lib/configs/react.js) from [GitHub's eslint plugin](https://github.com/github/eslint-plugin-github) to lint our JavaScript. To check your work before pushing, run:

```sh
yarn run lint
npm run lint
```

Or, you can use [npx] to run eslint on one or more specific files:
Expand All @@ -158,17 +158,17 @@ npx eslint src/**/MyComponent.js
**Protip:** The [eslint `--fix` flag](https://eslint.org/docs/user-guide/command-line-interface#--fix) can automatically fix most linting errors, such as those involving whitespace or incorrect ordering of object keys and imports. You can fix those issues across the entire project with:

```sh
yarn run lint -- --fix
npm run lint -- --fix
```

**Protip:** `yarn run lint -- --quiet` (or `npx eslint --quiet ...`) will suppress warnings so that you can focus on fixing errors.
**Protip:** `npm run lint -- --quiet` (or `npx eslint --quiet ...`) will suppress warnings so that you can focus on fixing errors.

### Testing

We test our components with [Jest](https://facebook.github.io/jest/) and [react-test-renderer](https://reactjs.org/docs/test-renderer.html). You can run the tests locally with `yarn test`. To run the tests as you work, run Jest in watch mode with:
We test our components with [Jest](https://facebook.github.io/jest/) and [react-test-renderer](https://reactjs.org/docs/test-renderer.html). You can run the tests locally with `npm test`. To run the tests as you work, run Jest in watch mode with:

```sh
yarn test -- --watch
npm test -- --watch
```

See [`src/__tests__/example.js`](src/__tests__/example.js) for examples of ways that we test our components.
Expand Down Expand Up @@ -234,7 +234,7 @@ We use [changesets](https://github.com/atlassian/changesets) to managing version
#### Using changesets to prepare and publish a release

1. When creating a new PR, changeset-bot will remind you to add a changeset if your change should trigger a new version number for the package.
2. To create a new changeset on your local machine, run `yarn changeset` and answer the prompts. If you are introducing multiple features in the PR, add a separate changeset for each.
2. To create a new changeset on your local machine, run `npx changeset` and answer the prompts. If you are introducing multiple features in the PR, add a separate changeset for each.
3. Push your new changes along with the changeset file to your PR; changeset-bot will show that there are valid changesets in the PR.
4. When the PR is ready, merge it to the main branch.
5. The changeset action will automatically create a new PR that bumps the version number appropriately, creates or updates `CHANGELOG.md`, and shows the release notes that will be used in the GitHub Release notes.
Expand All @@ -243,11 +243,11 @@ We use [changesets](https://github.com/atlassian/changesets) to managing version

## Troubleshooting

**`yarn start` fails with an error like `gatsby: command not found`**
**`npm start` fails with an error like `gatsby: command not found`**

Make sure to run `yarn` from inside the `docs/` subfolder _as well as_ the root folder.
Make sure to run `npm install` from inside the `docs/` subfolder _as well as_ the root folder.

**`yarn start` fails with a different error**
**`npm start` fails with a different error**

Ensure you are using the latest minor of Node.js for the major version specified in the `.nvmrc` file. For example, if `.nvmrc` contains `8`, make sure you're using the latest version of Node.js with the major version of 8.

Expand Down
4 changes: 2 additions & 2 deletions docs/content/index.md
Expand Up @@ -27,7 +27,7 @@ Check out [our getting started guide](/getting-started) for everything you need
To run `@primer/components` locally when adding or updating components:

1. Clone this repo: `git clone https://github.com/primer/components`
2. Install dependencies: `yarn`
3. Run the dev app: `yarn start`
2. Install dependencies: `npm install`
3. Run the dev app: `npm start`

> 👉 See [the contributing docs](https://github.com/primer/components/blob/main/contributor-docs/CONTRIBUTING.md) for more info on code style, testing, and coverage.