@srcroot/ui 1.0.2 → 1.0.4
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 +38 -5
- package/dist/index.js +7 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,21 +13,54 @@ A lightweight UI library with polymorphic, accessible React components for Next.
|
|
|
13
13
|
|
|
14
14
|
## Install
|
|
15
15
|
|
|
16
|
+
Initialize your project with `@srcroot/ui`:
|
|
17
|
+
|
|
16
18
|
```bash
|
|
19
|
+
# npm
|
|
17
20
|
npx @srcroot/ui init
|
|
21
|
+
|
|
22
|
+
# yarn
|
|
23
|
+
yarn dlx @srcroot/ui init
|
|
24
|
+
|
|
25
|
+
# pnpm
|
|
26
|
+
pnpm dlx @srcroot/ui init
|
|
27
|
+
|
|
28
|
+
# bun
|
|
29
|
+
bunx @srcroot/ui init
|
|
30
|
+
|
|
31
|
+
# deno
|
|
32
|
+
deno run -A npm:@srcroot/ui init
|
|
18
33
|
```
|
|
19
34
|
|
|
20
35
|
## Add Components
|
|
21
36
|
|
|
37
|
+
Add components to your project:
|
|
38
|
+
|
|
22
39
|
```bash
|
|
23
|
-
#
|
|
40
|
+
# npm
|
|
24
41
|
npx @srcroot/ui add
|
|
25
|
-
|
|
26
|
-
# Specific components
|
|
27
42
|
npx @srcroot/ui add button card input
|
|
28
|
-
|
|
29
|
-
# Add all components
|
|
30
43
|
npx @srcroot/ui add --all
|
|
44
|
+
|
|
45
|
+
# yarn
|
|
46
|
+
yarn dlx @srcroot/ui add
|
|
47
|
+
yarn dlx @srcroot/ui add button card input
|
|
48
|
+
yarn dlx @srcroot/ui add --all
|
|
49
|
+
|
|
50
|
+
# pnpm
|
|
51
|
+
pnpm dlx @srcroot/ui add
|
|
52
|
+
pnpm dlx @srcroot/ui add button card input
|
|
53
|
+
pnpm dlx @srcroot/ui add --all
|
|
54
|
+
|
|
55
|
+
# bun
|
|
56
|
+
bunx @srcroot/ui add
|
|
57
|
+
bunx @srcroot/ui add button card input
|
|
58
|
+
bunx @srcroot/ui add --all
|
|
59
|
+
|
|
60
|
+
# deno
|
|
61
|
+
deno run -A npm:@srcroot/ui add
|
|
62
|
+
deno run -A npm:@srcroot/ui add button card input
|
|
63
|
+
deno run -A npm:@srcroot/ui add --all
|
|
31
64
|
```
|
|
32
65
|
|
|
33
66
|
## Supported Package Managers
|
package/dist/index.js
CHANGED
|
@@ -971,12 +971,11 @@ var ComponentAdder = class {
|
|
|
971
971
|
return "unknown";
|
|
972
972
|
}
|
|
973
973
|
transformForVite(name, content) {
|
|
974
|
-
content = content.replace(/^"use client"
|
|
975
|
-
content = content.replace(/import\s
|
|
976
|
-
content = content.replace(/import\s
|
|
977
|
-
content = content.replace(/import\s
|
|
978
|
-
|
|
979
|
-
const otherUiImports = [
|
|
974
|
+
content = content.replace(/^["']use client["'];?\r?\n?/m, "");
|
|
975
|
+
content = content.replace(/import\s*\{[^}]*\}\s*from\s*["']next-themes["'];?\r?\n?/g, "");
|
|
976
|
+
content = content.replace(/import\s*\{[^}]*\}\s*from\s*["']@\/lib\/utils["'];?\r?\n?/g, 'import { cn } from "../../lib/utils"\n');
|
|
977
|
+
content = content.replace(/import\s*\{[^}]*\}\s*from\s*["']@\/components\/ui\/slot["'];?\r?\n?/g, 'import { Slot } from "./slot"\n');
|
|
978
|
+
const allComponents = [
|
|
980
979
|
"accordion",
|
|
981
980
|
"alert-dialog",
|
|
982
981
|
"alert",
|
|
@@ -1046,9 +1045,8 @@ var ComponentAdder = class {
|
|
|
1046
1045
|
"tooltip",
|
|
1047
1046
|
"whatsapp"
|
|
1048
1047
|
];
|
|
1049
|
-
for (const comp of
|
|
1050
|
-
|
|
1051
|
-
content = content.replace(regex, `from "./${comp}"`);
|
|
1048
|
+
for (const comp of allComponents) {
|
|
1049
|
+
content = content.replace(new RegExp(`from\\s+["']@/components/ui/${comp}["']`, "g"), `from "./${comp}"`);
|
|
1052
1050
|
}
|
|
1053
1051
|
return content.trimStart();
|
|
1054
1052
|
}
|