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

dropbox-paper-cms

v1.1.0

Published

Using Dropbox Paper APIs to generate static content in Vuepress

Downloads

4

Readme

Dropbox Paper CMS

NPM Total Downloads David Dependencies Status Language grade: JavaScript prs welcome styled with prettier License: MIT FOSSA Status

Using Dropbox Paper APIs to generate static content your CMS website

WARNING: Sidebar auto-generation currently only compatible with vuepress

dropbox vuepress

Dropbox Paper CMS was developed so that CMS sites could easily update their content without writing any code. One only needs to write documents in Dropbox Paper, and Dropbox Paper CMS will fetch documents in markdown, save them locally, then optionally update your CMS sidebar with new file paths (currently only available for vuepress, PRs welcome).

Contents

Getting Started

Install

  • With NPM

    npm install dropbox-paper-cms
  • With Yarn

    yarn add dropbox-paper-cms

Generate Dropbox Paper API Token

Create App

  • Generate an access token

Generate Access Token

API Reference

Docs Schema

Each API makes use of this custom schema for your Dropbox Paper documents. Since the Dropbox Paper APIs do not provide a convenient way to fetch and manage content, this module attempts to alleviate that by providing a standard schema to use as you like with all your Dropbox Paper files.

[
  {
    id: 'string',
    folders: [
      {
        id: 'string',
        name: 'string'
      }
    ],
    metaData: JSON,
    content: JSON,
    location: 'string'
  }
]

fetchPaperDocs

Fetches dropbox paper files and metaData from a list of dropbox folders and returns documents in a promise.

Parameters

{Options}

Pass an options object into the fetchPaperDocs function

{
  dropboxApiToken: 'string',
  contentDir: 'string',
  folders: [ 'string' ]
}

| Option | Type | Description | Example | |------------------- |--------------- |--------------------------------------------------------------------------------------- |------------------------------------------------------ | | dropboxApiToken | String | Token generated from your Dropbox Paper App Console | bwgnBMfB-LFFFYDNIYVb1zC6J6kBkvp_FwvISvJp989Tm9dx | | contentDir | String | Name or path of the directory you want dropbox-paper-cms to write markdown files to | 'content' | | folders | [String] | An array of folder names matching the folders in your Dropbox Paper directory | ['blog', 'portfolio', 'guide']

Returns

Promise<Docs>

generateContent

Writes Dropbox Paper docs to local markdown files using node's filesystem module

Parameters

Docs, contentDir

Parameter | Type | Description | Example | |-------------- |----------------------------- |---------------------------------------------|----------------- | | Docs | Docs | Docs returned from fetchPaperDocs | | | contentDir | String | Path to your static content directory | './content' |

Returns

Promise<Docs>

generateConfig

Writes Dropbox Paper docs to local markdown files using node's filesystem module

Parameters

Docs, config

Parameter | Type | Description | Example | |-------------- |----------------------------- |---------------------------------------------|--------------------------------- | | Docs | Docs | Docs returned from fetchPaperDocs | | | config | JSON | Config file for your static site generator | require('./.vuepress/config.js') |

Returns

Promise<Docs>

Examples

const paperCMS = require('dropbox-paper-cms')
const vueConfig = require('./content/.vuepress/config')

const contentDir = 'content'
const options = {
  contentDir,
  dropboxApiToken: 'bwgnBMfB-LFFFYDNIYVb1zC6J6kBkvp_FwvISvJp989Tm9dx ', // NOTE: keep this token secret
  folders: [
    'blog',
    'portfolio',
    'guide'
  ]
}

paperCMS
  .fetchPaperDocs(options)
  .then(docs => paperCMS.generateContent(docs, contentDir))
  .then(docs => paperCMS.generateConfig(docs, vueConfig)) // only compatible with vuepress for now
  .catch(console.error)

Limitations

  • Dropbox API App tokens only support full access to dropbox paper account instead of limiting access to a single folder. This is why you must specify the folders to match the corresponding folders in your Dropbox Paper account.

  • For now, sidebar content only generated in vuepress configuration files, so manual configuration is required for other static site generators.

  • Content is sorted alphabetically (or alphanumerically), but future versions will allow configuration.

  • Paper has no webhooks or other mechanism to trigger a new publication on document changes. (See acknowledgements below for a guide on publishing through slack)

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

FOSSA Status

Acknowledgments

This project was inspired by a project by De Voorhoede on using Dropbox Paper as a Content Management System.

Guide to publish using slack webhooks