Skip to content

Commit

Permalink
ocd cleanup on arweave deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
Ncookiez committed Sep 27, 2024
1 parent f514afd commit 37ae2e5
Showing 1 changed file with 10 additions and 24 deletions.
34 changes: 10 additions & 24 deletions scripts/deploy.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import fs from 'fs'
import yargs from 'yargs'
import * as path from 'path'
import { hideBin } from 'yargs/helpers'
import { TurboFactory } from '@ardrive/turbo-sdk'
import { hideBin } from 'yargs/helpers'
import * as path from 'path'
import yargs from 'yargs'
import fs from 'fs'

const __dirname = process.cwd()

Expand All @@ -13,9 +13,7 @@ const argv = yargs(hideBin(process.argv)).option('deploy-dir', {
default: './build'
}).argv

// const ARWEAVE_BASE_64_JWK = process.env.ARWEAVE_BASE_64_JWK

const runDeploy = async () => {
const deploy = async () => {
if (argv.deployDir.length == 0) {
console.error('deploy directory must not be an empty string')
return
Expand All @@ -32,34 +30,22 @@ const runDeploy = async () => {
return
}

// if (!ARWEAVE_BASE_64_JWK) {
// console.error('ARWEAVE_BASE_64_JWK is missing')
// return
// }

// let jwk = JSON.parse(Buffer.from(ARWEAVE_BASE_64_JWK, 'base64').toString('utf-8'))
const jwk = JSON.parse(fs.readFileSync(walletFile))
const turbo = TurboFactory.authenticated({ privateKey: jwk })

const folderPath = path.resolve(`${__dirname}/${argv.deployDir}`)
console.log(`Deploying: ${folderPath} to Arweave ...`)
console.log()
console.log(`Deploying: ${folderPath} to Arweave ...\n`)

try {
const { manifest, fileResponses, manifestResponse } = await turbo.uploadFolder({
folderPath
})

console.log(`Deployed!`)
console.log(``)
const { manifestResponse } = await turbo.uploadFolder({ folderPath })

console.log(`Deployed!\n`)
console.log(`Transaction id:`)
console.log(manifestResponse.id)
console.log(``)
console.log(`__Make sure to update ENS contentHash with this new ID!__`)
console.log(`\n__Make sure to update ENS contentHash with this new ID!__`)
} catch (e) {
console.error(e)
}
}

runDeploy()
deploy()

0 comments on commit 37ae2e5

Please sign in to comment.