Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
migrate to pnpm and buildkite-changsets
Browse files Browse the repository at this point in the history
  • Loading branch information
samchungy committed Mar 20, 2024
1 parent c0b256c commit e72068e
Show file tree
Hide file tree
Showing 12 changed files with 7,660 additions and 8,162 deletions.
6 changes: 0 additions & 6 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,3 @@ node_modules*/
npm-debug.log
yarn-error.log
# end managed by skuba

# Ignore .npmrc. This is no longer managed by skuba as pnpm projects use a managed .npmrc.
# IMPORTANT: if migrating to pnpm, remove this line and add an .npmrc IN THE SAME COMMIT.
# You can use `skuba format` to generate the file or otherwise commit an empty file.
# Doing so will conflict with a local .npmrc and make it more difficult to unintentionally commit auth secrets.
.npmrc
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

# Configured by Renovate
package.json
yarn.lock
pnpm.lock.yaml
20 changes: 17 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,37 @@ jobs:
name: Publish & Deploy
permissions:
contents: write
id-token: write
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.SEEK_OSS_CI_GITHUB_TOKEN }}

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Set up pnpm
run: corepack enable pnpm

- name: Install dependencies
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile

- name: Publish to npm
run: yarn release
uses: changesets/action@v1
with:
publish: pnpm release
version: pnpm stage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.SEEK_OSS_CI_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.SEEK_OSS_CI_NPM_TOKEN }}

- name: Deploy to GitHub Pages
run: pnpm run deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IS_GITHUB_PAGES: true
41 changes: 41 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Snapshot

on: workflow_dispatch

permissions: {}

jobs:
publish:
name: Publish Snapshot
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.SEEK_OSS_CI_GITHUB_TOKEN }}

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Set up pnpm
run: corepack enable pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Setup jq
uses: dcarbone/[email protected]

- name: Publish to npm
uses: seek-oss/changesets-snapshot@v0
with:
pre-version: ./scripts/snapshot-pre-version.sh
pre-publish: ./scripts/snapshot-pre-publish.sh
env:
GITHUB_TOKEN: ${{ secrets.SEEK_OSS_CI_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.SEEK_OSS_CI_NPM_TOKEN }}
46 changes: 39 additions & 7 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,48 @@
name: Validate

on:
- pull_request
- push
pull_request:

push:
branches-ignore:
- master

workflow_run:
branches:
- master
types:
- completed
workflows:
- Release

permissions: {}

jobs:
validate:
name: Lint
core:
name: Lint & Test
permissions:
checks: write
runs-on: ubuntu-latest
steps:
- name: Check out repo
- if: >-
github.actor != 'dependabot[bot]' && (
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == github.repository
)
name: Check out repo
uses: actions/checkout@v4
with:
token: ${{ secrets.SEEK_OSS_CI_GITHUB_TOKEN || github.token }}
- if: >-
github.actor == 'dependabot[bot]' || (
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name != github.repository
)
name: Check out repo
uses: actions/checkout@v4
# We don't share secrets with Dependabot nor forks.
- name: Set Git user
run: |
git config user.name seek-oss-ci
Expand All @@ -28,8 +53,15 @@ jobs:
with:
node-version: 20.x

- name: Set up pnpm
run: corepack enable pnpm

- name: Install dependencies
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile

- name: Lint
run: yarn lint
run: pnpm lint

- if: github.event_name == 'push'
name: Dry-run changelog versioning
run: pnpm changeset version
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,3 @@ npm-debug.log
package-lock.json
yarn-error.log
# end managed by skuba

# Ignore .npmrc. This is no longer managed by skuba as pnpm projects use a managed .npmrc.
# IMPORTANT: if migrating to pnpm, remove this line and add an .npmrc IN THE SAME COMMIT.
# You can use `skuba format` to generate the file or otherwise commit an empty file.
# Doing so will conflict with a local .npmrc and make it more difficult to unintentionally commit auth secrets.
.npmrc
8 changes: 8 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# managed by skuba
public-hoist-pattern[]="@types*"
public-hoist-pattern[]="*eslint*"
public-hoist-pattern[]="*prettier*"
public-hoist-pattern[]="esbuild"
public-hoist-pattern[]="jest"
public-hoist-pattern[]="tsconfig-seek"
# end managed by skuba
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ If you're on Windows, we recommend the [Windows Subsystem for Linux].

First, some JavaScript tooling:

- Node.js 12+
- Yarn 1.x
- Node.js
- pnpm

Next, install npm dependencies:

```shell
yarn install
pnpm install
```

### Git workflow
Expand Down Expand Up @@ -117,14 +117,14 @@ You can then copy those changes back into [index.js](/index.js).
Format your code once you're happy with it:

```shell
yarn format
pnpm format
```

We run linting in CI,
but consider running this command locally for a faster feedback loop:

```shell
yarn lint
pnpm lint
```

## Releases
Expand Down
40 changes: 1 addition & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,44 +14,6 @@ Shareable ESLint config for **[skuba]**.
- [Release](#release)
- [Contributing](https://github.com/seek-oss/eslint-config-skuba/blob/master/CONTRIBUTING.md)

## Usage

**eslint-config-skuba** is bundled with **skuba**.

You can start a new project:

```shell
npx skuba init
```

Or bootstrap an existing one:

```shell
# install skuba
yarn add --dev --exact skuba

# bootstrap your project
yarn skuba configure
```

Either method will leave you with an `.eslintrc.js`:

```typescript
module.exports = {
extends: ['skuba'],
};
```

Some scripts will be defined via `package.json`:

```shell
# run ESLint in fix mode
yarn format

# run ESLint in check mode
yarn lint
```

## Release

This package is published to the public npm registry with a GitHub Actions [release workflow].
Expand All @@ -73,7 +35,7 @@ It depends on this repo being hosted on [seek-oss] with access to the `SEEK_OSS_
### Releasing latest

Commits to the `master` branch will be released with the `latest` tag,
which is the default used when running `npm install` or `yarn install`.
which is the default used when running `pnpm install`.

### Releasing other dist-tags

Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
"eslint-plugin-yml": "^1.5.0"
},
"devDependencies": {
"@changesets/cli": "2.27.1",
"@changesets/get-github-info": "0.6.0",
"eslint": "8.56.0",
"skuba": "7.5.1",
"typescript": "5.3.3"
Expand All @@ -43,6 +45,7 @@
"eslint": ">= 7.2",
"typescript": ">= 3.9"
},
"packageManager": "[email protected]",
"skuba": {
"entryPoint": "index.js",
"template": "oss-npm-package",
Expand Down
Loading

0 comments on commit e72068e

Please sign in to comment.