stacks 0.59.11 → 0.61.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.
Files changed (40) hide show
  1. package/README.md +0 -1
  2. package/buddy/README.md +0 -1
  3. package/buddy/bin/cli.ts +9 -17
  4. package/buddy/build.ts +1 -12
  5. package/buddy/package.json +1 -1
  6. package/buddy/src/cli.ts +17 -13
  7. package/buddy/src/commands/add.ts +5 -6
  8. package/buddy/src/commands/build.ts +55 -34
  9. package/buddy/src/commands/changelog.ts +13 -6
  10. package/buddy/src/commands/clean.ts +13 -5
  11. package/buddy/src/commands/cloud.ts +91 -30
  12. package/buddy/src/commands/commit.ts +2 -2
  13. package/buddy/src/commands/configure.ts +7 -7
  14. package/buddy/src/commands/create.ts +14 -10
  15. package/buddy/src/commands/deploy.ts +15 -10
  16. package/buddy/src/commands/dev.ts +53 -53
  17. package/buddy/src/commands/dns.ts +5 -5
  18. package/buddy/src/commands/domains.ts +132 -41
  19. package/buddy/src/commands/fresh.ts +16 -6
  20. package/buddy/src/commands/generate.ts +14 -16
  21. package/buddy/src/commands/http.ts +2 -2
  22. package/buddy/src/commands/install.ts +2 -2
  23. package/buddy/src/commands/key.ts +3 -3
  24. package/buddy/src/commands/lint.ts +4 -4
  25. package/buddy/src/commands/list.ts +3 -4
  26. package/buddy/src/commands/make.ts +101 -65
  27. package/buddy/src/commands/migrate.ts +52 -9
  28. package/buddy/src/commands/ports.ts +35 -37
  29. package/buddy/src/commands/prepublish.ts +3 -3
  30. package/buddy/src/commands/projects.ts +5 -11
  31. package/buddy/src/commands/release.ts +8 -6
  32. package/buddy/src/commands/seed.ts +12 -5
  33. package/buddy/src/commands/setup.ts +10 -11
  34. package/buddy/src/commands/test.ts +97 -30
  35. package/buddy/src/commands/tinker.ts +10 -6
  36. package/buddy/src/commands/types.ts +3 -3
  37. package/buddy/src/commands/upgrade.ts +49 -29
  38. package/buddy/src/commands/version.ts +11 -13
  39. package/buddy/src/custom-cli.ts +5 -7
  40. package/package.json +7 -89
@@ -1,9 +1,10 @@
1
1
  import process from 'node:process'
2
2
  import { runAction } from '@stacksjs/actions'
3
3
  import { intro, log, outro } from '@stacksjs/cli'
4
+ import { Action } from '@stacksjs/enums'
4
5
  import { ExitCode } from '@stacksjs/types'
5
6
  import type { CLI, UpgradeOptions } from '@stacksjs/types'
6
- import { Action } from '@stacksjs/enums'
7
+ import { isString } from '@stacksjs/validation'
7
8
 
8
9
  export function upgrade(buddy: CLI) {
9
10
  const descriptions = {
@@ -12,7 +13,8 @@ export function upgrade(buddy: CLI) {
12
13
  dependencies: 'Upgrade your dependencies (pkgx.yaml & package.json)',
13
14
  bun: 'Upgrade Bun to the latest version',
14
15
  shell: 'Upgrade the to the latest shell integration (currently only supports Oh My Zsh)',
15
- binary: 'Upgrade the `stacks` binary to the latest version. Please note, the binary is moved to the `~/.stacks/bin` directory',
16
+ binary:
17
+ 'Upgrade the `stacks` binary to the latest version. Please note, the binary is moved to the `~/.stacks/bin` directory',
16
18
  all: 'Upgrade Node, package manager, project dependencies, and framework',
17
19
  force: 'Overwrite possible local updates with remote framework updates',
18
20
  select: 'What are you trying to upgrade?',
@@ -27,7 +29,7 @@ export function upgrade(buddy: CLI) {
27
29
  .option('-a, --all', descriptions.all, { default: false })
28
30
  .option('-f, --force', descriptions.force, { default: false })
29
31
  .option('--framework', descriptions.framework, { default: false })
30
- .option('-p, --project', descriptions.project, { default: false })
32
+ .option('-p, --project [project]', descriptions.project, { default: false })
31
33
  .option('-s, --shell', descriptions.shell, { default: false })
32
34
  .option('-b, --binary', descriptions.binary, { default: false })
33
35
  // .option('--canary', descriptions.canary, { default: false })
@@ -40,31 +42,35 @@ export function upgrade(buddy: CLI) {
40
42
  const perf = await intro('buddy upgrade')
41
43
 
42
44
  if (hasNoOptions(options)) {
43
- let answers = await log.prompt.require()
44
- .multiselect(descriptions.select, {
45
- options: [
46
- { value: 'dependencies', label: 'Dependencies' },
47
- { value: 'framework', label: 'Framework' },
48
- { value: 'bun', label: 'Bun' },
49
- { value: 'shell', label: 'Shell' },
50
- { value: 'binary', label: 'Binary' },
51
- ],
52
- })
53
-
54
- if (answers !== null)
55
- process.exit(ExitCode.InvalidArgument)
56
-
57
- if (isString(answers))
58
- answers = [answers]
45
+ let answers = await log.prompt.require().multiselect(descriptions.select, {
46
+ options: [
47
+ { value: 'dependencies', label: 'Dependencies' },
48
+ { value: 'framework', label: 'Framework' },
49
+ { value: 'bun', label: 'Bun' },
50
+ { value: 'shell', label: 'Shell' },
51
+ { value: 'binary', label: 'Binary' },
52
+ ],
53
+ })
54
+
55
+ if (answers !== null) process.exit(ExitCode.InvalidArgument)
56
+
57
+ if (isString(answers)) answers = [answers]
59
58
 
60
59
  // creates an object out of array and sets answers to true
61
- options = answers.reduce((a: any, v: any) => ({ ...a, [v]: true }), {})
60
+ options = answers.reduce((a: any, v: any) => {
61
+ a[v] = true
62
+ return a
63
+ }, {})
62
64
  }
63
65
 
64
66
  const result = await runAction(Action.Upgrade, options)
65
67
 
66
68
  if (result.isErr()) {
67
- await outro('While running the buddy:upgrade command, there was an issue', { startTime: perf, useSeconds: true }, result.error)
69
+ await outro(
70
+ 'While running the buddy:upgrade command, there was an issue',
71
+ { startTime: perf, useSeconds: true },
72
+ result.error,
73
+ )
68
74
  process.exit()
69
75
  }
70
76
 
@@ -74,7 +80,7 @@ export function upgrade(buddy: CLI) {
74
80
 
75
81
  buddy
76
82
  .command('upgrade:framework', descriptions.framework)
77
- .option('-p, --project', descriptions.project, { default: false })
83
+ .option('-p, --project [project]', descriptions.project, { default: false })
78
84
  .option('--verbose', descriptions.verbose, { default: false })
79
85
  .example('buddy upgrade:framework --verbose')
80
86
  .action(async (options: UpgradeOptions) => {
@@ -86,7 +92,7 @@ export function upgrade(buddy: CLI) {
86
92
 
87
93
  buddy
88
94
  .command('upgrade:dependencies', descriptions.dependencies)
89
- .option('-p, --project', descriptions.project, { default: false })
95
+ .option('-p, --project [project]', descriptions.project, { default: false })
90
96
  .option('--verbose', descriptions.verbose, { default: false })
91
97
  .alias('upgrade:deps')
92
98
  .example('buddy upgrade:dependencies --verbose')
@@ -97,7 +103,7 @@ export function upgrade(buddy: CLI) {
97
103
 
98
104
  buddy
99
105
  .command('upgrade:bun', descriptions.bun)
100
- .option('-p, --project', descriptions.project, { default: false })
106
+ .option('-p, --project [project]', descriptions.project, { default: false })
101
107
  .option('--verbose', descriptions.verbose, { default: false })
102
108
  .action(async (options: UpgradeOptions) => {
103
109
  log.debug('Running `buddy upgrade:bun` ...', options)
@@ -105,7 +111,11 @@ export function upgrade(buddy: CLI) {
105
111
  const result = await runAction(Action.UpgradeBun, options)
106
112
 
107
113
  if (result.isErr()) {
108
- await outro('While running the buddy upgrade:bun command, there was an issue', { startTime: perf, useSeconds: true }, result.error) // FIXME: should not have to cast
114
+ await outro(
115
+ 'While running the buddy upgrade:bun command, there was an issue',
116
+ { startTime: perf, useSeconds: true },
117
+ result.error,
118
+ ) // FIXME: should not have to cast
109
119
  process.exit()
110
120
  }
111
121
 
@@ -114,7 +124,7 @@ export function upgrade(buddy: CLI) {
114
124
 
115
125
  buddy
116
126
  .command('upgrade:all', descriptions.all)
117
- .option('-p, --project', descriptions.project, { default: false })
127
+ .option('-p, --project [project]', descriptions.project, { default: false })
118
128
  .option('--verbose', descriptions.verbose, { default: false })
119
129
  .action(async (options: UpgradeOptions) => {
120
130
  log.debug('Running `buddy upgrade:all` ...', options)
@@ -132,7 +142,11 @@ export function upgrade(buddy: CLI) {
132
142
  const result = await runAction(Action.UpgradeShell, options)
133
143
 
134
144
  if (result.isErr()) {
135
- await outro('While running the buddy upgrade:shell command, there was an issue', { startTime: perf, useSeconds: true }, result.error) // FIXME: should not have to cast
145
+ await outro(
146
+ 'While running the buddy upgrade:shell command, there was an issue',
147
+ { startTime: perf, useSeconds: true },
148
+ result.error,
149
+ ) // FIXME: should not have to cast
136
150
  process.exit()
137
151
  }
138
152
 
@@ -155,7 +169,11 @@ export function upgrade(buddy: CLI) {
155
169
  const result = await runAction(Action.UpgradeBinary, options)
156
170
 
157
171
  if (result.isErr()) {
158
- await outro('While running the buddy upgrade:binary command, there was an issue', { startTime: perf, useSeconds: true }, result.error) // FIXME: should not have to cast
172
+ await outro(
173
+ 'While running the buddy upgrade:binary command, there was an issue',
174
+ { startTime: perf, useSeconds: true },
175
+ result.error,
176
+ ) // FIXME: should not have to cast
159
177
  process.exit()
160
178
  }
161
179
 
@@ -169,5 +187,7 @@ export function upgrade(buddy: CLI) {
169
187
  }
170
188
 
171
189
  function hasNoOptions(options: UpgradeOptions) {
172
- return !options.framework && !options.dependencies && !options.bun && !options.shell && !options.binary && !options.all
190
+ return (
191
+ !options.framework && !options.dependencies && !options.bun && !options.shell && !options.binary && !options.all
192
+ )
173
193
  }
@@ -1,28 +1,26 @@
1
1
  import process from 'node:process'
2
- import type { CLI } from '@stacksjs/types'
3
2
  import { bold, dim, green, intro, log } from '@stacksjs/cli'
4
3
  import { storage } from '@stacksjs/storage'
4
+ import type { CLI } from '@stacksjs/types'
5
5
 
6
6
  export function version(buddy: CLI) {
7
7
  const descriptions = {
8
8
  version: 'Retrieving Stacks build version',
9
9
  }
10
10
 
11
- buddy
12
- .command('version', descriptions.version)
13
- .action(async () => {
14
- log.debug('Running `buddy version` ...')
15
- await intro('buddy version')
11
+ buddy.command('version', descriptions.version).action(async () => {
12
+ log.debug('Running `buddy version` ...')
13
+ await intro('buddy version')
16
14
 
17
- const pkg = await storage.readPackageJson('./package.json')
18
- const bunVersion = 'wip'
19
- const stacksVersion = pkg.version
15
+ const pkg = await storage.readPackageJson('./package.json')
16
+ const bunVersion = 'wip'
17
+ const stacksVersion = pkg.version
20
18
 
21
- log.info(green(bold('@stacksjs/ ')) + dim(` ${stacksVersion}`))
22
- log.info(green(bold('Bun: ')) + dim(` ${bunVersion}`))
19
+ log.info(green(bold('@stacksjs/ ')) + dim(` ${stacksVersion}`))
20
+ log.info(green(bold('Bun: ')) + dim(` ${bunVersion}`))
23
21
 
24
- // redis (or other cache/s), mysql (or other database/s),
25
- })
22
+ // redis (or other cache/s), mysql (or other database/s),
23
+ })
26
24
 
27
25
  buddy.on('version:*', () => {
28
26
  console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
@@ -1,7 +1,7 @@
1
1
  import process from 'node:process'
2
- import { handleError } from '@stacksjs/error-handling'
3
- import { config } from '@stacksjs/config'
4
2
  import { cli } from '@stacksjs/cli'
3
+ import { config } from '@stacksjs/config'
4
+ import { handleError } from '@stacksjs/error-handling'
5
5
  import { path as p } from '@stacksjs/path'
6
6
  import { fs } from '@stacksjs/storage'
7
7
 
@@ -17,17 +17,15 @@ async function main() {
17
17
 
18
18
  // dynamically import and register commands from ./app/Commands/*
19
19
  const commandsDir = p.appPath('Commands')
20
- const commandFiles = fs.readdirSync(commandsDir).filter(file => file.endsWith('.ts'))
20
+ const commandFiles = fs.readdirSync(commandsDir).filter((file) => file.endsWith('.ts'))
21
21
 
22
22
  for (const file of commandFiles) {
23
23
  const commandPath = `${commandsDir}/${file}`
24
24
  const dynamicImport = await import(commandPath)
25
25
 
26
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)
27
+ if (typeof dynamicImport.default === 'function') dynamicImport.default(buddy)
28
+ else console.error(`Expected a default export function in ${file}, but got:`, dynamicImport.default)
31
29
  }
32
30
 
33
31
  buddy.parse()
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stacks",
3
3
  "type": "module",
4
- "version": "0.59.11",
4
+ "version": "0.61.0",
5
5
  "description": "The Stacks framework.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
@@ -326,11 +326,6 @@
326
326
  "bun": "./validation/src/index.ts",
327
327
  "types": "./validation/dist/index.d.ts",
328
328
  "import": "./validation/dist/index.js"
329
- },
330
- "./vite": {
331
- "bun": "./vite/src/index.ts",
332
- "types": "./vite/dist/index.d.ts",
333
- "import": "./vite/dist/index.js"
334
329
  }
335
330
  },
336
331
  "types": "./types/dist/index.d.ts",
@@ -348,87 +343,8 @@
348
343
  "scripts": {
349
344
  "buddy": "bun --bun run ./buddy/src/cli.ts",
350
345
  "build": "cd config && bun run build && cd ../env && bun run build && cd ../storage && bun run build && cd .. && bun ./build.ts",
351
- "up": "bunx taze major -I",
352
- "publish:framework": "./scripts/publish",
353
- "publish:dummy-libs": "bun --bun run generate:entries && bunx pnpm --filter './libs/components/vue' --filter './libs/components/web' --filter './libs/functions' publish --access public --no-git-checks",
354
- "fresh": "bun buddy fresh",
355
- "clean": "bun buddy clean",
356
- "update": "bun buddy update",
357
- "update:dependencies": "bun buddy update:dependencies",
358
- "update:framework": "bun buddy update:framework",
359
- "update:package-manager": "bun buddy update:package-manager",
360
- "update:node": "bun buddy update:node",
361
- "update:all": "bun buddy update:all",
362
- "dev:components": "bun buddy dev:components",
363
- "dev:dashboard": "bun buddy dev:dashboard",
364
- "dev:desktop": "bun buddy dev:desktop",
365
- "dev:docs": "buddy dev:docs",
366
- "dev:views": "bun buddy dev:views",
367
- "dev:functions": "bun buddy dev:functions",
368
- "development": "bun --bun run dev",
369
- "build:components": "bun buddy build:components",
370
- "build:vue-components": "bunx vite build -c ./vite/src/components.ts",
371
- "build:web-components": "bunx vite build -c ./vite/src/web-components.ts",
372
- "build:functions": "bunx vite build -c ./vite/src/functions.ts",
373
- "build:docs": "bun buddy build:docs",
374
- "build:views": "bunx vite-ssg build ./views -c ./vite/src/views.ts",
375
- "build:buddy": "bun buddy build:cli --buddy",
376
- "build:cli": "bun --bun run build:buddy",
377
- "build:runtime": "bun --bun run build:cli",
378
- "build:desktop": "wip",
379
- "build:stacks": "bun buddy build:stacks",
380
- "build:all": "wip",
381
- "prod": "bun --bun run build",
382
- "prod:components": "bun --bun run build:components",
383
- "prod:vue": "bun --bun run prod:vue",
384
- "prod:web-components": "bun --bun run build:web-components",
385
- "prod:functions": "bun --bun run build:functions",
386
- "prod:docs": "bun --bun run build:docs",
387
- "prod:pages": "bun --bun run build:pages",
388
- "prod:stacks": "bun --bun run build:stacks",
389
- "prod:all": "bun --bun run build:all",
390
- "deploy": "bun buddy deploy",
391
- "deploy:functions": "bun buddy deploy:functions",
392
- "deploy:pages": "bun buddy deploy:functions",
393
- "deploy:docs": "bun buddy deploy:docs",
394
- "deploy:all": "bun buddy deploy:all",
395
- "example": "wip",
396
- "example:vue": "bun --bun run build:components && cd examples/vue && ln -sf ../../components/vue/dist dist && bunx vite serve -c ../../src/build/example-vue.ts",
397
- "example:web-components": "bun --bun run build:web-components && cd examples/web && ln -sf ../../components/web/dist dist && bunx vite serve -c ../../src/build/example-wc.ts",
398
- "lint": "bun --bun eslint -c ../.eslintrc ..",
399
- "lint:stacks": "bun buddy lint:stacks",
400
- "lint:fix": "bun buddy lint:fix",
401
- "serve": "bun buddy serve",
402
- "serve:pages": "bun --bun run dev:views",
403
- "serve:functions": "bun --bun run dev:functions",
404
- "make": "bun buddy make",
405
- "make:component": "bun buddy make:component",
406
- "make:function": "bun buddy make:function",
407
- "make:database": "bun buddy make:migration",
408
- "make:migration": "bun buddy make:migration",
409
- "make:factory": "bun buddy make:factory",
410
- "make:lang": "bun buddy make:lang",
411
- "make:stack": "bun buddy make:stack",
412
- "key": "bun buddy key",
413
- "key:generate": "bun buddy key:generate",
414
- "commit": "git cz",
415
- "release": "bun buddy release",
416
- "changelog": "bun buddy changelog",
417
- "generate": "bun buddy generate",
418
- "generate:types": "bun ./actions/src/generate/types.ts",
419
- "generate:entries": "bun buddy generate:entries",
420
- "generate:vscode-custom-data": "bun ./actions/src/generate/vscode-custom-data.ts",
421
- "generate:web-types": "vue-docgen-web-types -c ./src/build/web-types.config.cjs",
422
- "generate:component-meta": "bun ./actions/src/generate/component-meta.ts",
423
- "generate:ide-helpers": "bun ./actions/src/generate/ide-helpers.ts",
424
- "generate:all": "bun buddy generate:all",
425
- "types:generate": "vue-tsc --declaration --emitDeclarationOnly && bun ./actions/src/copy-types.ts",
426
- "types:fix": "bun actions/src/fix-types.ts",
427
- "add": "bun buddy add",
428
- "test": "bun buddy test",
429
- "test:ui": "bun buddy test:ui",
430
- "test:coverage": "bun buddy test:coverage",
431
- "test:types": "bun buddy test:types"
346
+ "types": "bunx tsc --project ./tsconfig-core-types.json",
347
+ "up": "bunx taze major -I"
432
348
  },
433
349
  "web-types": "./web-types.json",
434
350
  "peerDependencies": {
@@ -477,7 +393,8 @@
477
393
  "@stacksjs/ui": "latest",
478
394
  "@stacksjs/utils": "latest",
479
395
  "@stacksjs/validation": "latest",
480
- "@stacksjs/vite": "latest"
396
+ "@stacksjs/vite-config": "latest",
397
+ "@stacksjs/vite-plugin": "latest"
481
398
  },
482
399
  "dependencies": {
483
400
  "@stacksjs/actions": "latest",
@@ -525,6 +442,7 @@
525
442
  "@stacksjs/ui": "latest",
526
443
  "@stacksjs/utils": "latest",
527
444
  "@stacksjs/validation": "latest",
528
- "@stacksjs/vite": "latest"
445
+ "@stacksjs/vite-config": "latest",
446
+ "@stacksjs/vite-plugin": "latest"
529
447
  }
530
448
  }