Skip to content

Commit

Permalink
feat(middlewares): it adds middlewares
Browse files Browse the repository at this point in the history
  • Loading branch information
danilolmc committed Aug 21, 2023
1 parent 1113faf commit 5a2a676
Show file tree
Hide file tree
Showing 21 changed files with 11,621 additions and 4,568 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@babel/preset-env"]
}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/node_modules
/dist
/index.ts
/index.mjs
/index.html
17 changes: 17 additions & 0 deletions bin/getCloudProvider.ts
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);

}
39 changes: 39 additions & 0 deletions bin/getUserInput.ts
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);
})
}
25 changes: 25 additions & 0 deletions bin/installDependencies.ts
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)
}
}
15 changes: 15 additions & 0 deletions jsdoc.config.json
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
}
}
Loading

0 comments on commit 5a2a676

Please sign in to comment.