fenge 0.6.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/package.json +7 -7
- package/src/bin/fenge.cli.js +1 -3
- package/src/command/install.js +3 -4
- package/src/command/uninstall.js +3 -3
- package/src/utils.js +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# fenge
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 28d8553: chore: required node ^18.20.0 or >=20.10.0
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [fe27531]
|
|
12
|
+
- Updated dependencies [28d8553]
|
|
13
|
+
- @fenge/tsconfig@0.5.0
|
|
14
|
+
- @fenge/prettier-config@0.3.0
|
|
15
|
+
- prettier-ignore@0.3.0
|
|
16
|
+
- @fenge/eslint-config@0.6.0
|
|
17
|
+
- @fenge/types@0.3.0
|
|
18
|
+
|
|
3
19
|
## 0.6.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fenge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "A CLI tool for code quality",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"ora": "8.2.0",
|
|
52
52
|
"prettier": "3.5.3",
|
|
53
53
|
"yoctocolors": "2.1.1",
|
|
54
|
-
"@fenge/
|
|
55
|
-
"@fenge/
|
|
56
|
-
"
|
|
57
|
-
"@fenge/
|
|
58
|
-
"
|
|
54
|
+
"@fenge/prettier-config": "0.3.0",
|
|
55
|
+
"@fenge/types": "0.3.0",
|
|
56
|
+
"prettier-ignore": "0.3.0",
|
|
57
|
+
"@fenge/eslint-config": "0.6.0",
|
|
58
|
+
"@fenge/tsconfig": "0.5.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/node": "22.13.10"
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
"engines": {
|
|
72
|
-
"node": ">=
|
|
72
|
+
"node": "^18.20.0 || >=20.10.0"
|
|
73
73
|
},
|
|
74
74
|
"scripts": {
|
|
75
75
|
"build": "tsc --noEmit"
|
package/src/bin/fenge.cli.js
CHANGED
|
@@ -3,13 +3,11 @@
|
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { initAction, setup } from "@fenge/tsconfig/setup";
|
|
5
5
|
import { Command } from "commander";
|
|
6
|
+
import pkgJson from "../../package.json" with { type: "json" };
|
|
6
7
|
import { format } from "../command/format.js";
|
|
7
8
|
import { install } from "../command/install.js";
|
|
8
9
|
import { lint } from "../command/lint.js";
|
|
9
10
|
import { uninstall } from "../command/uninstall.js";
|
|
10
|
-
import { importJson } from "../utils.js";
|
|
11
|
-
|
|
12
|
-
const pkgJson = await importJson(import.meta.url, "../../package.json");
|
|
13
11
|
|
|
14
12
|
const program = new Command().enablePositionalOptions();
|
|
15
13
|
|
package/src/command/install.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import fs from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import process from "node:process";
|
|
5
|
-
import
|
|
5
|
+
import packageJson from "../../package.json" with { type: "json" };
|
|
6
|
+
import { dir, exists, getBinPath } from "../utils.js";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* @param {string} file
|
|
@@ -21,9 +22,7 @@ async function writeGitHook(file, content) {
|
|
|
21
22
|
|
|
22
23
|
const hookFilePath = path.resolve(hooksPath, file);
|
|
23
24
|
if (await exists(hookFilePath)) {
|
|
24
|
-
const pkgJsonName =
|
|
25
|
-
await importJson(import.meta.url, "../../package.json")
|
|
26
|
-
).name; // fenge
|
|
25
|
+
const pkgJsonName = packageJson.name; // fenge
|
|
27
26
|
if (!(await fs.readFile(hookFilePath, "utf8")).includes(pkgJsonName)) {
|
|
28
27
|
throw new Error(
|
|
29
28
|
`Cannot install git hook file since ${hookFilePath} is already existing. Please remove it first.`,
|
package/src/command/uninstall.js
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import fs from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import process from "node:process";
|
|
5
|
-
import
|
|
5
|
+
import packageJson from "../../package.json" with { type: "json" };
|
|
6
|
+
import { exists } from "../utils.js";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* @param {string} file
|
|
9
10
|
*/
|
|
10
11
|
async function removeGitHook(file) {
|
|
11
|
-
const pkgJsonName =
|
|
12
|
-
.name; // fenge
|
|
12
|
+
const pkgJsonName = packageJson.name; // fenge
|
|
13
13
|
const hookFilePath = path.resolve(process.cwd(), ".git", "hooks", file);
|
|
14
14
|
if (
|
|
15
15
|
(await exists(hookFilePath)) &&
|
package/src/utils.js
CHANGED
|
@@ -40,18 +40,6 @@ export async function resolveConfig(module, loadPath) {
|
|
|
40
40
|
: await searcher.search(process.cwd());
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
/**
|
|
44
|
-
* Usage: `importJson(import.meta.url, '../xx.json')`
|
|
45
|
-
* @param {string} importMetaUrl
|
|
46
|
-
* @param {string} jsonPath
|
|
47
|
-
* @returns {Promise<any>}
|
|
48
|
-
*/
|
|
49
|
-
export async function importJson(importMetaUrl, jsonPath) {
|
|
50
|
-
return JSON.parse(
|
|
51
|
-
await fs.readFile(path.resolve(dir(importMetaUrl), jsonPath), "utf8"),
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
43
|
/**
|
|
56
44
|
* @param {number} startTime
|
|
57
45
|
*/
|