ghostcn 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,171 @@
1
+ # ghostcn
2
+
3
+ <p align="center">
4
+ <strong>The <code>shadcn/ui</code> for Ghost CMS themes.</strong><br>
5
+ Beautiful, accessible, copy-pasteable Handlebars partials and stylesheets for modern Ghost theme development.
6
+ </p>
7
+
8
+ <p align="center">
9
+ <a href="https://www.npmjs.com/package/ghostcn"><img src="https://img.shields.io/npm/v/ghostcn?color=6366f1&style=flat-square" alt="npm version" /></a>
10
+ <a href="https://www.npmjs.com/package/ghostcn"><img src="https://img.shields.io/npm/dm/ghostcn?color=3b82f6&style=flat-square" alt="npm downloads" /></a>
11
+ <a href="https://ghost.org"><img src="https://img.shields.io/badge/Ghost-%3E%3D5.0.0-15171a?style=flat-square" alt="Ghost Version" /></a>
12
+ <a href="https://gscan.ghost.org"><img src="https://img.shields.io/badge/gscan-100%25%20valid-22c55e?style=flat-square" alt="gscan validation" /></a>
13
+ <a href="https://github.com/Geekbits-Org/ghost-ui/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue?style=flat-square" alt="License" /></a>
14
+ </p>
15
+
16
+ ---
17
+
18
+ ## What is ghostcn?
19
+
20
+ **ghostcn** brings the modern component distribution model to **Ghost CMS**.
21
+
22
+ Instead of installing cumbersome plugins or monolithic npm modules that lock down your markup, ghostcn injects clean, production-ready **Handlebars (`.hbs`) partials** and **CSS** directly into your theme repository.
23
+
24
+ You own the code. You customize the classes. Zero vendor lock-in.
25
+
26
+ ---
27
+
28
+ ## Features
29
+
30
+ - 📦 **Theme-Native**: Directly installs raw Handlebars partials and CSS into your theme folders.
31
+ - ⚡ **Zero Latency**: Bundled offline registry ensures blazing fast installation even without internet.
32
+ - 🎯 **Interactive Multi-Select**: Run `npx ghostcn add` without arguments to select and batch-install multiple components interactively.
33
+ - 🎨 **Tailwind & Vanilla CSS**: Pre-styled with utility classes and full Vanilla CSS stylesheets with Ghost CSS custom properties.
34
+ - 🔑 **Ghost Members API**: Native support for Ghost attributes (`data-members-form="subscribe"`, Portal checkout triggers).
35
+ - 🛡️ **100% gscan Validated**: All components strictly adhere to Ghost theme guidelines and pass official `gscan` checks with 0 errors.
36
+
37
+ ---
38
+
39
+ ## Available Components
40
+
41
+ | Component | Description | Files |
42
+ | :--- | :--- | :--- |
43
+ | **`newsletter-form`** | Native Ghost members subscription form with success/error states | `newsletter-form.hbs`, `newsletter-form.css` |
44
+ | **`pricing-table`** | Membership tiers (Free, Monthly, Annual) with native Portal checkout triggers | `pricing-table.hbs`, `pricing-table.css` |
45
+ | **`author-card`** | Author bio box with avatar, biography, social links, and post counts | `author-card.hbs`, `author-card.css` |
46
+ | **`post-card`** | Post loop preview card with feature image, tags, excerpt, and reading time | `post-card.hbs`, `post-card.css` |
47
+
48
+ ---
49
+
50
+ ## Quick Start
51
+
52
+ ### 1. Initialize your Ghost Theme
53
+
54
+ Run the `init` command from the root of any Ghost theme (must have `engines.ghost` in its `package.json`):
55
+
56
+ ```bash
57
+ npx ghostcn init
58
+ ```
59
+
60
+ Or pass `-y` to use default paths non-interactively:
61
+ ```bash
62
+ npx ghostcn init -y
63
+ ```
64
+
65
+ This creates a `components.json` configuration file:
66
+ ```json
67
+ {
68
+ "style": "tailwind",
69
+ "aliases": {
70
+ "partials": "partials/components",
71
+ "styles": "assets/css/components"
72
+ }
73
+ }
74
+ ```
75
+
76
+ ### 2. Browse Components
77
+
78
+ List all available components in the registry:
79
+
80
+ ```bash
81
+ npx ghostcn list
82
+ ```
83
+
84
+ ### 3. Add Components
85
+
86
+ Add a specific component:
87
+ ```bash
88
+ npx ghostcn add newsletter-form
89
+ ```
90
+
91
+ Or run `add` without arguments to pick interactively from a checklist:
92
+ ```bash
93
+ npx ghostcn add
94
+ ```
95
+
96
+ To overwrite existing files without prompts:
97
+ ```bash
98
+ npx ghostcn add pricing-table -y
99
+ ```
100
+
101
+ ### 4. Use in your Templates
102
+
103
+ Include the installed partial anywhere in your Handlebars templates:
104
+
105
+ ```handlebars
106
+ {{!-- Newsletter Form --}}
107
+ {{> "components/newsletter-form" title="Subscribe to our Newsletter"}}
108
+
109
+ {{!-- Pricing & Membership Table --}}
110
+ {{> "components/pricing-table" title="Choose your membership plan"}}
111
+
112
+ {{!-- Author Card --}}
113
+ {{#primary_author}}
114
+ {{> "components/author-card"}}
115
+ {{/primary_author}}
116
+
117
+ {{!-- Post Loop --}}
118
+ {{#foreach posts}}
119
+ {{> "components/post-card"}}
120
+ {{/foreach}}
121
+ ```
122
+
123
+ ---
124
+
125
+ ## Project Structure
126
+
127
+ ```text
128
+ ghostcn/
129
+ ├── packages/
130
+ │ └── cli/ # ghostcn CLI (Commander, Prompts, TypeScript, tests)
131
+ ├── registry/
132
+ │ ├── index.json # Registry catalog index
133
+ │ └── components/ # Component manifests and templates
134
+ ├── example-theme/ # Sample Ghost theme showing integration
135
+ └── .github/workflows/ # Automated CI pipeline
136
+ ```
137
+
138
+ ---
139
+
140
+ ## Development & Testing
141
+
142
+ ```bash
143
+ # Install dependencies
144
+ npm install
145
+
146
+ # Build CLI and bundle registry
147
+ npm run build
148
+
149
+ # Run automated tests
150
+ npm test
151
+
152
+ # Verify theme compatibility with Ghost validator
153
+ cd example-theme
154
+ npx gscan .
155
+ ```
156
+
157
+ ---
158
+
159
+ ## Troubleshooting
160
+
161
+ ### Clearing npx cache
162
+ If you've previously run an older version of `ghostcn`, npx may cache it locally. To always run the latest version:
163
+ ```bash
164
+ npx ghostcn@latest <command>
165
+ ```
166
+
167
+ ---
168
+
169
+ ## License
170
+
171
+ MIT © [Geekbits Org](https://github.com/Geekbits-Org)
@@ -67,7 +67,7 @@ async function add(componentName, options = {}) {
67
67
  const cwd = process.cwd();
68
68
  const configPath = path_1.default.join(cwd, 'components.json');
69
69
  if (!fs_1.default.existsSync(configPath)) {
70
- console.error(chalk_1.default.red('components.json not found. Please run "ghostcn init" first.'));
70
+ console.error(chalk_1.default.red('components.json not found. Please run "npx ghostcn init" first.'));
71
71
  process.exit(1);
72
72
  }
73
73
  let config;
@@ -9,7 +9,7 @@ const path_1 = __importDefault(require("path"));
9
9
  const prompts_1 = __importDefault(require("prompts"));
10
10
  const chalk_1 = __importDefault(require("chalk"));
11
11
  async function init(options = {}) {
12
- console.log(chalk_1.default.blue('Initializing Ghost UI component system...'));
12
+ console.log(chalk_1.default.blue('Initializing ghostcn component system...'));
13
13
  const cwd = process.cwd();
14
14
  // Verify it's a ghost theme
15
15
  const packageJsonPath = path_1.default.join(cwd, 'package.json');
@@ -8,14 +8,14 @@ const chalk_1 = __importDefault(require("chalk"));
8
8
  const ora_1 = __importDefault(require("ora"));
9
9
  const registry_1 = require("../utils/registry");
10
10
  async function list() {
11
- const spinner = (0, ora_1.default)('Fetching available components from Ghost UI registry...').start();
11
+ const spinner = (0, ora_1.default)('Fetching available components from ghostcn registry...').start();
12
12
  try {
13
13
  const items = await (0, registry_1.getRegistryIndex)();
14
14
  if (!items || items.length === 0) {
15
15
  spinner.warn('No components found in the registry.');
16
16
  return;
17
17
  }
18
- spinner.succeed(`Found ${items.length} components in Ghost UI registry:\n`);
18
+ spinner.succeed(`Found ${items.length} components in ghostcn registry:\n`);
19
19
  for (const item of items) {
20
20
  console.log(` ${chalk_1.default.bold.cyan(item.name)}`);
21
21
  console.log(` ${chalk_1.default.gray(item.description)}`);
@@ -24,8 +24,8 @@ async function list() {
24
24
  }
25
25
  console.log('');
26
26
  }
27
- console.log(`Install any component using: ${chalk_1.default.green('ghostcn add <component>')}`);
28
- console.log(`Or run ${chalk_1.default.green('ghostcn add')} to select interactively.\n`);
27
+ console.log(`Install any component using: ${chalk_1.default.green('npx ghostcn add <component>')}`);
28
+ console.log(`Or run ${chalk_1.default.green('npx ghostcn add')} to select interactively.\n`);
29
29
  }
30
30
  catch (err) {
31
31
  spinner.fail(`Failed to fetch component catalog: ${err.message || err}`);
package/dist/index.js CHANGED
@@ -21,7 +21,7 @@ function main() {
21
21
  .action(init_1.init);
22
22
  program
23
23
  .command('list')
24
- .description('List all available components in the Ghost UI registry')
24
+ .description('List all available components in the ghostcn registry')
25
25
  .action(list_1.list);
26
26
  program
27
27
  .command('add')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ghostcn",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "The shadcn/ui for Ghost CMS themes - component distribution system",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -9,10 +9,11 @@
9
9
  "ghost-ui": "dist/index.js"
10
10
  },
11
11
  "files": [
12
- "dist"
12
+ "dist",
13
+ "README.md"
13
14
  ],
14
15
  "scripts": {
15
- "build": "tsc && node -e \"const fs=require('fs'); const path=require('path'); const src=path.resolve('../../registry'); const dest=path.resolve('dist/registry'); if(fs.existsSync(src)){fs.cpSync(src, dest, {recursive:true});}\"",
16
+ "build": "tsc && node -e \"const fs=require('fs'); const path=require('path'); if(fs.existsSync('../../registry')){fs.cpSync('../../registry', 'dist/registry', {recursive:true});} if(fs.existsSync('../../README.md')){fs.copyFileSync('../../README.md', 'README.md');}\"",
16
17
  "prepublishOnly": "npm run build",
17
18
  "start": "ts-node src/index.ts",
18
19
  "dev": "ts-node src/index.ts",