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

json-google-docs

v0.2.1

Published

Uses Google Apps Scripts with Google Docs to provide a document tree in JSON exposed on a GET URL for integration into anything.

Downloads

23

Readme

JSON-Google-Docs

Maintenance Status NPM version Travis build

Uses Google Apps Scripts with Google Docs to provide a document tree in JSON exposed on a GET URL for integration into anything.

https://techcoop.github.io/json-google-docs/

Warning: This is should be considered extremely experimental

Requirements

  1. A Google Account
  2. Your Google Doc with text content with headers
  3. node > 6.0.0 (Optional)
  4. yarn (or npm latest) > 0.10.0 (Optional)

Installation

Google Scripts

  1. Open your google doc document
  2. Click on "Tools" > "Script Editor..."
  3. Name your project something memorable
  4. Replace contents of code.gs with this file
  5. Click on Publish and select "Deploy as web app"
  6. Select new and type a version name (e.g 0.1.0) (or update existing)
  7. In "Execute the app as" select yourself
  8. In "Who has access to the app" Select "Anyone, even anonymous"
  9. Click Deploy or Update
  10. Click "Review Permissions", to Authorize application
  11. When you see a warning, Click "Advanced" and "Go to json-google-docs Demo"
  12. Review list of permissions required, and click "Allow"
  13. Copy and paste URL (note: if you're logged into multiple Google accounts you'll have to manually remove "/u/0" or similar from the URL to avoid errors)

NPM package

yarn add json-google-docs

Usage

ES6

import { Document } from 'json-google-docs'

const uri = 'https://script.googleusercontent.com/macros/echo?user_content_key=hqAM2uUtmlnuSybtM-GbVnbqBG864jAwf7wPuMjLNY87kFc58orubUuGr2s4w_nU_2XbOUdnOhQYqydGFSerxTZcYg2lq4EUm5_BxDlH2jW0nuo2oDemN9CCS2h10ox_1xSncGQajx_ryfhECjZEnKHUxXDtU9d-4s_ZDMMZ5puQfuxCLCTCap-xNYsg5JYoTjyvpSz_6jTgQHY_bPxQKPKfVnhjI6Uu&lib=Mb46ZgXAGNpXApDvE_4m9szZqqPiN-w-P'
const doc = new Document(uri)

doc.fetch().then(() => {
  console.log(doc.get('Title'))
})

Node

var JSONGoogleDocs = require('json-google-docs')
var uri = 'https://script.googleusercontent.com/macros/echo?user_content_key=hqAM2uUtmlnuSybtM-GbVnbqBG864jAwf7wPuMjLNY87kFc58orubUuGr2s4w_nU_2XbOUdnOhQYqydGFSerxTZcYg2lq4EUm5_BxDlH2jW0nuo2oDemN9CCS2h10ox_1xSncGQajx_ryfhECjZEnKHUxXDtU9d-4s_ZDMMZ5puQfuxCLCTCap-xNYsg5JYoTjyvpSz_6jTgQHY_bPxQKPKfVnhjI6Uu&lib=Mb46ZgXAGNpXApDvE_4m9szZqqPiN-w-P'
var doc = new JSONGoogleDocs.Document(uri)

doc.fetch().then(function() {
  console.log(doc.get('Title'))
})

Javascript

<script src="json-google-docs.js"></script>
var url = 'https://script.googleusercontent.com/macros/echo?user_content_key=hqAM2uUtmlnuSybtM-GbVnbqBG864jAwf7wPuMjLNY87kFc58orubUuGr2s4w_nU_2XbOUdnOhQYqydGFSerxTZcYg2lq4EUm5_BxDlH2jW0nuo2oDemN9CCS2h10ox_1xSncGQajx_ryfhECjZEnKHUxXDtU9d-4s_ZDMMZ5puQfuxCLCTCap-xNYsg5JYoTjyvpSz_6jTgQHY_bPxQKPKfVnhjI6Uu&lib=Mb46ZgXAGNpXApDvE_4m9szZqqPiN-w-P'
var doc = new JSONGoogleDocs.Document(url)

doc.fetch().then(function() {
  console.log(doc.get('Title'))
})

Testing

Google Scripts

There is a test function setup that you can change to include your own fields and make sure your form is setup correctly.

  1. Change the testData in test_get()
  2. Move to Run in the top menu)
  3. Click function test_get()

Client library

# Run unit test
yarn test

Releasing

# Create new versioned release
yarn run release

Examples

Demo

You can see a demo for this: https://techcoop.github.io/json-google-docs/

You can see the original google docs here: https://docs.google.com/document/d/1bWzB8QWraOfoYG_ptIBTGz0aRWphbiXLvKWg-zs1gz4/edit

You can see the JSON source here: https://script.googleusercontent.com/macros/echo?user_content_key=hqAM2uUtmlnuSybtM-GbVnbqBG864jAwf7wPuMjLNY87kFc58orubUuGr2s4w_nU_2XbOUdnOhQYqydGFSerxTZcYg2lq4EUm5_BxDlH2jW0nuo2oDemN9CCS2h10ox_1xSncGQajx_ryfhECjZEnKHUxXDtU9d-4s_ZDMMZ5puQfuxCLCTCap-xNYsg5JYoTjyvpSz_6jTgQHY_bPxQKPKfVnhjI6Uu&lib=Mb46ZgXAGNpXApDvE_4m9szZqqPiN-w-P

TODO

  • TODO implement search or nested element fetching

Contributors

[email protected]