Skip to content
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
36 changes: 36 additions & 0 deletions .github/actions/publish/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'Publish to NPM'
description: 'Publish a package to NPM'

inputs:
name:
description: 'Package name, used to tag release commits'
required: true

package:
description: 'Path to package.json'
required: true

token:
description: 'NPM auth token'
required: true

runs:
using: 'composite'
steps:
- id: publish
name: Publish package
uses: JS-DevTools/npm-publish@1641d030cee266f093503c555ee9303ae7aede16
with:
package: ${{ input.package }}
token: ${{ inputs.token }}

- name: Tag commit
if: ${{ steps.publish.outputs.type != 'none' }}
shell: bash
env:
TAG_NAME: ${{ inputs.name }}@${{ steps.publish.outputs.version }}
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git tag -a "${{ env.TAG_NAME }}" -m "${{ env.TAG_NAME }}"
git push origin "${{ env.TAG_NAME }}"
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,15 @@ inputs:
description: 'Node.js version to install'
default: '18'

registry-url:
description: 'Registry URL (required for publish)'
required: false

runs:
using: 'composite'
steps:
- name: 'Install pnpm'
uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd

- name: 'Install Node.js'
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}
registry-url: ${{ inputs.registry-url }}
cache: pnpm
cache: npm

- name: 'Install development dependencies'
shell: bash
run: pnpm install --frozen-lockfile
run: npm ci --audit=false
32 changes: 22 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: ./.github/actions/setup

- name: 'Run checks ✅'
run: pnpm all
run: npm run all

publish:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
Expand All @@ -33,18 +33,30 @@ jobs:

- name: 'Install 🔧'
uses: ./.github/actions/setup
with:
registry-url: 'https://registry.npmjs.org'

- name: 'Build 🏗️'
run: pnpm build
run: npm run build

- name: 'Configure Git for publish 🌴'
run: |
git config user.name github-actions
git config user.email github-actions@github.com

- name: 'Publish packages 🚀'
run: ./scripts/publish.sh
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: 'Publish ESLint config 🚀'
uses: ./.github/actions/publish
with:
name: '@viamrobotics/eslint-config'
package: packages/eslint-config/package.json
token: ${{ secrets.NPM_TOKEN }}

- name: 'Publish Prettier config 🚀'
uses: ./.github/actions/publish
with:
name: '@viamrobotics/prettier-config'
package: packages/prettier-config/package.json
token: ${{ secrets.NPM_TOKEN }}

- name: 'Publish TypeScript config 🚀'
uses: ./.github/actions/publish
with:
name: '@viamrobotics/typescript-config'
package: packages/typescript-config/package.json
token: ${{ secrets.NPM_TOKEN }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
node_modules
pnpm-publish-summary.json
*.d.cts
*.tgz
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pnpm-lock.yaml
package-lock.json
20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,40 +20,36 @@ Shared configuration for JavaScript and TypeScript tools:

## Contributing

We use [corepack][] and [pnpm][] to manage development dependencies and tasks for this repository. To get started, enable corepack (if you haven't already), clone the repository, and install the project's development dependencies. Node.js v18 or higher is required.
Node.js v18 or higher is required to develop on this repository. To get started, clone the repository and install the project's development dependencies. .

```shell
corepack enable
git clone https://github.com/viamrobotics/js-config.git
cd js-config
pnpm install
npm install
```

Once your development dependencies are installed, you can verify that all checks and tests are passing:

```shell
# run all checks and builds
pnpm all
npm run all

# check lints
pnpm check-lint
npm run check-lint

# check types
pnpm check-types
npm run check-types

# check formatting
pnpm check-format
npm run check-format

# build all packages
pnpm build
npm run build

# auto-format (modifies files)
pnpm format
npm run format
```

[corepack]: https://nodejs.org/docs/latest-v18.x/api/corepack.html
[pnpm]: https://pnpm.io/

### Releasing

Modules in this repository are continuously deployed to npm from the `main` branch. To trigger a release, create a commit that bumps `version` in one or more `package.json` files and create a pull request to merge that commit into `main`.
Loading