Skip to content

Commit 6248e97

Browse files
committed
added tests
1 parent 09d9d55 commit 6248e97

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+8379
-201
lines changed

.github/workflows/test.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macos-latest]
16+
node-version: [18, 20, 22]
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
cache: 'npm'
27+
28+
- name: Install dependencies
29+
run: npm ci
30+
31+
- name: Run unit tests
32+
run: npm test
33+
34+
- name: Run integration tests
35+
run: npm run test:e2e
36+
37+
- name: Generate coverage report
38+
if: matrix.os == 'ubuntu-latest' && matrix.node-version == 20
39+
run: npm run test:coverage
40+
41+
- name: Upload coverage to Codecov
42+
if: matrix.os == 'ubuntu-latest' && matrix.node-version == 20
43+
uses: codecov/codecov-action@v4
44+
with:
45+
token: ${{ secrets.CODECOV_TOKEN }}
46+
files: ./coverage/lcov.info
47+
fail_ci_if_error: true
48+
49+
lint:
50+
runs-on: ubuntu-latest
51+
52+
steps:
53+
- name: Checkout code
54+
uses: actions/checkout@v4
55+
56+
- name: Setup Node.js
57+
uses: actions/setup-node@v4
58+
with:
59+
node-version: 20
60+
cache: 'npm'
61+
62+
- name: Install dependencies
63+
run: npm ci
64+
65+
- name: Check package.json validity
66+
run: npm run test:manual --dry-run || true # Just validate package structure
67+
68+
security:
69+
runs-on: ubuntu-latest
70+
71+
steps:
72+
- name: Checkout code
73+
uses: actions/checkout@v4
74+
75+
- name: Setup Node.js
76+
uses: actions/setup-node@v4
77+
with:
78+
node-version: 20
79+
cache: 'npm'
80+
81+
- name: Install dependencies
82+
run: npm ci
83+
84+
- name: Run security audit
85+
run: npm audit --audit-level moderate

CLAUDE.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
44

55
## Project Overview
66

7-
md2pdf is a generic, configurable Markdown to PDF conversion package with CLI support. It features a theme system, project initialization, and flexible configuration options for different document types and styling needs.
7+
markdown-to-pdf is a generic, configurable Markdown to PDF conversion package with CLI support. It features a theme system, project initialization, and flexible configuration options for different document types and styling needs.
88

99
## Core Commands
1010

1111
### CLI Commands
1212
```bash
1313
# Convert a markdown file
14-
md2pdf convert document.md
14+
markdown-to-pdf convert document.md
1515

1616
# Initialize new project
17-
md2pdf init my-project
17+
markdown-to-pdf init my-project
1818

1919
# List available themes
20-
md2pdf themes
20+
markdown-to-pdf themes
2121

2222
# Development/testing
2323
npm run test # Convert test.md using CLI
@@ -39,7 +39,7 @@ node generate-pdf.js test.md
3939
### Configuration System
4040
- **Config Manager** (`lib/config-manager.js`): Loads project configs and resolves themes
4141
- **Theme System**: `themes/` directory with built-in themes (default, minimal, academic)
42-
- **Project Configs**: Support for `md2pdf.config.json`, `md2pdf.config.js`, `.md2pdf.json`
42+
- **Project Configs**: Support for `markdown-to-pdf.config.json`, `markdown-to-pdf.config.js`, `.markdown-to-pdf.json`
4343

4444
### Processing Pipeline
4545
1. **Input Processing** (`lib/input-markdown-processor.js`): Parses frontmatter and processes markdown

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
# md2pdf
1+
# markdown-to-pdf
22

33
A flexible Markdown to PDF converter with support for custom themes, title pages, and author management.
44

55
## Installation
66

77
```bash
8-
npm install -g md2pdf
8+
npm install -g markdown-to-pdf
99
```
1010

1111
Or use directly without installation:
1212
```bash
13-
npx md2pdf convert document.md
13+
npx markdown-to-pdf convert document.md
1414
```
1515

1616
## Quick Start
1717

1818
### Convert a single file
1919
```bash
20-
md2pdf convert document.md
20+
markdown-to-pdf convert document.md
2121
```
2222

2323
### Initialize a new project
2424
```bash
25-
md2pdf init my-docs
25+
markdown-to-pdf init my-docs
2626
cd my-docs
27-
md2pdf convert docs/example.md
27+
markdown-to-pdf convert docs/example.md
2828
```
2929

3030
## CLI Commands
@@ -41,13 +41,13 @@ Convert a Markdown file to PDF
4141

4242
**Examples:**
4343
```bash
44-
md2pdf convert document.md
45-
md2pdf convert document.md -o output/final.pdf
46-
md2pdf convert document.md --theme minimal --html
44+
markdown-to-pdf convert document.md
45+
markdown-to-pdf convert document.md -o output/final.pdf
46+
markdown-to-pdf convert document.md --theme minimal --html
4747
```
4848

4949
### `init [name]`
50-
Initialize a new md2pdf project with sample files
50+
Initialize a new markdown-to-pdf project with sample files
5151

5252
**Options:**
5353
- `-t, --theme <name>` - Theme to use (default: 'default')
@@ -58,10 +58,10 @@ List available themes
5858
## Configuration
5959

6060
Projects can be configured using:
61-
- `md2pdf.config.json` (recommended)
62-
- `md2pdf.config.js`
63-
- `.md2pdf.json`
64-
- `package.json` (in `md2pdf` section)
61+
- `markdown-to-pdf.config.json` (recommended)
62+
- `markdown-to-pdf.config.js`
63+
- `.markdown-to-pdf.json`
64+
- `package.json` (in `markdown-to-pdf` section)
6565

6666
**Example configuration:**
6767
```json

bin/cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { initProject } from '../lib/project-init.js';
1010
const program = new Command();
1111

1212
program
13-
.name('md2pdf')
13+
.name('markdown-to-pdf')
1414
.description('Convert Markdown files to PDFs with custom themes and templates')
1515
.version('1.0.0');
1616

0 commit comments

Comments
 (0)