@contentstorage/core 0.3.5 → 0.3.7

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.
@@ -0,0 +1,2 @@
1
+ import { AppConfig } from './lib/configLoader.js';
2
+ export { AppConfig };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -3,4 +3,4 @@ export interface AppConfig {
3
3
  contentDir: string;
4
4
  typesOutputFile: string;
5
5
  }
6
- export declare function loadConfig(): AppConfig;
6
+ export declare function loadConfig(): Promise<AppConfig>;
@@ -4,13 +4,13 @@ const DEFAULT_CONFIG = {
4
4
  contentDir: path.join('src', 'assets', 'content'),
5
5
  typesOutputFile: path.join('src', 'generated', 'content-types.ts'),
6
6
  };
7
- export function loadConfig() {
8
- const configPath = path.resolve(process.cwd(), 'contentstorage.config.ts'); // Look in user's current working dir
7
+ export async function loadConfig() {
8
+ const configPath = path.resolve(process.cwd(), 'contentstorage.config.js'); // Look in user's current working dir
9
9
  let userConfig = {};
10
10
  if (fs.existsSync(configPath)) {
11
11
  try {
12
12
  // Use require for JS config file
13
- const loadedModule = require(configPath);
13
+ const loadedModule = await import(configPath);
14
14
  userConfig = loadedModule.default || loadedModule;
15
15
  console.log('Loaded config', JSON.stringify(userConfig));
16
16
  console.log(`Loaded configuration from ${configPath}`);
@@ -7,7 +7,7 @@ import chalk from 'chalk'; // Optional: for colored output
7
7
  import { loadConfig } from '../lib/configLoader.js';
8
8
  export async function generateTypes() {
9
9
  console.log(chalk.blue('Starting type generation...'));
10
- const config = loadConfig();
10
+ const config = await loadConfig();
11
11
  console.log(chalk.gray(`Reading JSON files from: ${config.contentDir}`));
12
12
  console.log(chalk.gray(`Saving TypeScript types to: ${config.typesOutputFile}`));
13
13
  try {
@@ -6,7 +6,7 @@ import chalk from 'chalk';
6
6
  import { loadConfig } from '../lib/configLoader.js';
7
7
  export async function pullContent() {
8
8
  console.log(chalk.blue('Starting content pull...'));
9
- const config = loadConfig();
9
+ const config = await loadConfig();
10
10
  console.log(chalk.gray(`Getting content from: ${config.contentUrl}`));
11
11
  console.log(chalk.gray(`Saving content to: ${config.contentDir}`));
12
12
  try {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@contentstorage/core",
3
3
  "author": "Kaido Hussar <kaidohus@gmail.com>",
4
4
  "homepage": "https://contentstorage.app",
5
- "version": "0.3.5",
5
+ "version": "0.3.7",
6
6
  "type": "module",
7
7
  "description": "Fetch content from contentstorage and generate TypeScript types",
8
8
  "module": "dist/index.js",