chalknotes 0.0.34 → 1.0.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 +143 -188
- package/bin/chalknotes.js +31 -0
- package/bin/cli.js +27 -288
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +196 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/scaffold.d.ts +6 -0
- package/dist/commands/scaffold.d.ts.map +1 -0
- package/dist/commands/scaffold.js +196 -0
- package/dist/commands/scaffold.js.map +1 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +163 -0
- package/dist/index.js.map +1 -0
- package/dist/notion/client.d.ts +14 -0
- package/dist/notion/client.d.ts.map +1 -0
- package/dist/notion/client.js +191 -0
- package/dist/notion/client.js.map +1 -0
- package/dist/plugins/parser.d.ts +10 -0
- package/dist/plugins/parser.d.ts.map +1 -0
- package/dist/plugins/parser.js +307 -0
- package/dist/plugins/parser.js.map +1 -0
- package/dist/templates/components.d.ts +4 -0
- package/dist/templates/components.d.ts.map +1 -0
- package/dist/templates/components.js +556 -0
- package/dist/templates/components.js.map +1 -0
- package/dist/templates/pages.d.ts +4 -0
- package/dist/templates/pages.d.ts.map +1 -0
- package/dist/templates/pages.js +321 -0
- package/dist/templates/pages.js.map +1 -0
- package/dist/types/index.d.ts +64 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/config.d.ts +12 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +99 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/detection.d.ts +19 -0
- package/dist/utils/detection.d.ts.map +1 -0
- package/dist/utils/detection.js +246 -0
- package/dist/utils/detection.js.map +1 -0
- package/dist/utils/logger.d.ts +10 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +62 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +47 -10
- package/templates/example-config.js +34 -0
- package/templates/example-env +3 -0
- package/src/index.js +0 -10
- package/src/lib/getAllPosts.js +0 -35
- package/src/lib/getPostBySlug.js +0 -380
- package/src/lib/nextHelpers.js +0 -36
- package/src/lib/notion.js +0 -11
- package/src/utils.js +0 -6
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.scaffold = scaffold;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const detection_1 = require("../utils/detection");
|
|
40
|
+
const config_1 = require("../utils/config");
|
|
41
|
+
const logger_1 = require("../utils/logger");
|
|
42
|
+
const components_1 = require("../templates/components");
|
|
43
|
+
const pages_1 = require("../templates/pages");
|
|
44
|
+
async function scaffold(options = {}) {
|
|
45
|
+
logger_1.Logger.title('Scaffolding ChalkNotes Blog');
|
|
46
|
+
try {
|
|
47
|
+
// Step 1: Load configuration
|
|
48
|
+
logger_1.Logger.step(1, 6, 'Loading configuration...');
|
|
49
|
+
const configManager = new config_1.ConfigManager();
|
|
50
|
+
if (!configManager.exists()) {
|
|
51
|
+
logger_1.Logger.error('Configuration file not found. Please run "chalknotes init" first.');
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
const config = await configManager.load();
|
|
55
|
+
if (!config) {
|
|
56
|
+
logger_1.Logger.error('Failed to load configuration.');
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
// Override theme if provided
|
|
60
|
+
if (options.theme) {
|
|
61
|
+
config.theme = options.theme;
|
|
62
|
+
}
|
|
63
|
+
// Step 2: Detect project structure
|
|
64
|
+
logger_1.Logger.step(2, 6, 'Detecting project structure...');
|
|
65
|
+
const detector = new detection_1.ProjectDetector();
|
|
66
|
+
const detection = await detector.detect();
|
|
67
|
+
if (!detection.isNextJs) {
|
|
68
|
+
logger_1.Logger.error('Next.js project not detected. ChalkNotes requires Next.js.');
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
logger_1.Logger.success(`Project structure detected: ${detection.isAppRouter ? 'App Router' : 'Pages Router'}`);
|
|
72
|
+
// Step 3: Prepare template variables
|
|
73
|
+
logger_1.Logger.step(3, 6, 'Preparing templates...');
|
|
74
|
+
const templateVars = {
|
|
75
|
+
routeBasePath: config.routeBasePath,
|
|
76
|
+
theme: config.theme,
|
|
77
|
+
hasTypeScript: detection.hasTypeScript,
|
|
78
|
+
hasTailwind: detection.hasTailwind,
|
|
79
|
+
isAppRouter: detection.isAppRouter,
|
|
80
|
+
cssFramework: getCSSFramework(detection)
|
|
81
|
+
};
|
|
82
|
+
// Step 4: Create directory structure
|
|
83
|
+
logger_1.Logger.step(4, 6, 'Creating directory structure...');
|
|
84
|
+
const blogDir = await createDirectoryStructure(config.routeBasePath, detection.isAppRouter);
|
|
85
|
+
// Step 5: Generate components and pages
|
|
86
|
+
logger_1.Logger.step(5, 6, 'Generating components and pages...');
|
|
87
|
+
await generateFiles(blogDir, templateVars, detection);
|
|
88
|
+
// Step 6: Install dependencies if needed
|
|
89
|
+
logger_1.Logger.step(6, 6, 'Checking dependencies...');
|
|
90
|
+
await checkAndInstallDependencies(detection);
|
|
91
|
+
logger_1.Logger.success('Blog scaffolding completed successfully!');
|
|
92
|
+
logger_1.Logger.section('Generated files:');
|
|
93
|
+
if (detection.isAppRouter) {
|
|
94
|
+
logger_1.Logger.info(`✓ app${config.routeBasePath}/page.${detection.hasTypeScript ? 'tsx' : 'jsx'} (Blog index)`);
|
|
95
|
+
logger_1.Logger.info(`✓ app${config.routeBasePath}/[slug]/page.${detection.hasTypeScript ? 'tsx' : 'jsx'} (Blog post)`);
|
|
96
|
+
logger_1.Logger.info(`✓ app${config.routeBasePath}/[slug]/NotionRenderer.${detection.hasTypeScript ? 'tsx' : 'jsx'}`);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
logger_1.Logger.info(`✓ pages${config.routeBasePath}/index.${detection.hasTypeScript ? 'tsx' : 'jsx'} (Blog index)`);
|
|
100
|
+
logger_1.Logger.info(`✓ pages${config.routeBasePath}/[slug].${detection.hasTypeScript ? 'tsx' : 'jsx'} (Blog post)`);
|
|
101
|
+
logger_1.Logger.info(`✓ pages${config.routeBasePath}/NotionRenderer.${detection.hasTypeScript ? 'tsx' : 'jsx'}`);
|
|
102
|
+
}
|
|
103
|
+
if (templateVars.cssFramework === 'css-modules') {
|
|
104
|
+
logger_1.Logger.info(`✓ NotionRenderer.module.css`);
|
|
105
|
+
}
|
|
106
|
+
logger_1.Logger.section('Next steps:');
|
|
107
|
+
logger_1.Logger.info('1. Add your Notion credentials to .env file');
|
|
108
|
+
logger_1.Logger.info('2. Start your development server');
|
|
109
|
+
logger_1.Logger.info(`3. Visit ${config.routeBasePath} to see your blog`);
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
logger_1.Logger.error(`Scaffolding failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
113
|
+
process.exit(1);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function getCSSFramework(detection) {
|
|
117
|
+
if (detection.hasTailwind)
|
|
118
|
+
return 'tailwind';
|
|
119
|
+
if (detection.hasStyledComponents)
|
|
120
|
+
return 'styled-components';
|
|
121
|
+
if (detection.hasCSSModules)
|
|
122
|
+
return 'css-modules';
|
|
123
|
+
return 'none';
|
|
124
|
+
}
|
|
125
|
+
async function createDirectoryStructure(routeBasePath, isAppRouter) {
|
|
126
|
+
const routePath = routeBasePath.replace(/^\//, '');
|
|
127
|
+
const baseDir = isAppRouter ? 'app' : 'pages';
|
|
128
|
+
const blogDir = path.join(process.cwd(), baseDir, routePath);
|
|
129
|
+
// Create the main blog directory
|
|
130
|
+
await fs.promises.mkdir(blogDir, { recursive: true });
|
|
131
|
+
if (isAppRouter) {
|
|
132
|
+
// Create [slug] directory for App Router
|
|
133
|
+
const slugDir = path.join(blogDir, '[slug]');
|
|
134
|
+
await fs.promises.mkdir(slugDir, { recursive: true });
|
|
135
|
+
return slugDir;
|
|
136
|
+
}
|
|
137
|
+
return blogDir;
|
|
138
|
+
}
|
|
139
|
+
async function generateFiles(blogDir, templateVars, detection) {
|
|
140
|
+
const ext = templateVars.hasTypeScript ? 'tsx' : 'jsx';
|
|
141
|
+
const isAppRouter = templateVars.isAppRouter;
|
|
142
|
+
// Generate NotionRenderer component
|
|
143
|
+
const rendererContent = (0, components_1.generateNotionRenderer)(templateVars);
|
|
144
|
+
const rendererPath = path.join(blogDir, `NotionRenderer.${ext}`);
|
|
145
|
+
await fs.promises.writeFile(rendererPath, rendererContent);
|
|
146
|
+
// Generate CSS Modules file if needed
|
|
147
|
+
if (templateVars.cssFramework === 'css-modules') {
|
|
148
|
+
const cssContent = (0, components_1.generateCSSModules)();
|
|
149
|
+
const cssPath = path.join(blogDir, 'NotionRenderer.module.css');
|
|
150
|
+
await fs.promises.writeFile(cssPath, cssContent);
|
|
151
|
+
}
|
|
152
|
+
if (isAppRouter) {
|
|
153
|
+
// App Router structure
|
|
154
|
+
const parentDir = path.dirname(blogDir);
|
|
155
|
+
// Generate blog index page
|
|
156
|
+
const indexContent = (0, pages_1.generateIndexPage)(templateVars);
|
|
157
|
+
const indexPath = path.join(parentDir, `page.${ext}`);
|
|
158
|
+
await fs.promises.writeFile(indexPath, indexContent);
|
|
159
|
+
// Generate individual blog post page
|
|
160
|
+
const postContent = (0, pages_1.generateBlogPage)(templateVars);
|
|
161
|
+
const postPath = path.join(blogDir, `page.${ext}`);
|
|
162
|
+
await fs.promises.writeFile(postPath, postContent);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
// Pages Router structure
|
|
166
|
+
// Generate blog index page
|
|
167
|
+
const indexContent = (0, pages_1.generateIndexPage)(templateVars);
|
|
168
|
+
const indexPath = path.join(blogDir, `index.${ext}`);
|
|
169
|
+
await fs.promises.writeFile(indexPath, indexContent);
|
|
170
|
+
// Generate individual blog post page
|
|
171
|
+
const postContent = (0, pages_1.generateBlogPage)(templateVars);
|
|
172
|
+
const postPath = path.join(blogDir, `[slug].${ext}`);
|
|
173
|
+
await fs.promises.writeFile(postPath, postContent);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
async function checkAndInstallDependencies(detection) {
|
|
177
|
+
const packageJsonPath = path.join(process.cwd(), 'package.json');
|
|
178
|
+
try {
|
|
179
|
+
const packageJson = JSON.parse(await fs.promises.readFile(packageJsonPath, 'utf-8'));
|
|
180
|
+
const dependencies = { ...packageJson.dependencies, ...packageJson.devDependencies };
|
|
181
|
+
const requiredDeps = ['chalknotes'];
|
|
182
|
+
const missingDeps = requiredDeps.filter(dep => !dependencies[dep]);
|
|
183
|
+
if (missingDeps.length > 0) {
|
|
184
|
+
logger_1.Logger.warn(`Missing dependencies: ${missingDeps.join(', ')}`);
|
|
185
|
+
logger_1.Logger.info(`Please install them with: ${detection.packageManager} install ${missingDeps.join(' ')}`);
|
|
186
|
+
}
|
|
187
|
+
// Check for optional but recommended dependencies
|
|
188
|
+
if (!dependencies['@types/node'] && detection.hasTypeScript) {
|
|
189
|
+
logger_1.Logger.info(`Recommendation: Install @types/node for better TypeScript support`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
catch (error) {
|
|
193
|
+
logger_1.Logger.warn('Could not check dependencies. Please ensure chalknotes is installed.');
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=scaffold.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scaffold.js","sourceRoot":"","sources":["../../src/commands/scaffold.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,4BAqFC;AAlGD,uCAAyB;AACzB,2CAA6B;AAC7B,kDAAqD;AACrD,4CAAgD;AAChD,4CAAyC;AACzC,wDAAqF;AACrF,8CAAyE;AAOlE,KAAK,UAAU,QAAQ,CAAC,UAA2B,EAAE;IAC1D,eAAM,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAE5C,IAAI,CAAC;QACH,6BAA6B;QAC7B,eAAM,CAAC,IAAI,CAAC,CAAC,EAAE,C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,CAAC,CAAC;QACnF,CAAC;IAEH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,eAAM,CAAC,IAAI,CAAC,sEAAsE,CAAC,CAAC;IACtF,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export { NotionClient } from './notion/client';
|
|
2
|
+
export type { ChalkNotesConfig, BlogPost, NotionBlock, Plugin, PluginContext } from './types';
|
|
3
|
+
export { PluginParser, builtInPlugins, defaultPluginStyles } from './plugins/parser';
|
|
4
|
+
export { ProjectDetector } from './utils/detection';
|
|
5
|
+
export { ConfigManager } from './utils/config';
|
|
6
|
+
export { Logger } from './utils/logger';
|
|
7
|
+
import type { Plugin } from './types';
|
|
8
|
+
/**
|
|
9
|
+
* Get all published blog posts from Notion
|
|
10
|
+
*/
|
|
11
|
+
export declare function getAllPosts(): Promise<import("./types").BlogPost[]>;
|
|
12
|
+
/**
|
|
13
|
+
* Get a specific blog post by slug
|
|
14
|
+
*/
|
|
15
|
+
export declare function getPostBySlug(slug: string): Promise<import("./types").BlogPost | null>;
|
|
16
|
+
/**
|
|
17
|
+
* Next.js Pages Router helper for getStaticProps
|
|
18
|
+
*/
|
|
19
|
+
export declare function getStaticPropsForPost({ params }: {
|
|
20
|
+
params: {
|
|
21
|
+
slug: string;
|
|
22
|
+
};
|
|
23
|
+
}): Promise<{
|
|
24
|
+
notFound: boolean;
|
|
25
|
+
props?: undefined;
|
|
26
|
+
revalidate?: undefined;
|
|
27
|
+
} | {
|
|
28
|
+
props: {
|
|
29
|
+
post: import("./types").BlogPost;
|
|
30
|
+
};
|
|
31
|
+
revalidate: number;
|
|
32
|
+
notFound?: undefined;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* Next.js Pages Router helper for getStaticPaths
|
|
36
|
+
*/
|
|
37
|
+
export declare function getStaticPathsForPosts(): Promise<{
|
|
38
|
+
paths: {
|
|
39
|
+
params: {
|
|
40
|
+
slug: string;
|
|
41
|
+
};
|
|
42
|
+
}[];
|
|
43
|
+
fallback: string;
|
|
44
|
+
}>;
|
|
45
|
+
/**
|
|
46
|
+
* Register a custom plugin
|
|
47
|
+
*/
|
|
48
|
+
export declare function registerPlugin(plugin: Plugin): void;
|
|
49
|
+
/**
|
|
50
|
+
* Get list of available plugins
|
|
51
|
+
*/
|
|
52
|
+
export declare function getAvailablePlugins(): string[];
|
|
53
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,YAAY,EACV,gBAAgB,EAChB,QAAQ,EACR,WAAW,EACX,MAAM,EACN,aAAa,EACd,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGrF,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAKxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAkCtC;;GAEG;AACH,wBAAsB,WAAW,0CAQhC;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,8CAqC/C;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE;;;;;;;;;;GAsBnF;AAED;;GAEG;AACH,wBAAsB,sBAAsB;;;;;;;GAmB3C;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,QAG5C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,EAAE,CAG9C"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Logger = exports.ConfigManager = exports.ProjectDetector = exports.defaultPluginStyles = exports.builtInPlugins = exports.PluginParser = exports.NotionClient = void 0;
|
|
4
|
+
exports.getAllPosts = getAllPosts;
|
|
5
|
+
exports.getPostBySlug = getPostBySlug;
|
|
6
|
+
exports.getStaticPropsForPost = getStaticPropsForPost;
|
|
7
|
+
exports.getStaticPathsForPosts = getStaticPathsForPosts;
|
|
8
|
+
exports.registerPlugin = registerPlugin;
|
|
9
|
+
exports.getAvailablePlugins = getAvailablePlugins;
|
|
10
|
+
// Core API exports
|
|
11
|
+
var client_1 = require("./notion/client");
|
|
12
|
+
Object.defineProperty(exports, "NotionClient", { enumerable: true, get: function () { return client_1.NotionClient; } });
|
|
13
|
+
// Plugin system
|
|
14
|
+
var parser_1 = require("./plugins/parser");
|
|
15
|
+
Object.defineProperty(exports, "PluginParser", { enumerable: true, get: function () { return parser_1.PluginParser; } });
|
|
16
|
+
Object.defineProperty(exports, "builtInPlugins", { enumerable: true, get: function () { return parser_1.builtInPlugins; } });
|
|
17
|
+
Object.defineProperty(exports, "defaultPluginStyles", { enumerable: true, get: function () { return parser_1.defaultPluginStyles; } });
|
|
18
|
+
// Utilities
|
|
19
|
+
var detection_1 = require("./utils/detection");
|
|
20
|
+
Object.defineProperty(exports, "ProjectDetector", { enumerable: true, get: function () { return detection_1.ProjectDetector; } });
|
|
21
|
+
var config_1 = require("./utils/config");
|
|
22
|
+
Object.defineProperty(exports, "ConfigManager", { enumerable: true, get: function () { return config_1.ConfigManager; } });
|
|
23
|
+
var logger_1 = require("./utils/logger");
|
|
24
|
+
Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return logger_1.Logger; } });
|
|
25
|
+
// Main API functions for Next.js integration
|
|
26
|
+
const client_2 = require("./notion/client");
|
|
27
|
+
const parser_2 = require("./plugins/parser");
|
|
28
|
+
let notionClient = null;
|
|
29
|
+
let pluginParser = null;
|
|
30
|
+
function getNotionClient() {
|
|
31
|
+
if (!notionClient) {
|
|
32
|
+
// Get credentials from environment variables directly
|
|
33
|
+
const notionToken = process.env.NOTION_TOKEN;
|
|
34
|
+
const notionDatabaseId = process.env.NOTION_DATABASE_ID;
|
|
35
|
+
if (!notionToken || !notionDatabaseId) {
|
|
36
|
+
throw new Error('NOTION_TOKEN and NOTION_DATABASE_ID environment variables are required. Please check your .env file.');
|
|
37
|
+
}
|
|
38
|
+
notionClient = new client_2.NotionClient(notionToken, notionDatabaseId);
|
|
39
|
+
}
|
|
40
|
+
return notionClient;
|
|
41
|
+
}
|
|
42
|
+
function getPluginParser() {
|
|
43
|
+
if (!pluginParser) {
|
|
44
|
+
pluginParser = new parser_2.PluginParser();
|
|
45
|
+
// Register built-in plugins
|
|
46
|
+
parser_2.builtInPlugins.forEach(plugin => {
|
|
47
|
+
pluginParser.registerPlugin(plugin);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return pluginParser;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Get all published blog posts from Notion
|
|
54
|
+
*/
|
|
55
|
+
async function getAllPosts() {
|
|
56
|
+
try {
|
|
57
|
+
const client = getNotionClient();
|
|
58
|
+
return await client.getAllPosts();
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
console.error('Error fetching posts:', error);
|
|
62
|
+
throw error;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Get a specific blog post by slug
|
|
67
|
+
*/
|
|
68
|
+
async function getPostBySlug(slug) {
|
|
69
|
+
try {
|
|
70
|
+
const client = getNotionClient();
|
|
71
|
+
const post = await client.getPostBySlug(slug);
|
|
72
|
+
if (!post) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
// Process plugins in post content
|
|
76
|
+
const parser = getPluginParser();
|
|
77
|
+
// Create a basic context for plugins (avoiding dynamic config loading)
|
|
78
|
+
const basicConfig = {
|
|
79
|
+
notionToken: process.env.NOTION_TOKEN || '',
|
|
80
|
+
notionDatabaseId: process.env.NOTION_DATABASE_ID || '',
|
|
81
|
+
routeBasePath: process.env.CHALKNOTES_ROUTE_BASE_PATH || '/blog',
|
|
82
|
+
theme: process.env.CHALKNOTES_THEME || 'modern',
|
|
83
|
+
plugins: [],
|
|
84
|
+
caching: { enabled: true, ttl: 3600 },
|
|
85
|
+
errorBoundaries: true
|
|
86
|
+
};
|
|
87
|
+
// Process each text block for plugin syntax
|
|
88
|
+
post.blocks = post.blocks.map(block => {
|
|
89
|
+
if (block.text) {
|
|
90
|
+
const context = { content: block.text, config: basicConfig, post };
|
|
91
|
+
block.text = parser.parseContent(block.text, context);
|
|
92
|
+
}
|
|
93
|
+
return block;
|
|
94
|
+
});
|
|
95
|
+
return post;
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
console.error('Error fetching post:', error);
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Next.js Pages Router helper for getStaticProps
|
|
104
|
+
*/
|
|
105
|
+
async function getStaticPropsForPost({ params }) {
|
|
106
|
+
try {
|
|
107
|
+
const post = await getPostBySlug(params.slug);
|
|
108
|
+
if (!post) {
|
|
109
|
+
return {
|
|
110
|
+
notFound: true
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
props: {
|
|
115
|
+
post
|
|
116
|
+
},
|
|
117
|
+
revalidate: 3600 // Revalidate every hour
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
console.error('Error in getStaticProps:', error);
|
|
122
|
+
return {
|
|
123
|
+
notFound: true
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Next.js Pages Router helper for getStaticPaths
|
|
129
|
+
*/
|
|
130
|
+
async function getStaticPathsForPosts() {
|
|
131
|
+
try {
|
|
132
|
+
const posts = await getAllPosts();
|
|
133
|
+
const paths = posts.map((post) => ({
|
|
134
|
+
params: { slug: post.slug }
|
|
135
|
+
}));
|
|
136
|
+
return {
|
|
137
|
+
paths,
|
|
138
|
+
fallback: 'blocking'
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
console.error('Error in getStaticPaths:', error);
|
|
143
|
+
return {
|
|
144
|
+
paths: [],
|
|
145
|
+
fallback: 'blocking'
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Register a custom plugin
|
|
151
|
+
*/
|
|
152
|
+
function registerPlugin(plugin) {
|
|
153
|
+
const parser = getPluginParser();
|
|
154
|
+
parser.registerPlugin(plugin);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Get list of available plugins
|
|
158
|
+
*/
|
|
159
|
+
function getAvailablePlugins() {
|
|
160
|
+
const parser = getPluginParser();
|
|
161
|
+
return parser.getAvailablePlugins();
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AA4DA,kCAQC;AAKD,sCAqCC;AAKD,sDAsBC;AAKD,wDAmBC;AAKD,wCAGC;AAKD,kDAGC;AAjLD,mBAAmB;AACnB,0CAA+C;AAAtC,sGAAA,YAAY,OAAA;AAWrB,gBAAgB;AAChB,2CAAqF;AAA5E,sGAAA,YAAY,OAAA;AAAE,wGAAA,cAAc,OAAA;AAAE,6GAAA,mBAAmB,OAAA;AAE1D,YAAY;AACZ,+CAAoD;AAA3C,4GAAA,eAAe,OAAA;AACxB,yCAA+C;AAAtC,uGAAA,aAAa,OAAA;AACtB,yCAAwC;AAA/B,gGAAA,MAAM,OA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AAE,CAAC;IACjC,OAAO,MAAM,CAAC,mBAAmB,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BlogPost } from '../types';
|
|
2
|
+
export declare class NotionClient {
|
|
3
|
+
private client;
|
|
4
|
+
private databaseId;
|
|
5
|
+
constructor(token: string, databaseId: string);
|
|
6
|
+
getAllPosts(): Promise<BlogPost[]>;
|
|
7
|
+
getPostBySlug(slug: string): Promise<BlogPost | null>;
|
|
8
|
+
private extractPostMetadata;
|
|
9
|
+
private getPageBlocks;
|
|
10
|
+
private convertBlockToStructuredJSON;
|
|
11
|
+
private extractPlainText;
|
|
12
|
+
private slugify;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/notion/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAe,MAAM,UAAU,CAAC;AAEjD,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,UAAU,CAAS;gBAEf,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAKvC,WAAW,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;IAiClC,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;YAqB7C,mBAAmB;YAgCnB,aAAa;IAsB3B,OAAO,CAAC,4BAA4B;IAsFpC,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,OAAO;CAMhB"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotionClient = void 0;
|
|
4
|
+
const client_1 = require("@notionhq/client");
|
|
5
|
+
class NotionClient {
|
|
6
|
+
constructor(token, databaseId) {
|
|
7
|
+
this.client = new client_1.Client({ auth: token });
|
|
8
|
+
this.databaseId = databaseId;
|
|
9
|
+
}
|
|
10
|
+
async getAllPosts() {
|
|
11
|
+
try {
|
|
12
|
+
const response = await this.client.databases.query({
|
|
13
|
+
database_id: this.databaseId,
|
|
14
|
+
filter: {
|
|
15
|
+
property: 'Published',
|
|
16
|
+
checkbox: {
|
|
17
|
+
equals: true
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
sorts: [
|
|
21
|
+
{
|
|
22
|
+
property: 'Created',
|
|
23
|
+
direction: 'descending'
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
});
|
|
27
|
+
const posts = [];
|
|
28
|
+
for (const page of response.results) {
|
|
29
|
+
const post = await this.extractPostMetadata(page);
|
|
30
|
+
if (post) {
|
|
31
|
+
posts.push(post);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return posts;
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
throw new Error(`Failed to fetch posts from Notion: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async getPostBySlug(slug) {
|
|
41
|
+
try {
|
|
42
|
+
const posts = await this.getAllPosts();
|
|
43
|
+
const post = posts.find(p => p.slug === slug);
|
|
44
|
+
if (!post) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
// Fetch the full content
|
|
48
|
+
const blocks = await this.getPageBlocks(post.notionPageId);
|
|
49
|
+
return {
|
|
50
|
+
...post,
|
|
51
|
+
blocks
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
throw new Error(`Failed to fetch post "${slug}": ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async extractPostMetadata(page) {
|
|
59
|
+
try {
|
|
60
|
+
const titleProperty = page.properties['Name'] || page.properties['Title'];
|
|
61
|
+
const title = titleProperty?.title?.[0]?.plain_text;
|
|
62
|
+
if (!title) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
const slug = this.slugify(title);
|
|
66
|
+
// Extract additional metadata
|
|
67
|
+
const publishedAtProperty = page.properties['Published Date'] || page.properties['Date'];
|
|
68
|
+
const publishedAt = publishedAtProperty?.date?.start;
|
|
69
|
+
const tagsProperty = page.properties['Tags'];
|
|
70
|
+
const tags = tagsProperty?.multi_select?.map((tag) => tag.name) || [];
|
|
71
|
+
return {
|
|
72
|
+
title,
|
|
73
|
+
slug,
|
|
74
|
+
notionPageId: page.id,
|
|
75
|
+
blocks: [], // Will be populated when full content is fetched
|
|
76
|
+
publishedAt,
|
|
77
|
+
tags
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
console.warn(`Failed to extract metadata for page: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
async getPageBlocks(pageId) {
|
|
86
|
+
try {
|
|
87
|
+
const response = await this.client.blocks.children.list({
|
|
88
|
+
block_id: pageId,
|
|
89
|
+
page_size: 100
|
|
90
|
+
});
|
|
91
|
+
const blocks = [];
|
|
92
|
+
for (const block of response.results) {
|
|
93
|
+
const convertedBlock = this.convertBlockToStructuredJSON(block);
|
|
94
|
+
if (convertedBlock) {
|
|
95
|
+
blocks.push(convertedBlock);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return blocks;
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
throw new Error(`Failed to fetch blocks for page ${pageId}: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
convertBlockToStructuredJSON(block) {
|
|
105
|
+
const base = { type: block.type };
|
|
106
|
+
try {
|
|
107
|
+
switch (block.type) {
|
|
108
|
+
case 'paragraph':
|
|
109
|
+
return {
|
|
110
|
+
...base,
|
|
111
|
+
text: this.extractPlainText(block.paragraph.rich_text),
|
|
112
|
+
richText: block.paragraph.rich_text
|
|
113
|
+
};
|
|
114
|
+
case 'heading_1':
|
|
115
|
+
case 'heading_2':
|
|
116
|
+
case 'heading_3':
|
|
117
|
+
return {
|
|
118
|
+
...base,
|
|
119
|
+
text: this.extractPlainText(block[block.type].rich_text),
|
|
120
|
+
richText: block[block.type].rich_text
|
|
121
|
+
};
|
|
122
|
+
case 'bulleted_list_item':
|
|
123
|
+
case 'numbered_list_item':
|
|
124
|
+
return {
|
|
125
|
+
...base,
|
|
126
|
+
text: this.extractPlainText(block[block.type].rich_text),
|
|
127
|
+
richText: block[block.type].rich_text
|
|
128
|
+
};
|
|
129
|
+
case 'image': {
|
|
130
|
+
const image = block.image;
|
|
131
|
+
const url = image.type === 'external' ? image.external.url : image.file.url;
|
|
132
|
+
const caption = this.extractPlainText(image.caption);
|
|
133
|
+
return {
|
|
134
|
+
...base,
|
|
135
|
+
imageUrl: url,
|
|
136
|
+
caption,
|
|
137
|
+
alt: caption || 'Blog image from Notion'
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
case 'quote':
|
|
141
|
+
return {
|
|
142
|
+
...base,
|
|
143
|
+
text: this.extractPlainText(block.quote.rich_text),
|
|
144
|
+
richText: block.quote.rich_text
|
|
145
|
+
};
|
|
146
|
+
case 'code':
|
|
147
|
+
return {
|
|
148
|
+
...base,
|
|
149
|
+
code: this.extractPlainText(block.code.rich_text),
|
|
150
|
+
language: block.code.language || 'text'
|
|
151
|
+
};
|
|
152
|
+
case 'divider':
|
|
153
|
+
return { ...base };
|
|
154
|
+
case 'callout':
|
|
155
|
+
return {
|
|
156
|
+
...base,
|
|
157
|
+
text: this.extractPlainText(block.callout.rich_text),
|
|
158
|
+
richText: block.callout.rich_text
|
|
159
|
+
};
|
|
160
|
+
case 'table_of_contents':
|
|
161
|
+
case 'bookmark':
|
|
162
|
+
case 'equation':
|
|
163
|
+
case 'table':
|
|
164
|
+
return { ...base };
|
|
165
|
+
default:
|
|
166
|
+
return {
|
|
167
|
+
...base,
|
|
168
|
+
unsupported: true
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
console.warn(`Failed to convert block of type ${block.type}:`, error);
|
|
174
|
+
return {
|
|
175
|
+
type: block.type,
|
|
176
|
+
unsupported: true
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
extractPlainText(richText = []) {
|
|
181
|
+
return richText.map(t => t.plain_text).join('');
|
|
182
|
+
}
|
|
183
|
+
slugify(str) {
|
|
184
|
+
return str
|
|
185
|
+
.toLowerCase()
|
|
186
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
187
|
+
.replace(/(^-|-$)/g, '');
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
exports.NotionClient = NotionClient;
|
|
191
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/notion/client.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAG1C,MAAa,YAAY;IAIvB,YAAY,KAAa,EAAE,UAAkB;QAC3C,IAAI,CAAC,MAAM,GAAG,IAAI,eAAM,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAC1C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,WAAW;QACf,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;gBACjD,WAAW,EAAE,IAAI,CAAC,UAAU;gBAC5B,MAAM,EAAE;oBACN,QAAQ,EAAE,WAAW;oBACrB,QAAQ,EAAE;wBACR,MAAM,EAAE,IAAI;qBACb;iBACF;gBACD,KAAK,EAAE;oBACL;wBACE,QAAQ,EAAE,SAAS;wBACnB,SAAS,EAAE,YAAY;qBACxB;iBACF;aACF,CAA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