ai-elements-vue 1.2.1 → 1.3.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/README.md +6 -3
- package/index.js +39 -50
- package/package.json +10 -2
package/README.md
CHANGED
|
@@ -40,10 +40,13 @@ This command will:
|
|
|
40
40
|
|
|
41
41
|
### Install Specific Components
|
|
42
42
|
|
|
43
|
-
Install individual components using the `add` command:
|
|
43
|
+
Install individual or multiple components using the `add` command:
|
|
44
44
|
|
|
45
45
|
```bash
|
|
46
46
|
npx ai-elements-vue@latest add <component-name>
|
|
47
|
+
|
|
48
|
+
# Or install multiple at once:
|
|
49
|
+
npx ai-elements-vue@latest add <name1> <name2> ...
|
|
47
50
|
```
|
|
48
51
|
|
|
49
52
|
Examples:
|
|
@@ -55,8 +58,8 @@ npx ai-elements-vue@latest add message
|
|
|
55
58
|
# Install the conversation component
|
|
56
59
|
npx ai-elements-vue@latest add conversation
|
|
57
60
|
|
|
58
|
-
# Install
|
|
59
|
-
npx ai-elements-vue@latest add
|
|
61
|
+
# Install multiple components in one command
|
|
62
|
+
npx ai-elements-vue@latest add message conversation
|
|
60
63
|
```
|
|
61
64
|
|
|
62
65
|
### Alternative: Use with shadcn-vue CLI
|
package/index.js
CHANGED
|
@@ -1,74 +1,63 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const { spawnSync } = require('node:child_process')
|
|
4
|
-
const
|
|
4
|
+
const process = require('node:process')
|
|
5
5
|
|
|
6
|
+
const ELEMENTS_REGISTRY_URL
|
|
7
|
+
= process.env.ELEMENTS_REGISTRY_URL ?? 'https://registry.ai-elements-vue.com'
|
|
8
|
+
|
|
9
|
+
// Function to detect the command used to invoke this script
|
|
6
10
|
function getCommandPrefix() {
|
|
7
|
-
|
|
8
|
-
|
|
11
|
+
// Check for common package manager environment variables
|
|
12
|
+
if (process.env.npm_config_user_agent) {
|
|
13
|
+
const userAgent = process.env.npm_config_user_agent
|
|
9
14
|
|
|
10
15
|
if (userAgent.includes('pnpm')) {
|
|
11
16
|
return 'pnpm dlx'
|
|
12
17
|
}
|
|
18
|
+
|
|
13
19
|
if (userAgent.includes('yarn')) {
|
|
14
20
|
return 'yarn dlx'
|
|
15
21
|
}
|
|
22
|
+
|
|
16
23
|
if (userAgent.includes('bun')) {
|
|
17
24
|
return 'bunx'
|
|
18
25
|
}
|
|
19
26
|
}
|
|
20
27
|
|
|
28
|
+
// Default fallback
|
|
21
29
|
return 'npx -y'
|
|
22
30
|
}
|
|
23
31
|
|
|
24
32
|
const commandPrefix = getCommandPrefix()
|
|
25
33
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
34
|
+
// Parse command line arguments
|
|
35
|
+
const args = process.argv.slice(2)
|
|
36
|
+
|
|
37
|
+
// Get all components or default to 'all' if no component is provided
|
|
38
|
+
const components = args.length >= 2 ? args.slice(1) : ['all']
|
|
39
|
+
|
|
40
|
+
// Get the target URLs for all components
|
|
41
|
+
const targetUrls = components
|
|
42
|
+
.map(component =>
|
|
43
|
+
new URL(
|
|
44
|
+
`${component}.json`,
|
|
45
|
+
ELEMENTS_REGISTRY_URL,
|
|
46
|
+
).toString(),
|
|
47
|
+
)
|
|
48
|
+
.join(' ')
|
|
49
|
+
|
|
50
|
+
const fullCommand = `${commandPrefix} shadcn-vue@latest add ${targetUrls}`
|
|
51
|
+
const result = spawnSync(fullCommand, {
|
|
52
|
+
stdio: 'inherit',
|
|
53
|
+
shell: true,
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
if (result.error) {
|
|
57
|
+
console.error('Failed to execute command:', result.error.message)
|
|
58
|
+
process.exit(1)
|
|
46
59
|
}
|
|
47
|
-
else {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
fetch(targetUrl)
|
|
51
|
-
.then(response => response.json())
|
|
52
|
-
.then((data) => {
|
|
53
|
-
const components = data.items.filter(item => item.type === 'registry:component')
|
|
54
|
-
|
|
55
|
-
const componentUrls = components.map(item =>
|
|
56
|
-
new URL(`/${item.name}.json`, 'https://registry.ai-elements-vue.com').toString(),
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
const fullCommand = `${commandPrefix} shadcn-vue@latest add ${componentUrls.join(' ')}`
|
|
60
|
-
const result = spawnSync(fullCommand, {
|
|
61
|
-
stdio: 'inherit',
|
|
62
|
-
shell: true,
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
if (result.error) {
|
|
66
|
-
console.error('Failed to execute command:', result.error.message)
|
|
67
|
-
processModule.exit(1)
|
|
68
|
-
}
|
|
69
|
-
else if (result.status !== 0) {
|
|
70
|
-
console.error(`Command failed with exit code ${result.status}`)
|
|
71
|
-
processModule.exit(1)
|
|
72
|
-
}
|
|
73
|
-
})
|
|
60
|
+
else if (result.status !== 0) {
|
|
61
|
+
console.error(`Command failed with exit code ${result.status}`)
|
|
62
|
+
process.exit(1)
|
|
74
63
|
}
|
package/package.json
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-elements-vue",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "AI Elements Vue is a component library and custom registry built on top of shadcn-vue to help you build AI-native applications faster.",
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"homepage": "https://ai-elements-vue.com",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/vuepont/ai-elements-vue.git",
|
|
11
|
+
"directory": "packages/cli"
|
|
12
|
+
},
|
|
7
13
|
"keywords": [
|
|
8
14
|
"nuxt",
|
|
9
15
|
"vue",
|
|
10
16
|
"shadcn-vue",
|
|
11
17
|
"ai",
|
|
12
18
|
"registry",
|
|
13
|
-
"cli"
|
|
19
|
+
"cli",
|
|
20
|
+
"ai-elements",
|
|
21
|
+
"ai-elements-vue"
|
|
14
22
|
],
|
|
15
23
|
"bin": {
|
|
16
24
|
"elements": "index.js"
|