Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

archieml-pipe

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

archieml-pipe

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

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
increased by60%
Maintainers
1
Weekly downloads
 
Created
Source

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;

gulp.task('archie', (cb) => {
    archiePipe('path/to/export/data.json');
    cb();
});

This example uses Gulp, but of course you can use whatever you like. Just call the function, passing it a string which will represent the path to your export file.

Credentials

archieml-pipe will prompt you for credentials to connect to your Google Doc if they haven't alreay been supplied in a archie.json file at the root of your directory. Here's how to get them:

What's you Google doc ID?

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."

What's your Google app client ID?

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.

What's your Google app client secret key?

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

archie.json

You can shortcut several prompts by creating an archie.json file in the root of your project ahead of time. (For example, we use Yeoman to create that file and remember credentials across builds.)

The file needs the following:

{
    "docId": "<Google Doc ID>",
    "clientId": "<Google wep app client ID>",
    "clientSecret": "<Google wep app client secret>",
    "redirectUrl": "http://localhost:6006"
}

Do not change the redirectUrl.

Enter the code you receive from Google here:

archieml-pipe will open a browser that will guide you through the Google permission dialogue, after which you will be redirected with an auth code. Copy and paste it into the prompt.

Token

.gitignore

This library saves authentication details in local files at the root of your project so you don't have to re-enter them. Therefore, it's also a really good idea to add those files to your .gitignore:

# archieml-pipe
archie.json
archie-token.json

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.

FAQs

Package last updated on 30 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc