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

@tincre/promo-node

v0.1.3

Published

Node and other utilities for the [`promo-button`](https://github.com/Tincre/promo-button).

Downloads

224

Readme

promo-button-node, by Tincre.dev

Node and other utilities for the promo-button.

Installation

Use your favorite package manager to rock installation of promo-button-node.

Yarn

yarn add @tincre/promo-button-node # -D if you want this as a dev dep

Npm

npm install @tincre/promo-button-node # --save-dev if you want it as a dev dep

Environment variables

You'll need the following environment variables available in Node.js:

  • PROMO_CLIENT_ID
  • PROMO_CLIENT_SECRET
  • PROMO_APP_ID
  • PROMO_API_KEY (optional)

These values can be found in the Tincre.dev Dashboard after you're logged in and have created at least one app.

.env.local Example

PROMO_API_KEY=
PROMO_CLIENT_ID=
PROMO_APP_ID=
PROMO_CLIENT_SECRET=

Usage

generateAccessToken

/* An example to hit the promo-api /campaigns endpoint */
import { generateAccessToken } from '@tincre/promo-button-node';

const formData = {...}; // campaign submission data, see https://tincre.dev/docs
const clientSecret = process.env.PROMO_CLIENT_SECRET || "";
const appId = process.env.PROMO_APP_ID || "";
const clientId = process.env.PROMO_CLIENT_ID || "";
let accessTokenSigned = generateAccessToken(
  "http://localhost:3000", // update w/hostname + base route
  clientId,
  appId,
  clientSecret
);
let resultToken = await getToken(accessTokenSigned);
const headers = {
  "Content-Type": "application/json",
  Authorization: `Bearer ${resultToken}`,
};

const promoApiRes = await fetch(`https://promo.api.tincre.dev/campaigns`, {
  method: "POST",
  headers: headers,
  body: JSON.stringify(formData),
});

Support

License

This code is free to use for your commercial or personal projects. It is open-source licensed under the Mozilla Public License 2.0.

You will see various headers throughout the codebase and can reference the license directly via LICENSE herein.

Development

Releases

We use npm for releases. In particular, we use npm --publish to get the job done.

Currently, only @thinkjrs has the ability to release. The following section is written for memory.

Release prep

Prior to using npm --publish a release tag needs to be created for the library using our standard tagging practices.

Ensure that tests :white_check_mark: pass during this process prior to releasing via npm.

Test release

To do a proper release, ensure you're in the base repo directory and run npm publish . --access public --dry-run.

Release latest tag

To complete a full release to the latest npm dist-tag, ensure you're in the base repo directory and run npm publish . --access public.

:tada: That's it! :tada: