npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@galadrim/adonis-scaffolder

v2.0.5

Published

## Why?

Downloads

161

Readme

Galadrim Adonis API Scaffolder

Why?

Imagine you have to create new projects every week or so, you will then not want to lose time in creating by hand boiler plate files over and over again in order to create CRUDL API for each of your Models (that and writing the same auth API for login, logout, reset password...)

I'm working in a web agency and this package helps me to be faster, use it if you want, if you have questions, I will be happy to help

Install

  • npm npm i -D @galadrim/adonis-scaffolder
  • yarn yarn add --dev @galadrim/adonis-scaffolder

View package

You must have adonis view package installed and configured

Install:

  • npm npm i @adonisjs/view
  • yarn yarn add @adonisjs/view

Configure:

  • node ace configure @adonisjs/view

Config

run node ace configure @galadrim/adonis-scaffolder

This will create the files needed for the scaffolder in YOUR code. This enables you to customise everything the scaffolder do. Once you have installed this scaffolder, it becomes your code, do whatever you want with it!

Usage

Imagine you want to create a CRUDL API for your Post model

First, anotate some fields of the Post model

export default class Post extends BaseModel {
  @column({ isPrimary: true })
  public id: number

  @column(scaffold('string'))
  public name: string

  @column(scaffold('number.nullable'))
  public price: number | null

  @column.dateTime({ autoCreate: true })
  public createdAt: DateTime

  @column.dateTime({ autoCreate: true, autoUpdate: true })
  public updatedAt: DateTime
}

Then, you can use the ace command line to scaffold the files:

node ace scaffold Post

this will create:

CREATE: app/Controllers/Http/posts/PostsController.ts
CREATE: app/Controllers/Http/posts/postSchema.ts
CREATE: app/Controllers/Http/posts/postsList.ts
CREATE: app/Controllers/Http/posts/destroyPost.ts
CREATE: app/Controllers/Http/posts/showPost.ts
CREATE: app/Controllers/Http/posts/storePost.ts
CREATE: app/Controllers/Http/posts/updatePost.ts

I don't guarantee that the scaffolder output will be nicely formatted I advise to run your formatter after generating files

  • npm npm run format
  • yarn yarn format

Further instructions

  • once you have scaffolded your API routes for a model you can edit the files created
  • don't re run the command as it will overwrite your changes
  • this tool is intended to win you some time on boilerplate only, once the files generated, you are on your own 😉

Bonus

there is a secret command to generate auth api 🤫

node ace scaffold auth