Add an NPM_TOKEN
secret on GitHub. Get your secret key from the NPM dashboard.
- name: Authenticate with private NPM package
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
const textIsWhite = (color: string): boolean => { | |
const hex = color.replace("#", ""); | |
const c_r = parseInt(hex.slice(0, 2), 16); | |
const c_g = parseInt(hex.slice(2, 4), 16); | |
const c_b = parseInt(hex.slice(4, 6), 16); | |
const brightness = ((c_r * 299) + (c_g * 587) + (c_b * 114)) / 1000; | |
return brightness < 155; | |
}; |
The package that linked you here is now pure ESM. It cannot be require()
'd from CommonJS.
This means you have the following choices:
import foo from 'foo'
instead of const foo = require('foo')
to import the package. You also need to put "type": "module"
in your package.json and more. Follow the below guide.await import(…)
from CommonJS instead of require(…)
.#!/usr/bin/env bash | |
# | |
# gh-dl-release! It works! | |
# | |
# This script downloads an asset from latest or specific Github release of a | |
# private repo. Feel free to extract more of the variables into command line | |
# parameters. | |
# | |
# PREREQUISITES | |
# |