Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pieh committed Dec 6, 2023
1 parent 4c20ceb commit d0cbd0a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 29 deletions.
1 change: 0 additions & 1 deletion e2e-tests/adapters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"cross-env": "^7.0.3",
"cypress": "^12.14.0",
"dotenv": "^8.6.0",
"tree-cli": "0.6.7",
"execa": "^6.1.0",
"gatsby-cypress": "^3.11.0",
"netlify-cli": "^17.9.0",
Expand Down
45 changes: 17 additions & 28 deletions e2e-tests/adapters/scripts/deploy-and-run/netlify.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// @ts-check
import { execa } from "execa"
import { inspect } from "util"
import tree from "tree-cli"

// only set NETLIFY_SITE_ID from E2E_ADAPTERS_NETLIFY_SITE_ID if it's set
if (process.env.E2E_ADAPTERS_NETLIFY_SITE_ID) {
Expand Down Expand Up @@ -44,35 +42,26 @@ const deployInfo = JSON.parse(deployResults.stdout)
const deployUrl = deployInfo.deploy_url + (process.env.PATH_PREFIX ?? ``)
process.env.DEPLOY_URL = deployUrl

const { report } = await tree({
base: ".netlify",
noreport: true, // this just avoid outputting by default, still is generated
l: Infinity,
})

console.log(report)

console.log(inspect({ deployInfo }, { depth: Infinity }))
console.log(`Deployed to ${deployUrl}`)

try {
await execa(`npm`, [`run`, npmScriptToRun], { stdio: `inherit` })
} finally {
// if (!process.env.GATSBY_TEST_SKIP_CLEANUP) {
// console.log(`Deleting project with deploy_id ${deployInfo.deploy_id}`)
// const deleteResponse = await execa("ntl", [
// "api",
// "deleteDeploy",
// "--data",
// `{ "deploy_id": "${deployInfo.deploy_id}" }`,
// ])
// if (deleteResponse.exitCode !== 0) {
// throw new Error(
// `Failed to delete project ${deleteResponse.stdout} ${deleteResponse.stderr} (${deleteResponse.exitCode})`
// )
// }
// console.log(
// `Successfully deleted project with deploy_id ${deployInfo.deploy_id}`
// )
// }
if (!process.env.GATSBY_TEST_SKIP_CLEANUP) {
console.log(`Deleting project with deploy_id ${deployInfo.deploy_id}`)
const deleteResponse = await execa("ntl", [
"api",
"deleteDeploy",
"--data",
`{ "deploy_id": "${deployInfo.deploy_id}" }`,
])
if (deleteResponse.exitCode !== 0) {
throw new Error(
`Failed to delete project ${deleteResponse.stdout} ${deleteResponse.stderr} (${deleteResponse.exitCode})`
)
}
console.log(
`Successfully deleted project with deploy_id ${deployInfo.deploy_id}`
)
}
}

0 comments on commit d0cbd0a

Please sign in to comment.