brewcli 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/.prettierignore +9 -0
  2. package/.prettierrc +25 -0
  3. package/LICENSE +21 -0
  4. package/Readme.md +157 -0
  5. package/dist/app.d.ts +8 -0
  6. package/dist/app.d.ts.map +1 -0
  7. package/dist/app.js +188 -0
  8. package/dist/app.js.map +1 -0
  9. package/dist/cli.d.ts +3 -0
  10. package/dist/cli.d.ts.map +1 -0
  11. package/dist/cli.js +26 -0
  12. package/dist/cli.js.map +1 -0
  13. package/dist/components/ErrorDisplay.d.ts +7 -0
  14. package/dist/components/ErrorDisplay.d.ts.map +1 -0
  15. package/dist/components/ErrorDisplay.js +8 -0
  16. package/dist/components/ErrorDisplay.js.map +1 -0
  17. package/dist/components/NamePrompt.d.ts +7 -0
  18. package/dist/components/NamePrompt.d.ts.map +1 -0
  19. package/dist/components/NamePrompt.js +19 -0
  20. package/dist/components/NamePrompt.js.map +1 -0
  21. package/dist/components/SelectionList.d.ts +13 -0
  22. package/dist/components/SelectionList.d.ts.map +1 -0
  23. package/dist/components/SelectionList.js +9 -0
  24. package/dist/components/SelectionList.js.map +1 -0
  25. package/dist/components/Spinner.d.ts +7 -0
  26. package/dist/components/Spinner.d.ts.map +1 -0
  27. package/dist/components/Spinner.js +9 -0
  28. package/dist/components/Spinner.js.map +1 -0
  29. package/dist/components/SuccessBox.d.ts +8 -0
  30. package/dist/components/SuccessBox.d.ts.map +1 -0
  31. package/dist/components/SuccessBox.js +10 -0
  32. package/dist/components/SuccessBox.js.map +1 -0
  33. package/dist/components/Welcome.d.ts +4 -0
  34. package/dist/components/Welcome.d.ts.map +1 -0
  35. package/dist/components/Welcome.js +10 -0
  36. package/dist/components/Welcome.js.map +1 -0
  37. package/dist/templates/node/javascript/angular/.gitkeep +0 -0
  38. package/dist/templates/node/javascript/express/.env.example +5 -0
  39. package/dist/templates/node/javascript/express/.gitkeep +0 -0
  40. package/dist/templates/node/javascript/express/Readme.md +11 -0
  41. package/dist/templates/node/javascript/express/package.json +18 -0
  42. package/dist/templates/node/javascript/express/src/.gitkeep +0 -0
  43. package/dist/templates/node/javascript/express/src/app.js +23 -0
  44. package/dist/templates/node/javascript/express/src/constants.js +1 -0
  45. package/dist/templates/node/javascript/express/src/controllers/.gitkeep +0 -0
  46. package/dist/templates/node/javascript/express/src/db/.gitkeep +0 -0
  47. package/dist/templates/node/javascript/express/src/db/index.js +14 -0
  48. package/dist/templates/node/javascript/express/src/index.js +17 -0
  49. package/dist/templates/node/javascript/express/src/middlewares/.gitkeep +0 -0
  50. package/dist/templates/node/javascript/express/src/models/.gitkeep +0 -0
  51. package/dist/templates/node/javascript/express/src/routes/.gitkeep +0 -0
  52. package/dist/templates/node/javascript/express/src/utils/.gitkeep +0 -0
  53. package/dist/templates/node/javascript/fastify/.env.example +5 -0
  54. package/dist/templates/node/javascript/fastify/.gitkeep +0 -0
  55. package/dist/templates/node/javascript/fastify/package.json +20 -0
  56. package/dist/templates/node/javascript/fastify/src/index.js +28 -0
  57. package/dist/templates/node/javascript/nestjs/.gitkeep +0 -0
  58. package/dist/templates/node/javascript/nextjs/.gitkeep +0 -0
  59. package/dist/templates/node/javascript/reactjs/.gitkeep +0 -0
  60. package/dist/templates/node/javascript/vuejs/.gitkeep +0 -0
  61. package/dist/templates/node/typescript/angular/.gitkeep +0 -0
  62. package/dist/templates/node/typescript/express/.env.example +5 -0
  63. package/dist/templates/node/typescript/express/.gitkeep +0 -0
  64. package/dist/templates/node/typescript/express/package.json +25 -0
  65. package/dist/templates/node/typescript/express/src/app.ts +17 -0
  66. package/dist/templates/node/typescript/express/src/constants.ts +1 -0
  67. package/dist/templates/node/typescript/express/src/db/index.ts +14 -0
  68. package/dist/templates/node/typescript/express/src/index.ts +17 -0
  69. package/dist/templates/node/typescript/express/tsconfig.json +15 -0
  70. package/dist/templates/node/typescript/fastify/.env.example +5 -0
  71. package/dist/templates/node/typescript/fastify/.gitkeep +0 -0
  72. package/dist/templates/node/typescript/fastify/package.json +20 -0
  73. package/dist/templates/node/typescript/fastify/tsconfig.json +15 -0
  74. package/dist/templates/node/typescript/nestjs/.gitkeep +0 -0
  75. package/dist/templates/node/typescript/nextjs/.gitkeep +0 -0
  76. package/dist/templates/node/typescript/reactjs/.gitkeep +0 -0
  77. package/dist/templates/node/typescript/vuejs/.gitkeep +0 -0
  78. package/package.json +66 -0
  79. package/src/app.tsx +274 -0
  80. package/src/cli.tsx +32 -0
  81. package/src/components/ErrorDisplay.tsx +21 -0
  82. package/src/components/NamePrompt.tsx +67 -0
  83. package/src/components/SelectionList.tsx +64 -0
  84. package/src/components/Spinner.tsx +24 -0
  85. package/src/components/SuccessBox.tsx +79 -0
  86. package/src/components/Welcome.tsx +30 -0
  87. package/src/templates/node/javascript/angular/.gitkeep +0 -0
  88. package/src/templates/node/javascript/express/.env.example +5 -0
  89. package/src/templates/node/javascript/express/.gitkeep +0 -0
  90. package/src/templates/node/javascript/express/Readme.md +11 -0
  91. package/src/templates/node/javascript/express/package.json +18 -0
  92. package/src/templates/node/javascript/express/src/.gitkeep +0 -0
  93. package/src/templates/node/javascript/express/src/app.js +23 -0
  94. package/src/templates/node/javascript/express/src/constants.js +1 -0
  95. package/src/templates/node/javascript/express/src/controllers/.gitkeep +0 -0
  96. package/src/templates/node/javascript/express/src/db/.gitkeep +0 -0
  97. package/src/templates/node/javascript/express/src/db/index.js +14 -0
  98. package/src/templates/node/javascript/express/src/index.js +17 -0
  99. package/src/templates/node/javascript/express/src/middlewares/.gitkeep +0 -0
  100. package/src/templates/node/javascript/express/src/models/.gitkeep +0 -0
  101. package/src/templates/node/javascript/express/src/routes/.gitkeep +0 -0
  102. package/src/templates/node/javascript/express/src/utils/.gitkeep +0 -0
  103. package/src/templates/node/javascript/fastify/.env.example +5 -0
  104. package/src/templates/node/javascript/fastify/.gitkeep +0 -0
  105. package/src/templates/node/javascript/fastify/package.json +20 -0
  106. package/src/templates/node/javascript/fastify/src/index.js +28 -0
  107. package/src/templates/node/javascript/nestjs/.gitkeep +0 -0
  108. package/src/templates/node/javascript/nextjs/.gitkeep +0 -0
  109. package/src/templates/node/javascript/reactjs/.gitkeep +0 -0
  110. package/src/templates/node/javascript/vuejs/.gitkeep +0 -0
  111. package/src/templates/node/typescript/angular/.gitkeep +0 -0
  112. package/src/templates/node/typescript/express/.env.example +5 -0
  113. package/src/templates/node/typescript/express/.gitkeep +0 -0
  114. package/src/templates/node/typescript/express/package.json +25 -0
  115. package/src/templates/node/typescript/express/src/app.ts +17 -0
  116. package/src/templates/node/typescript/express/src/constants.ts +1 -0
  117. package/src/templates/node/typescript/express/src/db/index.ts +14 -0
  118. package/src/templates/node/typescript/express/src/index.ts +17 -0
  119. package/src/templates/node/typescript/express/tsconfig.json +15 -0
  120. package/src/templates/node/typescript/fastify/.env.example +5 -0
  121. package/src/templates/node/typescript/fastify/.gitkeep +0 -0
  122. package/src/templates/node/typescript/fastify/package.json +20 -0
  123. package/src/templates/node/typescript/fastify/tsconfig.json +15 -0
  124. package/src/templates/node/typescript/nestjs/.gitkeep +0 -0
  125. package/src/templates/node/typescript/nextjs/.gitkeep +0 -0
  126. package/src/templates/node/typescript/reactjs/.gitkeep +0 -0
  127. package/src/templates/node/typescript/vuejs/.gitkeep +0 -0
  128. package/tsconfig.json +46 -0
@@ -0,0 +1,17 @@
1
+ import dotenv from "dotenv";
2
+ import connectDB from "./db/index.js";
3
+ import { app } from './app.js';
4
+
5
+ dotenv.config({
6
+ path: './.env'
7
+ });
8
+
9
+ connectDB()
10
+ .then(() => {
11
+ app.listen(process.env.PORT || 8000, () => {
12
+ console.log(`⚙️ Server is running at port : ${process.env.PORT}`);
13
+ });
14
+ })
15
+ .catch((err) => {
16
+ console.log("MONGO db connection failed !!! ", err);
17
+ });
@@ -0,0 +1,5 @@
1
+ PORT=8000
2
+ MONGODB_URI=mongodb+srv://yourusername:yourpassword@cluster0.mongodb.net
3
+ CORS_ORIGIN=*
4
+ # ACCESS_TOKEN_SECRET=...
5
+ # REFRESH_TOKEN_SECRET=...
File without changes
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "fastify-js-starter",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "main": "src/index.js",
6
+ "scripts": {
7
+ "dev": "nodemon src/index.js",
8
+ "start": "node src/index.js"
9
+ },
10
+ "dependencies": {
11
+ "fastify": "^4.26.2",
12
+ "fastify-plugin": "^4.5.1",
13
+ "@fastify/cors": "^9.0.1",
14
+ "@fastify/env": "^4.3.0",
15
+ "mongoose": "^8.0.0"
16
+ },
17
+ "devDependencies": {
18
+ "nodemon": "^3.1.0"
19
+ }
20
+ }
@@ -0,0 +1,28 @@
1
+ import Fastify from 'fastify';
2
+ import cors from '@fastify/cors';
3
+ import mongoose from 'mongoose';
4
+
5
+ const fastify = Fastify({
6
+ logger: true
7
+ });
8
+
9
+ // Register plugins
10
+ fastify.register(cors);
11
+
12
+ // Declare a route
13
+ fastify.get('/', async (request, reply) => {
14
+ return { hello: 'brew-cli' };
15
+ });
16
+
17
+ // Run the server!
18
+ const start = async () => {
19
+ try {
20
+ await mongoose.connect(process.env.MONGODB_URI || 'mongodb://localhost:27017/fastify-brew');
21
+ await fastify.listen({ port: 3000, host: '0.0.0.0' });
22
+ } catch (err) {
23
+ fastify.log.error(err);
24
+ process.exit(1);
25
+ }
26
+ };
27
+
28
+ start();
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+ PORT=8000
2
+ MONGODB_URI=mongodb+srv://yourusername:yourpassword@cluster0.mongodb.net
3
+ CORS_ORIGIN=*
4
+ # ACCESS_TOKEN_SECRET=...
5
+ # REFRESH_TOKEN_SECRET=...
File without changes
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "express-ts-starter",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "scripts": {
6
+ "dev": "tsx watch src/index.ts",
7
+ "start": "node dist/index.js",
8
+ "build": "tsc"
9
+ },
10
+ "dependencies": {
11
+ "express": "^4.19.0",
12
+ "cors": "^2.8.5",
13
+ "cookie-parser": "^1.4.6",
14
+ "dotenv": "^16.4.5",
15
+ "mongoose": "^8.0.0"
16
+ },
17
+ "devDependencies": {
18
+ "@types/express": "^4.17.21",
19
+ "@types/cors": "^2.8.17",
20
+ "@types/cookie-parser": "^1.4.7",
21
+ "@types/node": "^20.12.7",
22
+ "tsx": "^4.7.2",
23
+ "typescript": "^5.4.5"
24
+ }
25
+ }
@@ -0,0 +1,17 @@
1
+ import express, { Application } from "express";
2
+ import cors from "cors";
3
+ import cookieParser from "cookie-parser";
4
+
5
+ const app: Application = express();
6
+
7
+ app.use(cors({
8
+ origin: process.env.CORS_ORIGIN,
9
+ credentials: true
10
+ }));
11
+
12
+ app.use(express.json({limit: "16kb"}));
13
+ app.use(express.urlencoded({extended: true, limit: "16kb"}));
14
+ app.use(express.static("public"));
15
+ app.use(cookieParser());
16
+
17
+ export { app };
@@ -0,0 +1 @@
1
+ export const DB_NAME = "brewdb";
@@ -0,0 +1,14 @@
1
+ import mongoose from "mongoose";
2
+ import { DB_NAME } from "../constants.js";
3
+
4
+ const connectDB = async (): Promise<void> => {
5
+ try {
6
+ const connectionInstance = await mongoose.connect(`${process.env.MONGODB_URI}/${DB_NAME}`);
7
+ console.log(`\n MongoDB connected !! DB HOST: ${connectionInstance.connection.host}`);
8
+ } catch (error) {
9
+ console.log("MONGODB connection FAILED ", error);
10
+ process.exit(1);
11
+ }
12
+ };
13
+
14
+ export default connectDB;
@@ -0,0 +1,17 @@
1
+ import dotenv from "dotenv";
2
+ import connectDB from "./db/index.js";
3
+ import { app } from './app.js';
4
+
5
+ dotenv.config({
6
+ path: './.env'
7
+ });
8
+
9
+ connectDB()
10
+ .then(() => {
11
+ app.listen(process.env.PORT || 8000, () => {
12
+ console.log(`⚙️ Server is running at port : ${process.env.PORT}`);
13
+ });
14
+ })
15
+ .catch((err) => {
16
+ console.log("MONGO db connection failed !!! ", err);
17
+ });
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "outDir": "./dist",
7
+ "rootDir": "./src",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "forceConsistentCasingInFileNames": true
12
+ },
13
+ "include": ["src/**/*"],
14
+ "exclude": ["node_modules"]
15
+ }
@@ -0,0 +1,5 @@
1
+ PORT=8000
2
+ MONGODB_URI=mongodb+srv://yourusername:yourpassword@cluster0.mongodb.net
3
+ CORS_ORIGIN=*
4
+ # ACCESS_TOKEN_SECRET=...
5
+ # REFRESH_TOKEN_SECRET=...
File without changes
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "fastify-ts-starter",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "scripts": {
6
+ "dev": "tsx watch src/index.ts",
7
+ "start": "node dist/index.js",
8
+ "build": "tsc"
9
+ },
10
+ "dependencies": {
11
+ "fastify": "^4.26.2",
12
+ "@fastify/cors": "^9.0.1",
13
+ "mongoose": "^8.0.0"
14
+ },
15
+ "devDependencies": {
16
+ "@types/node": "^20.12.7",
17
+ "tsx": "^4.7.2",
18
+ "typescript": "^5.4.5"
19
+ }
20
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "outDir": "./dist",
7
+ "rootDir": "./src",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "forceConsistentCasingInFileNames": true
12
+ },
13
+ "include": ["src/**/*"],
14
+ "exclude": ["node_modules"]
15
+ }
File without changes
File without changes
File without changes
File without changes
package/tsconfig.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ // Visit https://aka.ms/tsconfig to read more about this file
3
+ "compilerOptions": {
4
+ // File Layout
5
+ "rootDir": "./src",
6
+ "outDir": "./dist",
7
+
8
+ // Environment Settings
9
+ // See also https://aka.ms/tsconfig/module
10
+ "module": "nodenext",
11
+ "target": "esnext",
12
+ // "types": [],
13
+ // For nodejs:
14
+ "lib": ["esnext"],
15
+ "types": ["node"],
16
+ // and npm install -D @types/node
17
+
18
+ // Other Outputs
19
+ "sourceMap": true,
20
+ "declaration": true,
21
+ "declarationMap": true,
22
+
23
+ // Stricter Typechecking Options
24
+ "noUncheckedIndexedAccess": true,
25
+ "exactOptionalPropertyTypes": true,
26
+
27
+ // Style Options
28
+ // "noImplicitReturns": true,
29
+ // "noImplicitOverride": true,
30
+ // "noUnusedLocals": true,
31
+ // "noUnusedParameters": true,
32
+ // "noFallthroughCasesInSwitch": true,
33
+ // "noPropertyAccessFromIndexSignature": true,
34
+
35
+ // Recommended Options
36
+ "strict": true,
37
+ "jsx": "react-jsx",
38
+ "verbatimModuleSyntax": true,
39
+ "isolatedModules": true,
40
+ "noUncheckedSideEffectImports": true,
41
+ "moduleDetection": "force",
42
+ "skipLibCheck": true,
43
+ },
44
+ "include": ["src/**/*"],
45
+ "exclude": ["node_modules", "dist", "src/templates"]
46
+ }