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

@renanlido/serverless-routes-generator

v1.0.15

Published

Minimal package that automates routes creation for serverless applications with using serverless.ts config file

Downloads

634

Readme

@renanlido/serverless-routes-generator

GitHub Repo stars npm GitHub npm GitHub top language

Full starter stack to develop CJS/ESM compatible npm packages with TypeScript, Vitest, ESLint, Prettier, and GitHub Actions.

Introducing serverless-routes-generator – an npm package designed to simplify route creation for Serverless applications. With just a few commands, you can effortlessly generate and manage routes in your serverless.ts file, eliminating the need for manual configuration. Whether you’re building a small project or scaling a complex architecture, serverless-routes-generator streamlines your workflow, allowing you to focus on developing features instead of handling boilerplate setup. Enhance your Serverless development experience today with this intuitive and efficient tool!

Tools

  • TypeScript: TypeScript is a typed superset of JavaScript that compiles to plain JavaScript.
  • biome: Biome statically analyzes your code to quickly find problems.
  • GitHub Actions: Automate your workflow from idea to production.
  • tsup - Zero-config bundler for tiny TypeScript libraries.
  • glob - Match files using the patterns the shell uses, like stars and stuff.

Features

  • ESM/CJS ready - Write your code in TypeScript and publish it as ESM and CJS with 0 configuration.
  • Are The types wrong? ready - Passes all the checks for typings on https://arethetypeswrong.github.io/ by default.
  • ESM/CJS test apps setup - Test your package in both ESM and CJS environments already setup for you.
  • Test runner setup - Coming soon
  • Linting setup - Lint your code with ESLint and Prettier already setup for you.
  • GitHub Actions setup - Automate deployments to npm by using GitHub Actions.

Usage Setup

  1. Install the package:

npm

npm install @renanlido/serverless-routes-generator

yarn

yarn add @renanlido/serverless-routes-generator

pnpm

pnpm add @renanlido/serverless-routes-generator
  1. Create de configuration script run and customize the configuration for your project:
{
  "scripts": {
    "generator-init": "serverless-routes-generator init"
  }
}
  1. Integrate the functional decorator on your serverless handler:
import { createHandler } from "@renanlido/serverless-routes-generator";

export const generatePresignedLink = createHandler(
  {
    method: 'POST',
    path: 'test/route-path',
    cors: true,
    name: 'route-path',
  },
  () => {
  // Any handler function here

    return {
      statusCode: 200,
      body: JSON.stringify({ message: 'Hello World' }),
    }
  },
)
  1. Run the command to generate the routes:
{
  "scripts": {
    "generate-routes": "serverless-routes-generator generate"
  }
}

Development Setup

  1. Clone the repository:
git clone [email protected]:renanlido/serverless-routes-generator.git
  1. Install the dependencies:
pnpm install

Development Scripts

  • npm run generate:routes:bin - Generate the routes.
  • npm run generate:bin:init - Generate the bin.
  • npm run generate:bin - Generate the bin.
  • npm run generate:routes - Generate the routes.
  • npm run link:bin - Link the package to the global scope.
  • npm run build - Build the package.
  • npm run type-check - Check the types.
  • npm run check:fix - Check and fix the code.
  • npm run validate - Run the type-check and check:fix scripts.
  • npm run check:exports - Check the exports.
  • npm run local-release - Build the package, version it, and publish it locally.

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

License

This project is licensed under the MIT License. See the LICENSE.md file for details.

Acknowledgements

This project was inspired by the need to streamline route management in Serverless applications. Special thanks to the open-source community for their valuable contributions.