diff --git a/README.md b/README.md index cf11fc3..099bcfd 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,77 @@ -# Work In Progress +![Adocasts](https://github.com/adocasts/.github/blob/main/assets/brand-banner-rounded.png?raw=true) -This package is not yet ready for use and is not available on NPM. +

+ Adocasts Jumpstart +

+

+ An AdonisJS 6 Authentication Scaffold with TailwindCSS +
+ node ace add @adocasts.com/jumpstart +

+ +
+ +[![npm-image]][npm-url] ![][typescript-image] [![license-image]][license-url] + +## Features +Everything you meed to jumpstart your next AdonisJS 6 project +- πŸͺ„ Automatically configures TailwindCSS +- πŸ” Full authentication flow, including remember me +- πŸ” Forgot password ready to go out-of-the-box, including email +- πŸ•΅οΈ Simple profile settings page +- πŸ‘¨β€πŸ’» Simple account settings page with change email & delete account forms +- 🚨 Toast messages to notify your users +- πŸ–οΈ Handy EdgeJS components and layouts to get you going + +## Works With +It is recommended to start from the **Web Starter Kit** as it comes out-of-the-box with most of the AdonisJS core packages we require. +- πŸ•ΈοΈ Web Starter Kit *(recommended)* +- πŸ“ Slim Starter Kit + +## Requires +We require the following AdonisJS core packages. If you're missing any, we'll walk you through adding any you're missing. +- [Vite](https://docs.adonisjs.com/guides/basics/vite) (`@adonisjs/vite`) +- [VineJS](https://docs.adonisjs.com/guides/basics/validation) (`vine`) +- [EdgeJS](https://docs.adonisjs.com/guides/views-and-templates/edgejs) (`edge`) +- [Session](https://docs.adonisjs.com/guides/basics/session) (`@adonisjs/session`) +- [Shield](https://docs.adonisjs.com/guides/security/securing-ssr-applications) (`@adonisjs/shield`) +- [Auth (Session Guard)](https://docs.adonisjs.com/guides/authentication/introduction) (`@adonisjs/auth`) +- [Lucid](https://docs.adonisjs.com/guides/database/lucid) (`@adonisjs/lucid`) +- [Mail](https://docs.adonisjs.com/guides/digging-deeper/mail) (`@adonisjs/mail`) + +## Getting Started +Adocasts Jumpstart only needs to run once and adds/installs everything needed directly into your project so you have full control to change anything you wish. +```shell +node ace add @adocasts.com/jumpstart +``` +All you need to do is install & configure Adocasts Jumpstart. It'll then: +1. Walk you through adding any missing AdonisJS core packages +2. Install the following dependencies directly into your project. Feel free to remove any you don't wish to use + - TailwindCSS (`tailwindcss --dev`) + - Autoprefixer (`autoprefixer --dev`) + - EdgeJS Iconify (`edge-iconify`) + - Iconify Phosphor (`@iconify-json/ph`) + - Iconify SVG Spinners (`@iconify-json/svg-spinners`) +3. Fully configure TailwindCSS inside your project +4. Adds an `APP_URL` environment variable (useful for email link generating) +5. Enables HTTP Method Spoofing (allows REST-based routes) +6. Adds a globals preload file for EdgeJS globals & to configure EdgeJS Iconify +7. Adds all stub files into your project. This will include: + - Controllers + - Models + - Services + - Validators + - Migrations + - Views -> Components + - Views -> Emails + - Views -> Pages +8. Adds Jumpstart's routes to your `routes.ts` file +9. Adds auth methods to your user model + +After that, be sure to update any new environment variables or configurations that may have been added from missing AdonisJS core packages, boot it up, and visit `/jumpstart`. + +[npm-image]: https://img.shields.io/npm/v/@adocasts.com/jumpstart/latest.svg?style=for-the-badge&logo=npm +[npm-url]: https://www.npmjs.com/package/@adocasts.com/jumpstart/v/latest 'npm' +[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript +[license-url]: LICENSE.md +[license-image]: https://img.shields.io/github/license/adocasts/generate-models?style=for-the-badge diff --git a/package.json b/package.json index 9b1ab27..19fd6e1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@adocasts.com/jumpstart", - "description": "", + "description": "Jumpstart your next AdonisJS 6 web project with authentication, forgot password, and more features out-of-the-box.", "version": "0.0.0", "engines": { "node": ">=20.6.0" @@ -62,8 +62,18 @@ "keywords": [ "adonisjs", "auth", - "lucid" + "lucid", + "forgot-password", + "scaffold" ], + "homepage": "https://github.com/adocasts/jumpstart#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/adocasts/jumpstart.git" + }, + "bugs": { + "url": "https://github.com/adocasts/jumpstart/issues" + }, "eslintConfig": { "extends": "@adonisjs/eslint-config/package" }, diff --git a/src/scaffolds/jumpstart_scaffold.ts b/src/scaffolds/jumpstart_scaffold.ts index 9001bab..5dc1844 100644 --- a/src/scaffolds/jumpstart_scaffold.ts +++ b/src/scaffolds/jumpstart_scaffold.ts @@ -3,6 +3,7 @@ import { readFile, writeFile } from 'node:fs/promises' import { stubsRoot } from '../../stubs/main.js' import BaseScaffold from './base_scaffold.js' import TailwindScaffold from './tailwind_scaffold.js' +import { exec } from '../utils/child_process.js' type Import = { defaultImport?: string @@ -49,6 +50,14 @@ export default class JumpstartScaffold extends BaseScaffold { await this.#updateUserModel() this.logger.success('Jumpstart is all set! Visit /jumpstart to get started.') + + const selfDestruct = await this.command.prompt.confirm( + "We're all done here, would you like to uninstall @adocasts.com/jumpstart?" + ) + + if (selfDestruct) { + await exec('npm uninstall @adocasts.com/jumpstart') + } } async #verifyCoreDependencies() { diff --git a/src/utils/child_process.ts b/src/utils/child_process.ts new file mode 100644 index 0000000..243676f --- /dev/null +++ b/src/utils/child_process.ts @@ -0,0 +1,4 @@ +import { promisify } from 'node:util' +import child_process from 'node:child_process' + +export const exec = promisify(child_process.exec)