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

@fractional-company/amm-data

v0.0.24

Published

A utility to query vault data across amms

Downloads

25

Readme

WARNING

This utility is under heavy dev. Still trying to find an optimal way to merge multiple subgraph data into one unified API.

!! DO NOT USE IT !!

Fractional AMM utility

A utility to query vault data across amms.

Supported AMMs

  • Uniswap V3
  • Sushiswap

Features

All Build Features

  • Babel - Write next generation JavaScript today.
  • Jest - JavaScript testing framework used by Facebook.
  • ESLint - Make sure you are writing a quality code.
  • Prettier - Enforces a consistent style by parsing your code and re-printing it.
  • Flow - A static type checker for JavaScript used heavily within Facebook.
  • Travis CI - Automate tests and linting for every push or pull request.
  • Documentation - A documentation system so good, you'll actually write documentation.
  • Standard Version - Automate versioning and CHANGELOG generation.

CDN Build Features

  • Rollup - Aggregate code into one compact file.
  • Babel Minify - Slim down code for streamlined, low impact CDN delivery.

Just make sure to edit package.json, README.md and LICENSE files accordingly with your module's info.

Adding Features

  1. Install dependencies:

    npm i -D rollup rollup-plugin-babel rollup-plugin-babel-minify rollup-plugin-commonjs rollup-plugin-node-resolve rollup-plugin-replace rollup-watch
  2. Add a rollup.config.js file in the root of the repository with the following contents:

    import minify from "rollup-plugin-babel-minify";
    
    module.exports = {
      input: "dist/index.js",
      plugins: [
        minify({
          comments: false
          // Any other options for babel-minify.
        })
      ]
    };
  3. Replace the build script/line in the package.json file with the following lines (make sure to replace the {YOUR_PKG_NAME} below with the actual name of your module):

    "build": "npm run build:common-js && npm run build:umd && npm run build:umd:min",
    "build:common-js": "babel src -d dist",
    "build:umd": "node_modules/.bin/rollup src/index.js --file dist/{YOUR_PKG_NAME}.umd.js --format umd --name {YOUR_PKG_NAME}",
    "build:umd:watch": "npm run build:umd -- --watch",
    "build:umd:min": "node_modules/.bin/rollup src/index.js --file dist/{YOUR_PKG_NAME}.umd.min.js --config --format umd --compact --name {YOUR_PKG_NAME}",
  4. Add appropriate entry points to your package.json file:

    "browser": "dist/{YOUR_PKG_NAME}.umd.min.js",
    "cdn": "dist/{YOUR_PKG_NAME}.umd.min.js",
  1. Install dependencies:

    yarn add -D @babel/preset-typescript @types/jest @typescript-eslint/eslint-plugin @typescript-eslint/parser typescript
  2. Update package.json:

    + "types": "dist/ts/src",
      "scripts": {
    +   "type-check": "tsc --noEmit",
    -   "lint": "eslint .",
    +   "lint": "eslint . --ext js,ts,tsx",
    -   "build": "babel src -d dist",
    +   "build": "tsc --emitDeclarationOnly && babel src -d dist -x .js,.ts,.tsx",
      },
      "lint-staged": {
    -   "*.js": [
    +   "*.{js,ts,tsx}": [
    -     "eslint --fix",
    +     "eslint --fix --ext js,ts,tsx",
          "git add"
        ]
      }
  3. Create tsconfig.json

    {
      "compilerOptions": {
        "outDir": "dist/ts",
        "target": "esnext",
        "module": "esnext",
        "moduleResolution": "node",
        "jsx": "react",
        "strict": true,
        "declaration": true,
        "noFallthroughCasesInSwitch": true,
        "noImplicitReturns": true,
        "noUnusedLocals": true,
        "noUnusedParameters": true,
        "stripInternal": true
      }
    }
  4. Update .babelrc:

      "presets": [
    +   "@babel/preset-typescript"
      ]
  5. Update .eslintrc with these settings:

      "settings": {
        "import/resolver": {
          "node": {
            "extensions": [".js", ".jsx", ".ts", ".tsx"]
          }
        }
      },
      "overrides": [
        {
          "files": ["**/*.ts", "**/*.tsx"],
          "parser": "@typescript-eslint/parser",
          "parserOptions": {
            "project": "./tsconfig.json"
          },
          "plugins": [
            "@typescript-eslint"
          ],
          "rules": {
            "no-undef": "off",
            "no-unused-vars": "off",
            "no-restricted-globals": "off"
          }
        }
      ]

Removing Features

  1. Remove .flowconfig file.

  2. Remove flow from package.json

      "scripts": {
    -   "flow": "flow check",
    -   "flowbuild": "flow-copy-source src dist",
    -   "prebuild": "npm run docs && npm run clean && npm run flowbuild",
    +   "prebuild": "npm run docs && npm run clean",
      },
      "devDependencies": {
    -   "@babel/preset-flow": "^7.0.0",
    -   "eslint-plugin-flowtype": "^2.50.0",
    -   "eslint-plugin-flowtype-errors": "^3.5.1",
    -   "flow-bin": "^0.81.0",
    -   "flow-copy-source": "^2.0.2",
      }
  3. Remove flow from .babelrc:

      "presets": [
    -   "@babel/preset-flow"
      ]
  4. Remove flow from .eslintrc:

      "extends": [
    -   "plugin:flowtype/recommended",
    -   "prettier/flowtype"
      ],
      "plugins": [
    -   "flowtype",
    -   "flowtype-errors"
      ],
      "rules": {
    -   "flowtype-errors/show-errors": "error"
      }
  5. Run yarn.

  1. Remove documentation from package.json:

      "scripts": {
    -   "docs": "documentation readme src --section=API",
    -   "postdocs": "git add README.md",
    -   "prebuild": "npm run docs && npm run clean",
    +   "prebuild": "npm run clean",
      },
      "devDependencies": {
    -   "documentation": "^8.0.0",
      }
  2. Run yarn.

Usage

Commands

npm test # run tests with Jest
npm run coverage # run tests with coverage and open it on browser
npm run lint # lint code
npm run docs # generate docs
npm run build # transpile code and build module

Publish

npm run release
npm publish

It'll automatically run test, lint, docs, build, generate CHANGELOG.md, and push commits and tags to the remote repository.