@stacksjs/shell 0.58.73

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 ADDED
@@ -0,0 +1,55 @@
1
+ # shell
2
+
3
+ This package contains the shell configuration files for the Stacks framework.
4
+
5
+ ## โ˜˜๏ธ Features
6
+
7
+ - It will find and execute `buddy` from anywhere within the project file tree _(and you don't need to prefix it with php or ./)_
8
+ - It provides auto-completion for `buddy` commands _(that also work anywhere within the project)_
9
+ - You can specify an editor to automatically open new files created by `buddy make:*` commands
10
+
11
+ ## ๐Ÿค– Usage
12
+
13
+ ```bash
14
+ buddy setup:oh-my-zsh
15
+ ```
16
+
17
+ To view the full documentation, please visit [https://stacksjs.org/ui](https://stacksjs.org/zsh).
18
+
19
+ ## ๐Ÿงช Testing
20
+
21
+ ```bash
22
+ # wip
23
+ ```
24
+
25
+ ## ๐Ÿ“ˆ Changelog
26
+
27
+ Please see our [releases](https://github.com/stacksjs/stacks/releases) page for more information on what has changed recently.
28
+
29
+ ## ๐Ÿšœ Contributing
30
+
31
+ Please review the [Contributing Guide](https://github.com/stacksjs/contributing) for details.
32
+
33
+ ## ๐Ÿ Community
34
+
35
+ For help, discussion about best practices, or any other conversation that would benefit from being searchable:
36
+
37
+ [Discussions on GitHub](https://github.com/stacksjs/stacks/discussions)
38
+
39
+ For casual chit-chat with others using this package:
40
+
41
+ [Join the Stacks Discord Server](https://discord.gg/stacksjs)
42
+
43
+ ## ๐Ÿ™๐Ÿผ Credits
44
+
45
+ Many thanks to the following core technologies & people who have contributed to this plugin:
46
+
47
+ - [Jess Archer](https://github.com/jessarcher/zsh-artisan/blob/master/artisan.plugin.zsh)
48
+ - [Chris Breuer](https://github.com/chrisbbreuer)
49
+ - [All Contributors](../../contributors)
50
+
51
+ ## ๐Ÿ“„ License
52
+
53
+ The MIT License (MIT). Please see [LICENSE](https://github.com/stacksjs/stacks/tree/main/LICENSE.md) for more information.
54
+
55
+ Made with ๐Ÿ’™
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ // @bun
2
+ // src/index.ts
3
+ var {$ } = globalThis.Bun;
4
+ export {
5
+ $
6
+ };
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@stacksjs/shell",
3
+ "type": "module",
4
+ "version": "0.58.73",
5
+ "description": "A better Stacks shell experience. Currently only fully supporting Oh My Zsh. Stay tuned for more. Or request one!",
6
+ "author": "Chris Breuer",
7
+ "license": "MIT",
8
+ "funding": "https://github.com/sponsors/chrisbbreuer",
9
+ "homepage": "https://github.com/stacksjs/stacks/tree/main/storage/framework/core/shell#readme",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/stacksjs/stacks.git",
13
+ "directory": "./storage/framework/core/shell"
14
+ },
15
+ "bugs": {
16
+ "url": "https://github.com/stacksjs/stacks/issues"
17
+ },
18
+ "keywords": [
19
+ "ohmyzsh",
20
+ "zsh",
21
+ "stacks"
22
+ ],
23
+ "contributors": [
24
+ "Chris Breuer <chris@stacksjs.org>"
25
+ ],
26
+ "files": [
27
+ "buddy.plugin.zsh",
28
+ "dist",
29
+ "src"
30
+ ],
31
+ "scripts": {
32
+ "build": "bun --bun build.ts",
33
+ "typecheck": "bun --bun tsc --noEmit",
34
+ "prepublishOnly": "bun --bun run build"
35
+ },
36
+ "devDependencies": {
37
+ "@stacksjs/development": "latest"
38
+ }
39
+ }
@@ -0,0 +1,120 @@
1
+ #--------------------------------------------------------------------------
2
+ # Stacks buddy plugin for zsh
3
+ #--------------------------------------------------------------------------
4
+ #
5
+ # This plugin adds an `buddy` shell command that will find and execute
6
+ # Stacks's buddy command from anywhere within the project. It also
7
+ # adds shell completions that work anywhere buddy can be located.
8
+ #
9
+ # Many thanks to Jess Archer for providing the initial scripts:
10
+ # https://github.com/jessarcher/zsh-artisan
11
+
12
+ function buddy() {
13
+ local buddy_path=$(_buddy_find)
14
+
15
+ if [ "$buddy_path" = "" ]; then
16
+ echo >&2 "shell: buddy not found. Are you in a Stacks directory? This only happens if you are not within a Stacks project, and buddy is not installed globally."
17
+ return 1
18
+ fi
19
+
20
+ local buddy_path=$(dirname $buddy_path)
21
+ local buddy_cmd
22
+
23
+ buddy_cmd="bun $buddy_path/buddy $*"
24
+
25
+ local buddy_start_time=$(date +%s)
26
+
27
+ eval $buddy_cmd $*
28
+
29
+ local buddy_exit_status=$? # Store the exit status so we can return it later
30
+
31
+ if [[ $1 = "make:"* && $BUDDY_OPEN_ON_MAKE_EDITOR != "" ]]; then
32
+ # Find and open files created by buddy
33
+ find \
34
+ "$buddy_path/app" \
35
+ "$buddy_path/tests" \
36
+ -type f \
37
+ -newermt "-$(($(date +%s) - $buddy_start_time + 1)) seconds" \
38
+ -exec $BUDDY_OPEN_ON_MAKE_EDITOR {} \; 2>/dev/null
39
+ fi
40
+
41
+ return $buddy_exit_status
42
+ }
43
+
44
+ function bud() {
45
+ buddy $*
46
+ }
47
+
48
+ function stacks() {
49
+ buddy $*
50
+ }
51
+
52
+ function stx() {
53
+ buddy $*
54
+ }
55
+
56
+ function b() {
57
+ buddy $*
58
+ }
59
+
60
+ function bi() {
61
+ buddy install
62
+ }
63
+
64
+ function ba() {
65
+ buddy add "$@"
66
+ }
67
+
68
+ function bd() {
69
+ buddy dev "$@"
70
+ }
71
+
72
+ function bb() {
73
+ buddy build "$@"
74
+ }
75
+
76
+ function bt() {
77
+ buddy test
78
+ }
79
+
80
+ function bu() {
81
+ buddy upgrade
82
+ }
83
+
84
+ function brb() {
85
+ bun run build
86
+ }
87
+
88
+ compdef _buddy_add_completion buddy
89
+
90
+ function _buddy_find() {
91
+ # First, try to find a globally installed buddy binary
92
+ local global_buddy_path=$(which buddy)
93
+ if [ -n "$global_buddy_path" ]; then
94
+ echo "$global_buddy_path"
95
+ return 0
96
+ fi
97
+
98
+ # If not found globally, look for buddy up the file tree until the root directory
99
+ local dir=.
100
+ until [ "$dir" -ef / ]; do
101
+ if [ -f "$dir/buddy" ]; then
102
+ echo "$dir/buddy"
103
+ return 0
104
+ fi
105
+
106
+ dir+=/..
107
+ done
108
+
109
+ return 1
110
+ }
111
+
112
+ function _buddy_add_completion() {
113
+ if [ "$(_buddy_find)" != "" ]; then
114
+ compadd $(_buddy_get_command_list)
115
+ fi
116
+ }
117
+
118
+ function _buddy_get_command_list() {
119
+ buddy list | sed "s/[[:space:]].*//g"
120
+ }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export { $ } from 'bun'