Skip to content

Commit aba7214

Browse files
committed
chore: wip
1 parent 110ce2b commit aba7214

File tree

5 files changed

+49
-0
lines changed

5 files changed

+49
-0
lines changed

.stacks/core/actions/src/deploy.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { runCommands } from '@stacksjs/cli'
2+
import { frameworkPath } from '@stacksjs/path'
3+
4+
// TODO: create this action
5+
await runCommands([
6+
'pnpm buddy clean',
7+
'pnpm install',
8+
], { cwd: frameworkPath(), verbose: true })
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import type { CLI, DeployOptions } from '@stacksjs/types'
2+
import { runAction } from '@stacksjs/actions'
3+
import { intro, outro } from '@stacksjs/cli'
4+
import { Action, ExitCode } from '@stacksjs/types'
5+
6+
async function deploy(buddy: CLI) {
7+
const descriptions = {
8+
deploy: 'Reinstalls your npm dependencies',
9+
verbose: 'Enable verbose output',
10+
debug: 'Enable debug mode',
11+
}
12+
13+
buddy
14+
.command('deploy', descriptions.deploy)
15+
.option('--verbose', descriptions.verbose, { default: false })
16+
.option('--debug', descriptions.debug, { default: false })
17+
.action(async (options: DeployOptions) => {
18+
const perf = await intro('buddy deploy')
19+
const result = await runAction(Action.Deploy, options)
20+
21+
if (result.isErr()) {
22+
outro('While running the `buddy deploy`, there was an issue', { startTime: perf, useSeconds: true, isError: true }, result.error)
23+
process.exit()
24+
}
25+
26+
outro('Deployment succeeded.', { startTime: perf, useSeconds: true })
27+
process.exit(ExitCode.Success)
28+
})
29+
}
30+
31+
export { deploy }

.stacks/core/buddy/src/commands/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export * from './changelog'
33
export * from './clean'
44
export * from './commit'
55
export * from './create'
6+
export * from './deploy'
67
export * from './dev'
78
export * from './example'
89
export * from './fresh'

.stacks/core/types/src/deploy.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* **Deploy Options**
3+
*
4+
* This configuration defines all of your deployment options. Because Stacks is fully-typed,
5+
* you may hover any of the options below and the definitions will be provided. In case
6+
* you have any questions, feel free to reach out via Discord or GitHub Discussions.
7+
*/
8+
export interface DeployOptions {}

.stacks/core/types/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export * from './cli'
77
export * from './cron-jobs'
88
export * from './database'
99
export * from './debug'
10+
export * from './deploy'
1011
export * from './dns'
1112
export * from './docs'
1213
export * from './errors'

0 commit comments

Comments
 (0)