@architect/destroy
Advanced tools
Comparing version 0.0.2 to 1.0.0
{ | ||
"name": "@architect/destroy", | ||
"version": "0.0.2", | ||
"version": "1.0.0", | ||
"description": "Destroy projects created with Architect", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
[<img src="https://s3-us-west-2.amazonaws.com/arc.codes/architect-logo-500b@2x.png" width=500>](https://www.npmjs.com/package/@architect/create) | ||
# @architect/destroy | ||
## [`@architect/destroy`](https://www.npmjs.com/package/@architect/destroy) | ||
@@ -10,5 +10,5 @@ > Architect serverless framework module for destroying projects created with Architect | ||
# API | ||
## API | ||
## `destroy({ name, force }, callback)` | ||
### `destroy({ name, force }, callback)` | ||
@@ -15,0 +15,0 @@ Destroys all infrastructure associated to your Architect app. |
@@ -27,2 +27,6 @@ #!/usr/bin/env node | ||
let env = production ? 'production' : 'staging' | ||
update.status(`Destroying ${env} environment`) | ||
if (env === 'staging') { | ||
update.status(`Reminder: if you deployed to production, don't forget to run destroy again with: --production`) | ||
} | ||
let name = toLogicalID(`${arc.app[0]}-${env}`) | ||
@@ -33,10 +37,13 @@ await destroy({ name, force, update }) | ||
let { message } = err | ||
let msg = 'To destroy this app (and any static assets and database tables that belong to it), run destroy with: --force' | ||
if (message === 'no_name') { | ||
update.error(`If you're really sure you want to destroy this app, run this command with: --name ${arc.app[0]}`) | ||
update.warn(`If you're really sure you want to destroy this app, run destroy with: --name ${arc.app[0]}`) | ||
} | ||
else if (message === 'bucket_exists') { | ||
update.error('Static bucket exists. Use --force to delete.') | ||
update.warn(`Found static bucket!`) | ||
update.warn(msg) | ||
} | ||
else if (message === 'table_exists') { | ||
update.error('Table(s) exist. Use --force to delete.') | ||
update.warn('Found DynamoDB table(s)!') | ||
update.warn(msg) | ||
} | ||
@@ -43,0 +50,0 @@ else { |
@@ -40,3 +40,3 @@ let aws = require('aws-sdk') | ||
setTimeout(() => { | ||
update.start(`Destroying ${StackName}...`) | ||
update.start(`Destroying ${StackName}`) | ||
callback() | ||
@@ -64,3 +64,3 @@ }, 5000) | ||
if (bucketExists && force) { | ||
let bucket = bucketExists.OutputValue.replace('http://', '').split('.')[0] | ||
let bucket = bucketExists.OutputValue.replace('http://', '').replace('https://', '').split('.')[0] | ||
deleteBucketContents({ | ||
@@ -119,6 +119,6 @@ bucket | ||
function done (err) { | ||
let msg = `Stack ID ${StackName} does not exist` | ||
let msg = `Stack with id ${StackName} does not exist` // Specific AWS message | ||
if (err && err.code == 'ValidationError' && err.message == msg) { | ||
update.done(`Successfully destroyed ${StackName}`) | ||
callback() // this is good! it's gone... | ||
callback() | ||
} | ||
@@ -125,0 +125,0 @@ else { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
8467
215
1