Skip to content

Commit

Permalink
prefs: reduce duplication io operations, use async method, drop repla…
Browse files Browse the repository at this point in the history
…ce-in-file, replace globby with tinyglobby (#68)

* fix(deps): replace globby with tinyglobby

* refactor: drop replace-in-file

* pref: use async method

* pref: ignore node_modules and write on demand

* pref: tweaks

* chore: clean

* fix: module export error
  • Loading branch information
northword authored Dec 15, 2024
1 parent 668e028 commit 1b0a76d
Show file tree
Hide file tree
Showing 14 changed files with 190 additions and 326 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,11 @@
"es-toolkit": "^1.29.0",
"esbuild": "^0.24.0",
"fs-extra": "^11.2.0",
"globby": "^14.0.2",
"hookable": "^5.5.3",
"mime": "^4.0.4",
"octokit": "^4.0.2",
"replace-in-file": "^8.2.0",
"std-env": "^3.8.0",
"tinyglobby": "^0.2.10",
"update-notifier": "^7.3.1",
"xvfb-ts": "^1.1.0"
},
Expand Down
122 changes: 3 additions & 119 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import type { Config, Context, Hooks, OverrideConfig, UserConfig } from "./types/index.js";
import path from "node:path";
import { env } from "node:process";
import { loadConfig as c12 } from "c12";
import { kebabCase, mapValues } from "es-toolkit";
import fs from "fs-extra";
import { readJsonSync } from "fs-extra/esm";
import { createHooks } from "hookable";
import { Log } from "./utils/log.js";
import { dateFormat, parseRepoUrl, template } from "./utils/string.js";
Expand Down Expand Up @@ -38,7 +37,7 @@ function resolveConfig(config: Config): Context {
const logger = new Log(config);

// Load user's package.json
const pkgUser = fs.readJsonSync(path.join("package.json"), {
const pkgUser = readJsonSync("package.json", {
encoding: "utf-8",
});
const { name, version } = pkgUser;
Expand Down
Loading

0 comments on commit 1b0a76d

Please sign in to comment.