Skip to content

Commit

Permalink
🚧 needs major work
Browse files Browse the repository at this point in the history
  • Loading branch information
acidjazz committed Feb 19, 2024
1 parent 005b586 commit dffe264
Show file tree
Hide file tree
Showing 4 changed files with 1,060 additions and 10 deletions.
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

0 comments on commit dffe264

Please sign in to comment.