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

archieml-pipe

v0.1.0

Published

Pipe a Google Doc with ArchieML data to local JSON with easy authentication steps.

Downloads

16

Readme

POLITICO

archieml-pipe npm version

archieml-pipe is a library to help easily export data structured in ArchieML in Google Docs to local JSON. You can then use that data as context to render HTML templates.

We use this library in order to separate the function of writing and editing text from producing interactive content for the web in the POLITICO newsroom.

Read all about how to use ArchieML, then see how you can use this library to easily authenticate and export structured data from Google Docs.

Usage

Use archieml-pipe in your build system:

const gulp = require('gulp');
const archiePipe = require('archieml-pipe').default;

const config = {
  googleDocId: '<google doc id>', // required
  googleClientId: '<google client id>', // required
  googleClientSecret: '<google client secret>', // required
  redirectPort: '6006', // defaults to 6006
  exportPath: 'path/to/save/data.json', // defaults to ./data.json
  tokenPath: 'path/to/save/token.json', // defaults to ./archie-token.json
};

gulp.task('archie', (cb) => {
    archiePipe(config);
    cb();
});

This example uses Gulp, but of course you can use whatever you like. Just call the function, passing it a config object with the required properties.

Credentials

googleDocId

Simply open you doc in the browser and copy the ID from the URL:

GoogleDoc

Don't forget to change your share settings to "Anyone with the link can view."

googleClientId

Oauth

  1. Go to the Google Developers Console and create a new project.

  2. Create credentials for an OAuth client ID.

  3. Select "Web Application" for the Application Type, and give your client a name.

  4. Add http://localhost to Authorized JavaScript origins

  5. Add http://localhost:6006 to Authorized Redirect URIs

  6. Click create and copy both the client ID and client secret.

  7. Go to the Library tab in the left rail and search for the Drive API

  8. Click it and enable the API in the next screen.

googleClientSecret

Use the client secret key you copied out of the previous step.

Token

On your first run, archieml-pipe will open a browser that will guide you through the Google permission dialogue to access you document, after which you will be redirected with an auth code. Copy and paste it into the prompt and archieml-pipe will save the token locally to a JSON file at tokenPath.

Token

Credits

archieml-pipe is cobbled together from several other great ArchieML libs, namely:

Developing

Make changes in src/ and then run $ gulp to transpile ES6 code.