@stacksjs/buddy 0.58.49 → 0.58.50

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.
@@ -591,7 +591,7 @@ function deploy(buddy) {
591
591
  if (await hasUserDomainBeenAddedToCloud(domain)) {
592
592
  log6.success("Your domain is properly configured.");
593
593
  log6.info("Your cloud is deploying...");
594
- console.log(`${italic2("This may take a while...")}`);
594
+ log6.info(`${italic2("This may take a while...")}`);
595
595
  await new Promise((resolve2) => setTimeout(resolve2, 2000));
596
596
  options.domain = domain;
597
597
  const result2 = await runAction5(Action5.Deploy, options);
package/dist/cli.js CHANGED
@@ -18,7 +18,7 @@ lint,
18
18
  release,
19
19
  setup,
20
20
  upgrade
21
- } from "./chunk-b32089b9556f373c.js";
21
+ } from "./chunk-91084836e95161e8.js";
22
22
  import"./chunk-0455e53fab4244b1.js";
23
23
 
24
24
  // src/cli.ts
@@ -26,6 +26,8 @@ import process from "process";
26
26
  import {handleError} from "@stacksjs/error-handling";
27
27
  import {cli as cli2} from "@stacksjs/cli";
28
28
  import {ensureProjectIsInitialized} from "@stacksjs/utils";
29
+ import {path as p} from "@stacksjs/path";
30
+ import {fs} from "@stacksjs/storage";
29
31
  async function main() {
30
32
  const buddy = cli2("buddy");
31
33
  setup(buddy);
@@ -48,6 +50,16 @@ async function main() {
48
50
  release(buddy);
49
51
  setup(buddy);
50
52
  upgrade(buddy);
53
+ const commandsDir = p.appPath("Commands");
54
+ const commandFiles = fs.readdirSync(commandsDir).filter((file) => file.endsWith(".ts"));
55
+ for (const file of commandFiles) {
56
+ const commandPath = `${commandsDir}/${file}`;
57
+ const dynamicImport = await import(commandPath);
58
+ if (typeof dynamicImport.default === "function")
59
+ dynamicImport.default(buddy);
60
+ else
61
+ console.error(`Expected a default export function in ${file}, but got:`, dynamicImport.default);
62
+ }
51
63
  buddy.parse();
52
64
  }
53
65
  process.on("uncaughtException", handleError);
package/dist/index.js CHANGED
@@ -32,7 +32,7 @@ tinker,
32
32
  types,
33
33
  upgrade,
34
34
  version
35
- } from "./chunk-b32089b9556f373c.js";
35
+ } from "./chunk-91084836e95161e8.js";
36
36
  import"./chunk-0455e53fab4244b1.js";
37
37
  export {
38
38
  version,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/buddy",
3
3
  "type": "module",
4
- "version": "0.58.49",
4
+ "version": "0.58.50",
5
5
  "description": "Meet Buddy. The Stacks runtime.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
package/src/cli.ts CHANGED
@@ -2,6 +2,8 @@ import process from 'node:process'
2
2
  import { handleError } from '@stacksjs/error-handling'
3
3
  import { cli } from '@stacksjs/cli'
4
4
  import { ensureProjectIsInitialized } from '@stacksjs/utils'
5
+ import { path as p } from '@stacksjs/path'
6
+ import { fs } from '@stacksjs/storage'
5
7
  import * as cmd from './commands'
6
8
 
7
9
  // setup global error handlers
@@ -44,6 +46,21 @@ async function main() {
44
46
  // cmd.prepublish(buddy)
45
47
  cmd.upgrade(buddy)
46
48
 
49
+ // dynamically import and register commands from ./app/Commands/*
50
+ const commandsDir = p.appPath('Commands')
51
+ const commandFiles = fs.readdirSync(commandsDir).filter(file => file.endsWith('.ts'))
52
+
53
+ for (const file of commandFiles) {
54
+ const commandPath = `${commandsDir}/${file}`
55
+ const dynamicImport = await import(commandPath)
56
+
57
+ // Correctly use the default export function
58
+ if (typeof dynamicImport.default === 'function')
59
+ dynamicImport.default(buddy)
60
+ else
61
+ console.error(`Expected a default export function in ${file}, but got:`, dynamicImport.default)
62
+ }
63
+
47
64
  buddy.parse()
48
65
  }
49
66
 
@@ -51,7 +51,7 @@ export function deploy(buddy: CLI) {
51
51
  log.success('Your domain is properly configured.')
52
52
  log.info('Your cloud is deploying...')
53
53
 
54
- console.log(`${italic('This may take a while...')}`)
54
+ log.info(`${italic('This may take a while...')}`)
55
55
  await new Promise(resolve => setTimeout(resolve, 2000))
56
56
  options.domain = domain
57
57
 
@@ -0,0 +1,36 @@
1
+ import process from 'node:process'
2
+ import { handleError } from '@stacksjs/error-handling'
3
+ import { config } from '@stacksjs/config'
4
+ import { cli } from '@stacksjs/cli'
5
+ import { path as p } from '@stacksjs/path'
6
+ import { fs } from '@stacksjs/storage'
7
+
8
+ // setup global error handlers
9
+ process.on('uncaughtException', handleError)
10
+ process.on('unhandledRejection', handleError)
11
+
12
+ async function main() {
13
+ const buddy = cli(config.cli.name)
14
+
15
+ if (!fs.existsSync(p.projectPath(config.cli.command)))
16
+ fs.writeFileSync(p.projectPath(config.cli.command), `import('./storage/framework/core/buddy/src/custom-cli')`)
17
+
18
+ // dynamically import and register commands from ./app/Commands/*
19
+ const commandsDir = p.appPath('Commands')
20
+ const commandFiles = fs.readdirSync(commandsDir).filter(file => file.endsWith('.ts'))
21
+
22
+ for (const file of commandFiles) {
23
+ const commandPath = `${commandsDir}/${file}`
24
+ const dynamicImport = await import(commandPath)
25
+
26
+ // Correctly use the default export function
27
+ if (typeof dynamicImport.default === 'function')
28
+ dynamicImport.default(buddy)
29
+ else
30
+ console.error(`Expected a default export function in ${file}, but got:`, dynamicImport.default)
31
+ }
32
+
33
+ buddy.parse()
34
+ }
35
+
36
+ await main()