Fix fetch-kinds script for Node.js compatibility (v0.36.9)
Some checks failed
Go / build-and-release (push) Has been cancelled
Some checks failed
Go / build-and-release (push) Has been cancelled
- Replace import.meta.dirname with fileURLToPath/dirname for Node < 20.11 - Use static imports instead of dynamic imports for fs/path Files modified: - app/web/scripts/fetch-kinds.js: Node.js compatibility fix - pkg/version/version: v0.36.8 -> v0.36.9 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,13 @@
|
|||||||
* Run: node scripts/fetch-kinds.js
|
* Run: node scripts/fetch-kinds.js
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
import { dirname, join } from 'path';
|
||||||
|
import { writeFileSync } from 'fs';
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = dirname(__filename);
|
||||||
|
|
||||||
const KINDS_URL = 'https://git.mleku.dev/mleku/nostr/raw/branch/main/encoders/kind/kinds.json';
|
const KINDS_URL = 'https://git.mleku.dev/mleku/nostr/raw/branch/main/encoders/kind/kinds.json';
|
||||||
|
|
||||||
async function fetchKinds() {
|
async function fetchKinds() {
|
||||||
@@ -199,11 +206,9 @@ async function main() {
|
|||||||
const js = generateJS(kinds, data);
|
const js = generateJS(kinds, data);
|
||||||
|
|
||||||
// Write to src/eventKinds.js
|
// Write to src/eventKinds.js
|
||||||
const fs = await import('fs');
|
const outPath = join(__dirname, '..', 'src', 'eventKinds.js');
|
||||||
const path = await import('path');
|
|
||||||
const outPath = path.join(import.meta.dirname, '..', 'src', 'eventKinds.js');
|
|
||||||
|
|
||||||
fs.writeFileSync(outPath, js);
|
writeFileSync(outPath, js);
|
||||||
console.log(`Generated ${outPath} with ${kinds.length} kinds`);
|
console.log(`Generated ${outPath} with ${kinds.length} kinds`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error:', error.message);
|
console.error('Error:', error.message);
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
v0.36.8
|
v0.36.9
|
||||||
|
|||||||
Reference in New Issue
Block a user