Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚧 attempt at moving teh aws-sdk to v3 since v2 is sunsetting #53

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion link-cli-pnpm.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rm ~/Library/pnpm//fume; ln -s ~/fumeapp/fume-cli/bin/run ~/Library/pnpm/fume
rm ~/Library/pnpm/fume; ln -s ~/fumeapp/fume-cli/bin/run ~/Library/pnpm/fume
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"bugs": "https://github.com/fumeapp/fume-cli/issues",
"dependencies": {
"@auth0/s3": "^1.0.0",
"@aws-sdk/client-s3": "^3.408.0",
"@aws-sdk/lib-storage": "^3.408.0",
"@oclif/core": "^2",
"@oclif/plugin-help": "^5",
"@oclif/plugin-plugins": "^2.4.3",
Expand Down
25 changes: 18 additions & 7 deletions src/lib/deploytasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import Deployment from './deployment'
import chalk from 'chalk'
import {FumeEnvironment, Mode, PackageType, Size, Variable, YamlConfig} from './types'
import {Listr, ListrTaskWrapper} from 'listr2'
import S3 = require('aws-sdk/clients/s3')
import * as fs from 'node:fs'
import execa from 'execa'
import numeral from 'numeral'
Expand All @@ -17,6 +16,9 @@ import {stringify} from 'envfile'

import md5file from 'md5-file'

import { S3Client } from '@aws-sdk/client-s3'
import { Upload } from '@aws-sdk/lib-storage'

export default class DeployTasks {
constructor(env: FumeEnvironment, environment: string) {
this.env = env
Expand Down Expand Up @@ -238,6 +240,14 @@ exports.handler = async (event, context) => {
pkg?.devDependencies?.nuxt?.includes('3')
)
) return true
if (
pkg.dependencies &&
(pkg.dependencies.nuxt3 ||
pkg?.dependencies?.nuxt?.includes('^3') ||
pkg?.dependencies?.nuxt?.includes('3')
)
) return true

return Boolean(pkg.devDependencies && pkg.devDependencies['@nuxt/bridge'])
}

Expand Down Expand Up @@ -339,15 +349,16 @@ exports.handler = async (event, context) => {
task.title = 'Uploading .output archvie'
const sts = await this.deployment.sts()
return new Promise((resolve, reject) => {
new S3.ManagedUpload({
service: new S3(sts),
new Upload({
client: new S3Client(sts),
params: {
Bucket: this.deployment.s3.bucket,
Key: this.deployment.s3.code,
Body: fs.createReadStream(this.deployment.s3.code),
},
}).on('httpUploadProgress', (event: { loaded: number; total: number }) => {
task.title = `Uploading .output archive: ${numeral((event.loaded / event.total)).format('0%')}`
}).on('httpUploadProgress', (progress) => {
if (progress.loaded && progress.total)
task.title = `Uploading .output archive: ${numeral((progress.loaded / progress.total)).format('0%')}`
}).send(async (error: any) => {
if (error) {
await this.deployment.fail({
Expand All @@ -367,7 +378,7 @@ exports.handler = async (event, context) => {
task.title = 'Uploading binary archive'
const sts = await this.deployment.sts()
return new Promise((resolve, reject) => {
new S3.ManagedUpload({
new AWS.S3.ManagedUpload({
service: new S3(sts),
params: {
Bucket: this.deployment.s3.bucket,
Expand Down Expand Up @@ -539,7 +550,7 @@ exports.handler = async (event, context) => {
deleteRemoved: deleteRemoved,
s3Params: {
Bucket: bucket,
ACL: 'public-read',
// ACL: 'public-read',
Prefix: prefix,
},
})
Expand Down
Loading
Loading