Skip to content

Instantly share code, notes, and snippets.

View darcyclarke's full-sized avatar
🔥
busy building things...

Darcy Clarke darcyclarke

🔥
busy building things...
View GitHub Profile
@darcyclarke
darcyclarke / npm-audit.sh
Last active October 7, 2020 22:00
A `npm audit <pkg>` proof-of-concept in bash...
#!/bin/bash
PKG=package.json
DIR=npm-audit-tmp
mkdir $DIR && cd $DIR && [[ $* == *--dry-run* && -f "../$PKG" ]] && cp "../$PKG" $PKG || echo '{}' >$PKG && npm i $1 --no-audit --package-lock-only --silent; npm audit; cd ../ && rm -rf $DIR
# Installation:
# 1. copy this into a file: /usr/local/bin/npm-audit
# 2. make it executable: chmod +x /usr/local/bin/npm-audit
# Usage:
@darcyclarke
darcyclarke / package.json
Last active October 7, 2020 03:49
npm prepublish check for package@version existence
{
"scripts": {
"prepublish" : "[[ $(npm view $npm_package_name@$npm_package_version --silent) ]] && echo \"error: $npm_package_name@$npm_package_version exists already!\" && exit 1 || echo \"successful check: $npm_package_name@$npm_package_version does not exist already\""
}
}
@darcyclarke
darcyclarke / get-authors-from-deps.js
Created March 9, 2022 18:49
Get All Contributors From Dependencies
const{ promisify } = require('util')
const Arborist = require('@npmcli/arborist')
const read = promisify(require('read-package-json'))
const arb = new Arborist({ path: '.' })
arb.loadActual().then(async tree => {
const authors = {}
const deps = []
function store (author) {
if (author.email && !authors[author.email]) {
authors[author.email] = author
@darcyclarke
darcyclarke / bug.yml
Last active November 29, 2023 19:57
Managing Releases + Version Labels + Issues w/ Version Fields
# .github/ISSUE_TEMPLATE/bug.yml
# A basic bug template...
# NOTE: `id` must be set for the `version` & correspond to...
# whatever the value you reference later when you parse an issue
name: Bug w/ Input
description: Something bad happened
labels: [bug]
body:
- type: input