Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **[BREAKING]** API Hosting runtime version from Node.js 18 to [Node.js 24](https://nodejs.org/en/blog/release/v24.11.0)
- Require minimum [Node.js 24](https://nodejs.org/en/blog/release/v24.11.0)

### Removed
- transfer monitor from s3 sync

### Removed

- **[BREAKING]** support for Node.js 18.
Expand Down
16 changes: 3 additions & 13 deletions src/cdn/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
PutObjectCommandInput,
S3Client,
} from '@aws-sdk/client-s3'
import { S3SyncClient, TransferMonitor, TransferStatus } from 's3-sync-client'
import { S3SyncClient } from 's3-sync-client'
import mime from 'mime-types'

import confirm from '../utils/confirm.js'
Expand All @@ -19,7 +19,7 @@
export default async function (
tenant: Tenant,
input: Array<string>,
flags: any,

Check warning on line 22 in src/cdn/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Test Node.js 24 on ubuntu-latest

Unexpected any. Specify a different type

Check warning on line 22 in src/cdn/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Test Node.js 24 on windows-latest

Unexpected any. Specify a different type

Check warning on line 22 in src/cdn/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Test Node.js 24 on macos-latest

Unexpected any. Specify a different type
oneBlinkAPIClient: OneBlinkAPIClient,
): Promise<void> {
const confirmation = await confirm(flags.force, flags.env)
Expand All @@ -37,8 +37,6 @@
const spinner = ora({ spinner: 'dots', text: 'Uploading to CDN' })
spinner.start()

let progress = 0

try {
const s3Client = new S3Client({
region: tenant.region,
Expand All @@ -51,19 +49,10 @@

const { sync } = new S3SyncClient({ client: s3Client })

const monitor = new TransferMonitor()
monitor.on('progress', (transferStatus: TransferStatus) => {
progress = Math.floor(
(transferStatus.size.current / transferStatus.size.total) * 100,
)
spinner.text = `Uploading to CDN: ${progress}%`
})

// Allow deployment of files in a sub directory to the current working directory
const cwd = path.join(flags.cwd, input[0] || '.')
const options: SyncLocalWithBucketOptions = {
del: flags.prune,
monitor,
commandInput: (input) => {
const putObjectCommandInput: Partial<PutObjectCommandInput> = {
ContentType:
Expand All @@ -73,10 +62,11 @@
return putObjectCommandInput as unknown as GetObjectCommandInput
},
}

await sync(cwd, `s3://${cfg.scope}/${flags.env}`, options)
spinner.succeed('Upload(s) complete!')
} catch (error) {
spinner.fail(`Upload(s) failed: ${progress}%`)
spinner.fail(`Upload(s) failed`)
throw error
}

Expand Down
Loading