sulaf 0.0.1

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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +17 -0
  3. package/index.js +64 -0
  4. package/package.json +34 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ebraheem Alhetari
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # @sulaf/cli
2
+
3
+ The CLI tool for the Sulaf custom registry. Built on top of `shadcn-vue` to help you quickly initialize and add components to your applications.
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ npx @sulaf/cli <component-name>
9
+ # or
10
+ bunx --bun @sulaf/cli <component-name>
11
+ ```
12
+
13
+ For example, to add all components:
14
+
15
+ ```bash
16
+ npx @sulaf/cli all
17
+ ```
package/index.js ADDED
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env node
2
+
3
+ // thanks to: https://github.com/vuepont/ai-elements-vue/blob/main/packages/cli
4
+
5
+ const { spawnSync } = require('node:child_process')
6
+ const process = require('node:process')
7
+
8
+ const ELEMENTS_REGISTRY_URL = 'https://sulaf.netlify.app/r/'
9
+
10
+ // Function to detect the command used to invoke this script
11
+ function getCommandPrefix() {
12
+ // Check for common package manager environment variables
13
+ if (process.env.npm_config_user_agent) {
14
+ const userAgent = process.env.npm_config_user_agent
15
+
16
+ if (userAgent.includes('pnpm')) {
17
+ return 'pnpm dlx'
18
+ }
19
+
20
+ if (userAgent.includes('yarn')) {
21
+ return 'yarn dlx'
22
+ }
23
+
24
+ if (userAgent.includes('bun')) {
25
+ return 'bunx --bun'
26
+ }
27
+ }
28
+
29
+ // Default fallback
30
+ return 'npx -y'
31
+ }
32
+
33
+ const commandPrefix = getCommandPrefix()
34
+
35
+ // Parse command line arguments
36
+ const args = process.argv.slice(2)
37
+
38
+ // Get all components or default to 'all' if no component is provided
39
+ const components = args.length >= 2 ? args.slice(1) : ['all']
40
+
41
+ // Get the target URLs for all components
42
+ const targetUrls = components
43
+ .map(component => new URL(`${component}.json`, ELEMENTS_REGISTRY_URL).toString())
44
+ .join(' ')
45
+
46
+ const fullCommand = `${commandPrefix} shadcn-vue@latest add ${targetUrls}`
47
+
48
+ // eslint-disable-next-line no-console
49
+ console.log(`Executing: ${fullCommand}`)
50
+
51
+ const result = spawnSync(fullCommand, {
52
+ stdio: 'inherit',
53
+ shell: true,
54
+ })
55
+
56
+ if (result.error) {
57
+ // eslint-disable-next-line no-console
58
+ console.error('Failed to execute command:', result.error.message)
59
+ process.exit(1)
60
+ } else if (result.status !== 0) {
61
+ // eslint-disable-next-line no-console
62
+ console.error(`Command failed with exit code ${result.status}`)
63
+ process.exit(1)
64
+ }
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "sulaf",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "description": "Sulaf is a custom registry built on top of shadcn-vue to help you build applications faster.",
6
+ "license": "MIT",
7
+ "homepage": "https://sulaf.netlify.app",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/hetari/sulaf.git",
11
+ "directory": "packages/cli"
12
+ },
13
+ "keywords": [
14
+ "nuxt",
15
+ "vue",
16
+ "shadcn-vue",
17
+ "registry",
18
+ "cli"
19
+ ],
20
+ "bin": {
21
+ "sulaf": "index.js"
22
+ },
23
+ "files": [
24
+ "LICENSE",
25
+ "README.md",
26
+ "index.js"
27
+ ],
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "engines": {
32
+ "node": ">=20.19.0"
33
+ }
34
+ }