-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(middlewares): it adds middlewares
- Loading branch information
Showing
21 changed files
with
11,621 additions
and
4,568 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["@babel/preset-env"] | ||
} |
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,3 +1,4 @@ | ||
/node_modules | ||
/dist | ||
/index.ts | ||
/index.mjs | ||
/index.html |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import inquirer from "inquirer" | ||
|
||
export default async function getCloudProvider() { | ||
const answers = await inquirer.prompt([ | ||
{ | ||
type: 'list', | ||
name: 'cloudProvider', | ||
message: 'Select your cloud provider:', | ||
choices: ['AWS', 'Azure', 'Google Cloud'], | ||
default: 'AWS', | ||
single: true, | ||
} | ||
]); | ||
const { cloudProvider } = answers; | ||
return String(cloudProvider); | ||
|
||
} |
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import inquirer from "inquirer"; | ||
import installDependencies from "./installDependencies"; | ||
|
||
function defineDependencies(key: string) { | ||
const dependenciesCloudMap = new Map<string, string[]>([ | ||
['AWS', ['@aws-sdk/client-transcribe']], | ||
]); | ||
|
||
return dependenciesCloudMap.get(key) as string[]; | ||
} | ||
|
||
export default function getUserInput() { | ||
|
||
inquirer.prompt([ | ||
{ | ||
type: 'list', | ||
name: 'environment', | ||
message: 'Select your runtime environment:', | ||
choices: ['NodeJS', 'Browser'], | ||
default: 'NodeJS', | ||
single: true, | ||
}, | ||
]).then(async (answers: any) => { | ||
const env: string = answers.environment; | ||
|
||
if(env == 'NodeJS') { | ||
installDependencies(defineDependencies('AWS')) | ||
return; | ||
} | ||
|
||
if(env == 'Browser') { | ||
installDependencies(defineDependencies('AWS')) | ||
return; | ||
} | ||
|
||
}).catch((err: any) => { | ||
console.log(err); | ||
}) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { execa } from "execa"; | ||
|
||
export default async function installDependencies(dependencies: string[]) { | ||
|
||
try { | ||
|
||
console.log('\n Installing dependencies...'); | ||
|
||
for (const dependencie of dependencies) { | ||
process.stdout.write(`\n Installing ${dependencie} - Loading... ⌛`); | ||
try { | ||
await execa('npm', ['install', dependencie]); | ||
process.stdout.write('\r'); | ||
process.stdout.write('\x1b[K'); | ||
process.stdout.write(`\r Installing ${dependencie} - Done! ✅`); | ||
} catch (error) { | ||
console.log('\x1b[31m%s\x1b[0m', `\nError on installing ${dependencie}, try it yourself by running npm install ${dependencie}!`); | ||
} | ||
} | ||
console.log('\x1b[32m%s\x1b[0m',"\n\nSuccess on setup, let's code! ✅"); | ||
|
||
}catch(error) { | ||
console.log(error) | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"source": { | ||
"include": ["src"], | ||
"includePattern": ".+\\.js$" | ||
}, | ||
"plugins": [], | ||
"templates": { | ||
"cleverLinks": false, | ||
"monospaceLinks": false | ||
}, | ||
"opts": { | ||
"destination": "docs", | ||
"recurse": true | ||
} | ||
} |
Oops, something went wrong.