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

@shopify/synapse

v1.1.1

Published

node --experimental-loader ./dist/index.js

Downloads

28

Readme

node --experimental-loader ./dist/index.js

Using Synapse

TODO: publish to internal registry and update this. In the meantime consumers of Synapse can import it as a dependency directly from Github.

Synapse comes with two tools:

  1. A CLI that helps you transform your data into embeddings.
  2. A TypeScript utility library that you can use to compare input to those embeddings, and use the result to craft context-aware prompts/messages to send to OpenAI for completion.

Using the Synapse CLI

You'll need to add commander to your project. yarn add -D commander fast-glob tsx.

To use the CLI make a synapse.config.mts in the root of your project.

Commands

generate all embeddings npx tsx ./path/to/synapse/src/cli.ts embeddings

  • generate embeddings for a synapse group (as you define in synapse.config.mts) npx tsx ./path/to/synapse/src/cli.ts embeddings --name examples

Using the Synapse TS lib

Note that Synapse is packed in ESM format, which is supported in Node once you get things setup correctly. ESM format is nice because it can import both ESM and Commonjs dependencies. See ESM & Node & TypeScript.

Here is a sample Node/TypeScript server configured properly for ESM, that uses Synapse: Shopify/test-synapse.

TODO: document the various functions. In the meantime see test-synapse for an example.

Development on Synapse

Clone this repo and run dev up.

setup OpenAI

To run the tests you'll need an OpenAI account & secret. If you want to use Shopify's talk to your lead (or Teddy Hwang, he's great).

The tests use ejson2env to safely store OpenAI key in the repo.

Once you have your key, copy it and then run dev ejson-paste.

run Synapse in dev mode

yarn dev will start the tsup bundler in watch mode, outputting the result to /dist/*.