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

@matthiesenxyz/astro-gists

v0.3.2

Published

Allows the user to import GitHub Gists by ID through an Astro Component and Octokit

Downloads

160

Readme

Astro-Gists

This is an Astro integration that allows the user to import GitHub Gists by ID through an Astro Component and Octokit

Example

Example of AstroGists in use

Usage

Prerequisites

The Only Requirement to install this package is a Github account with a Verified Email to be able to create a Personal Access Token.

This Integration uses Octokit by GitHub to Generate custom gists using ExpressiveCode within your Astro project!

Installation

Install the integration automatically using the Astro CLI:

pnpm astro add @matthiesenxyz/astro-gists
npx astro add @matthiesenxyz/astro-gists
yarn astro add @matthiesenxyz/astro-gists

Or install it manually:

  1. Install the required dependencies
pnpm add @matthiesenxyz/astro-gists
npm install @matthiesenxyz/astro-gists
yarn add @matthiesenxyz/astro-gists
  1. Add the integration to your astro config
import { defineConfig } from "astro/config";
+import astroGist from "@matthiesenxyz/astro-gists";

// https://astro.build/config
export default defineConfig({
+  integrations: [astroGist({
	// Allows you to set the default theme
	theme: ['catppuccin-macchiato'],
	// Allows you to enable verbose logging
	verbose: false,
+  })]
});

Configuration

Setup your .env file with the following secret from github:

Github Personal Access Token (Classic)

  • No Special Permissions required
  • Octokit recommends creating an empty token for this!
GITHUB_PERSONAL_TOKEN=ghp_YOURPERSONALTOKENHERE

Note: Without this token, you will be HEAVILY limited by quantity of requests made with Octokit. (Unauthorized Octokit Instances are limited to 60 requests per hour)

Note: It is recommended to use this Integration in SSG(Static Site) mode only(or enable prerendering for pages with Gists), as in SSR(Server Rendered) mode that could overload your Octokit request limit quite fast. Keep in mind for each Gist/Gists request made that counts twords your global limit.(60 requests per hour for unauthorized Octokit, 5,000 requests per hour for personal access tokens, and if using a GitHub App by Under GitHub Enterprise Cloud is 15,000+) see GitHub Docs

Usage

<GetGist> Shows a SINGLE gist from a GistCollection

This Utility is meant to display a single Gist as Codeblocks using ExpressiveCode for Astro instead of Scripted Elements using the default Gist method by calling the ID and Filename

---
import { GetGist } from "astro-gists:components"
---
<GetGist 
	gistId="your-gist-id-here"
	filename="name-of-desired-file-to-be-displayed.md" 
/>

<GetGistGroup> Shows all of the Gists from a GistCollection

This Utility is meant to display an entire collection of Gists by ID

---
import { GetGistGroup } from "astro-gists:components"
---
<GetGistGroup 
	gistId="your-gist-id-here"
/>

Contributing

This package is structured as a monorepo:

  • playground contains code for testing the package
  • package contains the actual package

Install dependencies using pnpm:

pnpm i --frozen-lockfile

Start the playground:

pnpm playground:dev

You can now edit files in package. Please note that making changes to those files may require restarting the playground dev server.

Licensing

MIT Licensed. Made with ❤️ by AdamMatthiesen Under MatthiesenXYZ.

Acknowledgements