fenge 0.9.6 → 0.9.7

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/README.md CHANGED
@@ -173,9 +173,21 @@ Config `tsconfig.json` file in your project root.
173
173
 
174
174
  Config `tsconfig.build.json` file in your project root.
175
175
 
176
+ For Node.js app:
177
+
178
+ ```json
179
+ {
180
+ "extends": ["./tsconfig.json", "fenge/tsconfig/node"],
181
+ "include": ["src"],
182
+ "exclude": ["**/*.test.ts"]
183
+ }
184
+ ```
185
+
186
+ For Web app:
187
+
176
188
  ```json
177
189
  {
178
- "extends": "./tsconfig.json",
190
+ "extends": ["./tsconfig.json", "fenge/tsconfig/web"],
179
191
  "include": ["src"],
180
192
  "exclude": ["**/*.test.ts"]
181
193
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fenge",
3
- "version": "0.9.6",
3
+ "version": "0.9.7",
4
4
  "description": "A CLI tool for code quality",
5
5
  "keywords": [
6
6
  "cli",
@@ -32,18 +32,15 @@
32
32
  "exports": {
33
33
  "./eslint-config": "./src/re-export/eslint.config.js",
34
34
  "./prettier-config": "./src/re-export/prettier.config.js",
35
- "./tsconfig": "./tsconfig/index.json",
36
- "./tsconfig.json": "./tsconfig/index.json",
37
- "./tsconfig/esm": "./tsconfig/esm.json",
38
- "./tsconfig/esm.json": "./tsconfig/esm.json",
39
- "./tsconfig/cjs": "./tsconfig/cjs.json",
40
- "./tsconfig/cjs.json": "./tsconfig/cjs.json"
35
+ "./tsconfig": "./tsconfig/esm.json",
36
+ "./tsconfig.json": "./tsconfig/esm.json",
37
+ "./tsconfig/*.json": "./tsconfig/*.json",
38
+ "./tsconfig/*": "./tsconfig/*.json"
41
39
  },
42
40
  "bin": "./src/bin/fenge.cli.js",
43
41
  "files": [
44
42
  "src",
45
- "tsconfig",
46
- "tsconfig.json"
43
+ "tsconfig"
47
44
  ],
48
45
  "dependencies": {
49
46
  "commander": "13.1.0",
@@ -52,11 +49,12 @@
52
49
  "lint-staged": "15.5.2",
53
50
  "ora": "8.2.0",
54
51
  "prettier": "3.5.3",
52
+ "pretty-ms": "9.2.0",
55
53
  "yoctocolors": "2.1.1",
56
54
  "@fenge/eslint-config": "0.7.6",
57
55
  "@fenge/prettier-config": "0.3.6",
58
- "@fenge/tsconfig": "0.5.1",
59
- "prettier-ignore": "0.4.0"
56
+ "prettier-ignore": "0.4.0",
57
+ "@fenge/tsconfig": "0.6.0"
60
58
  },
61
59
  "devDependencies": {
62
60
  "@types/node": "18.19.112"
package/src/utils.js CHANGED
@@ -9,6 +9,7 @@ import process from "node:process";
9
9
  import { fileURLToPath } from "node:url";
10
10
  import { lilconfig } from "lilconfig";
11
11
  import ora from "ora";
12
+ import prettyMs from "pretty-ms";
12
13
  import colors from "yoctocolors";
13
14
 
14
15
  /**
@@ -41,21 +42,6 @@ export async function resolveConfig(module, loadPath) {
41
42
  : await searcher.search(process.cwd());
42
43
  }
43
44
 
44
- /**
45
- * @param {number} startTime
46
- */
47
- function getSpentTime(startTime) {
48
- const cost = Date.now() - startTime;
49
- if (cost < 1000) {
50
- return `${cost}ms`;
51
- } else if (cost < 60 * 1000) {
52
- return `${cost / 1000}s`;
53
- } else {
54
- const second = Math.floor(cost / 1000);
55
- return `${Math.floor(second / 60)}m${Math.floor(second % 60)}s`;
56
- }
57
- }
58
-
59
45
  /**
60
46
  * @param {string[]} command
61
47
  * @param {{topic: string, dryRun: boolean, env: Record<string, string>}} options
@@ -97,11 +83,11 @@ export function execAsync(command, { topic, dryRun, env }) {
97
83
  cp.on("close", (code, signal) => {
98
84
  if (code === 0) {
99
85
  spinner.succeed(
100
- `${topic} succeeded in ${colors.yellow(getSpentTime(startTime))}`,
86
+ `${topic} succeeded in ${colors.yellow(prettyMs(Date.now() - startTime))}`,
101
87
  );
102
88
  } else {
103
89
  spinner.fail(
104
- `${topic} failed in ${colors.yellow(getSpentTime(startTime))}`,
90
+ `${topic} failed in ${colors.yellow(prettyMs(Date.now() - startTime))}`,
105
91
  );
106
92
  }
107
93
  process.stdout.write(stdout);
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "@fenge/tsconfig/node.json"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "@fenge/tsconfig/web.json"
3
+ }
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "@fenge/tsconfig/tsconfig.json"
3
- }
package/tsconfig.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "./tsconfig/index.json"
3
- }