diff --git a/.env b/.env deleted file mode 100644 index bb46394..0000000 --- a/.env +++ /dev/null @@ -1,2 +0,0 @@ -NODE_OPTIONS='--experimental-json-modules' -NODE_NO_WARNINGS=1 \ No newline at end of file diff --git a/package.json b/package.json index c900c57..aedcfd9 100644 --- a/package.json +++ b/package.json @@ -20,8 +20,8 @@ "lintcached:eslint": "pnpm lint:eslint --cache --cache-location .eslintcache --cache-strategy content", "lint-report": "pnpm lint:eslint --output-file eslint_report.json --format json", "lint-report:cached": "pnpm lintcached:eslint --output-file eslint.results.json --format json", - "generate-data-main": "dotenv node built/src/main.js generate-font-glyph-enums generate-custom-glyph-enums generate-symbols", - "generate-data-sub": "tsc && resolve-tspaths && dotenv node built/src/main.js", + "generate-data-main": "node built/src/main.js generate-font-glyph-enums generate-custom-glyph-enums generate-symbols", + "generate-data-sub": "tsc && resolve-tspaths && node built/src/main.js", "generate-data": "pnpm build && pnpm generate-data-main" }, "husky": { @@ -30,16 +30,13 @@ } }, "devDependencies": { - "@types/fs-extra": "^11.0.4", "@types/node": "^22.10.5", "@types/opentype.js": "^1.3.8", "@typescript-eslint/eslint-plugin": "^8.19.1", "@typescript-eslint/parser": "^8.19.1", - "dotenv-cli": "^7.4.2", "eslint": "v8", "eslint-config-prettier": "^9.1.0", "eslint-plugin-import": "^2.31.0", - "fs-extra": "^11.2.0", "husky": "^9.1.7", "lint-staged": "^15.3.0", "opentype.js": "^1.3.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5836bd9..abc6b09 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,9 +12,6 @@ importers: specifier: ^2.0.9 version: 2.0.9 devDependencies: - '@types/fs-extra': - specifier: ^11.0.4 - version: 11.0.4 '@types/node': specifier: ^22.10.5 version: 22.10.5 @@ -27,9 +24,6 @@ importers: '@typescript-eslint/parser': specifier: ^8.19.1 version: 8.19.1(eslint@8.57.0)(typescript@5.7.2) - dotenv-cli: - specifier: ^7.4.2 - version: 7.4.2 eslint: specifier: v8 version: 8.57.0 @@ -39,9 +33,6 @@ importers: eslint-plugin-import: specifier: ^2.31.0 version: 2.31.0(@typescript-eslint/parser@8.19.1(eslint@8.57.0)(typescript@5.7.2))(eslint@8.57.0) - fs-extra: - specifier: ^11.2.0 - version: 11.2.0 husky: specifier: ^9.1.7 version: 9.1.7 @@ -175,15 +166,9 @@ packages: resolution: {integrity: sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==} engines: {node: '>=10.13.0'} - '@types/fs-extra@11.0.4': - resolution: {integrity: sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==} - '@types/json5@0.0.29': resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} - '@types/jsonfile@6.1.4': - resolution: {integrity: sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==} - '@types/minimist@1.2.5': resolution: {integrity: sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==} @@ -602,18 +587,6 @@ packages: domutils@3.1.0: resolution: {integrity: sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==} - dotenv-cli@7.4.2: - resolution: {integrity: sha512-SbUj8l61zIbzyhIbg0FwPJq6+wjbzdn9oEtozQpZ6kW2ihCcapKVZj49oCT3oPM+mgQm+itgvUQcG5szxVrZTA==} - hasBin: true - - dotenv-expand@10.0.0: - resolution: {integrity: sha512-GopVGCpVS1UKH75VKHGuQFqS1Gusej0z4FyQkPdwjil2gNIv+LNsqBlboOzpJFZKVT95GkCyWJbBSdFEFUWI2A==} - engines: {node: '>=12'} - - dotenv@16.4.5: - resolution: {integrity: sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==} - engines: {node: '>=12'} - eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} @@ -832,10 +805,6 @@ packages: resolution: {integrity: sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==} engines: {node: '>=14'} - fs-extra@11.2.0: - resolution: {integrity: sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==} - engines: {node: '>=14.14'} - fs-minipass@2.1.0: resolution: {integrity: sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==} engines: {node: '>= 8'} @@ -1182,9 +1151,6 @@ packages: resolution: {integrity: sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==} hasBin: true - jsonfile@6.1.0: - resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==} - keyv@4.5.4: resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} @@ -1957,10 +1923,6 @@ packages: resolution: {integrity: sha512-WrcA6AyEfqDX5bWige/4NQfPZMtASNVxdmWR76WESYQVAACSgWcR6e9i0mofqqBxYFtL4oAxPIptY73/0YE1DQ==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} - universalify@2.0.1: - resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==} - engines: {node: '>= 10.0.0'} - uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} @@ -2157,17 +2119,8 @@ snapshots: '@trysound/sax@0.2.0': {} - '@types/fs-extra@11.0.4': - dependencies: - '@types/jsonfile': 6.1.4 - '@types/node': 22.10.5 - '@types/json5@0.0.29': {} - '@types/jsonfile@6.1.4': - dependencies: - '@types/node': 22.10.5 - '@types/minimist@1.2.5': {} '@types/node@22.10.5': @@ -2624,17 +2577,6 @@ snapshots: domelementtype: 2.3.0 domhandler: 5.0.3 - dotenv-cli@7.4.2: - dependencies: - cross-spawn: 7.0.3 - dotenv: 16.4.5 - dotenv-expand: 10.0.0 - minimist: 1.2.8 - - dotenv-expand@10.0.0: {} - - dotenv@16.4.5: {} - eastasianwidth@0.2.0: {} emoji-regex@10.4.0: {} @@ -2953,12 +2895,6 @@ snapshots: cross-spawn: 7.0.6 signal-exit: 4.1.0 - fs-extra@11.2.0: - dependencies: - graceful-fs: 4.2.11 - jsonfile: 6.1.0 - universalify: 2.0.1 - fs-minipass@2.1.0: dependencies: minipass: 3.3.6 @@ -3277,12 +3213,6 @@ snapshots: dependencies: minimist: 1.2.8 - jsonfile@6.1.0: - dependencies: - universalify: 2.0.1 - optionalDependencies: - graceful-fs: 4.2.11 - keyv@4.5.4: dependencies: json-buffer: 3.0.1 @@ -4104,8 +4034,6 @@ snapshots: dependencies: imurmurhash: 0.1.4 - universalify@2.0.1: {} - uri-js@4.4.1: dependencies: punycode: 2.3.1 diff --git a/src/generate-custom-glyph-enums.ts b/src/generate-custom-glyph-enums.ts index 2b36fe0..71b333d 100644 --- a/src/generate-custom-glyph-enums.ts +++ b/src/generate-custom-glyph-enums.ts @@ -2,9 +2,8 @@ import { parse } from 'opentype.js'; import { webfont } from 'webfont'; import { writeFile, toArrayBuffer } from './helpers.js'; import { infoLog } from './log.js'; -import fse from 'fs-extra'; +import { writeFileSync } from 'node:fs'; -const { writeFileSync } = fse; const acc: Record = {}; const TAG = 'CUSTOM-GLYPHS'; diff --git a/src/generate-font-glyph-enums.ts b/src/generate-font-glyph-enums.ts index 115ed9a..64b4529 100644 --- a/src/generate-font-glyph-enums.ts +++ b/src/generate-font-glyph-enums.ts @@ -1,12 +1,9 @@ import ttf2woff2 from 'ttf2woff2'; -import { readFileSync } from 'fs'; -import fse from 'fs-extra'; +import { readFileSync, writeFileSync } from 'node:fs'; import { loadSync } from 'opentype.js'; import { writeFile } from './helpers.js'; import { infoLog } from './log.js'; -const { writeFileSync } = fse; - const TAG = 'FONT-GLYPH'; const otfIn = readFileSync('./Destiny-2-Font-Symbols/fonts/destiny_symbols_common.otf'); const font = loadSync('./Destiny-2-Font-Symbols/fonts/destiny_symbols_common.otf'); diff --git a/src/helpers.ts b/src/helpers.ts index 1ff5ff9..09157a0 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -5,13 +5,11 @@ || \*================================================================================================================================*/ import { execSync } from 'child_process'; -import { writeFile as writeFileFS } from 'fs'; -import fse from 'fs-extra'; -import { promisify } from 'util'; +import { writeFileSync, existsSync, mkdirSync } from 'node:fs'; +import { writeFile as writeFileFS } from 'node:fs/promises'; import { infoLog } from './log.js'; const TAG = 'UTILS'; -const { writeFileSync /*,copyFileSync */ } = fse; type WriteHook = (fileName: string) => void; const writeHooks: WriteHook[] = []; @@ -71,13 +69,10 @@ export function sortObject>(o: T): T { return sorted as T; } - -export const writeFilePromise = promisify(writeFileFS); - export function downloadFile(url: string, outputPath: string) { return fetch(url) .then((x) => x.arrayBuffer()) - .then((x) => writeFilePromise(outputPath, Buffer.from(x))); + .then((x) => writeFileFS(outputPath, Buffer.from(x))); } export function uriToFileName(uri: string) { @@ -85,8 +80,8 @@ export function uriToFileName(uri: string) { } export function makeDirIfMissing(dir: string) { - if (!fse.existsSync(dir)) { - fse.mkdirSync(dir); + if (!existsSync(dir)) { + mkdirSync(dir); } } diff --git a/src/main.ts b/src/main.ts index 6215435..167322a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,14 +1,12 @@ import { load, setApiKey } from '@d2api/manifest-node'; import { spawnSync } from 'child_process'; -import { readdirSync } from 'fs'; -import fse from 'fs-extra'; +import { readdirSync, copyFileSync } from 'node:fs'; import path, { basename, dirname } from 'path'; import { fileURLToPath } from 'url'; import { registerWriteHook } from './helpers.js'; import { infoLog, infoTable } from './log.js'; const TAG = 'MAIN'; -const { copyFileSync } = fse; setApiKey(process.env.API_KEY); await load();