From eae492c0f239e952956b3acb5c56cc9ea3a350ec Mon Sep 17 00:00:00 2001 From: Nevan Scott Date: Wed, 16 Feb 2022 01:30:36 +0100 Subject: [PATCH 1/7] Typo fix (#37) ironlauncher with an `n` --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1492234..a02ea0b 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Welcome to the IronLauncher! A quick start for your JavaScript applications. 1. Run the CLI using ```sh -npx ironlaucher@latest # + flag(s) +npx ironlauncher@latest # + flag(s) ``` ## Help From 76f91541ec18c6dffca387e87947a90cf2fe1096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20de=20Albuquerque?= <51658452+itstheandre@users.noreply.github.com> Date: Mon, 21 Feb 2022 18:13:40 +0100 Subject: [PATCH 2/7] =?UTF-8?q?fix:=20issue=201:=20move=20capitalize=20fun?= =?UTF-8?q?ction=20out=20of=20app.js=20in=20views=20version=20into=20a=20u?= =?UTF-8?q?tils=20folder.=20=20issue=202:=20change=20globally=20defined=20?= =?UTF-8?q?=1B]2;=07=1B]1;=07=20variable=20onto=20=20so=20as=20not=20creat?= =?UTF-8?q?e=20conflicts=20with=20any=20=1B]2;=07=1B]1;=07=20variable=20co?= =?UTF-8?q?ming=20from=20routes.=20issue=203:=20rename=20routes=20files=20?= =?UTF-8?q?to=20add=20=20onto=20file=20name.=20issue=204:=20add=20cookie-p?= =?UTF-8?q?arser=20onto=20base=20express=20dependencies=20(#36)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/config/ironlauncher.js | 2 +- dist/core/install/depedencies/base.deps.js | 13 +++++----- dist/utils/cli/cliParse.js | 13 ---------- package.json | 2 +- src/config/ironlauncher.ts | 2 +- src/core/install/depedencies/base.deps.ts | 15 ++++++----- src/types/IronlauncherConfig.type.ts | 4 +-- src/utils/cli/cliParse.ts | 15 ----------- .../{auth => authentication}/client/README.md | 0 .../{auth => authentication}/client/_.env | 0 .../client/_.eslintcache | 0 .../client/_.gitignore | 0 .../client/package.json | 0 .../client/public/favicon.ico | Bin .../client/public/index.html | 0 .../client/public/logo192.png | Bin .../client/public/logo512.png | Bin .../client/public/manifest.json | 0 .../client/public/robots.txt | 0 .../client/src/App.css | 0 .../client/src/App.js | 0 .../client/src/App.test.js | 0 .../client/src/components/Loading/Loading.css | 0 .../client/src/components/Loading/index.jsx | 0 .../client/src/components/Navbar/Navbar.css | 0 .../client/src/components/Navbar/Navbar.jsx | 0 .../client/src/config/routes.jsx | 0 .../client/src/index.css | 0 .../client/src/index.js | 0 .../client/src/logo.svg | 0 .../client/src/pages/HomePage.jsx | 0 .../client/src/pages/LogIn.jsx | 0 .../client/src/pages/ProtectedPage.jsx | 0 .../client/src/pages/Signup.jsx | 0 .../client/src/pages/auth.css | 0 .../client/src/services/auth.js | 0 .../client/src/setupTests.js | 0 .../client/src/utils/consts.js | 0 .../client/src/utils/paths.js | 0 .../client/src/utils/userToken.js | 0 .../{auth => authentication}/server/_.env | 0 .../server/_.gitignore | 0 .../{auth => authentication}/server/app.js | 2 +- .../server/config/index.js | 0 .../server/db/index.js | 0 .../server/error-handling/index.js | 0 .../server/middleware/isLoggedIn.js | 0 .../server/middleware/isLoggedOut.js | 0 .../server/models/Session.model.js | 0 .../server/models/User.model.js | 0 .../server/package.json | 0 .../server/routes/auth.routes.js} | 0 .../server/routes/index.routes.js} | 2 +- .../{auth => authentication}/server/server.js | 0 template/fullstack/base/server/app.js | 2 +- .../routes/{index.js => index.routes.js} | 0 template/json/{auth => authentication}/_.env | 0 .../json/{auth => authentication}/_.gitignore | 0 template/json/{auth => authentication}/app.js | 2 +- .../{auth => authentication}/config/index.js | 0 .../json/{auth => authentication}/db/index.js | 0 .../error-handling/index.js | 0 .../middleware/isLoggedIn.js | 0 .../middleware/isLoggedOut.js | 0 .../models/User.model.js | 0 .../{auth => authentication}/package.json | 0 .../routes/auth.routes.js} | 0 .../routes/index.routes.js} | 2 +- .../json/{auth => authentication}/server.js | 0 .../{auth => authentication}/utils/consts.js | 0 template/json/base/app.js | 2 +- .../base/routes/{index.js => index.routes.js} | 0 template/layout.hbs | 2 +- template/views/auth/views/index.hbs | 2 -- template/views/auth/views/layout.hbs | 19 -------------- template/views/{auth => authentication}/_.env | 0 .../{auth => authentication}/_.gitignore | 0 .../views/{auth => authentication}/app.js | 8 +++--- .../{auth => authentication}/config/index.js | 0 .../{auth => authentication}/db/index.js | 0 .../error-handling/index.js | 0 .../middleware/isLoggedIn.js | 0 .../middleware/isLoggedOut.js | 0 .../models/User.model.js | 0 .../{auth => authentication}/package.json | 0 .../public/images/favicon.ico | Bin .../public/js/script.js | 0 .../public/stylesheets/style.css | 0 .../routes/auth.routes.js} | 24 +++++++++--------- .../routes/index.routes.js} | 0 .../views/{auth => authentication}/server.js | 0 .../views/authentication/utils/capitalized.js | 4 +++ .../{auth => authentication}/utils/consts.js | 0 .../views/auth/login.hbs | 0 .../views/auth/logout.hbs | 0 .../views/auth/signup.hbs | 0 .../{auth => authentication}/views/error.hbs | 0 template/views/authentication/views/index.hbs | 2 ++ .../views/authentication/views/layout.hbs | 18 +++++++++++++ .../views/not-found.hbs | 0 template/views/base/app.js | 6 ++--- .../base/routes/{index.js => index.routes.js} | 0 template/views/base/utils/capitalized.js | 4 +++ template/views/base/views/index.hbs | 2 +- template/views/base/views/layout.hbs | 2 +- 105 files changed, 76 insertions(+), 95 deletions(-) rename template/fullstack/{auth => authentication}/client/README.md (100%) rename template/fullstack/{auth => authentication}/client/_.env (100%) rename template/fullstack/{auth => authentication}/client/_.eslintcache (100%) rename template/fullstack/{auth => authentication}/client/_.gitignore (100%) rename template/fullstack/{auth => authentication}/client/package.json (100%) rename template/fullstack/{auth => authentication}/client/public/favicon.ico (100%) rename template/fullstack/{auth => authentication}/client/public/index.html (100%) rename template/fullstack/{auth => authentication}/client/public/logo192.png (100%) rename template/fullstack/{auth => authentication}/client/public/logo512.png (100%) rename template/fullstack/{auth => authentication}/client/public/manifest.json (100%) rename template/fullstack/{auth => authentication}/client/public/robots.txt (100%) rename template/fullstack/{auth => authentication}/client/src/App.css (100%) rename template/fullstack/{auth => authentication}/client/src/App.js (100%) rename template/fullstack/{auth => authentication}/client/src/App.test.js (100%) rename template/fullstack/{auth => authentication}/client/src/components/Loading/Loading.css (100%) rename template/fullstack/{auth => authentication}/client/src/components/Loading/index.jsx (100%) rename template/fullstack/{auth => authentication}/client/src/components/Navbar/Navbar.css (100%) rename template/fullstack/{auth => authentication}/client/src/components/Navbar/Navbar.jsx (100%) rename template/fullstack/{auth => authentication}/client/src/config/routes.jsx (100%) rename template/fullstack/{auth => authentication}/client/src/index.css (100%) rename template/fullstack/{auth => authentication}/client/src/index.js (100%) rename template/fullstack/{auth => authentication}/client/src/logo.svg (100%) rename template/fullstack/{auth => authentication}/client/src/pages/HomePage.jsx (100%) rename template/fullstack/{auth => authentication}/client/src/pages/LogIn.jsx (100%) rename template/fullstack/{auth => authentication}/client/src/pages/ProtectedPage.jsx (100%) rename template/fullstack/{auth => authentication}/client/src/pages/Signup.jsx (100%) rename template/fullstack/{auth => authentication}/client/src/pages/auth.css (100%) rename template/fullstack/{auth => authentication}/client/src/services/auth.js (100%) rename template/fullstack/{auth => authentication}/client/src/setupTests.js (100%) rename template/fullstack/{auth => authentication}/client/src/utils/consts.js (100%) rename template/fullstack/{auth => authentication}/client/src/utils/paths.js (100%) rename template/fullstack/{auth => authentication}/client/src/utils/userToken.js (100%) rename template/fullstack/{auth => authentication}/server/_.env (100%) rename template/fullstack/{auth => authentication}/server/_.gitignore (100%) rename template/fullstack/{auth => authentication}/server/app.js (93%) rename template/fullstack/{auth => authentication}/server/config/index.js (100%) rename template/fullstack/{auth => authentication}/server/db/index.js (100%) rename template/fullstack/{auth => authentication}/server/error-handling/index.js (100%) rename template/fullstack/{auth => authentication}/server/middleware/isLoggedIn.js (100%) rename template/fullstack/{auth => authentication}/server/middleware/isLoggedOut.js (100%) rename template/fullstack/{auth => authentication}/server/models/Session.model.js (100%) rename template/fullstack/{auth => authentication}/server/models/User.model.js (100%) rename template/fullstack/{auth => authentication}/server/package.json (100%) rename template/fullstack/{auth/server/routes/auth.js => authentication/server/routes/auth.routes.js} (100%) rename template/fullstack/{auth/server/routes/index.js => authentication/server/routes/index.routes.js} (81%) rename template/fullstack/{auth => authentication}/server/server.js (100%) rename template/fullstack/base/server/routes/{index.js => index.routes.js} (100%) rename template/json/{auth => authentication}/_.env (100%) rename template/json/{auth => authentication}/_.gitignore (100%) rename template/json/{auth => authentication}/app.js (93%) rename template/json/{auth => authentication}/config/index.js (100%) rename template/json/{auth => authentication}/db/index.js (100%) rename template/json/{auth => authentication}/error-handling/index.js (100%) rename template/json/{auth => authentication}/middleware/isLoggedIn.js (100%) rename template/json/{auth => authentication}/middleware/isLoggedOut.js (100%) rename template/json/{auth => authentication}/models/User.model.js (100%) rename template/json/{auth => authentication}/package.json (100%) rename template/json/{auth/routes/auth.js => authentication/routes/auth.routes.js} (100%) rename template/json/{auth/routes/index.js => authentication/routes/index.routes.js} (81%) rename template/json/{auth => authentication}/server.js (100%) rename template/json/{auth => authentication}/utils/consts.js (100%) rename template/json/base/routes/{index.js => index.routes.js} (100%) delete mode 100644 template/views/auth/views/index.hbs delete mode 100644 template/views/auth/views/layout.hbs rename template/views/{auth => authentication}/_.env (100%) rename template/views/{auth => authentication}/_.gitignore (100%) rename template/views/{auth => authentication}/app.js (76%) rename template/views/{auth => authentication}/config/index.js (100%) rename template/views/{auth => authentication}/db/index.js (100%) rename template/views/{auth => authentication}/error-handling/index.js (100%) rename template/views/{auth => authentication}/middleware/isLoggedIn.js (100%) rename template/views/{auth => authentication}/middleware/isLoggedOut.js (100%) rename template/views/{auth => authentication}/models/User.model.js (100%) rename template/views/{auth => authentication}/package.json (100%) rename template/views/{auth => authentication}/public/images/favicon.ico (100%) rename template/views/{auth => authentication}/public/js/script.js (100%) rename template/views/{auth => authentication}/public/stylesheets/style.css (100%) rename template/views/{auth/routes/auth.js => authentication/routes/auth.routes.js} (90%) rename template/views/{auth/routes/index.js => authentication/routes/index.routes.js} (100%) rename template/views/{auth => authentication}/server.js (100%) create mode 100644 template/views/authentication/utils/capitalized.js rename template/views/{auth => authentication}/utils/consts.js (100%) rename template/views/{auth => authentication}/views/auth/login.hbs (100%) rename template/views/{auth => authentication}/views/auth/logout.hbs (100%) rename template/views/{auth => authentication}/views/auth/signup.hbs (100%) rename template/views/{auth => authentication}/views/error.hbs (100%) create mode 100644 template/views/authentication/views/index.hbs create mode 100644 template/views/authentication/views/layout.hbs rename template/views/{auth => authentication}/views/not-found.hbs (100%) rename template/views/base/routes/{index.js => index.routes.js} (100%) create mode 100644 template/views/base/utils/capitalized.js diff --git a/dist/config/ironlauncher.js b/dist/config/ironlauncher.js index ca1783c..4d7ec72 100644 --- a/dist/config/ironlauncher.js +++ b/dist/config/ironlauncher.js @@ -75,7 +75,7 @@ class IronLauncher { } get variant() { if (__classPrivateFieldGet(this, _IronLauncher_auth, "f")) { - return "auth"; + return "authentication"; } return "base"; } diff --git a/dist/core/install/depedencies/base.deps.js b/dist/core/install/depedencies/base.deps.js index ebf4dfd..73a414a 100644 --- a/dist/core/install/depedencies/base.deps.js +++ b/dist/core/install/depedencies/base.deps.js @@ -1,12 +1,13 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BASE_EXPRESS_DEV = exports.baseCookieAuth = exports.baseExpress = void 0; -exports.baseExpress = [`dotenv`, `express`, `mongoose`, `morgan`]; -const baseAuth = ["bcrypt"]; -exports.baseCookieAuth = [ - ...baseAuth, +exports.baseExpress = [ + `dotenv`, + `express`, + `mongoose`, + `morgan`, "cookie-parser", - "express-session", - "connect-mongo", ]; +const baseAuth = ["bcrypt"]; +exports.baseCookieAuth = [...baseAuth, "express-session", "connect-mongo"]; exports.BASE_EXPRESS_DEV = ["nodemon"]; diff --git a/dist/utils/cli/cliParse.js b/dist/utils/cli/cliParse.js index 0227ad5..748d50d 100644 --- a/dist/utils/cli/cliParse.js +++ b/dist/utils/cli/cliParse.js @@ -20,19 +20,6 @@ const validator_1 = require("../../core/validator"); const helpText_1 = require("./helpText"); const args = (0, minimist_1.default)(process.argv.slice(2), {}); exports.inputs = args._, exports.__ = args["--"], exports.flags = __rest(args, ["_", "--"]); -// console.log("args:", args); -// console.log("inputs:", inputs); -// export const getFlags = () => { -// let obj = {} -// for (const key in flags) { -// const value = flags[key] -// if (key in flags) { -// if (typeof value === "boolean" || typeof JSON.parse(value) === "boolean") { -// obj[] -// } -// } -// } -// } const displayHelp = () => { return exports.inputs.includes("help") || !!args["help"]; }; diff --git a/package.json b/package.json index 798b38b..4001366 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ironlauncher", - "version": "0.35.0", + "version": "0.35.1", "main": "index.js", "repository": "git@github.com:ironhack-edu/ironlauncher.git", "author": "AndrΓ© de Albuquerque (https://itstheandre.com)", diff --git a/src/config/ironlauncher.ts b/src/config/ironlauncher.ts index aaa6fc8..40f92a4 100644 --- a/src/config/ironlauncher.ts +++ b/src/config/ironlauncher.ts @@ -173,7 +173,7 @@ class IronLauncher implements IronlauncherConfig { get variant(): IronLauncherVariant { if (this.#auth) { - return "auth"; + return "authentication"; } return "base"; } diff --git a/src/core/install/depedencies/base.deps.ts b/src/core/install/depedencies/base.deps.ts index 49914e8..14a2eb7 100644 --- a/src/core/install/depedencies/base.deps.ts +++ b/src/core/install/depedencies/base.deps.ts @@ -1,12 +1,13 @@ -export const baseExpress = [`dotenv`, `express`, `mongoose`, `morgan`]; +export const baseExpress = [ + `dotenv`, + `express`, + `mongoose`, + `morgan`, + "cookie-parser", +]; const baseAuth = ["bcrypt"]; -export const baseCookieAuth = [ - ...baseAuth, - "cookie-parser", - "express-session", - "connect-mongo", -]; +export const baseCookieAuth = [...baseAuth, "express-session", "connect-mongo"]; export const BASE_EXPRESS_DEV = ["nodemon"]; diff --git a/src/types/IronlauncherConfig.type.ts b/src/types/IronlauncherConfig.type.ts index b3c8b5e..f757b48 100644 --- a/src/types/IronlauncherConfig.type.ts +++ b/src/types/IronlauncherConfig.type.ts @@ -27,7 +27,7 @@ export interface BaseConfig { } export type IronLauncherTemplate = "views" | "json" | "fullstack"; -export type IronLauncherVariant = "base" | "auth"; +export type IronLauncherVariant = "base" | "authentication"; export interface IronlauncherConfig extends BaseConfig { init(): Promise; @@ -35,5 +35,5 @@ export interface IronlauncherConfig extends BaseConfig { export interface IronlauncherType { tech: "views" | "json" | "fs"; - variant: "auth" | "base"; + variant: "authentication" | "base"; } diff --git a/src/utils/cli/cliParse.ts b/src/utils/cli/cliParse.ts index d5dd660..d191527 100644 --- a/src/utils/cli/cliParse.ts +++ b/src/utils/cli/cliParse.ts @@ -5,21 +5,6 @@ import { FLAGS } from "./helpText"; const args = minimist(process.argv.slice(2), {}); export const { _: inputs, "--": __, ...flags } = args; -// console.log("args:", args); -// console.log("inputs:", inputs); - -// export const getFlags = () => { -// let obj = {} -// for (const key in flags) { -// const value = flags[key] -// if (key in flags) { -// if (typeof value === "boolean" || typeof JSON.parse(value) === "boolean") { - -// obj[] -// } -// } -// } -// } export const displayHelp = () => { return inputs.includes("help") || !!args["help"]; diff --git a/template/fullstack/auth/client/README.md b/template/fullstack/authentication/client/README.md similarity index 100% rename from template/fullstack/auth/client/README.md rename to template/fullstack/authentication/client/README.md diff --git a/template/fullstack/auth/client/_.env b/template/fullstack/authentication/client/_.env similarity index 100% rename from template/fullstack/auth/client/_.env rename to template/fullstack/authentication/client/_.env diff --git a/template/fullstack/auth/client/_.eslintcache b/template/fullstack/authentication/client/_.eslintcache similarity index 100% rename from template/fullstack/auth/client/_.eslintcache rename to template/fullstack/authentication/client/_.eslintcache diff --git a/template/fullstack/auth/client/_.gitignore b/template/fullstack/authentication/client/_.gitignore similarity index 100% rename from template/fullstack/auth/client/_.gitignore rename to template/fullstack/authentication/client/_.gitignore diff --git a/template/fullstack/auth/client/package.json b/template/fullstack/authentication/client/package.json similarity index 100% rename from template/fullstack/auth/client/package.json rename to template/fullstack/authentication/client/package.json diff --git a/template/fullstack/auth/client/public/favicon.ico b/template/fullstack/authentication/client/public/favicon.ico similarity index 100% rename from template/fullstack/auth/client/public/favicon.ico rename to template/fullstack/authentication/client/public/favicon.ico diff --git a/template/fullstack/auth/client/public/index.html b/template/fullstack/authentication/client/public/index.html similarity index 100% rename from template/fullstack/auth/client/public/index.html rename to template/fullstack/authentication/client/public/index.html diff --git a/template/fullstack/auth/client/public/logo192.png b/template/fullstack/authentication/client/public/logo192.png similarity index 100% rename from template/fullstack/auth/client/public/logo192.png rename to template/fullstack/authentication/client/public/logo192.png diff --git a/template/fullstack/auth/client/public/logo512.png b/template/fullstack/authentication/client/public/logo512.png similarity index 100% rename from template/fullstack/auth/client/public/logo512.png rename to template/fullstack/authentication/client/public/logo512.png diff --git a/template/fullstack/auth/client/public/manifest.json b/template/fullstack/authentication/client/public/manifest.json similarity index 100% rename from template/fullstack/auth/client/public/manifest.json rename to template/fullstack/authentication/client/public/manifest.json diff --git a/template/fullstack/auth/client/public/robots.txt b/template/fullstack/authentication/client/public/robots.txt similarity index 100% rename from template/fullstack/auth/client/public/robots.txt rename to template/fullstack/authentication/client/public/robots.txt diff --git a/template/fullstack/auth/client/src/App.css b/template/fullstack/authentication/client/src/App.css similarity index 100% rename from template/fullstack/auth/client/src/App.css rename to template/fullstack/authentication/client/src/App.css diff --git a/template/fullstack/auth/client/src/App.js b/template/fullstack/authentication/client/src/App.js similarity index 100% rename from template/fullstack/auth/client/src/App.js rename to template/fullstack/authentication/client/src/App.js diff --git a/template/fullstack/auth/client/src/App.test.js b/template/fullstack/authentication/client/src/App.test.js similarity index 100% rename from template/fullstack/auth/client/src/App.test.js rename to template/fullstack/authentication/client/src/App.test.js diff --git a/template/fullstack/auth/client/src/components/Loading/Loading.css b/template/fullstack/authentication/client/src/components/Loading/Loading.css similarity index 100% rename from template/fullstack/auth/client/src/components/Loading/Loading.css rename to template/fullstack/authentication/client/src/components/Loading/Loading.css diff --git a/template/fullstack/auth/client/src/components/Loading/index.jsx b/template/fullstack/authentication/client/src/components/Loading/index.jsx similarity index 100% rename from template/fullstack/auth/client/src/components/Loading/index.jsx rename to template/fullstack/authentication/client/src/components/Loading/index.jsx diff --git a/template/fullstack/auth/client/src/components/Navbar/Navbar.css b/template/fullstack/authentication/client/src/components/Navbar/Navbar.css similarity index 100% rename from template/fullstack/auth/client/src/components/Navbar/Navbar.css rename to template/fullstack/authentication/client/src/components/Navbar/Navbar.css diff --git a/template/fullstack/auth/client/src/components/Navbar/Navbar.jsx b/template/fullstack/authentication/client/src/components/Navbar/Navbar.jsx similarity index 100% rename from template/fullstack/auth/client/src/components/Navbar/Navbar.jsx rename to template/fullstack/authentication/client/src/components/Navbar/Navbar.jsx diff --git a/template/fullstack/auth/client/src/config/routes.jsx b/template/fullstack/authentication/client/src/config/routes.jsx similarity index 100% rename from template/fullstack/auth/client/src/config/routes.jsx rename to template/fullstack/authentication/client/src/config/routes.jsx diff --git a/template/fullstack/auth/client/src/index.css b/template/fullstack/authentication/client/src/index.css similarity index 100% rename from template/fullstack/auth/client/src/index.css rename to template/fullstack/authentication/client/src/index.css diff --git a/template/fullstack/auth/client/src/index.js b/template/fullstack/authentication/client/src/index.js similarity index 100% rename from template/fullstack/auth/client/src/index.js rename to template/fullstack/authentication/client/src/index.js diff --git a/template/fullstack/auth/client/src/logo.svg b/template/fullstack/authentication/client/src/logo.svg similarity index 100% rename from template/fullstack/auth/client/src/logo.svg rename to template/fullstack/authentication/client/src/logo.svg diff --git a/template/fullstack/auth/client/src/pages/HomePage.jsx b/template/fullstack/authentication/client/src/pages/HomePage.jsx similarity index 100% rename from template/fullstack/auth/client/src/pages/HomePage.jsx rename to template/fullstack/authentication/client/src/pages/HomePage.jsx diff --git a/template/fullstack/auth/client/src/pages/LogIn.jsx b/template/fullstack/authentication/client/src/pages/LogIn.jsx similarity index 100% rename from template/fullstack/auth/client/src/pages/LogIn.jsx rename to template/fullstack/authentication/client/src/pages/LogIn.jsx diff --git a/template/fullstack/auth/client/src/pages/ProtectedPage.jsx b/template/fullstack/authentication/client/src/pages/ProtectedPage.jsx similarity index 100% rename from template/fullstack/auth/client/src/pages/ProtectedPage.jsx rename to template/fullstack/authentication/client/src/pages/ProtectedPage.jsx diff --git a/template/fullstack/auth/client/src/pages/Signup.jsx b/template/fullstack/authentication/client/src/pages/Signup.jsx similarity index 100% rename from template/fullstack/auth/client/src/pages/Signup.jsx rename to template/fullstack/authentication/client/src/pages/Signup.jsx diff --git a/template/fullstack/auth/client/src/pages/auth.css b/template/fullstack/authentication/client/src/pages/auth.css similarity index 100% rename from template/fullstack/auth/client/src/pages/auth.css rename to template/fullstack/authentication/client/src/pages/auth.css diff --git a/template/fullstack/auth/client/src/services/auth.js b/template/fullstack/authentication/client/src/services/auth.js similarity index 100% rename from template/fullstack/auth/client/src/services/auth.js rename to template/fullstack/authentication/client/src/services/auth.js diff --git a/template/fullstack/auth/client/src/setupTests.js b/template/fullstack/authentication/client/src/setupTests.js similarity index 100% rename from template/fullstack/auth/client/src/setupTests.js rename to template/fullstack/authentication/client/src/setupTests.js diff --git a/template/fullstack/auth/client/src/utils/consts.js b/template/fullstack/authentication/client/src/utils/consts.js similarity index 100% rename from template/fullstack/auth/client/src/utils/consts.js rename to template/fullstack/authentication/client/src/utils/consts.js diff --git a/template/fullstack/auth/client/src/utils/paths.js b/template/fullstack/authentication/client/src/utils/paths.js similarity index 100% rename from template/fullstack/auth/client/src/utils/paths.js rename to template/fullstack/authentication/client/src/utils/paths.js diff --git a/template/fullstack/auth/client/src/utils/userToken.js b/template/fullstack/authentication/client/src/utils/userToken.js similarity index 100% rename from template/fullstack/auth/client/src/utils/userToken.js rename to template/fullstack/authentication/client/src/utils/userToken.js diff --git a/template/fullstack/auth/server/_.env b/template/fullstack/authentication/server/_.env similarity index 100% rename from template/fullstack/auth/server/_.env rename to template/fullstack/authentication/server/_.env diff --git a/template/fullstack/auth/server/_.gitignore b/template/fullstack/authentication/server/_.gitignore similarity index 100% rename from template/fullstack/auth/server/_.gitignore rename to template/fullstack/authentication/server/_.gitignore diff --git a/template/fullstack/auth/server/app.js b/template/fullstack/authentication/server/app.js similarity index 93% rename from template/fullstack/auth/server/app.js rename to template/fullstack/authentication/server/app.js index faf95d3..58748ad 100644 --- a/template/fullstack/auth/server/app.js +++ b/template/fullstack/authentication/server/app.js @@ -16,7 +16,7 @@ require("./config")(app); // πŸ‘‡ Start handling routes here // Contrary to the views version, all routes are controlled from the routes/index.js -const allRoutes = require("./routes"); +const allRoutes = require("./routes/index.routes"); app.use("/api", allRoutes); // ❗ To handle errors. Routes that don't exist or errors that you handle in specific routes diff --git a/template/fullstack/auth/server/config/index.js b/template/fullstack/authentication/server/config/index.js similarity index 100% rename from template/fullstack/auth/server/config/index.js rename to template/fullstack/authentication/server/config/index.js diff --git a/template/fullstack/auth/server/db/index.js b/template/fullstack/authentication/server/db/index.js similarity index 100% rename from template/fullstack/auth/server/db/index.js rename to template/fullstack/authentication/server/db/index.js diff --git a/template/fullstack/auth/server/error-handling/index.js b/template/fullstack/authentication/server/error-handling/index.js similarity index 100% rename from template/fullstack/auth/server/error-handling/index.js rename to template/fullstack/authentication/server/error-handling/index.js diff --git a/template/fullstack/auth/server/middleware/isLoggedIn.js b/template/fullstack/authentication/server/middleware/isLoggedIn.js similarity index 100% rename from template/fullstack/auth/server/middleware/isLoggedIn.js rename to template/fullstack/authentication/server/middleware/isLoggedIn.js diff --git a/template/fullstack/auth/server/middleware/isLoggedOut.js b/template/fullstack/authentication/server/middleware/isLoggedOut.js similarity index 100% rename from template/fullstack/auth/server/middleware/isLoggedOut.js rename to template/fullstack/authentication/server/middleware/isLoggedOut.js diff --git a/template/fullstack/auth/server/models/Session.model.js b/template/fullstack/authentication/server/models/Session.model.js similarity index 100% rename from template/fullstack/auth/server/models/Session.model.js rename to template/fullstack/authentication/server/models/Session.model.js diff --git a/template/fullstack/auth/server/models/User.model.js b/template/fullstack/authentication/server/models/User.model.js similarity index 100% rename from template/fullstack/auth/server/models/User.model.js rename to template/fullstack/authentication/server/models/User.model.js diff --git a/template/fullstack/auth/server/package.json b/template/fullstack/authentication/server/package.json similarity index 100% rename from template/fullstack/auth/server/package.json rename to template/fullstack/authentication/server/package.json diff --git a/template/fullstack/auth/server/routes/auth.js b/template/fullstack/authentication/server/routes/auth.routes.js similarity index 100% rename from template/fullstack/auth/server/routes/auth.js rename to template/fullstack/authentication/server/routes/auth.routes.js diff --git a/template/fullstack/auth/server/routes/index.js b/template/fullstack/authentication/server/routes/index.routes.js similarity index 81% rename from template/fullstack/auth/server/routes/index.js rename to template/fullstack/authentication/server/routes/index.routes.js index 1b26038..74f9ef2 100644 --- a/template/fullstack/auth/server/routes/index.js +++ b/template/fullstack/authentication/server/routes/index.routes.js @@ -1,5 +1,5 @@ const router = require("express").Router(); -const authRoutes = require("./auth"); +const authRoutes = require("./auth.routes"); /* GET home page */ router.get("/", (req, res, next) => { diff --git a/template/fullstack/auth/server/server.js b/template/fullstack/authentication/server/server.js similarity index 100% rename from template/fullstack/auth/server/server.js rename to template/fullstack/authentication/server/server.js diff --git a/template/fullstack/base/server/app.js b/template/fullstack/base/server/app.js index faf95d3..58748ad 100644 --- a/template/fullstack/base/server/app.js +++ b/template/fullstack/base/server/app.js @@ -16,7 +16,7 @@ require("./config")(app); // πŸ‘‡ Start handling routes here // Contrary to the views version, all routes are controlled from the routes/index.js -const allRoutes = require("./routes"); +const allRoutes = require("./routes/index.routes"); app.use("/api", allRoutes); // ❗ To handle errors. Routes that don't exist or errors that you handle in specific routes diff --git a/template/fullstack/base/server/routes/index.js b/template/fullstack/base/server/routes/index.routes.js similarity index 100% rename from template/fullstack/base/server/routes/index.js rename to template/fullstack/base/server/routes/index.routes.js diff --git a/template/json/auth/_.env b/template/json/authentication/_.env similarity index 100% rename from template/json/auth/_.env rename to template/json/authentication/_.env diff --git a/template/json/auth/_.gitignore b/template/json/authentication/_.gitignore similarity index 100% rename from template/json/auth/_.gitignore rename to template/json/authentication/_.gitignore diff --git a/template/json/auth/app.js b/template/json/authentication/app.js similarity index 93% rename from template/json/auth/app.js rename to template/json/authentication/app.js index faf95d3..58748ad 100644 --- a/template/json/auth/app.js +++ b/template/json/authentication/app.js @@ -16,7 +16,7 @@ require("./config")(app); // πŸ‘‡ Start handling routes here // Contrary to the views version, all routes are controlled from the routes/index.js -const allRoutes = require("./routes"); +const allRoutes = require("./routes/index.routes"); app.use("/api", allRoutes); // ❗ To handle errors. Routes that don't exist or errors that you handle in specific routes diff --git a/template/json/auth/config/index.js b/template/json/authentication/config/index.js similarity index 100% rename from template/json/auth/config/index.js rename to template/json/authentication/config/index.js diff --git a/template/json/auth/db/index.js b/template/json/authentication/db/index.js similarity index 100% rename from template/json/auth/db/index.js rename to template/json/authentication/db/index.js diff --git a/template/json/auth/error-handling/index.js b/template/json/authentication/error-handling/index.js similarity index 100% rename from template/json/auth/error-handling/index.js rename to template/json/authentication/error-handling/index.js diff --git a/template/json/auth/middleware/isLoggedIn.js b/template/json/authentication/middleware/isLoggedIn.js similarity index 100% rename from template/json/auth/middleware/isLoggedIn.js rename to template/json/authentication/middleware/isLoggedIn.js diff --git a/template/json/auth/middleware/isLoggedOut.js b/template/json/authentication/middleware/isLoggedOut.js similarity index 100% rename from template/json/auth/middleware/isLoggedOut.js rename to template/json/authentication/middleware/isLoggedOut.js diff --git a/template/json/auth/models/User.model.js b/template/json/authentication/models/User.model.js similarity index 100% rename from template/json/auth/models/User.model.js rename to template/json/authentication/models/User.model.js diff --git a/template/json/auth/package.json b/template/json/authentication/package.json similarity index 100% rename from template/json/auth/package.json rename to template/json/authentication/package.json diff --git a/template/json/auth/routes/auth.js b/template/json/authentication/routes/auth.routes.js similarity index 100% rename from template/json/auth/routes/auth.js rename to template/json/authentication/routes/auth.routes.js diff --git a/template/json/auth/routes/index.js b/template/json/authentication/routes/index.routes.js similarity index 81% rename from template/json/auth/routes/index.js rename to template/json/authentication/routes/index.routes.js index 1b26038..74f9ef2 100644 --- a/template/json/auth/routes/index.js +++ b/template/json/authentication/routes/index.routes.js @@ -1,5 +1,5 @@ const router = require("express").Router(); -const authRoutes = require("./auth"); +const authRoutes = require("./auth.routes"); /* GET home page */ router.get("/", (req, res, next) => { diff --git a/template/json/auth/server.js b/template/json/authentication/server.js similarity index 100% rename from template/json/auth/server.js rename to template/json/authentication/server.js diff --git a/template/json/auth/utils/consts.js b/template/json/authentication/utils/consts.js similarity index 100% rename from template/json/auth/utils/consts.js rename to template/json/authentication/utils/consts.js diff --git a/template/json/base/app.js b/template/json/base/app.js index faf95d3..58748ad 100644 --- a/template/json/base/app.js +++ b/template/json/base/app.js @@ -16,7 +16,7 @@ require("./config")(app); // πŸ‘‡ Start handling routes here // Contrary to the views version, all routes are controlled from the routes/index.js -const allRoutes = require("./routes"); +const allRoutes = require("./routes/index.routes"); app.use("/api", allRoutes); // ❗ To handle errors. Routes that don't exist or errors that you handle in specific routes diff --git a/template/json/base/routes/index.js b/template/json/base/routes/index.routes.js similarity index 100% rename from template/json/base/routes/index.js rename to template/json/base/routes/index.routes.js diff --git a/template/layout.hbs b/template/layout.hbs index c46cd80..c9268c2 100644 --- a/template/layout.hbs +++ b/template/layout.hbs @@ -5,7 +5,7 @@ - {{title}} + {{appTitle}} diff --git a/template/views/auth/views/index.hbs b/template/views/auth/views/index.hbs deleted file mode 100644 index 7c1cf1d..0000000 --- a/template/views/auth/views/index.hbs +++ /dev/null @@ -1,2 +0,0 @@ -

{{title}} πŸš€

-

Welcome Ironhacker!

\ No newline at end of file diff --git a/template/views/auth/views/layout.hbs b/template/views/auth/views/layout.hbs deleted file mode 100644 index c46cd80..0000000 --- a/template/views/auth/views/layout.hbs +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - {{title}} - - - - - - {{{body}}} - - - - - \ No newline at end of file diff --git a/template/views/auth/_.env b/template/views/authentication/_.env similarity index 100% rename from template/views/auth/_.env rename to template/views/authentication/_.env diff --git a/template/views/auth/_.gitignore b/template/views/authentication/_.gitignore similarity index 100% rename from template/views/auth/_.gitignore rename to template/views/authentication/_.gitignore diff --git a/template/views/auth/app.js b/template/views/authentication/app.js similarity index 76% rename from template/views/auth/app.js rename to template/views/authentication/app.js index 48d5cc2..6304f20 100644 --- a/template/views/auth/app.js +++ b/template/views/authentication/app.js @@ -18,16 +18,16 @@ const app = express(); // ℹ️ This function is getting exported from the config folder. It runs most pieces of middleware require("./config")(app); +const capitalized = require("./utils/capitalized"); const projectName = "{{name}}"; -const capitalized = (string) => string[0].toUpperCase() + string.slice(1).toLowerCase(); -app.locals.title = `${capitalized(projectName)} created with IronLauncher`; +app.locals.appTitle = `${capitalized(projectName)} created with IronLauncher`; // πŸ‘‡ Start handling routes here -const index = require("./routes/index"); +const index = require("./routes/index.routes"); app.use("/", index); -const authRoutes = require("./routes/auth"); +const authRoutes = require("./routes/auth.routes"); app.use("/auth", authRoutes); // ❗ To handle errors. Routes that don't exist or errors that you handle in specific routes diff --git a/template/views/auth/config/index.js b/template/views/authentication/config/index.js similarity index 100% rename from template/views/auth/config/index.js rename to template/views/authentication/config/index.js diff --git a/template/views/auth/db/index.js b/template/views/authentication/db/index.js similarity index 100% rename from template/views/auth/db/index.js rename to template/views/authentication/db/index.js diff --git a/template/views/auth/error-handling/index.js b/template/views/authentication/error-handling/index.js similarity index 100% rename from template/views/auth/error-handling/index.js rename to template/views/authentication/error-handling/index.js diff --git a/template/views/auth/middleware/isLoggedIn.js b/template/views/authentication/middleware/isLoggedIn.js similarity index 100% rename from template/views/auth/middleware/isLoggedIn.js rename to template/views/authentication/middleware/isLoggedIn.js diff --git a/template/views/auth/middleware/isLoggedOut.js b/template/views/authentication/middleware/isLoggedOut.js similarity index 100% rename from template/views/auth/middleware/isLoggedOut.js rename to template/views/authentication/middleware/isLoggedOut.js diff --git a/template/views/auth/models/User.model.js b/template/views/authentication/models/User.model.js similarity index 100% rename from template/views/auth/models/User.model.js rename to template/views/authentication/models/User.model.js diff --git a/template/views/auth/package.json b/template/views/authentication/package.json similarity index 100% rename from template/views/auth/package.json rename to template/views/authentication/package.json diff --git a/template/views/auth/public/images/favicon.ico b/template/views/authentication/public/images/favicon.ico similarity index 100% rename from template/views/auth/public/images/favicon.ico rename to template/views/authentication/public/images/favicon.ico diff --git a/template/views/auth/public/js/script.js b/template/views/authentication/public/js/script.js similarity index 100% rename from template/views/auth/public/js/script.js rename to template/views/authentication/public/js/script.js diff --git a/template/views/auth/public/stylesheets/style.css b/template/views/authentication/public/stylesheets/style.css similarity index 100% rename from template/views/auth/public/stylesheets/style.css rename to template/views/authentication/public/stylesheets/style.css diff --git a/template/views/auth/routes/auth.js b/template/views/authentication/routes/auth.routes.js similarity index 90% rename from template/views/auth/routes/auth.js rename to template/views/authentication/routes/auth.routes.js index 4e13f36..8426154 100644 --- a/template/views/auth/routes/auth.js +++ b/template/views/authentication/routes/auth.routes.js @@ -22,9 +22,9 @@ router.post("/signup", isLoggedOut, (req, res) => { const { username, password } = req.body; if (!username) { - return res - .status(400) - .render("auth/signup", { errorMessage: "Please provide your username." }); + return res.status(400).render("auth/signup", { + errorMessage: "Please provide your username.", + }); } if (password.length < 8) { @@ -97,9 +97,9 @@ router.post("/login", isLoggedOut, (req, res, next) => { const { username, password } = req.body; if (!username) { - return res - .status(400) - .render("auth/login", { errorMessage: "Please provide your username." }); + return res.status(400).render("auth/login", { + errorMessage: "Please provide your username.", + }); } // Here we use the same logic as above @@ -115,17 +115,17 @@ router.post("/login", isLoggedOut, (req, res, next) => { .then((user) => { // If the user isn't found, send the message that user provided wrong credentials if (!user) { - return res - .status(400) - .render("auth/login", { errorMessage: "Wrong credentials." }); + return res.status(400).render("auth/login", { + errorMessage: "Wrong credentials.", + }); } // If user is found based on the username, check if the in putted password matches the one saved in the database bcrypt.compare(password, user.password).then((isSamePassword) => { if (!isSamePassword) { - return res - .status(400) - .render("auth/login", { errorMessage: "Wrong credentials." }); + return res.status(400).render("auth/login", { + errorMessage: "Wrong credentials.", + }); } req.session.user = user; // req.session.user = user._id; // ! better and safer but in this case we saving the entire user object diff --git a/template/views/auth/routes/index.js b/template/views/authentication/routes/index.routes.js similarity index 100% rename from template/views/auth/routes/index.js rename to template/views/authentication/routes/index.routes.js diff --git a/template/views/auth/server.js b/template/views/authentication/server.js similarity index 100% rename from template/views/auth/server.js rename to template/views/authentication/server.js diff --git a/template/views/authentication/utils/capitalized.js b/template/views/authentication/utils/capitalized.js new file mode 100644 index 0000000..c9e2028 --- /dev/null +++ b/template/views/authentication/utils/capitalized.js @@ -0,0 +1,4 @@ +function capitalized(string) { + return string[0].toUpperCase() + string.slice(1).toLowerCase(); +} +module.exports = capitalized; diff --git a/template/views/auth/utils/consts.js b/template/views/authentication/utils/consts.js similarity index 100% rename from template/views/auth/utils/consts.js rename to template/views/authentication/utils/consts.js diff --git a/template/views/auth/views/auth/login.hbs b/template/views/authentication/views/auth/login.hbs similarity index 100% rename from template/views/auth/views/auth/login.hbs rename to template/views/authentication/views/auth/login.hbs diff --git a/template/views/auth/views/auth/logout.hbs b/template/views/authentication/views/auth/logout.hbs similarity index 100% rename from template/views/auth/views/auth/logout.hbs rename to template/views/authentication/views/auth/logout.hbs diff --git a/template/views/auth/views/auth/signup.hbs b/template/views/authentication/views/auth/signup.hbs similarity index 100% rename from template/views/auth/views/auth/signup.hbs rename to template/views/authentication/views/auth/signup.hbs diff --git a/template/views/auth/views/error.hbs b/template/views/authentication/views/error.hbs similarity index 100% rename from template/views/auth/views/error.hbs rename to template/views/authentication/views/error.hbs diff --git a/template/views/authentication/views/index.hbs b/template/views/authentication/views/index.hbs new file mode 100644 index 0000000..2c1bb13 --- /dev/null +++ b/template/views/authentication/views/index.hbs @@ -0,0 +1,2 @@ +

{{appTitle}} πŸš€

+

Welcome Ironhacker!

\ No newline at end of file diff --git a/template/views/authentication/views/layout.hbs b/template/views/authentication/views/layout.hbs new file mode 100644 index 0000000..06fce19 --- /dev/null +++ b/template/views/authentication/views/layout.hbs @@ -0,0 +1,18 @@ + + + + + + + {{appTitle}} + + + + + + {{{body}}} + + + + + \ No newline at end of file diff --git a/template/views/auth/views/not-found.hbs b/template/views/authentication/views/not-found.hbs similarity index 100% rename from template/views/auth/views/not-found.hbs rename to template/views/authentication/views/not-found.hbs diff --git a/template/views/base/app.js b/template/views/base/app.js index 88c66c6..78d6f8f 100644 --- a/template/views/base/app.js +++ b/template/views/base/app.js @@ -19,13 +19,13 @@ const app = express(); require("./config")(app); // default value for title local +const capitalized = require("./utils/capitalized"); const projectName = "{{name}}"; -const capitalized = (string) => string[0].toUpperCase() + string.slice(1).toLowerCase(); -app.locals.title = `${capitalized(projectName)} created with IronLauncher`; +app.locals.appTitle = `${capitalized(projectName)} created with IronLauncher`; // πŸ‘‡ Start handling routes here -const index = require("./routes/index"); +const index = require("./routes/index.routes"); app.use("/", index); // ❗ To handle errors. Routes that don't exist or errors that you handle in specific routes diff --git a/template/views/base/routes/index.js b/template/views/base/routes/index.routes.js similarity index 100% rename from template/views/base/routes/index.js rename to template/views/base/routes/index.routes.js diff --git a/template/views/base/utils/capitalized.js b/template/views/base/utils/capitalized.js new file mode 100644 index 0000000..c9e2028 --- /dev/null +++ b/template/views/base/utils/capitalized.js @@ -0,0 +1,4 @@ +function capitalized(string) { + return string[0].toUpperCase() + string.slice(1).toLowerCase(); +} +module.exports = capitalized; diff --git a/template/views/base/views/index.hbs b/template/views/base/views/index.hbs index 7c1cf1d..2c1bb13 100644 --- a/template/views/base/views/index.hbs +++ b/template/views/base/views/index.hbs @@ -1,2 +1,2 @@ -

{{title}} πŸš€

+

{{appTitle}} πŸš€

Welcome Ironhacker!

\ No newline at end of file diff --git a/template/views/base/views/layout.hbs b/template/views/base/views/layout.hbs index c46cd80..c9268c2 100644 --- a/template/views/base/views/layout.hbs +++ b/template/views/base/views/layout.hbs @@ -5,7 +5,7 @@ - {{title}} + {{appTitle}} From 813acd3ed0b25378adf86f644bf560bc0e112fb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20de=20Albuquerque?= Date: Mon, 21 Feb 2022 18:14:40 +0100 Subject: [PATCH 3/7] 0.36.0 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2d8b93c..616919d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ironlauncher", - "version": "0.35.0", + "version": "0.36.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "ironlauncher", - "version": "0.35.0", + "version": "0.36.0", "license": "MIT", "dependencies": { "chalk": "^4.1.0", diff --git a/package.json b/package.json index 4001366..531d0bb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ironlauncher", - "version": "0.35.1", + "version": "0.36.0", "main": "index.js", "repository": "git@github.com:ironhack-edu/ironlauncher.git", "author": "AndrΓ© de Albuquerque (https://itstheandre.com)", From 9510cda75816a510558bafe91977f657a2649ee6 Mon Sep 17 00:00:00 2001 From: Ironhack Education Team Date: Thu, 7 Apr 2022 11:24:20 +0200 Subject: [PATCH 4/7] fix rendering login page after login error, fix minor typos (#38) Co-authored-by: sandrabosk --- dist/utils/cli/helpText.js | 4 +- src/utils/cli/helpText.ts | 4 +- .../server/routes/auth.routes.js | 2 +- .../json/authentication/routes/auth.routes.js | 12 +++--- .../authentication/routes/auth.routes.js | 39 ++++++++++--------- 5 files changed, 32 insertions(+), 29 deletions(-) diff --git a/dist/utils/cli/helpText.js b/dist/utils/cli/helpText.js index 18def87..12ecfc3 100644 --- a/dist/utils/cli/helpText.js +++ b/dist/utils/cli/helpText.js @@ -14,12 +14,12 @@ const flags = { }, auth: { type: "boolean", - desc: `Adds auth behaviour`, + desc: `Adds auth behavior`, }, fs: { type: "boolean", default: false, - desc: "Creates an opinioated express and create-react-app setup", + desc: "Creates an opinionated express and create-react-app setup", }, }; const commands = { diff --git a/src/utils/cli/helpText.ts b/src/utils/cli/helpText.ts index a502258..18c8a00 100644 --- a/src/utils/cli/helpText.ts +++ b/src/utils/cli/helpText.ts @@ -12,12 +12,12 @@ const flags: MeowHelpFlags = { }, auth: { type: "boolean", - desc: `Adds auth behaviour`, + desc: `Adds auth behavior`, }, fs: { type: "boolean", default: false, - desc: "Creates an opinioated express and create-react-app setup", + desc: "Creates an opinionated express and create-react-app setup", }, }; diff --git a/template/fullstack/authentication/server/routes/auth.routes.js b/template/fullstack/authentication/server/routes/auth.routes.js index 02cef22..5995841 100644 --- a/template/fullstack/authentication/server/routes/auth.routes.js +++ b/template/fullstack/authentication/server/routes/auth.routes.js @@ -11,7 +11,7 @@ const saltRounds = 10; const User = require("../models/User.model"); const Session = require("../models/Session.model"); -// Require necessary (isLoggedOut and isLiggedIn) middleware in order to control access to specific routes +// Require necessary (isLoggedOut and isLoggedIn) middleware in order to control access to specific routes const isLoggedOut = require("../middleware/isLoggedOut"); const isLoggedIn = require("../middleware/isLoggedIn"); diff --git a/template/json/authentication/routes/auth.routes.js b/template/json/authentication/routes/auth.routes.js index 1b8fc5e..667fc77 100644 --- a/template/json/authentication/routes/auth.routes.js +++ b/template/json/authentication/routes/auth.routes.js @@ -10,7 +10,7 @@ const saltRounds = 10; // Require the User model in order to interact with the database const User = require("../models/User.model"); -// Require necessary (isLoggedOut and isLiggedIn) middleware in order to control access to specific routes +// Require necessary (isLoggedOut and isLoggedIn) middleware in order to control access to specific routes const isLoggedOut = require("../middleware/isLoggedOut"); const isLoggedIn = require("../middleware/isLoggedIn"); @@ -28,9 +28,9 @@ router.post("/signup", isLoggedOut, (req, res) => { } if (password.length < 8) { - return res.status(400).json({ - errorMessage: "Your password needs to be at least 8 characters long.", - }); + return res + .status(400) + .json({ errorMessage: "Your password needs to be at least 8 characters long." }); } // ! This use case is using a regular expression to control for special characters and min length @@ -49,7 +49,9 @@ router.post("/signup", isLoggedOut, (req, res) => { User.findOne({ username }).then((found) => { // If the user is found, send the message username is taken if (found) { - return res.status(400).json({ errorMessage: "Username already taken." }); + return res + .status(400) + .json({ errorMessage: "Username already taken." }); } // if user is not found, create a new user - start with hashing the password diff --git a/template/views/authentication/routes/auth.routes.js b/template/views/authentication/routes/auth.routes.js index 8426154..1db11cf 100644 --- a/template/views/authentication/routes/auth.routes.js +++ b/template/views/authentication/routes/auth.routes.js @@ -10,7 +10,7 @@ const saltRounds = 10; // Require the User model in order to interact with the database const User = require("../models/User.model"); -// Require necessary (isLoggedOut and isLiggedIn) middleware in order to control access to specific routes +// Require necessary (isLoggedOut and isLoggedIn) middleware in order to control access to specific routes const isLoggedOut = require("../middleware/isLoggedOut"); const isLoggedIn = require("../middleware/isLoggedIn"); @@ -51,7 +51,7 @@ router.post("/signup", isLoggedOut, (req, res) => { if (found) { return res .status(400) - .render("auth.signup", { errorMessage: "Username already taken." }); + .render("auth/signup", { errorMessage: "Username already taken." }); } // if user is not found, create a new user - start with hashing the password @@ -77,10 +77,9 @@ router.post("/signup", isLoggedOut, (req, res) => { .render("auth/signup", { errorMessage: error.message }); } if (error.code === 11000) { - return res.status(400).render("auth/signup", { - errorMessage: - "Username need to be unique. The username you chose is already in use.", - }); + return res + .status(400) + .render("auth/signup", { errorMessage: "Username need to be unique. The username you chose is already in use." }); } return res .status(500) @@ -97,17 +96,17 @@ router.post("/login", isLoggedOut, (req, res, next) => { const { username, password } = req.body; if (!username) { - return res.status(400).render("auth/login", { - errorMessage: "Please provide your username.", - }); + return res + .status(400) + .render("auth/login", { errorMessage: "Please provide your username." }); } // Here we use the same logic as above // - either length based parameters or we check the strength of a password if (password.length < 8) { - return res.status(400).render("auth/login", { - errorMessage: "Your password needs to be at least 8 characters long.", - }); + return res + .status(400) + .render("auth/login", { errorMessage: "Your password needs to be at least 8 characters long." }); } // Search the database for a user with the username submitted in the form @@ -115,18 +114,19 @@ router.post("/login", isLoggedOut, (req, res, next) => { .then((user) => { // If the user isn't found, send the message that user provided wrong credentials if (!user) { - return res.status(400).render("auth/login", { - errorMessage: "Wrong credentials.", - }); + return res + .status(400) + .render("auth/login", { errorMessage: "Wrong credentials." }); } // If user is found based on the username, check if the in putted password matches the one saved in the database bcrypt.compare(password, user.password).then((isSamePassword) => { if (!isSamePassword) { - return res.status(400).render("auth/login", { - errorMessage: "Wrong credentials.", - }); + return res + .status(400) + .render("auth/login", { errorMessage: "Wrong credentials." }); } + req.session.user = user; // req.session.user = user._id; // ! better and safer but in this case we saving the entire user object return res.redirect("/"); @@ -137,7 +137,7 @@ router.post("/login", isLoggedOut, (req, res, next) => { // in this case we are sending the error handling to the error handling middleware that is defined in the error handling file // you can just as easily run the res.status that is commented out below next(err); - // return res.status(500).render("login", { errorMessage: err.message }); + // return res.status(500).render("auth/login", { errorMessage: err.message }); }); }); @@ -148,6 +148,7 @@ router.get("/logout", isLoggedIn, (req, res) => { .status(500) .render("auth/logout", { errorMessage: err.message }); } + res.redirect("/"); }); }); From d202039329cf1159359431be3a25c1cc96045c74 Mon Sep 17 00:00:00 2001 From: Filipe Freire <45498579+filipe-freire@users.noreply.github.com> Date: Thu, 4 Aug 2022 19:22:03 +0200 Subject: [PATCH 5/7] add: pnpm flag helper text (#40) --- src/utils/cli/helpText.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utils/cli/helpText.ts b/src/utils/cli/helpText.ts index 18c8a00..7692128 100644 --- a/src/utils/cli/helpText.ts +++ b/src/utils/cli/helpText.ts @@ -1,7 +1,7 @@ import type { MeowHelpFlags, MeowHelpCommands } from "cli-meow-help"; import meowHelp from "cli-meow-help"; -export const FLAGS = ["json", "auth", "fs"] as const; +export const FLAGS = ["json", "auth", "fs", "pnpm"] as const; export type FLAGS_OPTS = typeof FLAGS[number]; const flags: MeowHelpFlags = { @@ -19,6 +19,11 @@ const flags: MeowHelpFlags = { default: false, desc: "Creates an opinionated express and create-react-app setup", }, + pnpm: { + type: "boolean", + default: false, + desc: "Installs dependencies through pnpm, assuming you have it installed", + }, }; const commands: MeowHelpCommands = { From b22f8e8646cb48dd5cbc30a4ee58b48a21376110 Mon Sep 17 00:00:00 2001 From: sandrabosk Date: Thu, 18 Aug 2022 13:31:31 +0200 Subject: [PATCH 6/7] 0.37.0 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 616919d..4bff805 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ironlauncher", - "version": "0.36.0", + "version": "0.37.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "ironlauncher", - "version": "0.36.0", + "version": "0.37.0", "license": "MIT", "dependencies": { "chalk": "^4.1.0", diff --git a/package.json b/package.json index 531d0bb..0c2aa7d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ironlauncher", - "version": "0.36.0", + "version": "0.37.0", "main": "index.js", "repository": "git@github.com:ironhack-edu/ironlauncher.git", "author": "AndrΓ© de Albuquerque (https://itstheandre.com)", From 8f493400f58567af62890d1caeaadd656c6f7bca Mon Sep 17 00:00:00 2001 From: Antoine BERNIER Date: Mon, 19 Sep 2022 16:38:32 +0200 Subject: [PATCH 7/7] chore: allow err.message and err.status values to be used in the error-middleware response --- .../fullstack/authentication/server/error-handling/index.js | 4 ++-- template/fullstack/base/server/error-handling/index.js | 4 ++-- template/json/authentication/error-handling/index.js | 4 ++-- template/json/base/error-handling/index.js | 4 ++-- template/views/authentication/error-handling/index.js | 2 +- template/views/base/error-handling/index.js | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/template/fullstack/authentication/server/error-handling/index.js b/template/fullstack/authentication/server/error-handling/index.js index b5b51e2..540fddd 100644 --- a/template/fullstack/authentication/server/error-handling/index.js +++ b/template/fullstack/authentication/server/error-handling/index.js @@ -11,8 +11,8 @@ module.exports = (app) => { // only render if the error ocurred before sending the response if (!res.headersSent) { - res.status(500).json({ - errorMessage: "Internal server error. Check the server console", + res.status(err.status || 500).json({ + errorMessage: err.message || "Internal server error. Check the server console", }); } }); diff --git a/template/fullstack/base/server/error-handling/index.js b/template/fullstack/base/server/error-handling/index.js index 4f58d57..fc1b366 100644 --- a/template/fullstack/base/server/error-handling/index.js +++ b/template/fullstack/base/server/error-handling/index.js @@ -12,9 +12,9 @@ module.exports = (app) => { // only render if the error ocurred before sending the response if (!res.headersSent) { res - .status(500) + .status(err.status || 500) .json({ - errorMessage: "Internal server error. Check the server console", + errorMessage: err.message || "Internal server error. Check the server console", }); } }); diff --git a/template/json/authentication/error-handling/index.js b/template/json/authentication/error-handling/index.js index b5b51e2..540fddd 100644 --- a/template/json/authentication/error-handling/index.js +++ b/template/json/authentication/error-handling/index.js @@ -11,8 +11,8 @@ module.exports = (app) => { // only render if the error ocurred before sending the response if (!res.headersSent) { - res.status(500).json({ - errorMessage: "Internal server error. Check the server console", + res.status(err.status || 500).json({ + errorMessage: err.message || "Internal server error. Check the server console", }); } }); diff --git a/template/json/base/error-handling/index.js b/template/json/base/error-handling/index.js index 4f58d57..fc1b366 100644 --- a/template/json/base/error-handling/index.js +++ b/template/json/base/error-handling/index.js @@ -12,9 +12,9 @@ module.exports = (app) => { // only render if the error ocurred before sending the response if (!res.headersSent) { res - .status(500) + .status(err.status || 500) .json({ - errorMessage: "Internal server error. Check the server console", + errorMessage: err.message || "Internal server error. Check the server console", }); } }); diff --git a/template/views/authentication/error-handling/index.js b/template/views/authentication/error-handling/index.js index 9ed32d0..a1a5593 100644 --- a/template/views/authentication/error-handling/index.js +++ b/template/views/authentication/error-handling/index.js @@ -11,7 +11,7 @@ module.exports = (app) => { // only render if the error ocurred before sending the response if (!res.headersSent) { - res.status(500).res.render("error"); + res.status(err.status || 500).res.render("error"); } }); }; diff --git a/template/views/base/error-handling/index.js b/template/views/base/error-handling/index.js index 5d6e74b..4dcb0f9 100644 --- a/template/views/base/error-handling/index.js +++ b/template/views/base/error-handling/index.js @@ -11,7 +11,7 @@ module.exports = (app) => { // only render if the error ocurred before sending the response if (!res.headersSent) { - res.status(500).render("error"); + res.status(err.status || 500).render("error"); } }); };