Updated script requires.

This commit is contained in:
Mike Cao 2025-04-29 14:16:20 -07:00
parent ec7d5bdfe2
commit 615a6d444f
6 changed files with 9 additions and 6 deletions

View file

@ -5,8 +5,8 @@ import chalk from 'chalk';
import { createRequire } from "module";
const require = createRequire(import.meta.url);
const messages = require('../src/lang/en-US.json');
const ignore = require('../lang-ignore.json');
const messages = require(path.resolve(process.cwd(), 'src/lang/en-US.json'));
const ignore = require(path.resolve(process.cwd(), 'lang-ignore.json'));
const dir = path.resolve(process.cwd(), 'lang');
const files = fs.readdirSync(dir);
const keys = Object.keys(messages).sort();

View file

@ -3,7 +3,6 @@ import fs from 'fs-extra';
import path from 'node:path';
import https from 'https';
import chalk from 'chalk';
import url from "node:url";
const src = path.resolve(process.cwd(), 'src/lang');
const dest = path.resolve(process.cwd(), 'public/intl/country');

View file

@ -19,7 +19,7 @@ async function run() {
await fs.ensureDir(dest);
files.forEach(file => {
const lang = require(`../src/lang/${file}`);
const lang = require(path.resolve(process.cwd() `src/lang/${file}`));
const keys = Object.keys(lang).sort();
const formatted = keys.reduce((obj, key) => {

View file

@ -16,7 +16,7 @@ with the existing files under `lang`. Any newly added
keys will be printed to the console.
*/
files.forEach(file => {
const lang = require(`../src/lang/${file}`);
const lang = require(path.resolve(process.cwd(), `src/lang/${file}`));
console.log(`Merging ${file}`);

View file

@ -2,6 +2,9 @@
import 'dotenv/config';
import fs from 'node:fs';
import path from 'node:path';
import { createRequire } from "module";
const require = createRequire(import.meta.url);
const routesManifestPath = path.resolve(process.cwd(), '.next/routes-manifest.json');
const originalPath = path.resolve(process.cwd(), '.next/routes-manifest-orig.json');

View file

@ -1,9 +1,10 @@
import os from 'node:os';
import path from 'node:path';
import isCI from 'is-ci';
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
const pkg = require('../package.json');
const pkg = require(path.resolve(process.cwd(), 'package.json'));
const url = 'https://api.umami.is/v1/telemetry';