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/scrollable-video

v1.0.4-beta.1

Published

The Reporter scrollable video component

Downloads

649

Readme

scrollable-video

npm (latest) npm (rc)

Usage

Use buildEmbeddedCode

import { google } from 'googleapis'
import scrollableVideo from '@twreporter/scrollable-video'
import webpackAssets from '@twreporter/scrollable-video/dist/webpack-assets.json'

/* FETCH DATA */

const sheets = await new scrollableVideo.Sheets({
  spreadsheetId: 'your target spreadsheet id',
  auth: new google.auth.GoogleAuth({
    keyFile: 'your-key-file-path', // ex: path.resolve(__dirname, './service-account.json')
    scopes: ['https://www.googleapis.com/auth/spreadsheets.readonly'],
  }),
})

const data = await sheets.getJSONData()
// data schema:
// https://github.com/twreporter/orangutan-monorepo/tree/master/packages/scrollable-video/src/types.js

/* BUILD CODE */

const codeString = scrollableVideo.buildEmbeddedCode(data, webpackAssets)

Use the Component

Example:

import ScrollableVideo from '@twreporter/scrollable-video'

const { appProps, ...elseProps } = data
// data schema:
// https://github.com/twreporter/orangutan-monorepo/tree/master/packages/scrollable-video/src/types.js

<ScrollableVideo.Component
  {...appProps}
  {...elseProps}
/>

How to develop this package

Test dev code

The default dev data is the data of our news article: 從租用到迫遷 ── 南鐵東移,25 年政策與地貌的轉變

You can run makefile command to fetch the latest data:

make dev-fetch-data

# Or specify your spreadsheet ids with `in` variable (separate with commas)
make dev-fetch-data in=1qMXdqZXtANzpOVlKRJJfVhr6YBOuzHV65VJBoylvxk0,1JwQ95yOsr7NEaAv4eX2L0b_hgKFVNqB6L2LE_rW_UXc,1P-RjNv-dFpEH0TadDHr8bEg-L-58or4IxeOgTWPO6Mo

If you change the paths of default data (dev/data-1.json, dev/data-2.json, and dev/data-3.json), you need to update the dev/entry.js to to merge your data into the dev sire.

We use webpack-dev-server to render a mock article with all elements for development. You can start the server with:

make dev-server

If you need to change the hostname (usually due to the CORS reasons), add DEV_HOST=[your-custom-hostname] for giving webpack-dev-server the hostname. Example:

# Start the webpack-dev-server with custom hostname
DEV_HOST=testtest.twreporter.org make dev-server

If you need to test your own video files in your machine, you can place them to dev/static/[filename]. The files will be served with url http://localhost:8080/static/[filename] when the webpack-dev-server runs. Remember to update the src of video in your json files:

{
  "video": {
    "sources": [
      {
        "type": "video/mp4",
        "src": "http://localhost:8080/static/googleearth.mp4"
        /* ... */
      }
    ]
  }
  /* ... */
}