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

Update tooling build #90

Merged
merged 5 commits into from
Feb 22, 2025
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
20 changes: 15 additions & 5 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
{
"name": "Node.js & TypeScript",
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-22-bookworm",
"postCreateCommand": "yarn install"
"image": "mcr.microsoft.com/devcontainers/typescript-node:18",
"postCreateCommand": "pnpm install",
"customizations": {
"vscode": {
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"amazonwebservices.amazon-q-vscode",
"dracula-theme.theme-dracula",
"YoavBls.pretty-ts-errors",
"vscodevim.vim",
"vitest.explorer"
]
}
}
}
28 changes: 0 additions & 28 deletions .eslintrc.json

This file was deleted.

43 changes: 18 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,26 @@
name: CI
name: Node.js CI

on:
pull_request:
branches: [main]
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
ref: ${{env.GITHUB_REF}}
- uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'yarn'
cache-dependency-path: yarn.lock
- run: yarn install --frozen-lockfile
- run: yarn test:ci
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{env.GITHUB_REF}}
- uses: actions/setup-node@v4
- uses: actions/checkout@v2
- name: Set up pnpm
uses: pnpm/action-setup@v2
with:
node-version: '20.x'
cache: 'yarn'
cache-dependency-path: yarn.lock
- run: yarn install --frozen-lockfile
- run: yarn build
version: 7.x
- name: Install dependencies
run: pnpm install
- name: Run tests
run: pnpm test:ci
- name: Lint code
run: pnpm lint
- name: Build project
run: pnpm run build
42 changes: 22 additions & 20 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
name: Publish Package to npmjs
name: Publish to NPM

on:
release:
types: [published]
push:
tags:
- 'v*.*.*'

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v4
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
- uses: actions/checkout@v2
- name: Set up pnpm
uses: pnpm/action-setup@v2
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- run: yarn install --frozen-lockfile
- run: yarn build
- run: |
if [ "${{ github.event.release.prerelease }}" = "true" ]; then
npm publish --provenance --access public --tag beta
else
npm publish --provenance --access public
fi
version: 7.x
- name: Install dependencies
run: pnpm install
- name: Run tests
run: pnpm test:ci
- name: Lint code
run: pnpm lint
- name: Build project
run: pnpm run build
- name: Publish package to NPM
run: pnpm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ dist-ssr
*.sln
*.sw?

coverage
coverage
.husky
6 changes: 5 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"github.vscode-github-actions",
"bierner.markdown-preview-github-styles",
"esbenp.prettier-vscode",
"vitest.explorer"
"vitest.explorer",
"amazonwebservices.amazon-q-vscode",
"dracula-theme.theme-dracula",
"yoavbls.pretty-ts-errors",
"vscodevim.vim"
]
}
34 changes: 34 additions & 0 deletions eslint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import tseslint from '@typescript-eslint/eslint-plugin'
import tsParser from '@typescript-eslint/parser'
import prettier from 'eslint-plugin-prettier'
import eslintConfigPrettier from 'eslint-config-prettier'

export default [
{
ignores: ['dist/*', 'node_modules/*', 'build/*', 'coverage/*'],
},
{
files: ['*.ts', '*.tsx'],
languageOptions: {
parser: tsParser,
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
window: 'readonly',
document: 'readonly',
console: 'readonly',
module: 'readonly',
process: 'readonly',
},
},
plugins: {
'@typescript-eslint': tseslint,
prettier: prettier,
},
rules: {
...tseslint.configs.recommended.rules, // TypeScript rules
...eslintConfigPrettier.rules, // Prettier rules
'@typescript-eslint/no-unused-vars': 'warn',
},
},
]
69 changes: 40 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
{
"name": "osr-generators",
"version": "0.0.4-canary.1",
"description": "Generators for OSR-style tabletop roleplaying games",
"repository": {
"type": "github",
"url": "git+https://github.com/riccjohn/osr-generators.git"
},
"private": false,
"version": "0.0.4-canary.1",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"/dist"
],
"type": "module",
"author": {
"email": "riccjohn@gmail.com",
Expand All @@ -34,33 +29,49 @@
"roleplaying"
],
"license": "GPL-3.0-only",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"module": "dist/index.es.js",
"files": [
"dist"
],
"scripts": {
"build": "tsc",
"test": "vitest --coverage",
"test:ci": "vitest --coverage",
"lint": "eslint .",
"format": "prettier --write .",
"prepare": "husky"
"build": "tsup",
"test": "vitest",
"test:ci": "vitest run --coverage --passWithNoTests",
"lint": "eslint",
"format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md}\"",
"type-check": "tsc --noEmit",
"prepublishOnly": "pnpm run build"
},
"devDependencies": {
"@types/jest": "^29.5",
"@types/node": "^20.14",
"@typescript-eslint/eslint-plugin": "^7.3",
"@typescript-eslint/parser": "^7.3",
"@vitest/coverage-v8": "^1.4",
"eslint": "^8.57",
"eslint-config-prettier": "^9.1",
"eslint-plugin-prettier": "^5.1",
"husky": "^9.0",
"lint-staged": "^15.2",
"prettier": "3.3",
"ts-node": "^10.9.2",
"typescript": "^5.4.5",
"vite": "^5.2.0",
"vite-plugin-eslint": "^1.8",
"vitest": "^1.6"
"@types/jest": "^29.5.14",
"@typescript-eslint/eslint-plugin": "^8.24.1",
"@typescript-eslint/parser": "^8.24.1",
"@vitest/coverage-v8": "^3.0.6",
"eslint": "^9.21.0",
"eslint-config-prettier": "^10.0.1",
"eslint-define-config": "^2.1.0",
"eslint-plugin-prettier": "^5.2.3",
"husky": "^9.1.7",
"jiti": "^2.4.2",
"lint-staged": "^15.4.3",
"prettier": "^3.5.2",
"tsup": "^8.3.6",
"typescript": "^5.7.3",
"vite-tsconfig-paths": "^5.1.4",
"vitest": "^3.0.6"
},
"lint-staged": {
"**/*": "prettier --write --ignore-unknown"
"*.{js,jsx,ts,tsx,json,md}": [
"prettier --write",
"pnpm lint --fix",
"pnpm test:ci"
]
},
"pnpm": {
"onlyBuiltDependencies": [
"@swc/core"
]
}
}
Loading