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

sfc-utils

v1.4.156

Published

Importable util functions for our templates

Downloads

470

Readme

utils

Importable util functions for our templates

This package includes some helpful functions that you can use across SFC projects

The copy directory includes the standard ways we copy data from sheets and docs into project data directories. If the sheets command is giving you trouble with types in GraphQL, please note that you can force the command to return only strings by setting the third param to true:

googleAuth(project, null, true)

brands.js has all the LESS settings that are specific to each brand. They are applied to the project in gatsby-config.js using the modifyVars config option. Since it's done at build time, we can only make brand distinctions by deployable market. We cannot use this same override strategy to make a style change between CTPost and New Haven Register, for example (since they are both CT market).

nav.js and footer.js both export the HTML needed for each markets' nav and footer settings. The styles controlling the actual look of these features exists at the project level.

nav2.js overhauls our existing nav and includes styles that are bundled in this repo, giving us an extra level of control.

topper.js implements a cool standardized set of topper options. Great for templates! If story_settings is configured with the right columns, this should be standard across projects.

blueconic.js handles the mapping of domains to the arbitrary string that the blueconic script lives on. Why is there an arbitrary string instead of a standard one? Maybe blueconic.houstonchronicle.com, for example? No one knows.

settings.js reconciles the project-config.json file and a story_settings sheet (if present) into a single standard object.

specialnav.js is a cool variant of nav.js that gives it a floating style for special projects, but works the same way.

Install

This package is now officially in the npm registry! Hopefully that means no more old versions being installed from the cache. You can install the latest like this:

npm i sfc-utils

You can still install what's on master by running npm i git+https://github.com/sfchronicle/utils.git but it will occasionally result in version problems.

Updating utils

Create an npm account and ask Evan to add you as a maintainer. You MUST enable two-factor on your account to push updates. Once you are all set, these are the steps:

  1. Make sure you've incremented the version number in package.json.

  2. Update the master branch with changes you want to push.

  3. Log in to npm via the terminal with npm login (this only needs to be done once).

  4. Run npm publish.

If you want to publish a version of utils that should only be beta, not the default install version, then run npm publish --tag beta instead. Then when installing, you must target the new version directly: npm i [email protected]

Import the functions

import { blendHDN, getSettings } from 'sfc-utils'

Use them

let settings = getSettings()

Troubleshooting

Only an issue for the package installed directly from Github:

If you get a message about a new function not existing in your project, you might need to force a reinstall of this package. The best way to do that is to completely uninstall it and then reinstall it:

npm uninstall sfc-utils && npm i git+https://github.com/sfchronicle/utils.git