Skip to content

Commit

Permalink
ci: release with pnpm publish instead of action
Browse files Browse the repository at this point in the history
  • Loading branch information
mcous committed Nov 27, 2024
1 parent a207bd1 commit edffb31
Show file tree
Hide file tree
Showing 15 changed files with 857 additions and 420 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dist
*.d.ts
6 changes: 5 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ module.exports = {
root: true,
extends: ['@viamrobotics/eslint-config'],
parserOptions: {
project: ['./tsconfig.json', './packages/*/tsconfig.json'],
tsconfigRootDir: __dirname,
projectService: true,
},
env: {
node: true,
},
};
27 changes: 8 additions & 19 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,21 @@ jobs:
needs: [check]
runs-on: ubuntu-latest
permissions:
# write permission required to push tags
contents: write
contents: read
id-token: write

steps:
- uses: actions/checkout@v4

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

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

- name: 'Publish ESLint config 🚀'
uses: ./.github/actions/publish
with:
package: ./packages/eslint-config
token: ${{ secrets.NPM_TOKEN }}

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

- name: 'Publish TypeScript config 🚀'
uses: ./.github/actions/publish
with:
package: ./packages/typescript-config
token: ${{ secrets.NPM_TOKEN }}
- name: 'Publish 🚀'
run: pnpm publish --recursive
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
node_modules
dist
*.d.cts
*.d.ts
*.tgz
*.tsbuildinfo
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ Install Node.js, pnpm, and development dependencies

### Publish

Publish a package to npm and add a tag to the repository
Publish a package to npm and add a tag to the repository.

> [!NOTE]
> Prefer `pnpm publish --recursive` if you are publishing packages from a monorepo.

```yaml
- name: Publish to npm
Expand Down Expand Up @@ -75,20 +78,17 @@ Once your development dependencies are installed, you can verify that all checks
# run all checks and builds
pnpm all
# check lints
pnpm check-lint
# lint
pnpm lint
# check types
pnpm check-types
pnpm check
# check formatting
pnpm check-format
# auto format
pnpm format
# build all packages
pnpm build
# auto-format (modifies files)
pnpm format
```

### Releasing
Expand Down
58 changes: 23 additions & 35 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,52 +7,40 @@
"license": "Apache-2.0",
"type": "module",
"scripts": {
"all": "concurrently -g pnpm:check-* pnpm:test pnpm:build",
"all": "concurrently -g pnpm:lint pnpm:test pnpm:build",
"test": "vitest run",
"test:watch": "vitest",
"check-format": "pnpm run _prettier --check",
"check-lint": "pnpm run _eslint",
"check-types": "tsc",
"build": "pnpm run --recursive --aggregate-output build",
"format": "pnpm run _prettier --write && pnpm run _eslint --fix",
"update-dependencies": "pnpm update --recursive --interactive --latest",
"_prettier": "prettier \"**/*.{js,cjs,ts,json,yaml,md}\"",
"_eslint": "eslint \".*.cjs\" \"**/*.{js,cjs,ts}\""
},
"packageManager": "[email protected]+sha256.24235772cc4ac82a62627cd47f834c72667a2ce87799a846ec4e8e555e2d4b8b",
"dependencies": {
"@viamrobotics/eslint-config": "workspace:*",
"@viamrobotics/prettier-config": "workspace:*",
"@viamrobotics/typescript-config": "workspace:*"
"lint": "eslint . && prettier . --check",
"build": "tsc -b",
"format": "prettier . --write && eslint . --fix",
"update-dependencies": "pnpm update --recursive --interactive --latest"
},
"packageManager": "[email protected]+sha256.06e65a4965baff6d6097f9c8f75c35f6d420974dbc03d775009056a69edfd271",
"devDependencies": {
"@types/node": "^22.9.0",
"@types/node": "^22.10.0",
"@types/semver": "^7.5.8",
"@typescript-eslint/eslint-plugin": "^8.13.0",
"@typescript-eslint/parser": "^8.13.0",
"@typescript-eslint/eslint-plugin": "^8.16.0",
"@typescript-eslint/parser": "^8.16.0",
"@viamrobotics/eslint-config": "workspace:*",
"@viamrobotics/prettier-config": "workspace:*",
"@viamrobotics/typescript-config": "workspace:*",
"concurrently": "^9.1.0",
"eslint": "^8.57.0",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest-dom": "^5.4.0",
"eslint-plugin-jest-dom": "^5.5.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-svelte": "^2.46.0",
"eslint-plugin-tailwindcss": "^3.17.5",
"eslint-plugin-testing-library": "^6.4.0",
"eslint-plugin-unicorn": "^56.0.0",
"eslint-plugin-testing-library": "^7.0.0",
"eslint-plugin-unicorn": "^56.0.1",
"eslint-plugin-vitest": "^0.5.4",
"prettier": "^3.3.3",
"prettier-plugin-svelte": "^3.2.7",
"prettier-plugin-tailwindcss": "^0.6.8",
"prettier": "^3.4.1",
"prettier-plugin-svelte": "^3.3.2",
"prettier-plugin-tailwindcss": "^0.6.9",
"semver": "^7.6.3",
"typescript": "^5.6.3",
"vitest": "^2.1.4"
},
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
"svelte",
"tailwindcss"
]
}
"svelte": "^5.2.9",
"tailwindcss": "3.4.15",
"typescript": "^5.7.2",
"vitest": "^2.1.6"
}
}
10 changes: 4 additions & 6 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "@viamrobotics/eslint-config",
"publishConfig": {
"access": "public"
"access": "public",
"provenance": true
},
"version": "0.7.0",
"version": "0.7.1",
"description": "Common ESLint configuration for Viam projects.",
"files": [
"**/*",
Expand All @@ -27,9 +28,6 @@
"default": "./svelte.cjs"
}
},
"scripts": {
"build": "tsc"
},
"repository": {
"type": "git",
"url": "git+https://github.com/viamrobotics/js-config.git",
Expand All @@ -49,7 +47,7 @@
"eslint-plugin-simple-import-sort": ">=12 <13",
"eslint-plugin-svelte": ">=2 <3",
"eslint-plugin-tailwindcss": ">=3 <4",
"eslint-plugin-testing-library": ">=6 <7",
"eslint-plugin-testing-library": ">=6 <8",
"eslint-plugin-unicorn": ">=47 <57",
"eslint-plugin-vitest": ">=0.5 <0.6"
},
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-config/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "@viamrobotics/typescript-config/base.json",
"compilerOptions": {
"types": ["node"],
"composite": true,
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "dist"
Expand Down
5 changes: 4 additions & 1 deletion packages/prettier-config/base.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

module.exports = {
/** @satisfies {import('prettier').Config} */
const config = {
// overrides
singleQuote: true,
jsxSingleQuote: true,
Expand All @@ -22,3 +23,5 @@ module.exports = {
endOfLine: 'lf',
embeddedLanguageFormatting: 'auto',
};

module.exports = config;
8 changes: 3 additions & 5 deletions packages/prettier-config/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "@viamrobotics/prettier-config",
"publishConfig": {
"access": "public"
"access": "public",
"provenance": true
},
"version": "0.3.5",
"version": "0.3.6",
"description": "Common Prettier configuration for Viam projects.",
"type": "commonjs",
"files": [
Expand All @@ -28,9 +29,6 @@
"default": "./svelte.cjs"
}
},
"scripts": {
"build": "tsc"
},
"repository": {
"type": "git",
"url": "git+https://github.com/viamrobotics/js-config.git",
Expand Down
5 changes: 4 additions & 1 deletion packages/prettier-config/svelte.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

const baseConfig = require('./base.cjs');

module.exports = {
/** @satisfies {import('prettier').Config} */
const config = {
...baseConfig,
plugins: ['prettier-plugin-svelte', 'prettier-plugin-tailwindcss'],
svelteIndentScriptAndStyle: false,
tailwindAttributes: ['cx'],
tailwindFunctions: ['classnames', 'cx'],
};

module.exports = config;
3 changes: 2 additions & 1 deletion packages/prettier-config/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
"extends": "@viamrobotics/typescript-config/base.json",
"compilerOptions": {
"types": ["node"],
"composite": true,
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "dist"
},
"include": ["**/*.cjs"]
"include": ["*.cjs"]
}
5 changes: 3 additions & 2 deletions packages/typescript-config/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "@viamrobotics/typescript-config",
"publishConfig": {
"access": "public"
"access": "public",
"provenance": true
},
"version": "0.1.0",
"version": "0.1.1",
"description": "Common TypeScript configuration for Viam projects.",
"files": [
"**/*",
Expand Down
Loading

0 comments on commit edffb31

Please sign in to comment.