@aikeytake/social-automation 2.0.3 → 2.0.4
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/package.json +1 -1
- package/src/index.js +5 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -7,9 +7,13 @@ import apiFetch from './fetchers/api.js';
|
|
|
7
7
|
import fs from 'fs';
|
|
8
8
|
import path from 'path';
|
|
9
9
|
import { fileURLToPath } from 'url';
|
|
10
|
+
import { createRequire } from 'module';
|
|
10
11
|
|
|
11
12
|
dotenv.config();
|
|
12
13
|
|
|
14
|
+
// Use require.resolve to find package root (works correctly through pnpm symlinks)
|
|
15
|
+
const require = createRequire(import.meta.url);
|
|
16
|
+
const PKG_ROOT = path.dirname(require.resolve('@aikeytake/social-automation/package.json'));
|
|
13
17
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
14
18
|
const logger = createLogger('Main');
|
|
15
19
|
|
|
@@ -123,7 +127,7 @@ async function scrape(options = {}) {
|
|
|
123
127
|
}
|
|
124
128
|
|
|
125
129
|
function loadConfig() {
|
|
126
|
-
const configPath = path.join(
|
|
130
|
+
const configPath = path.join(PKG_ROOT, 'config/sources.json');
|
|
127
131
|
const content = fs.readFileSync(configPath, 'utf-8');
|
|
128
132
|
return JSON.parse(content);
|
|
129
133
|
}
|