stacks 0.67.0 → 0.68.1

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 +7 -2
  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 -128
  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
package/buddy/src/cli.ts DELETED
@@ -1,105 +0,0 @@
1
- import type { CAC } from '@stacksjs/cli'
2
- import process from 'node:process'
3
- import { runAction } from '@stacksjs/actions'
4
- import { cli, log } from '@stacksjs/cli'
5
- import { Action } from '@stacksjs/enums'
6
- import { path as p } from '@stacksjs/path'
7
- import { fs } from '@stacksjs/storage'
8
- import { ensureProjectIsInitialized } from '@stacksjs/utils'
9
- import * as cmd from './commands'
10
-
11
- // setup global error handlers
12
- process.on('uncaughtException', (error: Error) => {
13
- log.debug('Buddy uncaughtException')
14
- log.error(error)
15
- process.exit(1)
16
- })
17
-
18
- process.on('unhandledRejection', (error: Error) => {
19
- log.debug('Buddy unhandledRejection')
20
- log.error(error)
21
- process.exit(1)
22
- })
23
-
24
- async function main() {
25
- const buddy = cli('buddy')
26
-
27
- // the following commands are not dependent on the project being initialized
28
- cmd.setup(buddy)
29
- cmd.key(buddy)
30
-
31
- // before running any commands, ensure the project is already initialized
32
- const isAppKeySet = await ensureProjectIsInitialized()
33
- if (isAppKeySet) {
34
- log.debug('Project is initialized')
35
- }
36
- else {
37
- log.info('Your `APP_KEY` is not yet set')
38
- log.info('Generating application key...')
39
- const result = await runAction(Action.KeyGenerate)
40
-
41
- if (result.isErr()) {
42
- log.error('Failed to set random application key.', result.error)
43
- process.exit()
44
- }
45
- }
46
-
47
- cmd.build(buddy)
48
- cmd.changelog(buddy)
49
- cmd.clean(buddy)
50
- cmd.cloud(buddy)
51
- cmd.commit(buddy)
52
- cmd.configure(buddy)
53
- cmd.dev(buddy)
54
- cmd.domains(buddy)
55
- cmd.deploy(buddy)
56
- cmd.dns(buddy)
57
- cmd.ports(buddy)
58
- cmd.projects(buddy)
59
- cmd.fresh(buddy)
60
- cmd.generate(buddy)
61
- cmd.http(buddy)
62
- cmd.install(buddy)
63
- cmd.lint(buddy)
64
- cmd.list(buddy)
65
- cmd.make(buddy)
66
- cmd.migrate(buddy)
67
- cmd.outdated(buddy)
68
- cmd.release(buddy)
69
- cmd.route(buddy)
70
- cmd.seed(buddy)
71
- cmd.setup(buddy)
72
- cmd.test(buddy)
73
- cmd.tinker(buddy)
74
- cmd.version(buddy)
75
- cmd.prepublish(buddy)
76
- cmd.upgrade(buddy)
77
-
78
- // dynamic imports
79
- await dynamicImports(buddy)
80
-
81
- buddy.help()
82
- buddy.parse()
83
- }
84
-
85
- await main()
86
-
87
- async function dynamicImports(buddy: CAC) {
88
- // dynamically import and register commands from ./app/Commands/*
89
- const commandsDir = p.appPath('Commands')
90
- const commandFiles = fs.readdirSync(commandsDir).filter((file: string) => file.endsWith('.ts'))
91
-
92
- for (const file of commandFiles) {
93
- const commandPath = `${commandsDir}/${file}`
94
- const dynamicImport = await import(commandPath)
95
-
96
- // Correctly use the default export function
97
- if (typeof dynamicImport.default === 'function')
98
- dynamicImport.default(buddy)
99
- else console.error(`Expected a default export function in ${file}, but got:`, dynamicImport.default)
100
- }
101
-
102
- const listenerImport = await import(p.listenersPath('Console.ts'))
103
- if (typeof listenerImport.default === 'function')
104
- listenerImport.default(buddy)
105
- }
@@ -1,71 +0,0 @@
1
- import type { AddOptions, BuildOptions, CLI } from '@stacksjs/types'
2
- import process from 'node:process'
3
- import { runAdd } from '@stacksjs/actions'
4
- import { log } from '@stacksjs/logging'
5
- import { ExitCode } from '@stacksjs/types'
6
-
7
- export function add(buddy: CLI): void {
8
- const descriptions = {
9
- add: 'Add a stack to your project (coming soon)',
10
- table: 'Add the Table Stack to your project',
11
- calendar: 'Add the Calendar Stack to your project',
12
- all: 'Add all stacks',
13
- select: 'Which stack/s are you trying to add?',
14
- project: 'Target a specific project',
15
- verbose: 'Enable verbose output',
16
- }
17
-
18
- buddy
19
- .command('add', descriptions.add)
20
- .option('-t, --table', descriptions.table, { default: false })
21
- .option('-c, --calendar', descriptions.calendar, { default: false })
22
- .option('-a, --all', descriptions.all, { default: false })
23
- .option('-p, --project [project]', descriptions.project, { default: false })
24
- .option('--verbose', descriptions.verbose, { default: false })
25
- .action(async (options: BuildOptions) => {
26
- log.debug('Running `buddy add`...', options)
27
-
28
- if (hasNoOptions(options)) {
29
- // const answers = await log.prompt(descriptions.select, {
30
- // type: 'multiselect',
31
- // options: [
32
- // { label: 'Calendar', value: 'calendar' },
33
- // { label: 'Table', value: 'table' },
34
- // ],
35
- // })
36
- // // creates an object out of array and sets answers to true
37
- // options = answers.reduce((a: any, v: any) => ({ ...a, [v]: true }), {})
38
- }
39
-
40
- await runAdd(options)
41
-
42
- process.exit(ExitCode.Success)
43
- })
44
-
45
- buddy
46
- .command('add:table', descriptions.table)
47
- .option('-t, --table', descriptions.table, { default: true })
48
- .option('-p, --project [project]', descriptions.project, { default: false })
49
- .option('--verbose', descriptions.verbose, { default: false })
50
- .action(async (options: BuildOptions) => {
51
- await runAdd(options)
52
- })
53
-
54
- buddy
55
- .command('add:calendar', descriptions.calendar)
56
- .option('-t, --calendar', descriptions.calendar, { default: true })
57
- .option('-p, --project [project]', descriptions.project, { default: false })
58
- .option('--verbose', descriptions.verbose, { default: false })
59
- .action(async (options: BuildOptions) => {
60
- await runAdd(options)
61
- })
62
-
63
- buddy.on('add:*', () => {
64
- console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
65
- process.exit(1)
66
- })
67
- }
68
-
69
- function hasNoOptions(options: AddOptions) {
70
- return !options.all && !options.table && !options.calendar
71
- }
@@ -1,299 +0,0 @@
1
- import type { BuildOptions, CLI } from '@stacksjs/types'
2
- import process from 'node:process'
3
- import { runAction } from '@stacksjs/actions'
4
- import { intro, log, outro, prompts } from '@stacksjs/cli'
5
- import { Action } from '@stacksjs/enums'
6
- import { ExitCode } from '@stacksjs/types'
7
-
8
- export function build(buddy: CLI): void {
9
- const descriptions = {
10
- build: 'Build any of your libraries (packages) for production use',
11
- components: 'Build your component library',
12
- vueComponents: 'Build your Vue component library',
13
- webComponents: 'Build your framework agnostic web component library',
14
- elements: 'An alias to the -w flag',
15
- buddy: 'Build the Buddy binary',
16
- functions: 'Build your function library',
17
- desktop: 'Build the Desktop Application',
18
- pages: 'Build your frontend',
19
- docs: 'Build your documentation',
20
- framework: 'Build Stacks framework',
21
- cli: 'Automagically build the CLI',
22
- server: 'Build the Stacks cloud server (Docker image)',
23
- select: 'What are you trying to build?',
24
- project: 'Target a specific project',
25
- verbose: 'Enable verbose output',
26
- }
27
-
28
- buddy
29
- .command('build [type]', descriptions.build)
30
- .option('-c, --components', descriptions.components)
31
- .option('-v, --vue-components', descriptions.vueComponents) // also automatically built via the -c flag
32
- .option('-w, --web-components', descriptions.webComponents) // also automatically built via the -c flag
33
- .option('-e, --elements', descriptions.elements) // alias for --web-components
34
- .option('-f, --functions', descriptions.functions)
35
- .option('-p, --views', descriptions.pages)
36
- .option('--pages', descriptions.pages) // alias for --views
37
- .option('-d, --docs', descriptions.docs)
38
- .option('-b, --buddy', descriptions.buddy, { default: false })
39
- .option('-s, --stacks', descriptions.framework, { default: false })
40
- .option('--project [project]', descriptions.project, { default: false })
41
- .option('--server', descriptions.server, { default: false })
42
- .option('--verbose', descriptions.verbose, { default: false })
43
- .action(async (server: string | undefined, options: BuildOptions) => {
44
- log.debug('Running `buddy build` ...', options)
45
-
46
- switch (server) {
47
- case 'components':
48
- options.components = true
49
- break
50
- case 'vue':
51
- options.vueComponents = true
52
- break
53
- case 'web-components':
54
- options.webComponents = true
55
- break
56
- case 'functions':
57
- options.functions = true
58
- break
59
- case 'views':
60
- options.views = true
61
- break
62
- case 'docs':
63
- options.docs = true
64
- break
65
- case 'buddy':
66
- options.buddy = true
67
- break
68
- case 'cli':
69
- options.buddy = true
70
- break
71
- case 'stacks':
72
- options.stacks = true
73
- break
74
- case 'server':
75
- options.server = true
76
- break
77
- default:
78
- break
79
- }
80
-
81
- console.log('server', server, options)
82
-
83
- // TODO: uncomment this when prompt is available
84
- if (hasNoOptions(options)) {
85
- console.log('has no')
86
- const answers = await prompts({
87
- type: 'multiselect',
88
- name: 'build',
89
- message: descriptions.select,
90
- choices: [
91
- { title: 'Components', value: 'components' },
92
- // { label: 'Vue Components', value: 'vue-components' },
93
- { title: 'Web Components', value: 'web-components' },
94
- { title: 'Functions', value: 'functions' },
95
- { title: 'Views', value: 'views' },
96
- { title: 'Documentation', value: 'docs' },
97
- ],
98
- })
99
-
100
- console.log('answers', answers)
101
- if (answers !== null)
102
- process.exit(ExitCode.InvalidArgument)
103
- }
104
- else {
105
- console.log('has op')
106
- }
107
-
108
- if (options.docs)
109
- await runAction(Action.BuildDocs)
110
- if (options.components)
111
- await runAction(Action.BuildComponentLibs)
112
- if (options.vueComponents)
113
- await runAction(Action.BuildVueComponentLib)
114
- if (options.webComponents)
115
- await runAction(Action.BuildWebComponentLib)
116
- if (options.functions)
117
- await runAction(Action.BuildFunctionLib)
118
- if (options.views)
119
- await runAction(Action.BuildViews)
120
- if (options.stacks)
121
- await runAction(Action.BuildStacks)
122
- if (options.buddy)
123
- await runAction(Action.BuildCli)
124
- if (options.server)
125
- await runAction(Action.BuildServer)
126
- process.exit(ExitCode.Success)
127
- })
128
-
129
- buddy
130
- .command('build:components', 'Automagically build component libraries for production use & npm/CDN distribution')
131
- .alias('prod:components')
132
- .option('-c, --components', descriptions.components, { default: true })
133
- .option('-p, --project [project]', descriptions.project, { default: false })
134
- .option('--verbose', descriptions.verbose, { default: false })
135
- .action(async (options: BuildOptions) => {
136
- log.debug('Running `buddy build:components` ...', options)
137
- await runAction(Action.BuildComponentLibs, options)
138
- })
139
-
140
- buddy
141
- .command('build:cli', descriptions.cli)
142
- .alias('prod:cli')
143
- .option('-b, --buddy', descriptions.buddy, { default: true })
144
- .option('-p, --project [project]', descriptions.project, { default: false })
145
- .option('--verbose', descriptions.verbose, { default: false })
146
- .action(async (options: BuildOptions) => {
147
- log.debug('Running `buddy build:cli` ...', options)
148
- await runAction(Action.BuildCli, options)
149
- })
150
-
151
- buddy
152
- .command('build:server', descriptions.server)
153
- .alias('prod:server')
154
- .alias('build:docker')
155
- .option('-p, --project [project]', descriptions.project, { default: false })
156
- .option('--verbose', descriptions.verbose, { default: false })
157
- .action(async (options: BuildOptions) => {
158
- log.debug('Running `buddy build:server` ...', options)
159
- await runAction(Action.BuildServer, options)
160
- })
161
-
162
- buddy
163
- .command('build:functions', 'Automagically build function library for npm/CDN distribution')
164
- .option('-f, --functions', descriptions.functions, { default: true })
165
- .option('-p, --project [project]', descriptions.project, { default: false })
166
- .option('--verbose', descriptions.verbose, { default: false })
167
- .action(async (options: BuildOptions) => {
168
- log.debug('Running `buddy `build:functions` ...', options)
169
- await runAction(Action.BuildFunctionLib, options)
170
- })
171
-
172
- buddy
173
- .command('build:vue-components', 'Automagically build Vue component library for npm/CDN distribution')
174
- .alias('build:vue')
175
- .alias('prod:vue-components')
176
- .alias('prod:vue')
177
- .option('-v, --vue-components', descriptions.vueComponents, {
178
- default: true,
179
- })
180
- .option('-p, --project [project]', descriptions.project, { default: false })
181
- .option('--verbose', descriptions.verbose, { default: false })
182
- .alias('build:vue')
183
- .action(async (options: BuildOptions) => {
184
- log.debug('Running `buddy build:vue-components` ...', options)
185
- await runAction(Action.BuildVueComponentLib, options)
186
- })
187
-
188
- buddy
189
- .command('build:web-components', 'Automagically build Web Component library for npm/CDN distribution')
190
- .alias('build:wc')
191
- .alias('prod:web-components')
192
- .alias('prod:wc')
193
- .option('-w, --web-components', descriptions.webComponents, {
194
- default: true,
195
- })
196
- .option('-p, --project [project]', descriptions.project, { default: false })
197
- .option('--verbose', descriptions.verbose, { default: false })
198
- .action(async (options: BuildOptions) => {
199
- log.debug('Running `buddy build:web-components` ...', options)
200
- await runAction(Action.BuildWebComponentLib, options)
201
- })
202
-
203
- buddy
204
- .command('build:docs', 'Automagically build your documentation site.')
205
- .alias('prod:docs')
206
- .alias('build:documentation')
207
- .alias('prod:documentation')
208
- .option('-d, --docs', descriptions.docs, { default: true })
209
- .option('-p, --project [project]', descriptions.project, { default: false })
210
- .option('--verbose', descriptions.verbose, { default: false })
211
- .action(async (options: BuildOptions) => {
212
- log.debug('Running `buddy build:docs` ...', options)
213
- await runAction(Action.BuildDocs, options)
214
- })
215
-
216
- buddy
217
- .command('build:core', 'Automagically build the Stacks core.')
218
- .option('-p, --project [project]', descriptions.project, { default: false })
219
- .option('--verbose', descriptions.verbose, { default: false })
220
- .action(async (options: BuildOptions) => {
221
- log.debug('Running `buddy build:core` ...', options)
222
-
223
- const startTime = await intro('buddy build:core')
224
- const result = await runAction(Action.BuildCore, options)
225
-
226
- if (result.isErr()) {
227
- log.error('Failed to build the Stacks core.', result.error)
228
- process.exit()
229
- }
230
-
231
- await outro('Core packages built successfully', {
232
- startTime,
233
- useSeconds: true,
234
- })
235
- })
236
-
237
- buddy
238
- .command('build:desktop', descriptions.desktop)
239
- .alias('prod:desktop')
240
- .option('-p, --project [project]', descriptions.project, { default: false })
241
- .option('--verbose', descriptions.verbose, { default: false })
242
- .action(async (options: BuildOptions) => {
243
- log.debug('Running `buddy build:desktop` ...', options)
244
-
245
- const perf = await intro('buddy build:desktop')
246
- const result = await runAction(Action.BuildDesktop, options)
247
-
248
- if (result.isErr()) {
249
- await outro(
250
- 'While running the build:desktop command, there was an issue',
251
- { startTime: perf, useSeconds: true },
252
- result.error,
253
- )
254
- process.exit()
255
- }
256
-
257
- console.log('')
258
- await outro('Exited', { startTime: perf, useSeconds: true })
259
- process.exit(ExitCode.Success)
260
- })
261
-
262
- buddy
263
- .command('build:stacks', 'Build the Stacks framework.')
264
- .option('-s, --stacks', descriptions.framework, { default: true })
265
- .option('-p, --project [project]', descriptions.project, { default: false })
266
- .option('--verbose', descriptions.verbose, { default: false })
267
- .action(async (options: BuildOptions) => {
268
- log.debug('Running `buddy build:stacks` ...', options)
269
-
270
- const startTime = await intro('buddy build:stacks')
271
- const result = await runAction(Action.BuildStacks, options)
272
-
273
- if (result.isErr()) {
274
- log.error('Failed to build Stacks.', result.error)
275
- process.exit()
276
- }
277
-
278
- await outro('Stacks built successfully', { startTime, useSeconds: true })
279
- })
280
-
281
- buddy.on('build:*', () => {
282
- console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
283
- process.exit(1)
284
- })
285
- }
286
-
287
- function hasNoOptions(options: BuildOptions) {
288
- return (
289
- !options.components
290
- && !options.vueComponents
291
- && !options.webComponents
292
- && !options.elements
293
- && !options.functions
294
- && !options.views
295
- && !options.docs
296
- && !options.stacks
297
- && !options.buddy
298
- )
299
- }
@@ -1,52 +0,0 @@
1
- import type { CLI, FreshOptions } 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 changelog(buddy: CLI): void {
8
- const descriptions = {
9
- changelog: 'Create a CHANGELOG.md file',
10
- quiet: 'Minimal output',
11
- dryRun: 'Do not write the file, just output the changes',
12
- project: 'Target a specific project',
13
- verbose: 'Enable verbose output',
14
- }
15
-
16
- // console.log('changelog', descriptions.changelog)
17
-
18
- buddy
19
- .command('changelog', descriptions.changelog)
20
- .option('-q, --quiet', descriptions.quiet, { default: false })
21
- .option('-d, --dry-run', descriptions.dryRun, { default: false })
22
- .option('-p, --project [project]', descriptions.project, { default: false })
23
- .option('--verbose', descriptions.verbose, { default: false })
24
- .action(async (options: FreshOptions) => {
25
- log.debug('Running `buddy changelog` ...', options)
26
-
27
- const perf = await intro('buddy changelog')
28
- const result = await runAction(Action.Changelog, options)
29
-
30
- if (result.isErr()) {
31
- await outro(
32
- 'While running the changelog command, there was an issue',
33
- { ...options, startTime: perf, useSeconds: true },
34
- result.error,
35
- )
36
- process.exit()
37
- }
38
-
39
- await outro('Generated CHANGELOG.md', {
40
- ...options,
41
- startTime: perf,
42
- useSeconds: true,
43
- type: 'success',
44
- })
45
- })
46
-
47
- buddy.on('changelog:*', () => {
48
- console.log('Invalid command: %s', buddy.args.join(' '))
49
- console.log('See --help for a list of available commands.')
50
- process.exit(1)
51
- })
52
- }
@@ -1,46 +0,0 @@
1
- import type { CleanOptions, CLI } 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
- import { ExitCode } from '@stacksjs/types'
7
-
8
- export function clean(buddy: CLI): void {
9
- const descriptions = {
10
- clean: 'Removes all node_modules & lock files',
11
- project: 'Target a specific project',
12
- verbose: 'Enable verbose output',
13
- }
14
-
15
- buddy
16
- .command('clean', descriptions.clean)
17
- .option('-p, --project [project]', descriptions.project, { default: false })
18
- .option('--verbose', descriptions.verbose, { default: false })
19
- .action(async (options: CleanOptions) => {
20
- log.debug('Running `buddy clean` ...', options)
21
-
22
- const perf = await intro('buddy clean')
23
- const result = await runAction(Action.Clean, options)
24
-
25
- if (result.isErr()) {
26
- await outro(
27
- 'While running the clean command, there was an issue',
28
- { startTime: perf, useSeconds: true },
29
- result.error,
30
- )
31
- process.exit(ExitCode.FatalError)
32
- }
33
-
34
- await outro('Cleaned up', {
35
- startTime: perf,
36
- useSeconds: true,
37
- message: 'Cleaned up',
38
- })
39
- process.exit(ExitCode.Success)
40
- })
41
-
42
- buddy.on('clean:*', () => {
43
- console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
44
- process.exit(1)
45
- })
46
- }