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

@ordent/netlify-cms-widget-url-preview

v0.0.2

Published

A widget for creating url preview and saving the metadata content.

Downloads

3

Readme

Netlify CMS Widget Starter

A boilerplate for creating Netlify CMS widgets.

Widgets are inputs for the Netlify CMS editor interface. It's a React component that receives user input and outputs a serialized value. Those are the only rules - the component can be extremely simple, like a text input, or extremely complicated, like a full blown markdown editor. They can make calls to external services, and generally do anything that JavaScript can do.

The starter currently provides a basic string widget, which you can customize, extend, or replace entirely with your own widget.

Check out the docs for more details.

Getting started

Clone or fork the repo, then install dependencies:

git clone --depth=1 https://github.com/netlify/netlify-cms-widget-starter.git netlify-cms-widget-<name>
cd netlify-cms-widget-<name>
npm install

Development

To run a copy of Netlify CMS with your widget loaded for development, use the start script:

npm start

Your widget source is in the src directory, where there are separate files for the Control and Preview components.

Production & Publishing

You'll want to take a few steps before publishing a production built package to npm:

  1. Customize package.json with details for your specific widget, e.g. name, description, author, version, etc.
  2. For discoverability, ensure that your package name follows the pattern netlify-cms-widget-<name>.
  3. Delete this README.md, rename README_TEMPLATE.md to README.md, and update the new file for your specific widget.
  4. Rename the exports in src/index.js. For example, if your widget is netlify-cms-widget-awesome, you would do:
if (typeof window !== 'undefined') {
  window.AwesomeControl = Control
  window.AwesomePreview = Preview
}

export { Control as AwesomeControl, Preview as AwesomePreview }
  1. Optional: customize the component and file names in src.
  2. If you haven't already, push your repo to your GitHub account so the source available to other developers.
  3. Create a production build, which will be output to dist:
npm run build
  1. Finally, if you're sure things are tested and working, publish!
npm publish

Deploying a live demo

The development (start) task provides a locally served preview of your widget in the CMS editor. This starter also includes a demo task for deploying this view live. Here's how to get your demo deployed using Netlify.

  1. Assuming your repo is on GitHub, head over to Netlify and create a site from your repo.
  2. The proper settings will be pre-filled based on what's in the netlify.toml file in this repo, so you can just click through to deploy.
  3. Add your deployed site url to README.md, replacing the placeholder url in the demo link.

Note: Be sure to retain the "/demo" at the end of url, as that will automatically redirect to the editor view with your widget.

Once deployed, your demo should look like this, except with your custom widget.