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

@slothking-online/sloth

v0.0.7

Published

Sloth CLI is dedicated for use with [slothking.online](https://slothking.online). It generates code from slothking node graphs. Our benchmarks show that it can speed up modern web apps development process up to 2000%. It is a huge step in system desing al

Downloads

7

Readme

Sloth CLI

Sloth CLI is dedicated for use with slothking.online. It generates code from slothking node graphs. Our benchmarks show that it can speed up modern web apps development process up to 2000%. It is a huge step in system desing also.

Installation

$ npm install -g @slothking-online/sloth

Login

$ sloth login <username> <password>

You have to login to use all features of this CLI

or if you don't have account and you haven't created one yet on slothking.online

Register

$ sloth login <username> <password> <repeat_password>

This will log you in automatically of course too.

Generate Code

As this is code generator, which generates code from slothking node graphs. For all examples we will use public user lib.

Node Typescript Backend based on simple http server

Generate backend from node graph.

$ sloth nodets <project> <path>

This generator generates code for your node typescript backend. You can try generating API for public user library to do so:

import * as sloth from "@slothking-online/node";
import * as tg from "typegoose";
import { ObjectId } from "bson";

export type UserType = {
  username: string;
  password: string;
  token: string;
}
export class User extends tg.Typegoose {
  @tg.prop() username: string;
  @tg.prop() password: string;
  @tg.prop() token: string;
}
export const Models = () => ({
  UserModel:new User().getModelForClass(User)
})

const slothking: {
  user: {
    name: string;
    middlewares: {
      isUser: sloth.SlothkingMiddleware<
        {
          token: string;
        },
        { 
          User: tg.InstanceType<User>;
        }
      >
    };
    endpoints: {
      refresh: sloth.SlothkingEndpoint<
        {
          token: string;
          username: string;
        },
        {},
        {
          username: string;
          token: string;
        }
      >;
      auth: sloth.SlothkingEndpoint<
        {
          token: string;
          username: string;
        },
        {},
        {
          username: string;
          token: string;
        }
      >;
      register: sloth.SlothkingEndpoint<
        {
          username: string;
          password: string;
        },
        {},
        {
          username: string;
          token: string;
        }
      >;
      login: sloth.SlothkingEndpoint<
        {
          username: string;
          password: string;
        },
        {},
        {
          username: string;
          token: string;
        }
      >;
      changePassword: sloth.SlothkingEndpoint<
        {
          password: string;
          newPassword: string;
        },
        {},
        {
          username: string;
          token: string;
        }
      >;
      resetPassword: sloth.SlothkingEndpoint<
        {
          username: string;
        },
        {},
        {}
      >;
      resetPasswordFromLink: sloth.SlothkingEndpoint<
        {
          newPassword: string;
          linkToken: string;
        },
        {},
        {}
      >;
      github: sloth.SlothkingEndpoint<
        {
          code: string;
        },
        {},
        {
          username: string;
          token: string;
        }
      >;
    };
  };
} = {
  user: {
    name: 'user',
    middlewares: {
      isUser: {
        name: "isUser"
      }
    },
    endpoints: {
      refresh: {
        path: "refresh",
        middlewares: []
      },
      auth: {
        path: "auth",
        middlewares: []
      },
      register: {
        path: "register",
        middlewares: []
      },
      login: {
        path: "login",
        middlewares: []
      },
      changePassword: {
        path: "changePassword",
        middlewares: []
      },
      resetPassword: {
        path: "resetPassword",
        middlewares: []
      },
      resetPasswordFromLink: {
        path: "resetPasswordFromLink",
        middlewares: []
      },
      github: {
        path: "github",
        middlewares: []
      }
    }
  }
};
export default slothking;

Frontend fetch API

Generate from node graph.

$ sloth fetch-api <project> <path>

This generator generates ready to use functions for your backend solution. You can try generating API for public user library to do so:

$ sloth fetch-api user user.ts
export type UserType = {
  username: string;
  password: string;
  token: string;
};
const slothking: {
  user: {
    name: string;
    endpoints: {
      refresh: (
        params: {
          host: string;
          props: {
            token: string;
            username: string;
          };
          method: "GET" | "POST" | "PATCH" | "DELETE" | "PUT";
        }
      ) => Promise<{
        username: string;
        token: string;
      }>;
      auth: (
        params: {
          host: string;
          props: {
            token: string;
            username: string;
          };
          method: "GET" | "POST" | "PATCH" | "DELETE" | "PUT";
        }
      ) => Promise<{
        username: string;
        token: string;
      }>;
      register: (
        params: {
          host: string;
          props: {
            username: string;
            password: string;
          };
          method: "GET" | "POST" | "PATCH" | "DELETE" | "PUT";
        }
      ) => Promise<{
        username: string;
        token: string;
      }>;
      login: (
        params: {
          host: string;
          props: {
            username: string;
            password: string;
          };
          method: "GET" | "POST" | "PATCH" | "DELETE" | "PUT";
        }
      ) => Promise<{
        username: string;
        token: string;
      }>;
      changePassword: (
        params: {
          host: string;
          props: {
            password: string;
            newPassword: string;
          };
          method: "GET" | "POST" | "PATCH" | "DELETE" | "PUT";
        }
      ) => Promise<{
        username: string;
        token: string;
      }>;
      resetPassword: (
        params: {
          host: string;
          props: {
            username: string;
          };
          method: "GET" | "POST" | "PATCH" | "DELETE" | "PUT";
        }
      ) => Promise<{}>;
      resetPasswordFromLink: (
        params: {
          host: string;
          props: {
            newPassword: string;
            linkToken: string;
          };
          method: "GET" | "POST" | "PATCH" | "DELETE" | "PUT";
        }
      ) => Promise<{}>;
      github: (
        params: {
          host: string;
          props: {
            code: string;
          };
          method: "GET" | "POST" | "PATCH" | "DELETE" | "PUT";
        }
      ) => Promise<{
        username: string;
        token: string;
      }>;
    };
  };
} = {
  user: {
    name: "user",
    endpoints: {
      refresh: ({ host, props, method = "POST" }) =>
        fetch(`${host}user/refresh`, {
          body: JSON.stringify(props),
          method
        }).then(res => res.json()),
      auth: ({ host, props, method = "POST" }) =>
        fetch(`${host}user/auth`, {
          body: JSON.stringify(props),
          method
        }).then(res => res.json()),
      register: ({ host, props, method = "POST" }) =>
        fetch(`${host}user/register`, {
          body: JSON.stringify(props),
          method
        }).then(res => res.json()),
      login: ({ host, props, method = "POST" }) =>
        fetch(`${host}user/login`, {
          body: JSON.stringify(props),
          method
        }).then(res => res.json()),
      changePassword: ({ host, props, method = "POST" }) =>
        fetch(`${host}user/changePassword`, {
          body: JSON.stringify(props),
          method
        }).then(res => res.json()),
      resetPassword: ({ host, props, method = "POST" }) =>
        fetch(`${host}user/resetPassword`, {
          body: JSON.stringify(props),
          method
        }).then(res => res.json()),
      resetPasswordFromLink: ({ host, props, method = "POST" }) =>
        fetch(`${host}user/resetPasswordFromLink`, {
          body: JSON.stringify(props),
          method
        }).then(res => res.json()),
      github: ({ host, props, method = "POST" }) =>
        fetch(`${host}user/github`, {
          body: JSON.stringify(props),
          method
        }).then(res => res.json())
    }
  }
};
export default slothking;

CoronaSDK lua api

$ sloth corona-sdk <project> <path>

More generators

More generators will be added soon