-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
19 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,29 @@ | ||
import { existsSync, mkdirSync } from 'fs' | ||
import { mkdir } from 'fs/promises' | ||
import { existsSync } from 'fs' | ||
import { execSync } from 'child_process' | ||
|
||
const dynamodbDir = 'dynamodb_local_latest' | ||
const dynamodbArchiveURL = | ||
'https://s3.us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.tar.gz' | ||
|
||
// Check if the dynamodbDir directory exists | ||
if (!existsSync(dynamodbDir)) { | ||
// If it doesn't exist, create it | ||
mkdirSync(dynamodbDir, { recursive: true }) | ||
async function runSetup() { | ||
if (!existsSync(dynamodbDir)) { | ||
// If it doesn't exist, create it | ||
await mkdir(dynamodbDir, { recursive: true }) | ||
|
||
// Download and extract DynamoDB Local | ||
try { | ||
console.log('Downloading DynamoDB Local...') | ||
execSync(`curl -L ${dynamodbArchiveURL} | tar -xz -C ${dynamodbDir}`, { | ||
stdio: 'inherit', | ||
}) | ||
console.log('DynamoDB Local setup completed successfully.') | ||
} catch (error) { | ||
console.error('Error setting up DynamoDB Local:', error.message) | ||
process.exit(1) | ||
// Download and extract DynamoDB Local | ||
try { | ||
console.log('Downloading DynamoDB Local...') | ||
execSync(`curl -L ${dynamodbArchiveURL} | tar -xz -C ${dynamodbDir}`, { | ||
stdio: 'inherit', | ||
}) | ||
console.log('DynamoDB Local setup completed successfully.') | ||
} catch (error) { | ||
console.error('Error setting up DynamoDB Local:', error.message) | ||
process.exit(1) | ||
} | ||
} | ||
} | ||
|
||
runSetup() |