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

@twreporter/static-fe-deployer

v1.0.1

Published

A tool for deploying `twreporter/static-fe-boilerplate` projects to GCS

Downloads

5

Readme

FEDE: @twreporter/static-fe-deployer

A tool for deploying twreporter/static-fe-boilerplate projects to GCS

Environment

Node

  • 6.0.0 above

Project Files

  • The project directory structure should have:
    • a dist folder contains .html and .js files bundled by Webpack
    • a static folder contains any other static files
project-directory
├── dist
├── static

IMPORTANT

The name of <project-directory> will be the basename of remote root folder. For example:

local:

awsome-infographic
├── dist
├── static

remote will be:

<gcs-project-id>
├─ <gcs-bucket-name>
  ├─ <root-prefix>-awsome-infographic-<root-postfix>
    ├─ dist
    ├─ static

<gcs-project-id>, <gcs-bucket-name>, <root-prefix>, and <root-postfix> are be set in fede-config.json. (See below)

Install and Setup

Install

# npm
npm i -g @twreporter/static-fe-deployer

# yarn
yarn global add @twreporter/static-fe-deployer

Setup GCS authentication

Follow the instruction to setup authetication: Google Cloud Platform Documentation > Authentication > Getting Started with Authentication

Setup fede-config.json

Make sure you have already cd to the project's root folder you want to deploy

fede build-config --project-id <your-gcs-project-id> --bucket-name <your-gcs-bucket-name>

It will create a fede-config.json at your project directory. You can edit it manually after it had been built.

Usage

  Usage: fede [options] [command]

  Options:

    -h, --help                             output usage information

  Commands:

    deploy [options] [files-or-subfolder]  deploy files to remote device
    archive [options] [subfolder-type]     set remote files cache-control
    build-config [options]                 build `fede-config.json` at current directory

deploy

# deploy all files to staging
fede deploy

# deploy `dist` to staging
fede deploy dist

# deploy custom files to production (only allow files under `static` or `dist`)
fede deploy "static/maps/*" --production

# deploy static to production with custom cache time
fede deploy static --production --cache-time 600

# deploy all files to staging with cache-control = 'no-cache, no-store, must-revalidate'
fede deploy --cache-time 0

Archive

# archive all files in staging `dist` and `static`
fede archive

# archive staging `dist`
fede archive dist

# archive production `static`
fede archive static -p

# set production static metadata with custom cache time
fede archive static --production --cache-time 600

# disable staging cache (cache-control = 'no-cache, no-store, must-revalidate')
fede archive --cache-time 0

Default cache-control value

  • staging: public, max-age=60
  • production: public, max-age=600
  • archive: public, max-age=604800 (7 days)

Developement

npm run dev

npm link will be broken if you modify the binary entry file. So we make npm run dev run the npm link right after babel compiled the src/index.js into bin/index.js.

After npm link, it complies other files and watches changes of these files .

If you update the src/index.js, you will need to restart this process with npm run dev again.

Testing

npm test

TODO

  • [ ] Add tests for src/utils and src/actions