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

@gatsby-cloud-pkg/merlin-synchronizer

v0.5.2

Published

Synchronizes a gatsby site's data layer with a remote source hosted on GCP

Downloads

28

Readme

Merlin Synchronizer

The synchronizer is responsible for pulling data from a Merlin ledger in GCS via the Gatsby Cloud Ledger API. It can sync all data in a ledger or just the data since the last time it synchronized.

It synchronizes Merlin ledger redux actions for a specific Gatsby Cloud site ID and a specific Gatsby site path local to the process calling synchronize. It handles its own caching via a provided cache function with get and set methods. It returns a promise that's resolved when all actions are synced or its determined that the synchronizer can be invoked in any follower when they need to sync data from Cloud.

Usage

import { synchronize } from "@gatsby-cloud-pkg/merlin-synchronizer"

const { ledgerExists } = await synchronize({
  siteId, // should be a site ID for a Gatsby Cloud site
  gatsbySitePath, // should be an absolute path to a Gatsby site on disk
  cache, // needs cache.get and cache.set methods
  // sourcingConfigurationId, <-- this is optional. a sourcingConfigurationId will be computed from the Gatsby site at the gatsbySitePath. But you can pass this directly too
  handleAction: (action) => {
    // do stuff with this action
    // it's a Gatsby core redux action which was emitted in Merlin and stored in GCS
  },
})
import { computeSourcingConfigurationId } from "@gatsby-cloud-pkg/merlin-synchronizer"

// ...
const sourcingConfigurationId = await computeSourcingConfigurationId(
  pathToGatsbySite
)

Development

You must have previously written a ledger to disk. You can do this by running yarn:start:local in services/cloud-sourcerer in the mansion repo. You may need to set environment variables for the site you are using to generate the ledger.

  1. Run dev-monolith with yarn:start:local in services/dev-monolith
  2. Create an env file with the SITE_ID you used to generate the ledger and the correct port for the API, e.g. GATSBY_CLOUD_DATALAYER=http://localhost:8201/get-ledger-entries if not using 8083
  3. Run yarn run:local in the merlin-synchronizer directory.