Skip to content

Commit

Permalink
Fix: Bump packages, resolve EEXIST err
Browse files Browse the repository at this point in the history
  • Loading branch information
black7375 committed Aug 6, 2023
1 parent 5259311 commit 44e8f6d
Show file tree
Hide file tree
Showing 176 changed files with 2,261 additions and 1,244 deletions.
1,951 changes: 1,235 additions & 716 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
26 changes: 21 additions & 5 deletions build/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,29 @@ const parseOptions = {
parseRulePrelude: false,
parseValue: false
};
function existsDir(dirPath) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
try {
yield (0, promises_1.stat)(dirPath);
}
catch (err) {
if (err.code === "ENOENT") {
try {
yield (0, promises_1.mkdir)(dirPath);
}
catch (err) {
if (err.code !== "EEXIST") {
throw err;
}
}
}
}
});
}
function loadAST(dirPath, url = exports.targets.korean, parseOption = parseOptions) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const cssPath = getCSSPath(dirPath, url);
if (!(0, fs_1.existsSync)(dirPath)) {
yield (0, promises_1.mkdir)(dirPath);
}
yield existsDir(dirPath);
if (!(0, fs_1.existsSync)(cssPath)) {
yield saveCSS(cssPath, url);
}
Expand Down Expand Up @@ -301,8 +318,7 @@ exports.fontRange = fontRange;
function fontSubset(fontPath = "", fontSubsetOption) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const { dirPath, initName, logMsg, baseOption, worker } = getOptionInfos(fontPath, fontSubsetOption);
if (!(0, fs_1.existsSync)(dirPath))
yield (0, promises_1.mkdir)(dirPath);
yield existsDir(dirPath);
const subsetOption = getSubsetOption(fontSubsetOption);
const saveOption = getSaveOption(dirPath, initName);
const options = [fontPath, saveOption, subsetOption, ...baseOption];
Expand Down
30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@
},
"devDependencies": {
"@types/command-exists": "^1.2.0",
"@types/jest": "^29.2.5",
"@types/node": "^18.11.18",
"@typescript-eslint/eslint-plugin": "^5.48.0",
"@typescript-eslint/parser": "^5.48.0",
"@types/jest": "^29.5.3",
"@types/node": "^20.4.10",
"@typescript-eslint/eslint-plugin": "^6.3.0",
"@typescript-eslint/parser": "^6.3.0",
"command-exists": "^1.2.9",
"eslint": "^8.31.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-jest": "^27.2.1",
"jest": "^29.3.1",
"prettier": "^2.8.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"eslint": "^8.47.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-jest": "^27.2.3",
"jest": "^29.6.2",
"prettier": "^3.0.1",
"rimraf": "^5.0.1",
"ts-jest": "^29.1.1",
"tsutils": "^3.21.0",
"typescript": "^4.9.4"
},
Expand All @@ -53,16 +53,16 @@
"build": "tsc -p tsconfig.release.json",
"build:watch": "tsc -w -p tsconfig.release.json",
"lint": "eslint . --ext .ts,.tsx",
"test": "jest --coverage --detectOpenHandles",
"test": "jest --coverage --detectOpenHandles --forceExit",
"test:watch": "jest --watch"
},
"dependencies": {
"@esm2cjs/execa": "^6.1.1-cjs.1",
"@esm2cjs/node-fetch": "^3.2.10",
"@types/css-tree": "^2.0.1",
"@esm2cjs/node-fetch": "^3.3.1",
"@types/css-tree": "^2.3.1",
"css-tree": "^2.3.1",
"piscina": "^3.2.0",
"tslib": "^2.4.1"
"tslib": "^2.6.1"
},
"volta": {
"node": "16.16.0",
Expand Down
26 changes: 21 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { join, parse } from "path";
import { createReadStream, createWriteStream, existsSync } from "fs";
import { mkdir } from "fs/promises";
import { stat, mkdir } from "fs/promises";

import Piscina from "piscina";
import fetch, { Headers } from "@esm2cjs/node-fetch";
Expand Down Expand Up @@ -124,11 +124,27 @@ const parseOptions: ParseOptions = {
parseValue: false
};

async function existsDir(dirPath: string) {
try {
await stat(dirPath);
}
catch (err) {
if (err.code === "ENOENT") {
try {
await mkdir(dirPath);
}
catch (err) {
if (err.code !== "EEXIST") {
throw err;
}
}
}
}
}

async function loadAST(dirPath: string, url = targets.korean, parseOption = parseOptions) {
const cssPath = getCSSPath(dirPath, url);
if (!existsSync(dirPath)) {
await mkdir(dirPath);
}
await existsDir(dirPath)
if (!existsSync(cssPath)) {
await saveCSS(cssPath, url);
}
Expand Down Expand Up @@ -405,7 +421,7 @@ export async function fontSubset(fontPath = "", fontSubsetOption?: FontSubsetOpt
baseOption,
worker
} = getOptionInfos(fontPath, fontSubsetOption);
if(!existsSync(dirPath)) await mkdir(dirPath);
await existsDir(dirPath)

const subsetOption = getSubsetOption(fontSubsetOption);
const saveOption = getSaveOption(dirPath, initName);
Expand Down
Loading

0 comments on commit 44e8f6d

Please sign in to comment.