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

tresor

v0.0.1

Published

A tool to fetch Trello API data and store them locally as static JSON files

Downloads

8

Readme

Tresor

⚠️ WIP ⚠️

A tool to fetch Trello API data and store them locally as static JSON files.

With Tresor you can use Trello as redactional UI and content managment system. It will transform a Trello list into a set of static JSON files ready to be served as API for a static website.

How it works ?

This script is responsible to read the Trello API and save the results locally as static JSON files, in a folder structure that allow to consume the data as API endpoints. The static files can be either copied in the client build folder or hosted somewhere else (CDNs, ...), so that the client can then consume the data in a RESTful way.

Setting up Continous Delivery it is then possible to configure a Webhook to trigger a new build when the content served from you API is changed.

This approach will allow your codebase to be entirely static and serverless, but will also have the advantages of a dynamic content management system, as your site will be automatically updated when the content provided by your third-party API changes.

Installation

Run:

npm install tresor

Usage

You will need to copy the API Key and the API Token from your Trello App Key to the config.json file in the project root folder. An example config file will look like this (see options):

{
    "api": {
        "url": "https://api.trello.com/1/",
        "key": "asenoiuwqeWNEUfnewoeFNWQetr3295023rer",
        "token": "ASnqoiwqenmNEWOIWNrffnklef3io2r032rnewfoid3T439543",
        "list": ["124f9hue2983232rj32052s"]
    },
    "dest": {
        "root": "static",
        "all": "all.json",
        "tags": "tags.json",
        "post": "post",
        "tag": "tag",
        "images": false
    },
    "fields": {
        "fields": ["id", "name", "dateLastActivity", "desc", "idList", "labels"],
        "members": true,
        "member_fields": ["fullName", "bio"],
        "attachments": true,
        "attachment_fields": ["previews", "url"]
    },
    "pagination": {
        "entriesPerPage": 20
    }
}

And run the following command to download the JSON files:

tresor

The config options can be also passed as environment variables or as command-line arguments:

API__KEY=asenoiuwqeWNEUfnewoeFNWQetr3295023rer API__TOKEN=ASnqoiwqenmNEWOIWNrffnklef3io2r032rnewfoid3T439543 API__LIST=124f9hue2983232rj32052s tresor

or

tresor --api.key=asenoiuwqeWNEUfnewoeFNWQetr3295023rer --api.token=ASnqoiwqenmNEWOIWNrffnklef3io2r032rnewfoid3T439543 --api.list=124f9hue2983232rj32052s

Options

The options you can add to the config.json file or pass via command-line/environment variable are:

| Name | Description | Default | |-------------|---------------------------------------------------|-------------------------------| | api.url | The base API url | "https://api.trello.com/1/" | | api.key | The API key (required) | | | api.token | The API token (required) | | | api.list | The IDs (as array) of the trello lists to watch (required) | | | dest.root | The folder where all JSON files are saved | "static/" | | dest.all | The filename of the JSON containings all entries | "all.json" | | dest.tags | The filename of the JSON containings all tags | "tags.json" | | dest.post | The folder name where all single posts are saved | "post" | | dest.tag | The folder name where all single tags are saved | "tag" | | dest.images | The folder name where all images will be stored | false (don't download images) | | fields.fields | The post fields to be displayed | ["id", "name", "dateLastActivity", "desc", "idList", "labels"] | | fields.members | Display or not user information (true or false) | true | | fields.member_fields | The user fields to be displayed | ["fullName", "bio"] | | fields.attachments | Display or not attachments information (true or false) | true | | fields.attachment_fields | The attachment fields to be displayed | ["previews", "url"] | | pagination.entriesPerPage | The number of entries in a single JSON | 20 |

To get further information about the fields you can select, please referr to the card, attachment and user documentations.

npx

This module is suitable to be used with npx, so that you don't even need to install the module and add it to your package dependencies. Just add npx tresor to your prebuild hook in the package.json of your module:

{
  [...]
  "scripts": {
    "prebuild": "npx tresor",
  [...]
  }
}

Done!

Help

Running tresor --help will print the following usage manual:

$ tresor --help

  A tool to fetch remote API data and store them locally as static JSON files

  Usage
  $ tresor
  Run tresor

  $ tresor --help
  Print this help message

  $ tresor --version
  Print the current version

  Examples
  $ tresor --api.key=XXX --api.token=XXX --api.list=XXX

  Run the script to request the remote JSON files and save
  them locally.
  You can alternatively pass the configuration options as
  environment variables or writing them to config.json.
  See the online documentation for further information