Skip to content

Commit f4fa0b5

Browse files
committed
refactor: consolidate and streamline documentation pipeline
- Create unified pipeline script that runs steps in sequence - Move pipeline scripts to /scripts/publish directory - Add new /scripts/ingest directory for processing new patterns - Update documentation: - Add detailed scripts/README.md - Update CONTRIBUTING.md with new workflow - Improve template.mdx with better guidance - Remove deprecated scripts: - extract-examples.ts - restore-examples.ts - run-all-ts.sh
1 parent 3b28ae7 commit f4fa0b5

53 files changed

Lines changed: 12931 additions & 5930 deletions

Some content is hidden

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

CONTRIBUTING.md

Lines changed: 96 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,102 @@
33
Thank you for your interest in contributing! This project aims to be the best
44
community-driven knowledge base for Effect-TS patterns. Every contribution helps.
55

6-
## How to Add a New Pattern
7-
8-
1. **Create a new file** in the `/content` directory.
9-
2. **Name the file** using a descriptive, kebab-case name, like
10-
`use-gen-for-business-logic.mdx`.
11-
3. **Copy the contents** from the `template.mdx` file into your new file.
12-
4. **Fill out the template** with the details of your pattern.
13-
5. **Submit a Pull Request.**
6+
## Documentation Pipeline
7+
8+
This project uses a two-stage pipeline system:
9+
10+
### 1. Ingest Stage
11+
12+
New patterns start in `/content/new` and go through validation:
13+
14+
- **Source Files**
15+
- TypeScript examples in `/content/new/src/*.ts`
16+
- MDX documentation in `/content/new/*.mdx`
17+
- Run `npm run ingest` to process
18+
19+
### 2. Publishing Pipeline
20+
21+
The main pipeline has five sequential steps:
22+
23+
1. **Test** (`/content/src`)
24+
- Run all TypeScript examples
25+
- Verify code correctness
26+
27+
2. **Publish** (`/content/raw``/content/published`)
28+
- Convert raw MDX to published format
29+
- Expand TypeScript examples inline
30+
31+
3. **Validate** (`/content/published`)
32+
- Check frontmatter and sections
33+
- Verify code block consistency
34+
35+
4. **Generate** (`README.md`)
36+
- Create main README
37+
- Group patterns by use case
38+
39+
5. **Rules** (`/rules`)
40+
- Generate AI coding rules
41+
- Multiple output formats
42+
43+
### Available Commands
44+
45+
- `npm run ingest` - Process new patterns from `/content/new`
46+
- `npm run pipeline` - Run all publishing steps in sequence
47+
- `npm run all` - Alias for pipeline
48+
49+
Individual pipeline steps:
50+
- `npm run test` - Run TypeScript examples
51+
- `npm run publish` - Convert raw to published MDX
52+
- `npm run validate` - Validate published files
53+
- `npm run generate` - Generate README
54+
- `npm run rules` - Generate AI rules
55+
56+
### Validation Rules
57+
58+
All patterns must have:
59+
1. Valid frontmatter with required fields
60+
2. A Good Example section with TypeScript code
61+
3. An Anti-Pattern section
62+
4. Either an Explanation or Rationale section
63+
5. TypeScript code that matches the source file
64+
65+
## Adding New Patterns
66+
67+
### Step 1: Create New Pattern Files
68+
69+
Create your new pattern in the `/content/new` directory:
70+
71+
1. Create the TypeScript example in `/content/new/src/{pattern-id}.ts`
72+
2. Create the MDX documentation in `/content/new/{pattern-id}.mdx`
73+
74+
### Step 2: Run the Ingest Process
75+
76+
Run `npm run ingest` to process your new pattern. This will:
77+
1. Validate your pattern files
78+
2. Move the TypeScript file to `/content/src`
79+
3. Move the MDX file to `/content/raw`
80+
81+
If validation fails, fix the issues and try again.
82+
83+
### Step 3: Run the Publishing Pipeline
84+
85+
1. **Fill out your pattern**
86+
- Add your TypeScript code to the `.ts` file
87+
- Fill out the MDX template with your pattern details
88+
- Make sure to include all required sections
89+
90+
2. **Run the pipeline**
91+
```bash
92+
npm run pipeline
93+
```
94+
This will:
95+
- Run your TypeScript example
96+
- Convert and validate your MDX
97+
- Update README and rules
98+
99+
3. **Submit a Pull Request**
100+
- Verify all pipeline steps passed
101+
- Include both your source files and generated files
14102

15103
## The Pattern Structure
16104

README.md

Lines changed: 135 additions & 257 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
"private": true,
55
"description": "A community-driven knowledge base for Effect-TS patterns.",
66
"scripts": {
7-
"all-ts": "bash scripts/run-all-ts.sh",
8-
"dev": "echo 'Development server not yet implemented'",
9-
"build": "echo 'Build script not yet implemented'",
10-
"start": "echo 'Start script not yet implemented'",
11-
"readme": "bun scripts/generate_readme.ts",
12-
"rules": "bun scripts/generate_rules.ts",
7+
"publish": "bun run scripts/publish/publish.ts",
8+
"validate": "bun run scripts/publish/validate.ts",
9+
"generate": "bun run scripts/publish/generate.ts",
10+
"test": "bun run scripts/publish/test.ts",
11+
"rules": "bun run scripts/publish/rules.ts",
12+
"ingest": "bun run scripts/ingest/process.ts",
13+
"pipeline": "bun run scripts/publish/pipeline.ts",
14+
"all": "bun run pipeline",
1315
"lint:examples": "eslint \"content/src/**/*.ts\"",
1416
"typecheck:examples": "tsc --noEmit"
1517
},

0 commit comments

Comments
 (0)