@stacksjs/buddy 0.58.71 → 0.58.72

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/dist/index.js CHANGED
@@ -32,7 +32,7 @@ tinker,
32
32
  types,
33
33
  upgrade,
34
34
  version
35
- } from "./chunk-89229d657386eb70.js";
35
+ } from "./chunk-94f0ae38d2d27d78.js";
36
36
  import"./chunk-0455e53fab4244b1.js";
37
37
  import"./chunk-59a9de11428ba763.js";
38
38
  export {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/buddy",
3
3
  "type": "module",
4
- "version": "0.58.71",
4
+ "version": "0.58.72",
5
5
  "description": "Meet Buddy. The Stacks runtime.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
package/src/cli.ts CHANGED
@@ -2,8 +2,8 @@ import process from 'node:process'
2
2
  import { handleError } from '@stacksjs/error-handling'
3
3
  import { CAC } from 'cac'
4
4
  import { ensureProjectIsInitialized } from '@stacksjs/utils'
5
- import { log } from '@stacksjs/cli'
6
- import { collect } from '@stacksjs/collections'
5
+ import { path as p } from '@stacksjs/path'
6
+ import { fs } from '@stacksjs/storage'
7
7
  import * as cmd from './commands'
8
8
 
9
9
  // setup global error handlers
@@ -65,79 +65,27 @@ async function main() {
65
65
  // cmd.prepublish(buddy)
66
66
  cmd.upgrade(buddy)
67
67
 
68
- const quotes = collect([
69
- 'The best way to get started is to quit talking and begin doing.',
70
- 'The pessimist sees difficulty in every opportunity. The optimist sees opportunity in every difficulty.',
71
- 'Don’t let yesterday take up too much of today.',
72
- 'You learn more from failure than from success. Don’t let it stop you. Failure builds character.',
73
- 'It’s not whether you get knocked down, it’s whether you get up.',
74
- 'If you are working on something that you really care about, you don’t have to be pushed. The vision pulls you.',
75
- 'People who are crazy enough to think they can change the world, are the ones who do.',
76
- 'Failure will never overtake me if my determination to succeed is strong enough.',
77
- 'Entrepreneurs are great at dealing with uncertainty and also very good at minimizing risk. That’s the classic entrepreneur.',
78
- 'We may encounter many defeats but we must not be defeated.',
79
- 'Knowing is not enough; we must apply. Wishing is not enough; we must do.',
80
- 'Imagine your life is perfect in every respect; what would it look like?',
81
- 'We generate fears while we sit. We overcome them by action.',
82
- 'Whether you think you can or think you can’t, you’re right.',
83
- 'Security is mostly a superstition. Life is either a daring adventure or nothing.',
84
- ])
85
-
86
- buddy
87
- .command('inspire', 'Inspire yourself with a random quote')
88
- .alias('insp')
89
- .action(() => {
90
- log.info(quotes.random())
91
- log.success('Have a great days!')
92
- })
93
-
94
- buddy.on('inspire:*', () => {
95
- // eslint-disable-next-line no-console
96
- console.log('Invalid command:', buddy.args.join(' '))
97
- // eslint-disable-next-line no-console
98
- console.log('See `--help` for a list of available commands')
99
- throw new Error('Invalid command')
100
- })
101
-
102
68
  // dynamically import and register commands from ./app/Commands/*
103
- // const commandsDir = p.appPath('Commands')
104
- // const commandFiles = fs.readdirSync(commandsDir).filter(file => file.endsWith('.ts'))
105
-
106
- // for (const file of commandFiles) {
107
- // const commandPath = `${commandsDir}/${file}`
108
- // const dynamicImport = await import(commandPath)
109
-
110
- // // Correctly use the default export function
111
- // if (typeof dynamicImport.default === 'function')
112
- // dynamicImport.default(buddy)
113
- // else
114
- // console.error(`Expected a default export function in ${file}, but got:`, dynamicImport.default)
115
- // }
69
+ const commandsDir = p.appPath('Commands')
70
+ const commandFiles = fs.readdirSync(commandsDir).filter(file => file.endsWith('.ts'))
116
71
 
117
- // const listenerImport = await import(p.listenersPath('Console.ts'))
118
- // if (typeof listenerImport.default === 'function')
119
- // listenerImport.default(buddy)
72
+ for (const file of commandFiles) {
73
+ const commandPath = `${commandsDir}/${file}`
74
+ const dynamicImport = await import(commandPath)
120
75
 
121
- // buddy.on('inspire:two', () => {
122
- // // eslint-disable-next-line no-console
123
- // console.log('inspiring with two quotes')
124
- // // Do something
125
- // })
76
+ // Correctly use the default export function
77
+ if (typeof dynamicImport.default === 'function')
78
+ dynamicImport.default(buddy)
79
+ else
80
+ console.error(`Expected a default export function in ${file}, but got:`, dynamicImport.default)
81
+ }
126
82
 
127
- // buddy.on('changelog:*', () => {
128
- // // eslint-disable-next-line no-console
129
- // console.log('changelog with two quotes')
130
- // process.exit(1)
131
- // // Do something
132
- // })
83
+ const listenerImport = await import(p.listenersPath('Console.ts'))
84
+ if (typeof listenerImport.default === 'function')
85
+ listenerImport.default(buddy)
133
86
 
134
- // console.log('buddy', buddy)
135
- // console.log('buddy running')
136
87
  buddy.help()
137
88
  buddy.parse()
138
- // console.log('process.argv', process.argv)
139
- // console.log('b.rawArgs', buddy.rawArgs)
140
- // await buddy.runMatchedCommand()
141
89
  }
142
90
 
143
91
  await main()
@@ -35,6 +35,7 @@ export function setup(buddy: CLI) {
35
35
 
36
36
  buddy
37
37
  .command('setup:oh-my-zsh', descriptions.ohMyZsh) // if triggered multiple times, it will update the plugin
38
+ .alias('upgrade:oh-my-zsh')
38
39
  .option('--verbose', descriptions.verbose, { default: false })
39
40
  .action(async (_options?: CliOptions) => {
40
41
  log.debug('Running `buddy setup:oh-my-zsh` ...', _options)