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

newton-aidocs

v1.0.8

Published

A CLI that creates your API documentation for you with AI

Downloads

15

Readme

Example

Node.js (Express) project

[showing input and outputs]

const express = require('express');
const app = express();

app.post('/users', (req, res) => {
    const { username, email } = req.body;

    res.status(200).json({ message: 'User created successfully', username, email });
    if (!username || !email) {
        res.status(400).send('Missing required arguments');
    }
});
.
.
.
[full source in examples/express-app/index.js]

Set up

Installing

  1. Install newton globally:
npm install -g newton-aidocs
  1. Perform first time set up by configuring newton with an OpenAI API key that has billing set up:
npx newton

Note: This creates a .newton file in your home directory where this API key, along with any other future customizable newton configurations, is stored.

Updating

  1. Check the version you have installed:
npx newton --version
  1. If it is not equivalent to the latest version:
npm update -g newton-aidocs

Usage

To start an interactive prompt to provide newton with the details to generate the documentation for your API:

npx newton

If you have an existing api-documentation.json file previously generated by newton and want to export it to another newton format (i.e. Markdown, HTML, Next.js):

npx newton -t

Changelog

Specifications

  1. For Express.js (Node.js) projects, newton works best when:
  • the input file contains Express.js routes, e.g. where each route begins on a new line with app.{get, post, put, delete}:
const express = require('express')
const app = express()
const port = 80

app.use(express.json());

app.post('/api/auth', async (req, res) => {
  const uid = req.body.uid;
  const user = db.collection('users').doc(uid);

  await user.set({
    uid: uid,
    last_login: Timestamp.now(),
  });

  res.send('Logged in user with uid ' + uid);
});
.
.
.
  1. For Flask (Python) projects, newton works best when:
  • the input file contains the Flask routes, e.g. where each route begins on a new line with @app.route:
from flask import Flask, request
.
.
.
app = Flask(__name__)

@app.route("/user/metadata", methods=['GET'])
def get_user():
    email = request.args.get('email')
    user = users.get_user(email)
    return user, 200

@app.route("/user/create", methods=['POST'])
def create_user():
    email = request.args.get('email')
    role = request.args.get('role')
    if role not in ["staff"]:
        return "Invalid role", 400
    user_created = users.create_user(email, role)
    return user_created, 200
.
.
.

Note: The files mentioned above are provided for illustrative purposes only and do not guarantee functionality. However, their formats served as a guideline for Newton's parsing functionalities.

What is transmogrify?