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

draaft

v0.1.0-alpha8

Published

A CLI to pull content from https://pilot.pm content collaboration platform and feed your static site generator with markdown files

Downloads

14

Readme

Draaft

Draaft is a command line tool that simply allows you to retrieve content produced on Pilot for statics sites generators. Pilot is a content production platform for marketing or communication teams.

🚨 ⚠ Alpha version : This cli is absolutely not production ready and API is subject to changes ⚠ 🚨

Installing

Using npm:

$ npm install -g draaft

Using yarn:

$ yarn global add draaft

Usage

$ npm install -g draaft
$ draaft COMMAND
running command...
$ draaft (-v|--version|version)
draaft/0.1.0-alpha8 darwin-x64 node-v12.18.3
$ draaft --help [COMMAND]
USAGE
  $ draaft COMMAND
...

Configuration

A configuration file with sensible defaults will be created for you in .draaft/config.json when you execute a first command. Only the API token will be prompted.

{
    // Base url of the API ( scheme + host + base path ).
    // You can change this value to force a specific version of the API.
    "apiBaseUrl": "https://app.pilot.pm/integrations/beta/",

    // The secret API token to authenticate yourself in the API
    "apiToken": "secretToken",

    // Should we make page bundles ?
    // If `true`, draaft will create a bundle for each item, containing the content and resources (images).
    // If `false`, all the resources will be created in the `/static/` directory
    "bundlePages": true,

    // The name of the field in `Item.content` that will be used for the page content.
    "contentFieldName": "body",

    // How should we serialize the frontmatter ?
    // Allowed values : "yaml" | "toml"
    "frontmatterFormat": "yaml"

    // Should we handle item translations, and if yes with which organization ?
    // Allowed values : "none" | "directory" | "filename"
    "i18nMode": "none",

    // When i18n is activated, and an item has no language defined, fallback on `i18nDefaultLanguage`
    "i18nDefaultLanguage": "en",

    // Should we create a top-directory with the channel name ?
    // If `true`, draaft will create all files into `/[destDir]/[channel.name]/`
    // If `false`, draaft will create all files into `/[destDir]/`
    "useChannelName": false,

    //Target Static Site Generator.
    // For now, only "hugo" is supported
    "ssg": "hugo"
}

Commands

draaft help [COMMAND]

display help for draaft

USAGE
  $ draaft help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI

See code: @oclif/plugin-help

draaft layout

Create basic layout to display content

USAGE
  $ draaft layout

OPTIONS
  -f, --overwrite
  -h, --help       show CLI help
  -s, --ssg=ssg    Static site generator

See code: src/commands/layout.ts

draaft pull

Pull content and create files on disk

USAGE
  $ draaft pull

OPTIONS
  -h, --help                           show CLI help
  -o, --overwrite                      Empty destination directory before writing
  --channel=channel                    [int] [multiple] Channel to pull content from
  --dest=dest                          Destination directory where to write files
  --publicationState=publicationState  [int] [multiple] workflow state for a published content
  --ssg=hugo|gatsby                    [default: hugo] Your static site generator.

See code: src/commands/pull.ts

draaft states

List all workflow states

USAGE
  $ draaft states

OPTIONS
  -b, --backup  If file exists create backup
  -h, --help    show CLI help
  -s, --save    Save states as file for customisation

See code: src/commands/states.ts

draaft types [ID]

List all item types

USAGE
  $ draaft types [ID]

ARGUMENTS
  ID  ID of type

OPTIONS
  -b, --backup  If file exists create backup
  -h, --help    show CLI help
  -s, --save    Save content shema as file for customisation
  -w, --schema  Display content schema for each type

See code: src/commands/types.ts

Roadmap

Alpha

  • [x] Get content from channel
  • [x] hugo.io : Create _index.file for sections
  • [x] generate basic Hugo layout
  • [x] Data mapper : let user map Draaft response keys to Frontmatter (use Hugo archetype maybe)
  • [x] Generate page bundles
  • [x] Basic documentation

Beta

  • [ ] Generate data files for complex layout (eg. home page)
  • [ ] Option : Flat layout (with frontmatter menu infos + hierarchy)
  • [ ] Option : Merge frontmatter
  • [ ] hugo.io : i18n support
  • [ ] Select which pilot.pm workflow state map with the "draft" frontmatter key in Hugo

V1.0.0

  • [ ] Support Gatsby
  • [ ] Generate complete layout for Hugo and Gatsby with theme selector
  • [ ] Tests

Deploying to npm

Manually bump version number in package.json, then

[optionnal, only if a command has changed] yarn readme
yarn prepack
git add .
git commit
yarn publish