ghostcn 1.0.3 → 1.1.0
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 +52 -2
- package/dist/commands/add.js +41 -36
- package/dist/commands/create.d.ts +5 -0
- package/dist/commands/create.js +108 -0
- package/dist/commands/init.js +129 -26
- package/dist/index.js +8 -0
- package/dist/registry/components/author-card.json +2 -2
- package/dist/registry/components/featured-posts.json +27 -0
- package/dist/registry/components/member-cta.json +27 -0
- package/dist/registry/components/newsletter-form.json +9 -6
- package/dist/registry/components/pagination.json +28 -0
- package/dist/registry/components/post-card.json +2 -2
- package/dist/registry/components/post-header.json +27 -0
- package/dist/registry/components/pricing-table.json +2 -2
- package/dist/registry/components/site-footer.json +27 -0
- package/dist/registry/components/site-header.json +27 -0
- package/dist/registry/index.json +61 -1
- package/dist/utils/component-installer.d.ts +16 -0
- package/dist/utils/component-installer.js +59 -0
- package/dist/utils/registry.d.ts +1 -0
- package/dist/utils/registry.js +42 -19
- package/dist/utils/theme-files.d.ts +13 -0
- package/dist/utils/theme-files.js +104 -0
- package/dist/utils/theme-project.d.ts +29 -0
- package/dist/utils/theme-project.js +41 -0
- package/dist/utils/theme-scaffold.d.ts +21 -0
- package/dist/utils/theme-scaffold.js +288 -0
- package/dist/utils/theme.d.ts +46 -0
- package/dist/utils/theme.js +427 -0
- package/package.json +2 -1
- package/dist/test/registry.test.d.ts +0 -1
- package/dist/test/registry.test.js +0 -62
package/README.md
CHANGED
|
@@ -44,11 +44,42 @@ You own the code. You customize the classes. Zero vendor lock-in.
|
|
|
44
44
|
| **`pricing-table`** | Membership tiers (Free, Monthly, Annual) with native Portal checkout triggers | `pricing-table.hbs`, `pricing-table.css` |
|
|
45
45
|
| **`author-card`** | Author bio box with avatar, biography, social links, and post counts | `author-card.hbs`, `author-card.css` |
|
|
46
46
|
| **`post-card`** | Post loop preview card with feature image, tags, excerpt, and reading time | `post-card.hbs`, `post-card.css` |
|
|
47
|
+
| **`site-header`** | Responsive navigation with search, mobile menu, sign-in, and subscribe actions | `site-header.hbs`, `site-header.css` |
|
|
48
|
+
| **`site-footer`** | Secondary navigation, publication information, social links, and attribution | `site-footer.hbs`, `site-footer.css` |
|
|
49
|
+
| **`featured-posts`** | Homepage hero grid backed by Ghost featured posts | `featured-posts.hbs`, `featured-posts.css` |
|
|
50
|
+
| **`pagination`** | Accessible replacement for Ghost’s native pagination partial | `partials/pagination.hbs`, `pagination.css` |
|
|
51
|
+
| **`post-header`** | Editorial post heading, author metadata, reading time, and responsive image | `post-header.hbs`, `post-header.css` |
|
|
52
|
+
| **`member-cta`** | Context-aware calls to action for visitors, free members, and paid members | `member-cta.hbs`, `member-cta.css` |
|
|
47
53
|
|
|
48
54
|
---
|
|
49
55
|
|
|
50
56
|
## Quick Start
|
|
51
57
|
|
|
58
|
+
### Create a complete Ghost theme
|
|
59
|
+
|
|
60
|
+
Start a new, production-ready theme with an interactive setup:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npx ghostcn create my-theme
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The wizard configures Tailwind CSS or vanilla CSS, design tokens, color mode, package manager, optional components, and dependency installation. The generated theme includes Ghost templates for the home page, posts, pages, tags, and authors; responsive navigation; member flows; build scripts; and gscan validation.
|
|
67
|
+
|
|
68
|
+
Use recommended defaults without installing dependencies:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npx ghostcn create my-theme -y --skip-install
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Tailwind themes include a complete Tailwind CLI build and watch pipeline. Vanilla themes include a zero-dependency CSS copy/watch pipeline. In both cases:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
cd my-theme
|
|
78
|
+
npm run dev
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Generated themes also include `npm test` for offline scaffold checks and `npm run validate` for official, pinned gscan validation. The validator is downloaded only when requested, keeping validator-only dependencies out of the day-to-day theme install.
|
|
82
|
+
|
|
52
83
|
### 1. Initialize your Ghost Theme
|
|
53
84
|
|
|
54
85
|
Run the `init` command from the root of any Ghost theme (must have `engines.ghost` in its `package.json`):
|
|
@@ -62,17 +93,36 @@ Or pass `-y` to use default paths non-interactively:
|
|
|
62
93
|
npx ghostcn init -y
|
|
63
94
|
```
|
|
64
95
|
|
|
65
|
-
This
|
|
96
|
+
This prompts you to choose your styling system (`tailwind` or `css`), base color palette (`zinc`, `slate`, `stone`, `gray`, `neutral`), accent color (`ghost` native dynamic accent, `indigo`, `violet`, etc.), and border radius (`none`, `sm`, `md`, `lg`, `full`).
|
|
97
|
+
|
|
98
|
+
It generates `assets/css/ghostcn.css` with semantic design tokens, creates `components.json`, and adds a managed stylesheet block to `default.hbs`:
|
|
66
99
|
```json
|
|
67
100
|
{
|
|
101
|
+
"$schema": "https://ghostcn.com/schema.json",
|
|
68
102
|
"style": "tailwind",
|
|
103
|
+
"theme": {
|
|
104
|
+
"baseColor": "zinc",
|
|
105
|
+
"accentColor": "ghost",
|
|
106
|
+
"radius": "0.5rem"
|
|
107
|
+
},
|
|
69
108
|
"aliases": {
|
|
70
109
|
"partials": "partials/components",
|
|
71
110
|
"styles": "assets/css/components"
|
|
72
|
-
}
|
|
111
|
+
},
|
|
112
|
+
"cssFile": "assets/css/ghostcn.css"
|
|
73
113
|
}
|
|
74
114
|
```
|
|
75
115
|
|
|
116
|
+
The CLI keeps the token stylesheet and every installed component stylesheet linked automatically:
|
|
117
|
+
```handlebars
|
|
118
|
+
{{!-- ghostcn:styles:start --}}
|
|
119
|
+
<link rel="stylesheet" href="{{asset "css/ghostcn.css"}}" />
|
|
120
|
+
{{!-- Component styles are added here by `ghostcn add` --}}
|
|
121
|
+
{{!-- ghostcn:styles:end --}}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
If a theme uses a layout other than `default.hbs`, the CLI leaves the layout untouched and prints the link you need to add manually.
|
|
125
|
+
|
|
76
126
|
### 2. Browse Components
|
|
77
127
|
|
|
78
128
|
List all available components in the registry:
|
package/dist/commands/add.js
CHANGED
|
@@ -10,6 +10,7 @@ const prompts_1 = __importDefault(require("prompts"));
|
|
|
10
10
|
const chalk_1 = __importDefault(require("chalk"));
|
|
11
11
|
const ora_1 = __importDefault(require("ora"));
|
|
12
12
|
const registry_1 = require("../utils/registry");
|
|
13
|
+
const component_installer_1 = require("../utils/component-installer");
|
|
13
14
|
async function installSingleComponent(componentName, config, options) {
|
|
14
15
|
let sanitizedName;
|
|
15
16
|
try {
|
|
@@ -21,46 +22,45 @@ async function installSingleComponent(componentName, config, options) {
|
|
|
21
22
|
}
|
|
22
23
|
const cwd = process.cwd();
|
|
23
24
|
const spinner = (0, ora_1.default)(`Fetching component "${sanitizedName}"...`).start();
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
let result;
|
|
26
|
+
try {
|
|
27
|
+
result = await (0, component_installer_1.installComponent)({
|
|
28
|
+
themeRoot: cwd,
|
|
29
|
+
componentName: sanitizedName,
|
|
30
|
+
config,
|
|
31
|
+
overwrite: options.yes,
|
|
32
|
+
shouldOverwrite: async (relativePath) => {
|
|
33
|
+
const response = await (0, prompts_1.default)({
|
|
34
|
+
type: 'confirm',
|
|
35
|
+
name: 'overwrite',
|
|
36
|
+
message: `File ${relativePath} already exists. Overwrite?`,
|
|
37
|
+
initial: false
|
|
38
|
+
}, {
|
|
39
|
+
onCancel: () => {
|
|
40
|
+
console.log(chalk_1.default.yellow('\nOperation cancelled.'));
|
|
41
|
+
process.exit(0);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
return Boolean(response.overwrite);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
spinner.fail(chalk_1.default.red(error.message));
|
|
27
50
|
return false;
|
|
28
51
|
}
|
|
29
52
|
spinner.succeed(`Found "${sanitizedName}"!`);
|
|
30
|
-
for (const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
else if (file.type === 'js')
|
|
37
|
-
targetDirAlias = config.aliases?.js || 'assets/js/components';
|
|
38
|
-
if (!targetDirAlias)
|
|
39
|
-
continue;
|
|
40
|
-
const targetDir = path_1.default.join(cwd, targetDirAlias);
|
|
41
|
-
const targetPath = path_1.default.join(targetDir, file.name);
|
|
42
|
-
if (!fs_1.default.existsSync(targetDir)) {
|
|
43
|
-
fs_1.default.mkdirSync(targetDir, { recursive: true });
|
|
44
|
-
}
|
|
45
|
-
if (fs_1.default.existsSync(targetPath) && !options.yes) {
|
|
46
|
-
const response = await (0, prompts_1.default)({
|
|
47
|
-
type: 'confirm',
|
|
48
|
-
name: 'overwrite',
|
|
49
|
-
message: `File ${targetDirAlias}/${file.name} already exists. Overwrite?`,
|
|
50
|
-
initial: false
|
|
51
|
-
});
|
|
52
|
-
if (!response.overwrite) {
|
|
53
|
-
console.log(chalk_1.default.yellow(`Skipped ${file.name}.`));
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
fs_1.default.writeFileSync(targetPath, file.content, 'utf8');
|
|
58
|
-
console.log(chalk_1.default.green(`Installed ${file.name} to ${targetDirAlias}/${file.name}`));
|
|
53
|
+
for (const installed of result.installed)
|
|
54
|
+
console.log(chalk_1.default.green(` ✓ Installed ${installed}`));
|
|
55
|
+
for (const skipped of result.skipped)
|
|
56
|
+
console.log(chalk_1.default.yellow(` - Skipped ${skipped}`));
|
|
57
|
+
if (result.styleSync?.status === 'missing-template') {
|
|
58
|
+
console.warn(chalk_1.default.yellow(' ⚠ default.hbs was not found, so component styles could not be linked automatically.'));
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
console.log(chalk_1.default.yellow(`Note: Import ${config.aliases?.styles || 'assets/css/components'}/<style>.css into your main stylesheet if using Vanilla CSS.`));
|
|
60
|
+
else if (result.styleSync?.status === 'updated') {
|
|
61
|
+
console.log(chalk_1.default.green(' ✓ Updated the managed stylesheet links in default.hbs'));
|
|
63
62
|
}
|
|
63
|
+
console.log(chalk_1.default.bold.blue(`Component "${sanitizedName}" successfully installed!`));
|
|
64
64
|
return true;
|
|
65
65
|
}
|
|
66
66
|
async function add(componentName, options = {}) {
|
|
@@ -103,6 +103,11 @@ async function add(componentName, options = {}) {
|
|
|
103
103
|
value: item.name
|
|
104
104
|
})),
|
|
105
105
|
hint: '- Space to select. Return to submit'
|
|
106
|
+
}, {
|
|
107
|
+
onCancel: () => {
|
|
108
|
+
console.log(chalk_1.default.yellow('\nCancelled.'));
|
|
109
|
+
process.exit(0);
|
|
110
|
+
}
|
|
106
111
|
});
|
|
107
112
|
if (!response.selected || response.selected.length === 0) {
|
|
108
113
|
console.log(chalk_1.default.yellow('No components selected. Exiting.'));
|
|
@@ -113,5 +118,5 @@ async function add(componentName, options = {}) {
|
|
|
113
118
|
await installSingleComponent(item, config, options);
|
|
114
119
|
console.log('');
|
|
115
120
|
}
|
|
116
|
-
console.log(chalk_1.default.green('All selected components have been installed!'));
|
|
121
|
+
console.log(chalk_1.default.bold.green('All selected components have been installed!'));
|
|
117
122
|
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.create = create;
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
const ora_1 = __importDefault(require("ora"));
|
|
11
|
+
const prompts_1 = __importDefault(require("prompts"));
|
|
12
|
+
const component_installer_1 = require("../utils/component-installer");
|
|
13
|
+
const theme_project_1 = require("../utils/theme-project");
|
|
14
|
+
const theme_scaffold_1 = require("../utils/theme-scaffold");
|
|
15
|
+
async function create(themeNameArgument, options = {}) {
|
|
16
|
+
let themeName = themeNameArgument || '';
|
|
17
|
+
let style = 'tailwind';
|
|
18
|
+
let baseColor = 'zinc';
|
|
19
|
+
let accentColor = 'ghost';
|
|
20
|
+
let radius = '0.5rem';
|
|
21
|
+
let colorScheme = 'Auto';
|
|
22
|
+
let packageManager = 'npm';
|
|
23
|
+
let authorName = 'Theme Author';
|
|
24
|
+
let authorEmail = 'hello@example.com';
|
|
25
|
+
let optionalComponents = ['newsletter-form', 'author-card'];
|
|
26
|
+
let installDependencies = !options.skipInstall;
|
|
27
|
+
if (!options.yes) {
|
|
28
|
+
const response = await (0, prompts_1.default)([
|
|
29
|
+
...(!themeName ? [{ type: 'text', name: 'themeName', message: 'What should the theme be called?', initial: 'my-ghost-theme' }] : []),
|
|
30
|
+
{ type: 'select', name: 'style', message: 'Which styling system?', choices: [{ title: 'Tailwind CSS', value: 'tailwind' }, { title: 'Vanilla CSS', value: 'css' }], initial: 0 },
|
|
31
|
+
{ type: 'select', name: 'baseColor', message: 'Choose a base palette', choices: ['zinc', 'slate', 'stone', 'gray', 'neutral'].map(value => ({ title: value[0].toUpperCase() + value.slice(1), value })), initial: 0 },
|
|
32
|
+
{ type: 'select', name: 'accentColor', message: 'Choose an accent color', choices: ['ghost', 'indigo', 'violet', 'blue', 'emerald', 'rose', 'orange', 'zinc'].map(value => ({ title: value === 'ghost' ? 'Ghost accent (Recommended)' : value[0].toUpperCase() + value.slice(1), value })), initial: 0 },
|
|
33
|
+
{ type: 'select', name: 'radius', message: 'Choose a border radius', choices: [{ title: 'Medium', value: '0.5rem' }, { title: 'Small', value: '0.25rem' }, { title: 'Large', value: '0.75rem' }, { title: 'Extra large', value: '1rem' }, { title: 'None', value: '0' }, { title: 'Pill', value: '9999px' }], initial: 0 },
|
|
34
|
+
{ type: 'select', name: 'colorScheme', message: 'Choose the initial color scheme', choices: ['Auto', 'Light', 'Dark'].map(value => ({ title: value, value })), initial: 0 },
|
|
35
|
+
{ type: 'multiselect', name: 'optionalComponents', message: 'Add optional starter components', choices: [{ title: 'Newsletter form', value: 'newsletter-form', selected: true }, { title: 'Author card', value: 'author-card', selected: true }, { title: 'Pricing table', value: 'pricing-table', selected: false }], hint: '- Space to select. Return to submit' },
|
|
36
|
+
{ type: 'select', name: 'packageManager', message: 'Choose a package manager', choices: ['npm', 'pnpm', 'yarn', 'bun'].map(value => ({ title: value, value })), initial: 0 },
|
|
37
|
+
{ type: 'text', name: 'authorName', message: 'Theme author name', initial: 'Theme Author' },
|
|
38
|
+
{ type: 'text', name: 'authorEmail', message: 'Theme author email', initial: 'hello@example.com', validate: value => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value) ? true : 'Enter a valid email address' },
|
|
39
|
+
...(!options.skipInstall ? [{ type: 'confirm', name: 'installDependencies', message: 'Install dependencies now?', initial: true }] : [])
|
|
40
|
+
], {
|
|
41
|
+
onCancel: () => {
|
|
42
|
+
console.log(chalk_1.default.yellow('\nTheme creation cancelled.'));
|
|
43
|
+
process.exit(0);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
themeName = response.themeName || themeName;
|
|
47
|
+
style = response.style || style;
|
|
48
|
+
baseColor = response.baseColor || baseColor;
|
|
49
|
+
accentColor = response.accentColor || accentColor;
|
|
50
|
+
radius = response.radius || radius;
|
|
51
|
+
colorScheme = response.colorScheme || colorScheme;
|
|
52
|
+
optionalComponents = response.optionalComponents || [];
|
|
53
|
+
packageManager = response.packageManager || packageManager;
|
|
54
|
+
authorName = response.authorName || authorName;
|
|
55
|
+
authorEmail = response.authorEmail || authorEmail;
|
|
56
|
+
if (typeof response.installDependencies === 'boolean')
|
|
57
|
+
installDependencies = response.installDependencies;
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
themeName = (0, theme_scaffold_1.sanitizeThemeName)(themeName);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
console.error(chalk_1.default.red(error.message));
|
|
64
|
+
process.exitCode = 1;
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const spinner = (0, ora_1.default)(`Creating Ghost theme "${themeName}"...`).start();
|
|
68
|
+
try {
|
|
69
|
+
const includeNewsletter = optionalComponents.includes('newsletter-form');
|
|
70
|
+
const includeAuthorCard = optionalComponents.includes('author-card');
|
|
71
|
+
const includePricing = optionalComponents.includes('pricing-table');
|
|
72
|
+
const scaffold = (0, theme_scaffold_1.scaffoldTheme)({
|
|
73
|
+
parentDirectory: process.cwd(), themeName, style, colorScheme, packageManager,
|
|
74
|
+
authorName, authorEmail,
|
|
75
|
+
includeNewsletter, includeAuthorCard, includePricing
|
|
76
|
+
});
|
|
77
|
+
const themeConfig = { style, baseColor, accentColor, radius };
|
|
78
|
+
const config = (0, theme_project_1.buildGhostcnConfig)(themeConfig);
|
|
79
|
+
(0, theme_project_1.initializeThemeProject)({ themeRoot: scaffold.themeRoot, config });
|
|
80
|
+
const components = [...theme_scaffold_1.REQUIRED_STARTER_COMPONENTS, ...optionalComponents];
|
|
81
|
+
for (const componentName of components) {
|
|
82
|
+
await (0, component_installer_1.installComponent)({ themeRoot: scaffold.themeRoot, componentName, config, overwrite: true });
|
|
83
|
+
}
|
|
84
|
+
spinner.succeed(chalk_1.default.green(`Created ${themeName} with ${components.length} components.`));
|
|
85
|
+
if (installDependencies) {
|
|
86
|
+
const installSpinner = (0, ora_1.default)(`Installing dependencies with ${packageManager}...`).start();
|
|
87
|
+
installSpinner.stop();
|
|
88
|
+
const installed = (0, child_process_1.spawnSync)(packageManager, ['install'], {
|
|
89
|
+
cwd: scaffold.themeRoot,
|
|
90
|
+
stdio: 'inherit',
|
|
91
|
+
shell: process.platform === 'win32'
|
|
92
|
+
});
|
|
93
|
+
if (installed.status !== 0) {
|
|
94
|
+
console.warn(chalk_1.default.yellow(`Dependency installation did not finish. The generated theme is intact; run "${packageManager} install" inside it.`));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const run = packageManager === 'npm' ? 'npm run' : `${packageManager} run`;
|
|
98
|
+
console.log(`\n${chalk_1.default.bold.green('Your Ghost theme is ready.')}`);
|
|
99
|
+
console.log(` ${chalk_1.default.cyan(`cd ${path_1.default.basename(scaffold.themeRoot)}`)}`);
|
|
100
|
+
if (!installDependencies)
|
|
101
|
+
console.log(` ${chalk_1.default.cyan(`${packageManager} install`)}`);
|
|
102
|
+
console.log(` ${chalk_1.default.cyan(`${run} dev`)}\n`);
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
spinner.fail(chalk_1.default.red(error.message));
|
|
106
|
+
process.exitCode = 1;
|
|
107
|
+
}
|
|
108
|
+
}
|
package/dist/commands/init.js
CHANGED
|
@@ -4,12 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.init = init;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
7
|
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
9
|
const prompts_1 = __importDefault(require("prompts"));
|
|
10
10
|
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
+
const ora_1 = __importDefault(require("ora"));
|
|
12
|
+
const theme_project_1 = require("../utils/theme-project");
|
|
11
13
|
async function init(options = {}) {
|
|
12
|
-
console.log(chalk_1.default.blue('Initializing ghostcn
|
|
14
|
+
console.log(chalk_1.default.bold.blue('\n✨ Initializing ghostcn theming system...\n'));
|
|
13
15
|
const cwd = process.cwd();
|
|
14
16
|
// Verify it's a ghost theme
|
|
15
17
|
const packageJsonPath = path_1.default.join(cwd, 'package.json');
|
|
@@ -17,13 +19,23 @@ async function init(options = {}) {
|
|
|
17
19
|
console.error(chalk_1.default.red('No package.json found. Please run this command from the root of a Ghost theme.'));
|
|
18
20
|
process.exit(1);
|
|
19
21
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
try {
|
|
23
|
+
const packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonPath, 'utf8').replace(/^\uFEFF/, ''));
|
|
24
|
+
if (!packageJson.engines || (!packageJson.engines.ghost && !packageJson.engines['ghost-api'])) {
|
|
25
|
+
console.warn(chalk_1.default.yellow('⚠️ Warning: No "ghost" engine found in package.json. Continuing anyway, but ensure this is a Ghost theme.'));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
console.error(chalk_1.default.red('Error reading package.json. Ensure it is valid JSON.'));
|
|
30
|
+
process.exit(1);
|
|
23
31
|
}
|
|
24
32
|
let style = 'tailwind';
|
|
33
|
+
let baseColor = 'zinc';
|
|
34
|
+
let accentColor = 'ghost';
|
|
35
|
+
let radius = '0.5rem';
|
|
25
36
|
let partialsAlias = 'partials/components';
|
|
26
37
|
let stylesAlias = 'assets/css/components';
|
|
38
|
+
let cssFile = 'assets/css/ghostcn.css';
|
|
27
39
|
if (!options.yes) {
|
|
28
40
|
const response = await (0, prompts_1.default)([
|
|
29
41
|
{
|
|
@@ -31,40 +43,131 @@ async function init(options = {}) {
|
|
|
31
43
|
name: 'style',
|
|
32
44
|
message: 'Which styling system are you using?',
|
|
33
45
|
choices: [
|
|
34
|
-
{ title: 'Tailwind CSS', value: 'tailwind' },
|
|
35
|
-
{ title: 'Vanilla CSS', value: 'css' }
|
|
36
|
-
]
|
|
46
|
+
{ title: 'Tailwind CSS', value: 'tailwind', description: 'Utility-first CSS' },
|
|
47
|
+
{ title: 'Vanilla CSS', value: 'css', description: 'Raw Ghost CSS with Custom Properties' }
|
|
48
|
+
],
|
|
49
|
+
initial: 0
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
type: 'select',
|
|
53
|
+
name: 'baseColor',
|
|
54
|
+
message: 'Which base color palette would you like to use?',
|
|
55
|
+
choices: [
|
|
56
|
+
{ title: 'Zinc', value: 'zinc', description: 'Modern neutral with cool undertones' },
|
|
57
|
+
{ title: 'Slate', value: 'slate', description: 'Cool gray with subtle blue tones' },
|
|
58
|
+
{ title: 'Stone', value: 'stone', description: 'Warm, earthy neutral' },
|
|
59
|
+
{ title: 'Gray', value: 'gray', description: 'Clean, balanced neutral gray' },
|
|
60
|
+
{ title: 'Neutral', value: 'neutral', description: 'Pure monochromatic neutral' }
|
|
61
|
+
],
|
|
62
|
+
initial: 0
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: 'select',
|
|
66
|
+
name: 'accentColor',
|
|
67
|
+
message: 'Which accent / primary color would you like to use?',
|
|
68
|
+
choices: [
|
|
69
|
+
{
|
|
70
|
+
title: 'Ghost Accent (Recommended)',
|
|
71
|
+
value: 'ghost',
|
|
72
|
+
description: 'Dynamically connects to Ghost Admin brand color (@site.accent_color)'
|
|
73
|
+
},
|
|
74
|
+
{ title: 'Indigo', value: 'indigo', description: 'Deep tech indigo' },
|
|
75
|
+
{ title: 'Violet', value: 'violet', description: 'Vibrant modern violet' },
|
|
76
|
+
{ title: 'Blue', value: 'blue', description: 'Classic editorial blue' },
|
|
77
|
+
{ title: 'Emerald', value: 'emerald', description: 'Lush natural green' },
|
|
78
|
+
{ title: 'Rose', value: 'rose', description: 'Warm crimson rose' },
|
|
79
|
+
{ title: 'Orange', value: 'orange', description: 'Energetic warm orange' },
|
|
80
|
+
{ title: 'Zinc / Monochrome', value: 'zinc', description: 'Minimalist black/white' }
|
|
81
|
+
],
|
|
82
|
+
initial: 0
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
type: 'select',
|
|
86
|
+
name: 'radius',
|
|
87
|
+
message: 'Which border radius style would you like?',
|
|
88
|
+
choices: [
|
|
89
|
+
{ title: 'Medium (0.5rem)', value: '0.5rem' },
|
|
90
|
+
{ title: 'Small (0.25rem)', value: '0.25rem' },
|
|
91
|
+
{ title: 'Large (0.75rem)', value: '0.75rem' },
|
|
92
|
+
{ title: 'Extra Large (1.0rem)', value: '1rem' },
|
|
93
|
+
{ title: 'None (0px)', value: '0' },
|
|
94
|
+
{ title: 'Full (Pill / 9999px)', value: '9999px' }
|
|
95
|
+
],
|
|
96
|
+
initial: 0
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
type: 'text',
|
|
100
|
+
name: 'cssFile',
|
|
101
|
+
message: 'Where should the theme CSS tokens file be written?',
|
|
102
|
+
initial: 'assets/css/ghostcn.css'
|
|
37
103
|
},
|
|
38
104
|
{
|
|
39
105
|
type: 'text',
|
|
40
106
|
name: 'partialsAlias',
|
|
41
|
-
message: 'Where should partials be installed?',
|
|
107
|
+
message: 'Where should Handlebars partials be installed?',
|
|
42
108
|
initial: 'partials/components'
|
|
43
109
|
},
|
|
44
110
|
{
|
|
45
111
|
type: 'text',
|
|
46
112
|
name: 'stylesAlias',
|
|
47
|
-
message: 'Where should
|
|
113
|
+
message: 'Where should component CSS stylesheets be installed?',
|
|
48
114
|
initial: 'assets/css/components'
|
|
49
115
|
}
|
|
50
|
-
]
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
116
|
+
], {
|
|
117
|
+
onCancel: () => {
|
|
118
|
+
console.log(chalk_1.default.red('\nInitialization cancelled.'));
|
|
119
|
+
process.exit(1);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
55
122
|
style = response.style || style;
|
|
56
|
-
|
|
57
|
-
|
|
123
|
+
baseColor = response.baseColor || baseColor;
|
|
124
|
+
accentColor = response.accentColor || accentColor;
|
|
125
|
+
radius = response.radius || radius;
|
|
126
|
+
cssFile = response.cssFile || cssFile;
|
|
127
|
+
partialsAlias = response.partialsAlias || partialsAlias;
|
|
128
|
+
stylesAlias = response.stylesAlias || stylesAlias;
|
|
58
129
|
}
|
|
59
|
-
const
|
|
130
|
+
const themeConfig = {
|
|
60
131
|
style,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
132
|
+
baseColor,
|
|
133
|
+
accentColor,
|
|
134
|
+
radius
|
|
65
135
|
};
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
136
|
+
const config = (0, theme_project_1.buildGhostcnConfig)(themeConfig, {
|
|
137
|
+
partials: partialsAlias,
|
|
138
|
+
styles: stylesAlias,
|
|
139
|
+
cssFile
|
|
140
|
+
});
|
|
141
|
+
const spinner = (0, ora_1.default)('Setting up theme configuration & design tokens...').start();
|
|
142
|
+
let styleSync;
|
|
143
|
+
try {
|
|
144
|
+
styleSync = (0, theme_project_1.initializeThemeProject)({ themeRoot: cwd, config }).styleSync;
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
spinner.fail(chalk_1.default.red(error.message));
|
|
148
|
+
process.exit(1);
|
|
149
|
+
}
|
|
150
|
+
spinner.succeed(chalk_1.default.green('Configuration & design tokens successfully initialized!'));
|
|
151
|
+
console.log('\n' + chalk_1.default.bold('Summary:'));
|
|
152
|
+
console.log(` • Style: ${chalk_1.default.cyan(style)}`);
|
|
153
|
+
console.log(` • Base Palette: ${chalk_1.default.cyan(baseColor)}`);
|
|
154
|
+
console.log(` • Accent Color: ${chalk_1.default.cyan(accentColor)}`);
|
|
155
|
+
console.log(` • Border Radius: ${chalk_1.default.cyan(radius)}`);
|
|
156
|
+
console.log(` • Theme Tokens: ${chalk_1.default.cyan(cssFile)}`);
|
|
157
|
+
console.log(` • Partials: ${chalk_1.default.cyan(partialsAlias)}`);
|
|
158
|
+
console.log(` • Styles: ${chalk_1.default.cyan(stylesAlias)}`);
|
|
159
|
+
console.log(` • Template: ${styleSync.status === 'missing-template'
|
|
160
|
+
? chalk_1.default.yellow('default.hbs not found; stylesheet link not added')
|
|
161
|
+
: chalk_1.default.cyan('default.hbs (managed automatically)')}`);
|
|
162
|
+
console.log('\n' + chalk_1.default.bold.green('Next Steps:'));
|
|
163
|
+
if (styleSync.status === 'missing-template') {
|
|
164
|
+
console.log(` 1. Add this stylesheet to your layout's <head>:`);
|
|
165
|
+
console.log(` ${chalk_1.default.dim('<link rel="stylesheet" href="{{asset "' + cssFile.replace('assets/', '') + '"}}">')}`);
|
|
166
|
+
console.log(` 2. Add components to your theme:`);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
console.log(` 1. Add components to your theme:`);
|
|
170
|
+
}
|
|
171
|
+
console.log(` ${chalk_1.default.cyan('npx ghostcn add')}`);
|
|
172
|
+
console.log(` ${chalk_1.default.cyan('npx ghostcn add newsletter-form')}\n`);
|
|
70
173
|
}
|
package/dist/index.js
CHANGED
|
@@ -8,12 +8,20 @@ const commander_1 = require("commander");
|
|
|
8
8
|
const init_1 = require("./commands/init");
|
|
9
9
|
const add_1 = require("./commands/add");
|
|
10
10
|
const list_1 = require("./commands/list");
|
|
11
|
+
const create_1 = require("./commands/create");
|
|
11
12
|
const package_json_1 = __importDefault(require("../package.json"));
|
|
12
13
|
function main() {
|
|
13
14
|
const program = new commander_1.Command()
|
|
14
15
|
.name('ghostcn')
|
|
15
16
|
.description('The shadcn/ui for Ghost CMS themes')
|
|
16
17
|
.version(package_json_1.default.version || '1.0.0');
|
|
18
|
+
program
|
|
19
|
+
.command('create')
|
|
20
|
+
.description('Create a complete Ghost theme with ghostcn components')
|
|
21
|
+
.argument('[theme-name]', 'Directory and package name for the new theme')
|
|
22
|
+
.option('-y, --yes', 'Skip prompts and use recommended defaults')
|
|
23
|
+
.option('--skip-install', 'Generate the theme without installing dependencies')
|
|
24
|
+
.action(create_1.create);
|
|
17
25
|
program
|
|
18
26
|
.command('init')
|
|
19
27
|
.description('Initialize your Ghost theme and choose a component structure')
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
"name": "author-card.hbs",
|
|
10
10
|
"type": "partial",
|
|
11
11
|
"target": "partials/components/author-card.hbs",
|
|
12
|
-
"content": "{{
|
|
12
|
+
"content": "{{!--\n Component: Author Card\n Usage: In post context {{> \"components/author-card\"}} or {{#primary_author}}{{> \"components/author-card\"}}{{/primary_author}}\n--}}\n<section class=\"gh-author-card bg-card text-card-foreground border border-border rounded-ghostcn p-6 my-8 max-w-2xl mx-auto flex flex-col sm:flex-row items-center sm:items-start gap-5 shadow-sm\">\n {{#if profile_image}}\n <img src=\"{{img_url profile_image size=\"m\"}}\" alt=\"{{name}}\" class=\"gh-author-avatar w-20 h-20 rounded-full object-cover border-2 border-border shadow-sm\" />\n {{else}}\n <div class=\"gh-author-avatar-fallback w-20 h-20 rounded-full bg-muted text-foreground flex items-center justify-center font-bold text-2xl border-2 border-border shadow-sm\">\n {{name.[0]}}\n </div>\n {{/if}}\n\n <div class=\"gh-author-details flex-1 text-center sm:text-left\">\n <div class=\"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2\">\n <h4 class=\"gh-author-name text-xl font-bold tracking-tight text-foreground\">\n <a href=\"{{url}}\" class=\"hover:text-primary transition-colors\">{{name}}</a>\n </h4>\n {{#if count.posts}}\n <span class=\"gh-author-post-count text-xs text-muted-foreground bg-muted px-2.5 py-1 rounded-full font-medium\">\n {{plural count.posts empty=\"0 posts\" singular=\"% post\" plural=\"% posts\"}}\n </span>\n {{/if}}\n </div>\n\n {{#if bio}}\n <p class=\"gh-author-bio text-muted-foreground text-sm mb-4 leading-relaxed\">{{bio}}</p>\n {{/if}}\n\n <div class=\"gh-author-meta flex flex-wrap items-center justify-center sm:justify-start gap-4 text-xs text-muted-foreground\">\n {{#if location}}\n <span class=\"gh-author-location flex items-center gap-1\">📍 {{location}}</span>\n {{/if}}\n {{#if website}}\n <a href=\"{{website}}\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"gh-author-link text-primary hover:underline\">Website</a>\n {{/if}}\n {{#if twitter}}\n <a href=\"{{social_url type=\"twitter\"}}\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"gh-author-link text-primary hover:underline\">Twitter/X</a>\n {{/if}}\n {{#if facebook}}\n <a href=\"{{social_url type=\"facebook\"}}\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"gh-author-link text-primary hover:underline\">Facebook</a>\n {{/if}}\n </div>\n </div>\n</section>"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
"name": "author-card.css",
|
|
16
16
|
"type": "style",
|
|
17
17
|
"target": "assets/css/components/author-card.css",
|
|
18
|
-
"content": "/*
|
|
18
|
+
"content": "/* ghostcn: Author Card Styles */\n.gh-author-card {\n box-sizing: border-box;\n font-family: inherit;\n font-size: 16px;\n line-height: 1.5;\n isolation: isolate;\n background-color: var(--card, #ffffff);\n color: var(--card-foreground, #09090b);\n border: 1px solid var(--border, #e4e4e7);\n border-radius: min(var(--radius, 0.5em), 1.5em);\n padding: 1.5em;\n margin: 2em auto;\n max-width: 42em;\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 1.25em;\n box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);\n}\n\n.gh-author-card *,\n.gh-author-card *::before,\n.gh-author-card *::after {\n box-sizing: border-box;\n}\n\n@media (min-width: 640px) {\n .gh-author-card {\n flex-direction: row;\n align-items: flex-start;\n }\n}\n\n.gh-author-avatar {\n width: 5em;\n height: 5em;\n border-radius: 9999px;\n object-fit: cover;\n border: 2px solid var(--border, #e4e4e7);\n}\n\n.gh-author-avatar-fallback {\n width: 5em;\n height: 5em;\n border-radius: 9999px;\n background-color: var(--muted, #f4f4f5);\n color: var(--foreground, #09090b);\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 1.5em;\n font-weight: 700;\n border: 2px solid var(--border, #e4e4e7);\n}\n\n.gh-author-details {\n flex: 1;\n text-align: center;\n}\n\n@media (min-width: 640px) {\n .gh-author-details {\n text-align: left;\n }\n}\n\n.gh-author-name {\n font-size: 1.25em;\n font-weight: 700;\n letter-spacing: -0.025em;\n margin: 0;\n}\n\n.gh-author-name a {\n color: var(--foreground, #09090b);\n text-decoration: none;\n transition: color 0.15s ease;\n}\n\n.gh-author-name a:hover {\n color: var(--primary, var(--ghost-accent-color, #18181b));\n}\n\n.gh-author-bio {\n color: var(--muted-foreground, #71717a);\n font-size: 0.875em;\n line-height: 1.5;\n margin: 0.5em 0 1em;\n}\n\n.gh-author-meta {\n display: flex;\n flex-wrap: wrap;\n gap: 1em;\n font-size: 0.75em;\n color: var(--muted-foreground, #71717a);\n}\n\n.gh-author-meta a {\n color: var(--primary, var(--ghost-accent-color, #18181b));\n text-decoration: none;\n}\n\n.gh-author-meta a:hover {\n text-decoration: underline;\n}\n"
|
|
19
19
|
}
|
|
20
20
|
],
|
|
21
21
|
"gscan": {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "featured-posts",
|
|
3
|
+
"type": "components:content",
|
|
4
|
+
"description": "Responsive homepage hero populated from Ghost featured posts.",
|
|
5
|
+
"dependencies": [],
|
|
6
|
+
"ghost_version": ">=5.0.0",
|
|
7
|
+
"files": [
|
|
8
|
+
{
|
|
9
|
+
"name": "featured-posts.hbs",
|
|
10
|
+
"type": "partial",
|
|
11
|
+
"target": "partials/components/featured-posts.hbs",
|
|
12
|
+
"content": "{{!-- Component: Featured Posts | Usage: {{> \"components/featured-posts\"}} --}}\n{{#get \"posts\" filter=\"featured:true\" limit=\"3\" include=\"authors,tags\"}}\n{{#if posts}}\n<section class=\"ghcn-featured ghcn-container\" aria-labelledby=\"ghcn-featured-title\">\n <div class=\"ghcn-featured__heading\">\n <div><span class=\"ghcn-badge\">Featured</span><h2 id=\"ghcn-featured-title\">Editor’s picks</h2></div>\n <a href=\"{{@site.url}}\">View all posts <span aria-hidden=\"true\">→</span></a>\n </div>\n <div class=\"ghcn-featured__grid\">\n {{#foreach posts}}\n <article class=\"ghcn-featured__card{{#has index=\"0\"}} ghcn-featured__card--lead{{/has}}\">\n <a class=\"ghcn-featured__image\" href=\"{{url}}\">\n {{#if feature_image}}<img src=\"{{img_url feature_image size=\"l\"}}\" alt=\"{{#if feature_image_alt}}{{feature_image_alt}}{{else}}{{title}}{{/if}}\" loading=\"{{#has index=\"0\"}}eager{{else}}lazy{{/has}}\" />{{/if}}\n </a>\n <div class=\"ghcn-featured__content\">\n <div class=\"ghcn-featured__meta\">{{#if primary_tag}}<a href=\"{{primary_tag.url}}\">{{primary_tag.name}}</a><span>•</span>{{/if}}<span>{{reading_time}}</span></div>\n <h3><a href=\"{{url}}\">{{title}}</a></h3>\n {{#has index=\"0\"}}{{#if excerpt}}<p>{{excerpt words=\"30\"}}</p>{{/if}}{{/has}}\n </div>\n </article>\n {{/foreach}}\n </div>\n</section>\n{{/if}}\n{{/get}}"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "featured-posts.css",
|
|
16
|
+
"type": "style",
|
|
17
|
+
"target": "assets/css/components/featured-posts.css",
|
|
18
|
+
"content": "/* ghostcn: Featured Posts */\n.ghcn-featured { box-sizing: border-box; margin-block: 3em; color: var(--foreground); font-family: inherit; font-size: 16px; line-height: 1.5; isolation: isolate; }\n.ghcn-featured *, .ghcn-featured *::before, .ghcn-featured *::after { box-sizing: border-box; }\n.ghcn-featured__heading { display: flex; align-items: end; justify-content: space-between; gap: 1em; margin-bottom: 1.25em; }\n.ghcn-featured__heading h2 { margin: 0.75em 0 0; font-size: clamp(1.75em,4vw,2.5em); line-height: 1.05; letter-spacing: -0.04em; }\n.ghcn-featured__heading > a { color: var(--muted-foreground); font-size: 0.875em; font-weight: 600; text-decoration: none; }\n.ghcn-featured__grid { display: grid; grid-template-columns: minmax(0,2fr) minmax(15em,1fr); gap: 1em; }\n.ghcn-featured__card { position: relative; min-height: 15em; overflow: hidden; border-radius: min(var(--radius),1.25em); background: var(--muted); }\n.ghcn-featured__card--lead { grid-row: span 2; min-height: 31em; }\n.ghcn-featured__image, .ghcn-featured__image::after { position: absolute; inset: 0; }\n.ghcn-featured__image::after { content: \"\"; background: linear-gradient(to top,rgba(0,0,0,.82),rgba(0,0,0,.02) 70%); }\n.ghcn-featured__image img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }\n.ghcn-featured__card:hover img { transform: scale(1.025); }\n.ghcn-featured__content { position: absolute; right: 0; bottom: 0; left: 0; z-index: 1; padding: 1.25em; color: #fff; }\n.ghcn-featured__card--lead .ghcn-featured__content { padding: 2em; }\n.ghcn-featured__meta { display: flex; gap: 0.5em; margin-bottom: 0.5em; color: rgba(255,255,255,.78); font-size: 0.75em; }\n.ghcn-featured__meta a, .ghcn-featured h3 a { color: inherit; text-decoration: none; }\n.ghcn-featured h3 { margin: 0; font-size: 1.25em; line-height: 1.15; letter-spacing: -0.025em; }\n.ghcn-featured__card--lead h3 { font-size: clamp(1.75em,4vw,3em); }\n.ghcn-featured__content p { max-width: 42em; margin: 0.75em 0 0; color: rgba(255,255,255,.82); }\n@media (max-width: 720px) { .ghcn-featured__grid { grid-template-columns: 1fr; } .ghcn-featured__card--lead { grid-row: auto; min-height: 25em; } }\n"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"gscan": {
|
|
22
|
+
"rules_satisfied": [
|
|
23
|
+
"GS010-PJ-VALID"
|
|
24
|
+
],
|
|
25
|
+
"notes": "Uses the Ghost get helper and featured post filter."
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "member-cta",
|
|
3
|
+
"type": "components:members",
|
|
4
|
+
"description": "Context-aware member CTA for visitors, free members, paid members, and protected posts.",
|
|
5
|
+
"dependencies": [],
|
|
6
|
+
"ghost_version": ">=5.0.0",
|
|
7
|
+
"files": [
|
|
8
|
+
{
|
|
9
|
+
"name": "member-cta.hbs",
|
|
10
|
+
"type": "partial",
|
|
11
|
+
"target": "partials/components/member-cta.hbs",
|
|
12
|
+
"content": "{{!-- Component: Member CTA | Usage: inside {{#post}} after {{content}} --}}\n<aside class=\"ghcn-member-cta\">\n {{#if access}}\n {{#if @member}}\n <span class=\"ghcn-badge\">Member access</span>\n <h2>You’re all caught up</h2>\n <p>Manage your subscription, email preferences, and account details in Portal.</p>\n <a class=\"ghcn-button ghcn-button--outline\" href=\"#/portal/account\" data-portal=\"account\">Manage account</a>\n {{else}}\n <span class=\"ghcn-badge\">Join the publication</span>\n <h2>Enjoying this story?</h2>\n <p>Subscribe for new posts and member updates delivered directly to your inbox.</p>\n <div class=\"ghcn-member-cta__actions\"><a class=\"ghcn-button\" href=\"#/portal/signup\" data-portal=\"signup\">Subscribe</a><a class=\"ghcn-button ghcn-button--ghost\" href=\"#/portal/signin\" data-portal=\"signin\">Sign in</a></div>\n {{/if}}\n {{else}}\n {{#if @member.paid}}\n <span class=\"ghcn-badge\">Account required</span>\n <h2>This post isn’t included in your plan</h2>\n <p>Open your account to review your membership and available plans.</p>\n <a class=\"ghcn-button\" href=\"#/portal/account/plans\" data-portal=\"account/plans\">View plans</a>\n {{else if @member}}\n <span class=\"ghcn-badge\">Paid members</span>\n <h2>Upgrade to continue reading</h2>\n <p>Become a paid member to unlock this post and the complete archive.</p>\n <a class=\"ghcn-button\" href=\"#/portal/account/plans\" data-portal=\"account/plans\">Upgrade membership</a>\n {{else}}\n <span class=\"ghcn-badge\">Members only</span>\n <h2>Continue reading with a membership</h2>\n <p>Sign up to unlock this post. Already a member? Sign in to continue.</p>\n <div class=\"ghcn-member-cta__actions\"><a class=\"ghcn-button\" href=\"#/portal/signup\" data-portal=\"signup\">Become a member</a><a class=\"ghcn-button ghcn-button--outline\" href=\"#/portal/signin\" data-portal=\"signin\">Sign in</a></div>\n {{/if}}\n {{/if}}\n</aside>"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "member-cta.css",
|
|
16
|
+
"type": "style",
|
|
17
|
+
"target": "assets/css/components/member-cta.css",
|
|
18
|
+
"content": "/* ghostcn: Member CTA */\n.ghcn-member-cta { box-sizing: border-box; max-width: 44em; margin: 3em auto; overflow: hidden; border: 1px solid var(--border); border-radius: min(var(--radius),1.25em); padding: clamp(1.5em,5vw,3em); color: var(--card-foreground); background: radial-gradient(circle at top right,color-mix(in srgb,var(--primary) 18%,transparent),transparent 48%),var(--card); text-align: center; font-family: inherit; font-size: 16px; line-height: 1.5; isolation: isolate; }\n.ghcn-member-cta *, .ghcn-member-cta *::before, .ghcn-member-cta *::after { box-sizing: border-box; }\n.ghcn-member-cta h2 { margin: 1em 0 0.625em; color: var(--foreground); font-size: clamp(1.5em,4vw,2.25em); line-height: 1.1; letter-spacing: -0.035em; }\n.ghcn-member-cta p { max-width: 34em; margin: 0 auto 1.5em; color: var(--muted-foreground); }\n.ghcn-member-cta__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75em; }\n"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"gscan": {
|
|
22
|
+
"rules_satisfied": [
|
|
23
|
+
"GS010-PJ-VALID"
|
|
24
|
+
],
|
|
25
|
+
"notes": "Uses post access, member state, paid status, and native Portal triggers."
|
|
26
|
+
}
|
|
27
|
+
}
|