@kyh/prettier-config 0.1.5 → 0.1.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/CHANGELOG.md +12 -0
- package/base.js +19 -4
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
package/base.js
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { promises as fs } from "fs";
|
|
2
|
+
import { join } from "path";
|
|
3
|
+
|
|
4
|
+
const fileExists = async (filePath) => {
|
|
5
|
+
try {
|
|
6
|
+
await fs.access(filePath);
|
|
7
|
+
return true;
|
|
8
|
+
} catch {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const tailwindConfigPath = join(process.cwd(), "packages/tailwind/src/web.ts");
|
|
14
|
+
const tailwindConfigExists = await fileExists(tailwindConfigPath);
|
|
2
15
|
|
|
3
16
|
/** @typedef {import("prettier").Config} PrettierConfig */
|
|
4
17
|
/** @typedef {import("prettier-plugin-tailwindcss").PluginOptions} TailwindConfig */
|
|
@@ -10,9 +23,6 @@ const config = {
|
|
|
10
23
|
"@ianvs/prettier-plugin-sort-imports",
|
|
11
24
|
"prettier-plugin-tailwindcss",
|
|
12
25
|
],
|
|
13
|
-
tailwindConfig: fileURLToPath(
|
|
14
|
-
new URL("../../../packages/tailwind/src/web.ts", import.meta.url),
|
|
15
|
-
),
|
|
16
26
|
tailwindFunctions: ["cn", "cva"],
|
|
17
27
|
importOrder: [
|
|
18
28
|
"<TYPES>",
|
|
@@ -30,4 +40,9 @@ const config = {
|
|
|
30
40
|
importOrderTypeScriptVersion: "4.4.0",
|
|
31
41
|
};
|
|
32
42
|
|
|
43
|
+
if (tailwindConfigExists) {
|
|
44
|
+
console.log("Using Tailwind config from", tailwindConfigPath);
|
|
45
|
+
config.tailwindConfig = tailwindConfigPath;
|
|
46
|
+
}
|
|
47
|
+
|
|
33
48
|
export default config;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kyh/prettier-config",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
".": "./base.js"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@ianvs/prettier-plugin-sort-imports": "^4.
|
|
13
|
-
"prettier": "^3.2.
|
|
14
|
-
"prettier-plugin-tailwindcss": "^0.5.
|
|
12
|
+
"@ianvs/prettier-plugin-sort-imports": "^4.2.1",
|
|
13
|
+
"prettier": "^3.2.5",
|
|
14
|
+
"prettier-plugin-tailwindcss": "^0.5.13"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"typescript": "^5.
|
|
18
|
-
"@kyh/tsconfig": "^0.1.
|
|
17
|
+
"typescript": "^5.4.5",
|
|
18
|
+
"@kyh/tsconfig": "^0.1.7"
|
|
19
19
|
},
|
|
20
20
|
"prettier": "@kyh/prettier-config",
|
|
21
21
|
"scripts": {
|