diff --git a/site/scripts/fetch-stats.js b/site/scripts/fetch-stats.js index 7e70b802e..c2cc84242 100644 --- a/site/scripts/fetch-stats.js +++ b/site/scripts/fetch-stats.js @@ -4,13 +4,15 @@ import fs from 'fs' import path from 'path' import { filter, flatten, map, partition, pipe } from 'ramda' import { compose } from 'redux' +import { fileURLToPath } from 'url'; import { createDataDir, writeInDataDir } from './utils.js' const matomoSiteVisitsHistory = JSON.parse( fs.readFileSync( path.join( - import.meta.url.replace('file:', ''), - '../matomoVisitHistory.json' + fileURLToPath(import.meta.url), + '..', + 'matomoVisitHistory.json' ) ) ) diff --git a/site/scripts/utils.js b/site/scripts/utils.js index b2c9fc3ae..65cf1dd66 100644 --- a/site/scripts/utils.js +++ b/site/scripts/utils.js @@ -1,7 +1,8 @@ import { existsSync, mkdirSync, writeFileSync } from 'fs' import { join } from 'path' +import { fileURLToPath } from 'url' -const dataDir = new URL('../source/data/', import.meta.url).pathname +const dataDir = join(fileURLToPath(import.meta.url), '..', '..', 'source', 'data') export function createDataDir() { if (!existsSync(dataDir)) {