stacks 0.66.0 → 0.68.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 (45) hide show
  1. package/package.json +54 -49
  2. package/buddy/README.md +0 -396
  3. package/buddy/art/social.jpg +0 -0
  4. package/buddy/bin/cli.ts +0 -85
  5. package/buddy/build.ts +0 -43
  6. package/buddy/package.json +0 -129
  7. package/buddy/src/cli.ts +0 -105
  8. package/buddy/src/commands/add.ts +0 -71
  9. package/buddy/src/commands/build.ts +0 -299
  10. package/buddy/src/commands/changelog.ts +0 -52
  11. package/buddy/src/commands/clean.ts +0 -46
  12. package/buddy/src/commands/cloud.ts +0 -553
  13. package/buddy/src/commands/commit.ts +0 -26
  14. package/buddy/src/commands/configure.ts +0 -84
  15. package/buddy/src/commands/create.ts +0 -143
  16. package/buddy/src/commands/deploy.ts +0 -194
  17. package/buddy/src/commands/dev.ts +0 -292
  18. package/buddy/src/commands/dns.ts +0 -86
  19. package/buddy/src/commands/domains.ts +0 -255
  20. package/buddy/src/commands/fresh.ts +0 -48
  21. package/buddy/src/commands/generate.ts +0 -202
  22. package/buddy/src/commands/http.ts +0 -57
  23. package/buddy/src/commands/index.ts +0 -33
  24. package/buddy/src/commands/install.ts +0 -30
  25. package/buddy/src/commands/key.ts +0 -36
  26. package/buddy/src/commands/lint.ts +0 -54
  27. package/buddy/src/commands/list.ts +0 -42
  28. package/buddy/src/commands/make.ts +0 -352
  29. package/buddy/src/commands/migrate.ts +0 -105
  30. package/buddy/src/commands/outdated.ts +0 -31
  31. package/buddy/src/commands/ports.ts +0 -188
  32. package/buddy/src/commands/prepublish.ts +0 -28
  33. package/buddy/src/commands/projects.ts +0 -54
  34. package/buddy/src/commands/release.ts +0 -47
  35. package/buddy/src/commands/route.ts +0 -39
  36. package/buddy/src/commands/seed.ts +0 -47
  37. package/buddy/src/commands/setup.ts +0 -145
  38. package/buddy/src/commands/test.ts +0 -214
  39. package/buddy/src/commands/tinker.ts +0 -42
  40. package/buddy/src/commands/types.ts +0 -35
  41. package/buddy/src/commands/upgrade.ts +0 -200
  42. package/buddy/src/commands/version.ts +0 -29
  43. package/buddy/src/custom-cli.ts +0 -35
  44. package/buddy/src/index.ts +0 -1
  45. package/buddy/tsconfig.json +0 -3
@@ -1,202 +0,0 @@
1
- import process from 'node:process'
2
- import {
3
- generateComponentMeta,
4
- generateCoreSymlink,
5
- generateIdeHelpers,
6
- generateLibEntries,
7
- generateOpenApiSpec,
8
- generatePkgxConfig,
9
- generateTypes,
10
- generateVsCodeCustomData,
11
- generateWebTypes,
12
- invoke as startGenerationProcess,
13
- } from '@stacksjs/actions'
14
- import { intro, log, outro } from '@stacksjs/cli'
15
- import { generateModelFiles } from '@stacksjs/orm'
16
- import { type CLI, ExitCode, type GeneratorOptions } from '@stacksjs/types'
17
-
18
- export function generate(buddy: CLI): void {
19
- const descriptions = {
20
- command:
21
- 'Automagically build any of your libraries/packages for production use. Select any of the following packages',
22
- types: 'Generate your TypeScript types',
23
- entries: 'Generate your function & Component Library Entry Points',
24
- webTypes: 'Generate web-types.json for IDEs',
25
- customData: 'Generate VS Code custom data (custom-elements.json) for IDEs',
26
- ideHelpers: 'Generate IDE helpers',
27
- componentMeta: 'Generate component meta information',
28
- coreSymlink: 'Generate symlink of the core framework to the project root',
29
- pkgx: 'Generate the pkgx configuration file',
30
- modelFiles: 'Generate the model files',
31
- openApi: 'Generate the OpenAPI specification',
32
- select: 'What are you trying to generate?',
33
- project: 'Target a specific project',
34
- verbose: 'Enable verbose output',
35
- }
36
-
37
- buddy
38
- .command('generate', descriptions.command)
39
- .option('-t, --types', descriptions.types)
40
- .option('-e, --entries', descriptions.entries)
41
- .option('-w, --web-types', descriptions.webTypes)
42
- .option('-c, --custom-data', descriptions.customData)
43
- .option('-i, --ide-helpers', descriptions.ideHelpers)
44
- .option('-c, --component-meta', descriptions.componentMeta)
45
- .option('-p, --pkgx', descriptions.pkgx)
46
- .option('-m, --model-files', descriptions.modelFiles)
47
- .option('-o, --openapi', descriptions.openApi)
48
- .option('-p, --project [project]', descriptions.project, { default: false })
49
- .option('--core-symlink', descriptions.coreSymlink)
50
- .option('--verbose', descriptions.verbose, { default: false })
51
- .action(async (options: GeneratorOptions) => {
52
- log.debug('Running `buddy generate` ...', options)
53
-
54
- // TODO: uncomment this
55
- // if (hasNoOptions(options)) {
56
- // let answers = await prompt.require()
57
- // .multiselect(descriptions.select, {
58
- // options: [
59
- // { label: '1.) TypeScript Types', value: 'types' },
60
- // { label: '2.) Library Entry Points', value: 'entries' },
61
- // { label: '3.) Web Types', value: 'web-types' },
62
- // { label: '4.) VS Code Custom Data', value: 'custom-data' },
63
- // { label: '5.) IDE Helpers', value: 'ide-helpers' },
64
- // { label: '6.) Component Meta', value: 'component-meta' },
65
- // ],
66
- // })
67
- //
68
- // if (isString(answers))
69
- // answers = [answers]
70
- //
71
- // // creates an object out of array and sets answers to true
72
- // options = (answers as Array<any>).reduce((a: any, v: any) => ({ ...a, [v]: true }), {})
73
- // }
74
-
75
- await startGenerationProcess(options)
76
-
77
- process.exit(ExitCode.Success)
78
- })
79
-
80
- buddy
81
- .command('generate:types', descriptions.types)
82
- .option('-p, --project [project]', descriptions.project, { default: false })
83
- .option('--verbose', descriptions.verbose, { default: false })
84
- .alias('types:generate')
85
- .action(async (options: GeneratorOptions) => {
86
- log.debug('Running `buddy generate:types` ...', options)
87
- await generateTypes(options)
88
- })
89
-
90
- buddy
91
- .command('generate:entries', descriptions.entries)
92
- .option('-p, --project [project]', descriptions.project, { default: false })
93
- .option('--verbose', descriptions.verbose, { default: false })
94
- .action(async (options: GeneratorOptions) => {
95
- log.debug('Running `buddy generate:entries` ...', options)
96
- await generateLibEntries(options)
97
- })
98
-
99
- buddy
100
- .command('generate:web-types', descriptions.webTypes)
101
- .option('-p, --project [project]', descriptions.project, { default: false })
102
- .option('--verbose', descriptions.verbose, { default: false })
103
- .action(async (options: GeneratorOptions) => {
104
- log.debug('Running `buddy generate:web-types` ...', options)
105
- await generateWebTypes(options)
106
- })
107
-
108
- buddy
109
- .command('generate:vscode-custom-data', descriptions.customData)
110
- .option('-p, --project [project]', descriptions.project, { default: false })
111
- .option('--verbose', descriptions.verbose, { default: false })
112
- .action(async (options: GeneratorOptions) => {
113
- log.debug('Running `buddy generate:vscode-custom-data` ...', options)
114
- await generateVsCodeCustomData(options)
115
- })
116
-
117
- buddy
118
- .command('generate:ide-helpers', descriptions.ideHelpers)
119
- .option('-p, --project [project]', descriptions.project, { default: false })
120
- .option('--verbose', descriptions.verbose, { default: false })
121
- .action(async (options: GeneratorOptions) => {
122
- log.debug('Running `buddy generate:ide-helpers` ...', options)
123
- await generateIdeHelpers(options)
124
- })
125
-
126
- buddy
127
- .command('generate:component-meta', descriptions.componentMeta)
128
- .option('-p, --project [project]', descriptions.project, { default: false })
129
- .option('--verbose', descriptions.verbose, { default: false })
130
- .action(async (options: GeneratorOptions) => {
131
- log.debug('Running `buddy generate:component-meta` ...', options)
132
- await generateComponentMeta(options)
133
- })
134
-
135
- buddy
136
- .command('generate:pkgx-config', descriptions.pkgx)
137
- .option('-p, --project [project]', descriptions.project, { default: false })
138
- .option('--verbose', descriptions.verbose, { default: false })
139
- .action((options: GeneratorOptions) => {
140
- log.debug('Running `buddy generate:pkgx-config` ...', options)
141
- generatePkgxConfig()
142
- })
143
-
144
- buddy
145
- .command('generate:model-files', descriptions.modelFiles)
146
- .option('-p, --project [project]', descriptions.project, { default: false })
147
- .option('--verbose', descriptions.verbose, { default: false })
148
- .action(async () => {
149
- const perf = await intro('buddy generate:model-files')
150
-
151
- try {
152
- await generateModelFiles()
153
-
154
- outro('Generated Model files', {
155
- startTime: perf,
156
- useSeconds: true,
157
- })
158
- }
159
- catch (error) {
160
- log.error('There was an error generating your model files', error)
161
- process.exit(ExitCode.FatalError)
162
- }
163
- })
164
-
165
- buddy
166
- .command('generate:openapi-spec', descriptions.openApi)
167
- .alias('generate:openapi')
168
- .option('-p, --project [project]', descriptions.project, { default: false })
169
- .option('--verbose', descriptions.verbose, { default: false })
170
- .action(async (options: GeneratorOptions) => {
171
- log.debug('Running `buddy generate:openapi-spec` ...', options)
172
- const perf = await intro('buddy generate:openapi-spec')
173
-
174
- await generateOpenApiSpec()
175
-
176
- outro('Generated OpenAPI specification', {
177
- startTime: perf,
178
- useSeconds: true,
179
- })
180
- })
181
-
182
- buddy.command('generate:migrations', 'Generate Migrations').action((options: GeneratorOptions) => {
183
- log.debug('Running `buddy generate:migrations` ...', options)
184
- // generateMigrations()
185
- })
186
-
187
- buddy
188
- .command('generate:core-symlink', 'Generate core symlink. A shortcut for core developers.')
189
- .action(async (options: GeneratorOptions) => {
190
- log.debug('Running `buddy core-symlink` ...', options)
191
- await generateCoreSymlink()
192
- })
193
-
194
- buddy.on('generate:*', () => {
195
- console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
196
- process.exit(1)
197
- })
198
- }
199
-
200
- // function hasNoOptions(options: GeneratorOptions) {
201
- // return !options.types && !options.entries && !options.webTypes && !options.customData && !options.ideHelpers && !options.componentMeta
202
- // }
@@ -1,57 +0,0 @@
1
- import type { CLI } from '@stacksjs/types'
2
- import process from 'node:process'
3
- import { config } from '@stacksjs/config'
4
- import { ExitCode } from '@stacksjs/types'
5
-
6
- // import { path } from '@stacksjs/path'
7
- import { log, runCommandSync } from '@stacksjs/cli'
8
-
9
- // function runCommand(command: string): Promise<string> {
10
- // return new Promise((resolve, reject) => {
11
- // exec(command, { shell: true, cwd: path.projectPath() }, (error, stdout, stderr) => {
12
- // if (error) {
13
- // console.error(`exec error: ${error}`)
14
- // reject(error)
15
- // } else {
16
- // console.log(error, stdout, stderr)
17
- // resolve(stdout)
18
- // }
19
- // })
20
- // })
21
- // }
22
-
23
- // import { Action } from '@stacksjs/enums'
24
- // import { runAction } from '@stacksjs/actions'
25
-
26
- interface HttpOptions {
27
- verbose?: boolean
28
- }
29
-
30
- export function http(buddy: CLI): void {
31
- const descriptions = {
32
- http: 'Send an HTTP request to a domain',
33
- project: 'Target a specific project',
34
- verbose: 'Enable verbose output',
35
- }
36
-
37
- buddy
38
- .command('http [domain]', descriptions.http)
39
- .option('-p, --project [project]', descriptions.project, { default: false })
40
- // .option('--verbose', descriptions.verbose, { default: false })
41
- .action(async (domain: string | undefined, options: HttpOptions) => {
42
- log.debug('Running `buddy http [domain]` ...', options)
43
-
44
- // Convert options object to command-line options string
45
- const optionsString = Object.entries(options)
46
- .filter(([key, value]) => key !== '--' && key.length > 1 && value !== false) // filter out '--' key and short options
47
- .map(([key, value]) => `--${key} ${value}`)
48
- .join(' ')
49
-
50
- const command = `http GET ${domain || config.app.url} ${optionsString}`
51
-
52
- log.info(`Running command: ${command}`)
53
- await runCommandSync(command)
54
-
55
- process.exit(ExitCode.Success)
56
- })
57
- }
@@ -1,33 +0,0 @@
1
- export * from './build'
2
- export * from './changelog'
3
- export * from './clean'
4
- export * from './cloud'
5
- export * from './commit'
6
- export * from './configure'
7
- export * from './create'
8
- export * from './deploy'
9
- export * from './dev'
10
- export * from './dns'
11
- export * from './domains'
12
- export * from './fresh'
13
- export * from './generate'
14
- export * from './http'
15
- export * from './install'
16
- export * from './key'
17
- export * from './lint'
18
- export * from './list'
19
- export * from './make'
20
- export * from './migrate'
21
- export * from './outdated'
22
- export * from './ports'
23
- export * from './prepublish'
24
- export * from './projects'
25
- export * from './release'
26
- export * from './route'
27
- export * from './seed'
28
- export * from './setup'
29
- export * from './test'
30
- export * from './tinker'
31
- export * from './types'
32
- export * from './upgrade'
33
- export * from './version'
@@ -1,30 +0,0 @@
1
- import type { CLI, InstallOptions } from '@stacksjs/types'
2
- import process from 'node:process'
3
- import { log, runCommand } from '@stacksjs/cli'
4
- import { path as p } from '@stacksjs/path'
5
-
6
- export function install(buddy: CLI): void {
7
- const descriptions = {
8
- install: 'Install your dependencies',
9
- project: 'Target a specific project',
10
- verbose: 'Enable verbose output',
11
- }
12
-
13
- buddy
14
- .command('install', descriptions.install)
15
- .option('-p, --project [project]', descriptions.project, { default: false })
16
- .option('-v, --verbose', descriptions.verbose, { default: false })
17
- .action(async (options: InstallOptions) => {
18
- log.debug('Running `buddy install` ...', options)
19
-
20
- await runCommand('bun install', {
21
- ...options,
22
- cwd: p.projectPath(),
23
- })
24
- })
25
-
26
- buddy.on('install:*', () => {
27
- console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
28
- process.exit(1)
29
- })
30
- }
@@ -1,36 +0,0 @@
1
- import type { CLI, KeyOptions } from '@stacksjs/types'
2
- import process from 'node:process'
3
- import { runAction } from '@stacksjs/actions'
4
- import { intro, log, outro } from '@stacksjs/cli'
5
- import { Action } from '@stacksjs/enums'
6
-
7
- export function key(buddy: CLI): void {
8
- const descriptions = {
9
- command: 'Generate & set the application key.',
10
- project: 'Target a specific project',
11
- verbose: 'Enable verbose output',
12
- }
13
-
14
- buddy
15
- .command('key:generate', descriptions.command)
16
- .option('-p, --project [project]', descriptions.project, { default: false })
17
- .option('--verbose', descriptions.verbose, { default: false })
18
- .action(async (options: KeyOptions) => {
19
- log.debug('Running `buddy key:generate` ...', options)
20
-
21
- await intro('buddy key:generate')
22
- const result = await runAction(Action.KeyGenerate, options)
23
-
24
- if (result.isErr()) {
25
- log.error('Failed to set random application key.', result.error)
26
- process.exit()
27
- }
28
-
29
- await outro('Random application key set.')
30
- })
31
-
32
- buddy.on('key:*', () => {
33
- console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
34
- process.exit(1)
35
- })
36
- }
@@ -1,54 +0,0 @@
1
- import type { CLI, LintOptions } from '@stacksjs/types'
2
- import process from 'node:process'
3
- import { runAction } from '@stacksjs/actions'
4
- import { intro, log, outro, runCommand } from '@stacksjs/cli'
5
- import { Action } from '@stacksjs/enums'
6
-
7
- export function lint(buddy: CLI): void {
8
- const descriptions = {
9
- lint: 'Automagically lints your project codebase',
10
- lintFix: 'Automagically fixes all lint errors',
11
- project: 'Target a specific project',
12
- verbose: 'Enable verbose output',
13
- }
14
-
15
- buddy
16
- .command('lint', descriptions.lint)
17
- .option('-f, --fix', descriptions.lintFix, { default: false })
18
- .option('-p, --project [project]', descriptions.project, { default: false })
19
- .option('--verbose', descriptions.verbose, { default: false })
20
- .action(async (options: LintOptions) => {
21
- log.debug('Running `buddy lint` ...', options)
22
-
23
- const startTime = await intro('buddy lint')
24
-
25
- if (options.fix)
26
- await runAction(Action.LintFix, { ...options })
27
- else await runCommand('bunx --bun eslint .')
28
-
29
- await outro('Linted your project', { startTime, useSeconds: true })
30
- })
31
-
32
- buddy
33
- .command('lint:fix', descriptions.lintFix)
34
- .option('-p, --project [project]', descriptions.project, { default: false })
35
- .option('--verbose', descriptions.verbose, { default: false })
36
- .action(async (options: LintOptions) => {
37
- log.debug('Running `buddy lint:fix` ...', options)
38
-
39
- log.info('Fixing lint errors...')
40
- const result = await runAction(Action.LintFix, { ...options })
41
-
42
- if (result.isErr()) {
43
- log.error('There was an error lint fixing your code.', result.error)
44
- process.exit()
45
- }
46
-
47
- log.success('Fixed lint errors')
48
- })
49
-
50
- buddy.on('lint:*', () => {
51
- console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
52
- process.exit(1)
53
- })
54
- }
@@ -1,42 +0,0 @@
1
- import type { CLI, CliOptions } from '@stacksjs/types'
2
- import { $ } from 'bun'
3
- import process from 'node:process'
4
- import { log } from '@stacksjs/logging'
5
- import { projectPath } from '@stacksjs/path'
6
-
7
- export function list(buddy: CLI): void {
8
- const descriptions = {
9
- list: 'List all of the project-specific Buddy commands',
10
- project: 'Target a specific project',
11
- verbose: 'Enable verbose output',
12
- }
13
-
14
- buddy
15
- .command('list', descriptions.list)
16
- .option('-p, --project [project]', descriptions.project, { default: false })
17
- .option('--verbose', descriptions.verbose, { default: false })
18
- .action(async (options: CliOptions) => {
19
- log.debug('Running `buddy list` ...', options)
20
-
21
- $.cwd(projectPath())
22
-
23
- const test = await $`buddy --help`.text()
24
- const commandsSection = test.match(/Commands:.*?(?=For more info, run any command with the)/s)?.[0]
25
-
26
- if (commandsSection) {
27
- const cleanedCommands = commandsSection
28
- .replace('Commands:', '') // Remove "Commands:"
29
- .replace(/^\s+/gm, '') // Trim leading whitespace from the start of each line
30
-
31
- console.log(cleanedCommands)
32
- return
33
- }
34
-
35
- console.error('#1 - Please reach out to our Discord for helper: https://discord.gg/stacksjs')
36
- })
37
-
38
- buddy.on('list:*', () => {
39
- console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
40
- process.exit(1)
41
- })
42
- }