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
9 changes: 4 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ jobs:
if: ${{ always() && !failure() && !cancelled() }}
needs: [test, check-beachball-changefile]
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
Expand All @@ -94,19 +97,15 @@ jobs:
- name: Publish (development)
if: github.repository == 'RightCapitalHQ/phpdoc-parser' && github.base_ref == github.event.repository.default_branch
env:
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
HEAD_REF: ${{ github.head_ref }}
run: |
npm config set //registry.npmjs.org/:_authToken "${NPM_TOKEN}"
preid="${HEAD_REF//\//-}".${{ github.run_number }}.${{ github.run_attempt }}
npm --no-git-tag-version version prerelease --preid="${preid}"
pnpm publish --no-git-checks --access public --tag development

- name: Publish (main)
if: github.repository == 'RightCapitalHQ/phpdoc-parser' && github.ref_name == github.event.repository.default_branch
env:
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
run: |
npm config set //registry.npmjs.org/:_authToken "${NPM_TOKEN}"
git config --local user.email "npm-publisher@rightcapital.com"
git config --local user.name "GitHub Actions[bot]"
pnpm beachball publish --access public --yes -m 'chore(release): applying package updates'
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22.17.1
24.10.0
9 changes: 8 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
## Commands

### Development

- `pnpm test` - Run tests using Vitest
- `pnpm run build` - Build the TypeScript project
- `pnpm run clean` - Clean build artifacts
- `pnpm run eslint` - Run ESLint linting
- `pnpm run eslint:fix` - Run ESLint with auto-fix

### Package Management

- Uses pnpm as package manager (required, enforced by preinstall hook)
- `pnpm install` - Install dependencies

Expand All @@ -22,28 +24,33 @@ This is a TypeScript implementation of PHPDoc parser inspired by PHPStan's phpdo
### Core Components

**Lexical Analysis (`src/phpdoc-parser/lexer/`)**

- `lexer.ts` - Tokenizes PHPDoc strings using regex patterns
- Handles 20+ token types (identifiers, types, operators, brackets, etc.)

**Parsing (`src/phpdoc-parser/parser/`)**

- `php-doc-parser.ts` - Main parser that converts tokens to AST nodes
- `type-parser.ts` - Handles type parsing (generics, unions, intersections)
- `const-expr-parser.ts` - Parses constant expressions
- `token-iterator.ts` - Token stream management with savepoint/rollback
- `string-unescaper.ts` - String literal processing

**AST Nodes (`src/phpdoc-parser/ast/`)**

- Base interfaces: `node.ts`, `base-node.ts`
- **php-doc/**: PHPDoc-specific nodes (tags, text, parameters, etc.)
- **type/**: Type system nodes (unions, intersections, generics, arrays)
- **const-expr/**: Constant expression nodes (strings, numbers, arrays)

**Printing (`src/phpdoc-parser/printer/`)**

- `printer.ts` - Converts AST back to formatted PHPDoc
- `differ.ts` - Format-preserving printing with diff tracking
- Supports both clean formatting and original format preservation

**Transpilation (`src/phpdoc-parser/transpiler/`)**

- `php-doc-to-typescript-type-transpiler.ts` - Converts PHPDoc types to TypeScript

### Key Patterns
Expand All @@ -66,4 +73,4 @@ This is a TypeScript implementation of PHPDoc parser inspired by PHPStan's phpdo

- `src/index.ts` - Main entry point exporting all public APIs
- `tests/` - Test files organized by component (lexer, parser, printer, transpiler)
- TypeScript build configuration in `tsconfig.build.json`
- TypeScript build configuration in `tsconfig.build.json`
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"comment": "ci: migrate to trusted publishing",
"type": "none",
"packageName": "@rightcapital/phpdoc-parser",
"email": "im@pyonpyon.today",
"dependentChangeType": "none"
}