Skip to content

Commit 3b8210e

Browse files
committed
chore: wip
1 parent 67ac238 commit 3b8210e

File tree

15 files changed

+74
-231
lines changed

15 files changed

+74
-231
lines changed

storage/framework/core/chat/build.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { dts } from 'bun-plugin-dts-auto'
12
import { intro, outro } from '../build/src'
23

34
const { startTime } = await intro({
@@ -12,6 +13,7 @@ const result = await Bun.build({
1213
sourcemap: 'linked',
1314
minify: true,
1415
external: ['@stacksjs/cli', '@stacksjs/error-handling'],
16+
plugins: [dts({ root: './src', outdir: './dist' })],
1517
})
1618

1719
await outro({

storage/framework/core/cli/build.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1+
import { dts } from 'bun-plugin-dts-auto'
12
import { intro, outro } from '../build/src'
2-
import { dts } from './dts'
3-
4-
// import { dts } from 'bun-plugin-dts-auto'
53

64
const { startTime } = await intro({
75
dir: import.meta.dir,
@@ -25,10 +23,10 @@ const result = await Bun.build({
2523
],
2624

2725
plugins: [
28-
// dts({
29-
// root: './src',
30-
// outdir: './dist',
31-
// }),
26+
dts({
27+
root: './src',
28+
outdir: './dist',
29+
}),
3230
],
3331
})
3432

storage/framework/core/cli/dts.ts

Lines changed: 0 additions & 180 deletions
This file was deleted.

storage/framework/core/cli/src/exec.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import process from 'node:process'
22
import { type Result, err, handleError, ok } from '@stacksjs/error-handling'
3-
import type { CliOptions, Subprocess } from '@stacksjs/types'
3+
import type { CliOptions, ErrorLike, SpawnOptions, Subprocess } from '@stacksjs/types'
44
import { ExitCode } from '@stacksjs/types'
55
import { italic, log } from './'
66

@@ -42,7 +42,12 @@ export async function exec(command: string | string[], options?: CliOptions): Pr
4242
detached: options?.background || false,
4343
cwd,
4444
// env: { ...e, ...options?.env },
45-
onExit(subprocess, exitCode, signalCode, error) {
45+
onExit(
46+
subprocess: Subprocess<SpawnOptions.Writable, SpawnOptions.Readable, SpawnOptions.Readable>,
47+
exitCode: number | null,
48+
signalCode: number | null,
49+
error: ErrorLike | undefined,
50+
) {
4651
exitHandler('spawn', subprocess, exitCode, signalCode, error)
4752
},
4853
})
@@ -98,12 +103,17 @@ export async function execSync(command: string | string[], options?: CliOptions)
98103
stderr: options?.stderr ?? 'inherit',
99104
cwd: options?.cwd ?? process.cwd(),
100105
// env: { ...Bun.env, ...options?.env },
101-
onExit(subprocess, exitCode, signalCode, error) {
106+
onExit(
107+
subprocess: Subprocess<SpawnOptions.Writable, SpawnOptions.Readable, SpawnOptions.Readable>,
108+
exitCode: number | null,
109+
signalCode: number | null,
110+
error: ErrorLike | undefined,
111+
) {
102112
exitHandler('spawnSync', subprocess, exitCode, signalCode, error)
103113
},
104114
})
105115

106-
return proc.stdout.toString()
116+
return proc.stdout?.toString() ?? ''
107117
}
108118

109119
function exitHandler(

storage/framework/core/cloud/build.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { dts } from 'bun-plugin-dts-auto'
12
import { intro, outro } from '../build/src'
23

34
const { startTime } = await intro({
@@ -24,6 +25,12 @@ const result = await Bun.build({
2425
'@stacksjs/cli',
2526
'aws-cdk-lib', // TODO: a recent AWS issue. We want to potentially remove this once the issue is resolved. Dig deeper into this before removing
2627
],
28+
plugins: [
29+
dts({
30+
root: './src',
31+
outdir: './dist',
32+
}),
33+
],
2734
})
2835

2936
// Building the edge/origin-request separately

storage/framework/core/cloud/src/cloud/ai.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class AiStack {
1010
const bedrockAccessPolicy = new iam.PolicyStatement({
1111
effect: iam.Effect.ALLOW,
1212
actions: ['bedrock:InvokeModel', 'bedrock:InvokeModelWithResponseStream'],
13-
resources: config.ai.models?.map((model) => `arn:aws:bedrock:us-east-1::foundation-model/${model}`),
13+
resources: config.ai.models?.map((model: string) => `arn:aws:bedrock:us-east-1::foundation-model/${model}`),
1414
})
1515

1616
const bedrockAccessRole = new iam.Role(scope, 'BedrockAccessRole', {

storage/framework/core/cloud/src/cloud/deployment.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export interface DeploymentStackProps extends NestedCloudProps {
1212
docsBucket?: s3.Bucket
1313
privateBucket: s3.Bucket
1414
mainDistribution: cloudfront.Distribution
15-
docsDistribution: cloudfront.Distribution
15+
docsDistribution?: cloudfront.Distribution
1616
}
1717

1818
export class DeploymentStack {
@@ -64,7 +64,7 @@ export class DeploymentStack {
6464
}
6565
}
6666

67-
shouldDeployDocs() {
67+
shouldDeployDocs(): boolean {
6868
return hasFiles(p.projectPath('docs')) && !config.app.docMode
6969
}
7070
}

storage/framework/core/cloud/src/cloud/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export class Cloud extends Stack {
9292

9393
// we use an async init() method here because we need to wait for the
9494

95-
async init() {
95+
async init(): Promise<void> {
9696
const props = this.props
9797

9898
if (this.shouldDeployApi()) {
@@ -122,7 +122,6 @@ export class Cloud extends Stack {
122122
firewall: this.security.firewall,
123123
originRequestFunction: this.docs.originRequestFunction,
124124
zone: this.dns.zone,
125-
cliSetupUrl: this.cli.cliSetupUrl,
126125
lb: this.api?.lb,
127126
})
128127

@@ -131,11 +130,12 @@ export class Cloud extends Stack {
131130
publicBucket: this.storage.publicBucket,
132131
privateBucket: this.storage.privateBucket,
133132
docsBucket: this.storage.docsBucket,
134-
cdn: this.cdn.distribution,
133+
mainDistribution: this.cdn.mainDistribution,
134+
docsDistribution: this.cdn.docsDistribution,
135135
})
136136
}
137137

138-
shouldDeployApi() {
139-
return config.cloud.api?.deploy
138+
shouldDeployApi(): boolean {
139+
return config.cloud.api?.deploy ?? false
140140
}
141141
}

storage/framework/core/cloud/src/cloud/queue.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class QueueStack {
2222
this.props = props
2323
}
2424

25-
async init() {
25+
async init(): Promise<void> {
2626
const jobsDir = path.jobsPath()
2727
const actionsDir = path.appPath('Actions')
2828
const ormActionDir = path.builtUserActionsPath('src')
@@ -86,14 +86,14 @@ export class QueueStack {
8686
}
8787
}
8888

89-
async loadModule(filePath: string) {
89+
async loadModule(filePath: string): Promise<{ default: any }> {
9090
const jobModule = await import(filePath)
9191

9292
return jobModule
9393
}
9494

9595
// TODO: narrow any type -> jobs & actions are allowed
96-
createQueueRule(module: { default: any }, file: string) {
96+
createQueueRule(module: { default: any }, file: string): void {
9797
// Now you can safely access module.default.rate
9898
const rate = module.default?.rate
9999

storage/framework/core/cloud/src/cloud/redirects.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ export class RedirectsStack {
1212

1313
constructor(scope: Construct, props: RedirectsStackProps) {
1414
// for each redirect, create a bucket & redirect it to the APP_URL
15-
config.dns.redirects?.forEach((redirect) => {
15+
config.dns.redirects?.forEach((redirect: string) => {
1616
// TODO: use string-ts function here instead
1717
const slug = redirect
1818
.split('.')
19-
.map((part, index) => (index === 0 ? part : part.charAt(0).toUpperCase() + part.slice(1)))
19+
.map((part: string, index: number) => (index === 0 ? part : part.charAt(0).toUpperCase() + part.slice(1)))
2020
.join('') // creates a CamelCase slug from the redirect
2121
const hostedZone = route53.HostedZone.fromLookup(scope, 'HostedZone', {
2222
domainName: redirect,
@@ -40,10 +40,10 @@ export class RedirectsStack {
4040
})
4141

4242
// TODO: fix this – redirects do not work yet
43-
config.dns.redirects?.forEach((redirect) => {
43+
config.dns.redirects?.forEach((redirect: string) => {
4444
const slug = redirect
4545
.split('.')
46-
.map((part, index) => (index === 0 ? part : part.charAt(0).toUpperCase() + part.slice(1)))
46+
.map((part: string, index: number) => (index === 0 ? part : part.charAt(0).toUpperCase() + part.slice(1)))
4747
.join('') // creates a CamelCase slug from the redirect
4848
const hostedZone = route53.HostedZone.fromLookup(scope, `RedirectHostedZone${slug}`, { domainName: redirect })
4949
this.redirectZones.push(hostedZone)

0 commit comments

Comments
 (0)