@leadcms/sdk 1.2.89-pre â 1.2.91-pre
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 +136 -107
- package/dist/cli/index.js +19 -23
- package/dist/cli/index.js.map +1 -1
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +4 -10
- package/dist/lib/config.js.map +1 -1
- package/dist/scripts/fetch-leadcms-content.mjs +8 -0
- package/leadcms.config.json.sample +0 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -48,9 +48,29 @@ npm install -g @leadcms/sdk
|
|
|
48
48
|
|
|
49
49
|
LeadCMS SDK supports multiple configuration methods in order of priority:
|
|
50
50
|
|
|
51
|
-
### 1.
|
|
51
|
+
### 1. Environment Variables (Recommended for API credentials)
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
For security reasons, it's best to keep sensitive credentials as environment variables:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Required - keep these as environment variables for security
|
|
57
|
+
LEADCMS_URL=your-leadcms-instance-url
|
|
58
|
+
LEADCMS_API_KEY=your-api-key
|
|
59
|
+
|
|
60
|
+
# Optional - can also be set via environment variables
|
|
61
|
+
LEADCMS_DEFAULT_LANGUAGE=en
|
|
62
|
+
LEADCMS_CONTENT_DIR=.leadcms/content
|
|
63
|
+
LEADCMS_MEDIA_DIR=public/media
|
|
64
|
+
LEADCMS_ENABLE_DRAFTS=true
|
|
65
|
+
|
|
66
|
+
# Next.js users can also use:
|
|
67
|
+
NEXT_PUBLIC_LEADCMS_URL=your-leadcms-instance-url
|
|
68
|
+
NEXT_PUBLIC_LEADCMS_DEFAULT_LANGUAGE=en
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 2. Configuration File (For project-specific settings)
|
|
72
|
+
|
|
73
|
+
Create a `leadcms.config.json` file **only if you need to override default settings** like `contentDir`, `mediaDir`, or `defaultLanguage`:
|
|
54
74
|
|
|
55
75
|
```bash
|
|
56
76
|
# Initialize configuration file
|
|
@@ -59,8 +79,6 @@ npx leadcms init
|
|
|
59
79
|
|
|
60
80
|
```json
|
|
61
81
|
{
|
|
62
|
-
"url": "https://your-leadcms-instance.com",
|
|
63
|
-
"apiKey": "your-api-key-here",
|
|
64
82
|
"defaultLanguage": "en",
|
|
65
83
|
"contentDir": ".leadcms/content",
|
|
66
84
|
"mediaDir": "public/media",
|
|
@@ -68,9 +86,11 @@ npx leadcms init
|
|
|
68
86
|
}
|
|
69
87
|
```
|
|
70
88
|
|
|
71
|
-
> **Note:**
|
|
89
|
+
> **Security Note:** Avoid putting `url` and `apiKey` in config files. Environment variables are safer and work better with deployment platforms.
|
|
90
|
+
|
|
91
|
+
### 3. Programmatic Configuration
|
|
72
92
|
|
|
73
|
-
|
|
93
|
+
For advanced use cases, you can configure the SDK programmatically:
|
|
74
94
|
|
|
75
95
|
```typescript
|
|
76
96
|
import { configure } from '@leadcms/sdk';
|
|
@@ -78,26 +98,23 @@ import { configure } from '@leadcms/sdk';
|
|
|
78
98
|
configure({
|
|
79
99
|
url: 'https://your-leadcms-instance.com',
|
|
80
100
|
apiKey: 'your-api-key',
|
|
81
|
-
defaultLanguage: 'en'
|
|
101
|
+
defaultLanguage: 'en',
|
|
102
|
+
contentDir: '.leadcms/content',
|
|
103
|
+
mediaDir: 'public/media',
|
|
104
|
+
enableDrafts: false
|
|
82
105
|
});
|
|
83
106
|
```
|
|
84
107
|
|
|
85
|
-
|
|
108
|
+
> **Best Practice:** Use environment variables for `url` and `apiKey`, and programmatic configuration only for project-specific overrides.
|
|
86
109
|
|
|
87
|
-
|
|
88
|
-
# Required
|
|
89
|
-
LEADCMS_URL=your-leadcms-instance-url
|
|
90
|
-
LEADCMS_API_KEY=your-api-key
|
|
91
|
-
|
|
92
|
-
# Optional
|
|
93
|
-
LEADCMS_DEFAULT_LANGUAGE=en
|
|
94
|
-
LEADCMS_CONTENT_DIR=.leadcms/content
|
|
95
|
-
LEADCMS_MEDIA_DIR=public/media
|
|
110
|
+
### Configuration Options
|
|
96
111
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
112
|
+
- `url` - Your LeadCMS instance URL (**required**, best as env var)
|
|
113
|
+
- `apiKey` - Your LeadCMS API key (**required**, best as env var)
|
|
114
|
+
- `defaultLanguage` - Default language code (default: "en")
|
|
115
|
+
- `contentDir` - Directory for downloaded content (default: ".leadcms/content")
|
|
116
|
+
- `mediaDir` - Directory for media files (default: "public/media")
|
|
117
|
+
- `enableDrafts` - Enable draft content support (default: false)
|
|
101
118
|
|
|
102
119
|
## CLI Usage
|
|
103
120
|
|
|
@@ -128,97 +145,17 @@ npx leadcms watch
|
|
|
128
145
|
npx leadcms generate-env
|
|
129
146
|
```
|
|
130
147
|
|
|
131
|
-
## Core Functions
|
|
132
148
|
|
|
133
|
-
```typescript
|
|
134
|
-
import {
|
|
135
|
-
getCMSContentBySlugForLocale,
|
|
136
|
-
getAllContentSlugsForLocale,
|
|
137
|
-
getAllContentRoutes,
|
|
138
|
-
getAvailableLanguages,
|
|
139
|
-
configure
|
|
140
|
-
} from '@leadcms/sdk';
|
|
141
|
-
|
|
142
|
-
// Option 1: Use configuration file (recommended)
|
|
143
|
-
// Content directory from config: .leadcms/content
|
|
144
|
-
const content = getCMSContentBySlugForLocale('about-us', undefined, 'en');
|
|
145
|
-
|
|
146
|
-
// Option 2: Programmatic configuration
|
|
147
|
-
configure({
|
|
148
|
-
url: 'https://your-instance.com',
|
|
149
|
-
apiKey: 'your-key',
|
|
150
|
-
contentDir: '.leadcms/content'
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
// Option 3: Specify content directory explicitly
|
|
154
|
-
const content = getCMSContentBySlugForLocale('about-us', '.leadcms/content', 'en');
|
|
155
|
-
|
|
156
|
-
// Get all content slugs for a locale
|
|
157
|
-
const slugs = getAllContentSlugsForLocale('.leadcms/content', 'en');
|
|
158
|
-
|
|
159
|
-
// Get all routes (framework-agnostic)
|
|
160
|
-
const routes = getAllContentRoutes('.leadcms/content');
|
|
161
|
-
// Returns: [{ locale: 'en', slug: 'about-us', path: '/about-us', ... }]
|
|
162
|
-
|
|
163
|
-
// Get available languages (uses configured contentDir if not specified)
|
|
164
|
-
const languages = getAvailableLanguages();
|
|
165
|
-
|
|
166
|
-
// Get content with draft support
|
|
167
|
-
const draftContent = getCMSContentBySlugForLocaleWithDraftSupport(
|
|
168
|
-
'about-us',
|
|
169
|
-
'.leadcms/content',
|
|
170
|
-
'en',
|
|
171
|
-
'user-uuid-for-drafts'
|
|
172
|
-
);
|
|
173
|
-
|
|
174
|
-
// Load configuration objects
|
|
175
|
-
const headerConfig = getHeaderConfig('.leadcms/content', 'en');
|
|
176
|
-
const footerConfig = getFooterConfig('.leadcms/content', 'en');
|
|
177
|
-
|
|
178
|
-
// Advanced configuration loading with draft support
|
|
179
|
-
import {
|
|
180
|
-
loadConfigWithDraftSupport,
|
|
181
|
-
loadContentConfig,
|
|
182
|
-
getHeaderConfigAuto,
|
|
183
|
-
getFooterConfigAuto
|
|
184
|
-
} from '@leadcms/sdk';
|
|
185
|
-
|
|
186
|
-
// Generic config loading with explicit paths
|
|
187
|
-
const customConfig = loadConfigWithDraftSupport(
|
|
188
|
-
'.leadcms/content',
|
|
189
|
-
'en',
|
|
190
|
-
'navigation',
|
|
191
|
-
'user-uuid-for-drafts'
|
|
192
|
-
);
|
|
193
|
-
|
|
194
|
-
// Convenience functions using configured contentDir
|
|
195
|
-
const headerAuto = getHeaderConfigAuto('en', 'user-uuid-for-drafts');
|
|
196
|
-
const footerAuto = getFooterConfigAuto(); // Uses default language
|
|
197
|
-
|
|
198
|
-
// Generic config loading with auto contentDir resolution
|
|
199
|
-
const menuConfig = loadContentConfig('menu', 'en', 'user-uuid-for-drafts');
|
|
200
|
-
|
|
201
|
-
// Strict config loading with detailed error information (throws on missing files)
|
|
202
|
-
try {
|
|
203
|
-
const requiredConfig = loadContentConfigStrict('layout', 'en');
|
|
204
|
-
} catch (error) {
|
|
205
|
-
console.log('Missing config:', error.configName);
|
|
206
|
-
console.log('Expected locale:', error.locale);
|
|
207
|
-
console.log('Expected path:', error.message);
|
|
208
|
-
}
|
|
209
|
-
```
|
|
210
149
|
|
|
211
150
|
## Framework Integration
|
|
212
151
|
|
|
213
152
|
The SDK provides framework-agnostic data access. Most frameworks use it as a **development dependency** for build-time static generation:
|
|
214
153
|
|
|
215
154
|
```typescript
|
|
216
|
-
// Next.js
|
|
217
|
-
import { getAllContentRoutes, getCMSContentBySlugForLocale } from '@leadcms/sdk';
|
|
218
|
-
|
|
155
|
+
// Next.js Static Generation (Build-time only - devDependency)
|
|
219
156
|
export function generateStaticParams() {
|
|
220
157
|
// This runs at BUILD TIME, not runtime
|
|
221
|
-
const routes = getAllContentRoutes(
|
|
158
|
+
const routes = getAllContentRoutes();
|
|
222
159
|
return routes.map(route => ({
|
|
223
160
|
slug: route.slugParts,
|
|
224
161
|
...(route.isDefaultLocale ? {} : { locale: route.locale })
|
|
@@ -228,7 +165,7 @@ export function generateStaticParams() {
|
|
|
228
165
|
// Astro Static Generation (Build-time only - devDependency)
|
|
229
166
|
export function getStaticPaths() {
|
|
230
167
|
// This runs at BUILD TIME, not runtime
|
|
231
|
-
const routes = getAllContentRoutes(
|
|
168
|
+
const routes = getAllContentRoutes();
|
|
232
169
|
return routes.map(route => ({
|
|
233
170
|
params: { slug: route.slug },
|
|
234
171
|
props: { locale: route.locale, path: route.path }
|
|
@@ -238,7 +175,7 @@ export function getStaticPaths() {
|
|
|
238
175
|
// Gatsby Static Generation (Build-time only - devDependency)
|
|
239
176
|
exports.createPages = async ({ actions }) => {
|
|
240
177
|
const { createPage } = actions;
|
|
241
|
-
const routes = getAllContentRoutes(
|
|
178
|
+
const routes = getAllContentRoutes();
|
|
242
179
|
|
|
243
180
|
routes.forEach(route => {
|
|
244
181
|
createPage({
|
|
@@ -256,18 +193,77 @@ import { getCMSContentBySlugForLocale } from '@leadcms/sdk';
|
|
|
256
193
|
|
|
257
194
|
export async function GET(request) {
|
|
258
195
|
// This runs at REQUEST TIME, needs production dependency
|
|
259
|
-
const content = getCMSContentBySlugForLocale('about', '
|
|
196
|
+
const content = getCMSContentBySlugForLocale('about', 'en');
|
|
260
197
|
return Response.json(content);
|
|
261
198
|
}
|
|
262
199
|
|
|
263
200
|
// Express.js Server (Runtime)
|
|
264
201
|
app.get('/api/content/:slug', (req, res) => {
|
|
265
202
|
// This runs at REQUEST TIME, needs production dependency
|
|
266
|
-
const content = getCMSContentBySlugForLocale(req.params.slug, '
|
|
203
|
+
const content = getCMSContentBySlugForLocale(req.params.slug, 'en');
|
|
267
204
|
res.json(content);
|
|
268
205
|
});
|
|
269
206
|
```
|
|
270
207
|
|
|
208
|
+
## API Reference
|
|
209
|
+
|
|
210
|
+
### Core Functions
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
import {
|
|
214
|
+
getCMSContentBySlugForLocale,
|
|
215
|
+
getAllContentSlugsForLocale,
|
|
216
|
+
getAllContentRoutes,
|
|
217
|
+
getAvailableLanguages,
|
|
218
|
+
configure
|
|
219
|
+
} from '@leadcms/sdk';
|
|
220
|
+
|
|
221
|
+
// Get content by slug and locale
|
|
222
|
+
const content = getCMSContentBySlugForLocale('about-us', 'en');
|
|
223
|
+
|
|
224
|
+
// Get all content slugs for a locale
|
|
225
|
+
const slugs = getAllContentSlugsForLocale('en');
|
|
226
|
+
|
|
227
|
+
// Get all routes (framework-agnostic)
|
|
228
|
+
const routes = getAllContentRoutes();
|
|
229
|
+
// Returns: [{ locale: 'en', slug: 'about-us', path: '/about-us', ... }]
|
|
230
|
+
|
|
231
|
+
// Get available languages (uses configured contentDir)
|
|
232
|
+
const languages = getAvailableLanguages();
|
|
233
|
+
|
|
234
|
+
// Get content with draft support
|
|
235
|
+
const draftContent = getCMSContentBySlugForLocaleWithDraftSupport(
|
|
236
|
+
'about-us',
|
|
237
|
+
'en',
|
|
238
|
+
'user-uuid-for-drafts'
|
|
239
|
+
);
|
|
240
|
+
|
|
241
|
+
// Load configuration objects (header, footer, etc.)
|
|
242
|
+
const headerConfig = getHeaderConfig('en');
|
|
243
|
+
const footerConfig = getFooterConfig('en');
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Advanced Configuration Loading
|
|
247
|
+
|
|
248
|
+
```typescript
|
|
249
|
+
import {
|
|
250
|
+
loadContentConfig,
|
|
251
|
+
loadContentConfigStrict
|
|
252
|
+
} from '@leadcms/sdk';
|
|
253
|
+
|
|
254
|
+
// Generic config loading with auto contentDir resolution
|
|
255
|
+
const menuConfig = loadContentConfig('menu', 'en', 'user-uuid-for-drafts');
|
|
256
|
+
|
|
257
|
+
// Strict config loading with detailed error information (throws on missing files)
|
|
258
|
+
try {
|
|
259
|
+
const requiredConfig = loadContentConfigStrict('layout', 'en');
|
|
260
|
+
} catch (error) {
|
|
261
|
+
console.log('Missing config:', error.configName);
|
|
262
|
+
console.log('Expected locale:', error.locale);
|
|
263
|
+
console.log('Expected path:', error.message);
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
271
267
|
## Docker Deployment
|
|
272
268
|
|
|
273
269
|
LeadCMS SDK includes framework-agnostic Docker templates for easy deployment:
|
|
@@ -410,7 +406,40 @@ try {
|
|
|
410
406
|
|
|
411
407
|
## Development
|
|
412
408
|
|
|
409
|
+
For SDK development and contributions:
|
|
410
|
+
|
|
413
411
|
```bash
|
|
412
|
+
# Clone and setup
|
|
413
|
+
git clone https://github.com/LeadCMS/leadcms.sdk.git
|
|
414
|
+
cd leadcms-sdk
|
|
415
|
+
npm install
|
|
416
|
+
|
|
417
|
+
# Development workflow
|
|
414
418
|
npm run build # Build the SDK
|
|
415
419
|
npm run dev # Watch mode for development
|
|
420
|
+
npm run test # Run tests
|
|
421
|
+
npm run clean # Clean build artifacts
|
|
422
|
+
|
|
423
|
+
# Local testing with npm link
|
|
424
|
+
npm link
|
|
425
|
+
cd ../your-test-project
|
|
426
|
+
npm link @leadcms/sdk
|
|
416
427
|
```
|
|
428
|
+
|
|
429
|
+
### Debug Mode
|
|
430
|
+
|
|
431
|
+
Enable detailed logging during development:
|
|
432
|
+
|
|
433
|
+
```bash
|
|
434
|
+
LEADCMS_DEBUG=true npm run build
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
### Contributing
|
|
438
|
+
|
|
439
|
+
1. Fork the repository
|
|
440
|
+
2. Create a feature branch
|
|
441
|
+
3. Make your changes
|
|
442
|
+
4. Run tests: `npm run test`
|
|
443
|
+
5. Submit a pull request
|
|
444
|
+
|
|
445
|
+
For detailed development setup, see [DEVELOPMENT.md](./DEVELOPMENT.md).
|
package/dist/cli/index.js
CHANGED
|
@@ -81,12 +81,12 @@ Usage:
|
|
|
81
81
|
leadcms generate-env - Generate environment variables file
|
|
82
82
|
|
|
83
83
|
Configuration:
|
|
84
|
-
|
|
84
|
+
Set required environment variables (recommended for security):
|
|
85
|
+
LEADCMS_URL=your-leadcms-instance-url
|
|
86
|
+
LEADCMS_API_KEY=your-api-key
|
|
85
87
|
|
|
86
|
-
|
|
88
|
+
Optional: Create leadcms.config.json for project-specific settings:
|
|
87
89
|
{
|
|
88
|
-
"url": "https://your-leadcms-instance.com",
|
|
89
|
-
"apiKey": "your-api-key",
|
|
90
90
|
"defaultLanguage": "en",
|
|
91
91
|
"contentDir": ".leadcms/content",
|
|
92
92
|
"mediaDir": "public/media"
|
|
@@ -104,20 +104,21 @@ Configuration:
|
|
|
104
104
|
break;
|
|
105
105
|
}
|
|
106
106
|
function initializeConfig() {
|
|
107
|
-
Promise.resolve().then(() => __importStar(require('fs'))).then(fs => {
|
|
107
|
+
Promise.all([Promise.resolve().then(() => __importStar(require('fs'))), Promise.resolve().then(() => __importStar(require('readline')))]).then(([fs, readline]) => {
|
|
108
108
|
const configPath = 'leadcms.config.json';
|
|
109
109
|
if (fs.existsSync(configPath)) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
110
|
+
const rl = readline.createInterface({
|
|
111
|
+
input: process.stdin,
|
|
112
|
+
output: process.stdout
|
|
113
|
+
});
|
|
114
|
+
rl.question('â leadcms.config.json already exists. Overwrite? (y/N): ', (answer) => {
|
|
115
|
+
if (answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes') {
|
|
115
116
|
createConfigFile(configPath);
|
|
116
117
|
}
|
|
117
118
|
else {
|
|
118
|
-
console.log('
|
|
119
|
+
console.log('â
Configuration initialization cancelled.');
|
|
119
120
|
}
|
|
120
|
-
|
|
121
|
+
rl.close();
|
|
121
122
|
});
|
|
122
123
|
}
|
|
123
124
|
else {
|
|
@@ -127,18 +128,13 @@ function initializeConfig() {
|
|
|
127
128
|
}
|
|
128
129
|
function createConfigFile(configPath) {
|
|
129
130
|
Promise.resolve().then(() => __importStar(require('fs'))).then(fs => {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
"contentDir": ".leadcms/content",
|
|
135
|
-
"mediaDir": "public/media",
|
|
136
|
-
"enableDrafts": false
|
|
137
|
-
};
|
|
138
|
-
const content = JSON.stringify(sampleConfig, null, 2);
|
|
139
|
-
fs.writeFileSync(configPath, content, 'utf-8');
|
|
131
|
+
// Use the sample config file as the source of truth
|
|
132
|
+
const sampleConfigPath = path_1.default.join(__dirname, '../../leadcms.config.json.sample');
|
|
133
|
+
const sampleConfig = fs.readFileSync(sampleConfigPath, 'utf-8');
|
|
134
|
+
fs.writeFileSync(configPath, sampleConfig, 'utf-8');
|
|
140
135
|
console.log(`â
Created ${configPath}`);
|
|
141
|
-
console.log('đ
|
|
136
|
+
console.log('đ Set LEADCMS_URL and LEADCMS_API_KEY as environment variables.');
|
|
137
|
+
console.log('đ§ Customize contentDir, mediaDir, or other settings in the config file.');
|
|
142
138
|
console.log('âšī¸ Content types are automatically detected from your LeadCMS API.');
|
|
143
139
|
});
|
|
144
140
|
}
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","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,CAAC,CAAC;YAC9D,OAAO,CAAC,GAAG,CAAC,8EAA8E,CAAC,CAAC;YAC5F,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;YACjC,OAAO,CAAC,GAAG,CAAC,oEAAoE,CAAC,CAAC;YAClF,OAAO,CAAC,GAAG,CAAC,+DAA+D,CAAC,CAAC;YAC7E,OAAO,CAAC,GAAG,CAAC,gEAAgE,CAAC,CAAC;QAEhF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,wCAAwC,EAAE,KAAK,CAAC,CAAC;QACjE,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAa;IAC5B,2BAA2B;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,eAAe,EAAE,MAAM,CAAC;IACxB,wDAAwD;IACxD,UAAU,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,QAAQ,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,YAAY,EAAE,OAAO,CAAC;CACvB;AA2BD;;;;;;GAMG;AACH,wBAAgB,UAAU,IAAI,aAAa,CA8B1C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAErD;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAGlC;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,aAAa,CAEzC;AA4ID;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,GAAE,MAA8B,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAa;IAC5B,2BAA2B;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,eAAe,EAAE,MAAM,CAAC;IACxB,wDAAwD;IACxD,UAAU,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,QAAQ,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,YAAY,EAAE,OAAO,CAAC;CACvB;AA2BD;;;;;;GAMG;AACH,wBAAgB,UAAU,IAAI,aAAa,CA8B1C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAErD;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAGlC;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,aAAa,CAEzC;AA4ID;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,GAAE,MAA8B,GAAG,MAAM,CAOnF"}
|
package/dist/lib/config.js
CHANGED
|
@@ -200,16 +200,10 @@ function isValidUrl(url) {
|
|
|
200
200
|
* Generate a sample configuration file
|
|
201
201
|
*/
|
|
202
202
|
function generateConfigFile(filePath = "leadcms.config.json") {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
contentDir: ".leadcms/content",
|
|
208
|
-
mediaDir: "public/media",
|
|
209
|
-
enableDrafts: false
|
|
210
|
-
};
|
|
211
|
-
const content = JSON.stringify(sampleConfig, null, 2);
|
|
212
|
-
fs_1.default.writeFileSync(filePath, content, "utf-8");
|
|
203
|
+
// Use the sample config file as the source of truth
|
|
204
|
+
const sampleConfigPath = path_1.default.join(__dirname, '../../leadcms.config.json.sample');
|
|
205
|
+
const sampleConfig = fs_1.default.readFileSync(sampleConfigPath, 'utf-8');
|
|
206
|
+
fs_1.default.writeFileSync(filePath, sampleConfig, "utf-8");
|
|
213
207
|
return filePath;
|
|
214
208
|
}
|
|
215
209
|
//# sourceMappingURL=config.js.map
|
package/dist/lib/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":";;;;;AAkDA,gCA8BC;AAKD,8BAEC;AAKD,kCAGC;AAKD,8BAEC;AA+ID,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":";;;;;AAkDA,gCA8BC;AAKD,8BAEC;AAKD,kCAGC;AAKD,8BAEC;AA+ID,gDAOC;AA5PD,4CAAoB;AACpB,gDAAwB;AAiBxB,IAAI,YAAY,GAAyB,IAAI,CAAC;AAS9C,MAAM,WAAW,GAAG,IAAI,GAAG,EAAuB,CAAC;AACnD,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,qBAAqB;AAE9C,wBAAwB;AACxB,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAC;AAErG;;GAEG;AACH,MAAM,cAAc,GAA2B;IAC7C,eAAe,EAAE,IAAI;IACrB,UAAU,EAAE,kBAAkB;IAC9B,QAAQ,EAAE,cAAc;IACxB,YAAY,EAAE,KAAK;CACpB,CAAC;AAEF;;;;;;GAMG;AACH,SAAgB,UAAU;IACxB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAE1B,kCAAkC;IAClC,MAAM,cAAc,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;IAE3C,qCAAqC;IACrC,MAAM,aAAa,GAAG,iBAAiB,EAAE,CAAC;IAE1C,8CAA8C;IAC9C,2EAA2E;IAC3E,MAAM,YAAY,GAAG;QACnB,GAAG,cAAc;QACjB,GAAG,cAAc,EAAM,uBAAuB;QAC9C,GAAG,aAAa,EAAO,6CAA6C;QACpE,GAAG,YAAY,EAAQ,uCAAuC;KAC/D,CAAC;IAE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AS,EAAE,kCAAkC,CAAC,CAAC;IAClF,MAAM,YAAY,GAAG,YAAE,CAAC,YAAY,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IAEhE,YAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;IAClD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -357,3 +357,11 @@ async function main() {
|
|
|
357
357
|
|
|
358
358
|
// Export the main function so it can be imported by other modules
|
|
359
359
|
export { main as fetchLeadCMSContent }
|
|
360
|
+
|
|
361
|
+
// If this script is run directly (not imported), execute the main function
|
|
362
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
363
|
+
main().catch((error) => {
|
|
364
|
+
console.error('Error running LeadCMS fetch:', error.message);
|
|
365
|
+
process.exit(1);
|
|
366
|
+
});
|
|
367
|
+
}
|
package/package.json
CHANGED