Skip to content

Commit e79955e

Browse files
committed
Initial Commit of wp-hooks-documentor
1 parent 2988309 commit e79955e

File tree

576 files changed

+62452
-2
lines changed

Some content is hidden

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

576 files changed

+62452
-2
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Update built branch
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
name: Build and Push
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
14+
15+
- name: Install dependencies
16+
run: npm install
17+
18+
- name: Build
19+
run: npm run build
20+
21+
- name: Create the build folder
22+
run: |
23+
mkdir build
24+
cp package.json build/
25+
mv dist build/
26+
mv lib build/
27+
28+
- name: Push
29+
uses: s0/git-publish-subdir-action@ac113f6bfe8896e85a373534242c949a7ea74c98 # develop
30+
env:
31+
REPO: self
32+
BRANCH: build
33+
FOLDER: build
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
MESSAGE: 'Build: ({sha}) {msg}'

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Dependencies
2+
node_modules/
3+
npm-debug.log*
4+
yarn-debug.log*
5+
yarn-error.log*
6+
7+
# Build output
8+
dist/
9+
*.tsbuildinfo
10+
11+
# IDE and editor files
12+
.idea/
13+
.vscode/
14+
*.swp
15+
*.swo
16+
.DS_Store
17+
18+
# Test coverage
19+
coverage/
20+
21+
# Environment variables
22+
.env
23+
.env.local
24+
.env.*.local
25+
26+
# Temporary files
27+
.hooks-temp/
28+
*.log
29+
wp-hooks-docs/

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v20

.prettierrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "es5",
4+
"singleQuote": true,
5+
"printWidth": 100,
6+
"tabWidth": 2,
7+
"useTabs": false,
8+
"endOfLine": "lf"
9+
}

README.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# WP Hooks Documentor
2+
3+
A powerful tool to generate beautiful documentation for WordPress plugin hooks.
4+
5+
## Features
6+
7+
- 📦 Automatically collects action and filter hooks from your WordPress plugin
8+
- 📝 Generates well-structured markdown documentation
9+
- 🌐 Creates a beautiful documentation site using Docusaurus
10+
- 🎨 Fully customizable theme
11+
- 🔍 Built-in search functionality
12+
13+
## Requirements
14+
15+
- Node.js >= 20.0
16+
- PHP >= 8.3
17+
18+
## Installation
19+
20+
```bash
21+
npm install -g wp-hooks-documentor
22+
```
23+
24+
## Quick Start
25+
26+
1. Initialize a new configuration file:
27+
```bash
28+
wp-hooks-documentor init
29+
```
30+
31+
2. Edit the generated `wp-hooks-doc.json` file to match your project settings.
32+
33+
3. Generate documentation:
34+
```bash
35+
wp-hooks-documentor generate
36+
```
37+
38+
## Configuration
39+
40+
The tool uses a single configuration file (`wp-hooks-doc.json`) to control all aspects of the documentation generation process. Here's a complete example with all available options:
41+
42+
```json
43+
{
44+
"title": "Plugin Hooks Documentation",
45+
"tagline": "Hooks Documentation for the plugin",
46+
"url": "https://example.com",
47+
"baseUrl": "/",
48+
"repoUrl": "https://github.com/username/repo",
49+
"organizationName": "username",
50+
"projectName": "repo",
51+
"input": ".",
52+
"ignoreFiles": [],
53+
"ignoreHooks": [],
54+
"outputDir": "./wp-hooks-docs",
55+
"templatesDir": "./.wp-hooks-docs/template",
56+
"footerStyle": "dark",
57+
"footerCopyright: `Copyright © 2025. Built with WP Hooks Documentor.`,
58+
}
59+
```
60+
61+
### Configuration Options
62+
63+
- `title`: Site title
64+
- `tagline`: Site tagline
65+
- `url`: Production URL
66+
- `baseUrl`: Base URL path
67+
- `repoUrl`: GitHub repository URL
68+
- `organizationName`: GitHub organization/username
69+
- `projectName`: GitHub repository name
70+
- `input`: Path to your WordPress plugin
71+
- `ignoreFiles`: Files to ignore
72+
- `ignoreHooks`: Hooks to ignore
73+
- `outputDir`: Where to export documentation site
74+
- `templatesDir`: Custom templates directory to customize overall documentation site.
75+
- `footerStyle`: Footer style, eg: dark or light
76+
- `footerCopyright`: Footer copyright text
77+
78+
## Commands
79+
80+
- `wp-hooks-documentor init`: Create a new configuration file
81+
- `wp-hooks-documentor generate`: Generate complete documentation
82+
83+
## Customization
84+
85+
### Theme
86+
87+
The documentation site uses Docusaurus, which means you can fully customize the theme. See the [Docusaurus documentation](https://docusaurus.io/docs/styling-layout) for more details.
88+

eslint.config.mjs

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import { defineConfig, globalIgnores } from 'eslint/config';
2+
import typescriptEslint from '@typescript-eslint/eslint-plugin';
3+
import globals from 'globals';
4+
import tsParser from '@typescript-eslint/parser';
5+
import path from 'node:path';
6+
import { fileURLToPath } from 'node:url';
7+
import js from '@eslint/js';
8+
import { FlatCompat } from '@eslint/eslintrc';
9+
10+
const __filename = fileURLToPath(import.meta.url);
11+
const __dirname = path.dirname(__filename);
12+
const compat = new FlatCompat({
13+
baseDirectory: __dirname,
14+
recommendedConfig: js.configs.recommended,
15+
allConfig: js.configs.all,
16+
});
17+
18+
export default defineConfig([
19+
globalIgnores(['node_modules/*', 'dist/*']),
20+
{
21+
extends: compat.extends(
22+
'eslint:recommended',
23+
'plugin:@typescript-eslint/recommended',
24+
'plugin:prettier/recommended'
25+
),
26+
27+
plugins: {
28+
'@typescript-eslint': typescriptEslint,
29+
},
30+
31+
languageOptions: {
32+
globals: {
33+
...globals.node,
34+
},
35+
36+
parser: tsParser,
37+
ecmaVersion: 'latest',
38+
sourceType: 'module',
39+
},
40+
41+
rules: {
42+
'@typescript-eslint/explicit-function-return-type': [
43+
'error',
44+
{
45+
allowExpressions: true,
46+
allowTypedFunctionExpressions: true,
47+
},
48+
],
49+
50+
'@typescript-eslint/no-explicit-any': 'warn',
51+
52+
'@typescript-eslint/no-unused-vars': [
53+
'error',
54+
{
55+
argsIgnorePattern: '^_',
56+
varsIgnorePattern: '^_',
57+
},
58+
],
59+
60+
'no-console': [
61+
'warn',
62+
{
63+
allow: ['warn', 'error', 'info', 'log'],
64+
},
65+
],
66+
},
67+
},
68+
]);

lib/php/composer.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"require": {
3+
"php": ">=8.3",
4+
"wp-hooks/generator": "dev-trunk"
5+
},
6+
"minimum-stability": "dev",
7+
"prefer-stable": true,
8+
"repositories": [
9+
{
10+
"type": "vcs",
11+
"url": "https://github.com/iamdharmesh/wp-hooks-generator"
12+
}
13+
]
14+
}

0 commit comments

Comments
 (0)