Skip to content

Commit

Permalink
Standard npm template for repo
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Jul 27, 2021
1 parent 59caac2 commit f4291d4
Show file tree
Hide file tree
Showing 8 changed files with 193 additions and 10,682 deletions.
3 changes: 2 additions & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# These are supported funding model platforms

custom: https://bitcoinschema.org
github: BitcoinSchema
custom: https://bitcoinschema.org/?utm_source=github&utm_medium=sponsor-link&utm_campaign=schema&utm_term=schema&utm_content=schema
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Basic dependabot.yml to update npm

version: 2
updates:
- package-ecosystem: 'npm'
target-branch: 'master'
directory: '/'
schedule:
interval: 'daily'
# Check for npm updates at 10am UTC (5am EST)
time: '10:00'
reviewers:
- 'mrz1836'
assignees:
- 'mrz1836'
# Labels must be created first
labels:
- 'update'
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ node_modules/

# WebStorm
.idea

# Mac / Win files
.DS_Store
thumbs.db
todo.md

# Deployment
release
packaged.yaml
29 changes: 29 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Make sure to check the documentation at http://goreleaser.com
# ---------------------------
# GENERAL
# ---------------------------
dist: release
before:
hooks:
# run make
- make test
snapshot:
name_template: '{{ .Tag }}'
changelog:
sort: asc
filters:
exclude:
- '^.github:'
- '^test:'

# ---------------------------
# BUILDER
# ---------------------------
build:
skip: true
# ---------------------------
# Github Release
# ---------------------------
release:
prerelease: true
name_template: 'Release v{{.Version}}'
71 changes: 71 additions & 0 deletions .make/common.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
## Default repository domain name
ifndef GIT_DOMAIN
override GIT_DOMAIN=github.com
endif

## Set if defined (alias variable for ease of use)
ifdef branch
override REPO_BRANCH=$(branch)
export REPO_BRANCH
endif

## Do we have git available?
HAS_GIT := $(shell command -v git 2> /dev/null)

ifdef HAS_GIT
## Do we have a repo?
HAS_REPO := $(shell git rev-parse --is-inside-work-tree 2> /dev/null)
ifdef HAS_REPO
## Automatically detect the repo owner and repo name (for local use with Git)
REPO_NAME=$(shell basename "$(shell git rev-parse --show-toplevel 2> /dev/null)")
REPO_OWNER=$(shell git config --get remote.origin.url | sed 's/git@$(GIT_DOMAIN)://g' | sed 's/\/$(REPO_NAME).git//g')
VERSION_SHORT=$(shell git describe --tags --always --abbrev=0)
export REPO_NAME, REPO_OWNER, VERSION_SHORT
endif
endif

## Set the distribution folder
ifndef DISTRIBUTIONS_DIR
override DISTRIBUTIONS_DIR=./dist
endif
export DISTRIBUTIONS_DIR

help: ## Show this help message
@egrep -h '^(.+)\:\ ##\ (.+)' ${MAKEFILE_LIST} | column -t -c 2 -s ':#'

release:: ## Full production release (creates release in Github)
@test $(github_token)
@export GITHUB_TOKEN=$(github_token) && goreleaser --rm-dist

release-test: ## Full production test release (everything except deploy)
@goreleaser --skip-publish --rm-dist

release-snap: ## Test the full release (build binaries)
@goreleaser --snapshot --skip-publish --rm-dist

replace-version: ## Replaces the version in HTML/JS (pre-deploy)
@test $(version)
@test "$(path)"
@find $(path) -name "*.html" -type f -exec sed -i '' -e "s/{{version}}/$(version)/g" {} \;
@find $(path) -name "*.js" -type f -exec sed -i '' -e "s/{{version}}/$(version)/g" {} \;

tag: ## Generate a new tag and push (tag version=0.0.0)
@test $(version)
@git tag -a v$(version) -m "Pending full release..."
@git push origin v$(version)
@git fetch --tags -f

tag-remove: ## Remove a tag if found (tag-remove version=0.0.0)
@test $(version)
@git tag -d v$(version)
@git push --delete origin v$(version)
@git fetch --tags

tag-update: ## Update an existing tag to current commit (tag-update version=0.0.0)
@test $(version)
@git push --force origin HEAD:refs/tags/v$(version)
@git fetch --tags -f

update-releaser: ## Update the goreleaser application
@brew update
@brew upgrade goreleaser
55 changes: 55 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Common makefile commands & variables between projects
include .make/common.mk

## Set the distribution folder
ifndef DISTRIBUTIONS_DIR
override DISTRIBUTIONS_DIR=./release
endif

## Not defined? Use default repo name which is the application
ifeq ($(REPO_NAME),)
REPO_NAME="schema"
endif

## Not defined? Use default repo owner
ifeq ($(REPO_OWNER),)
REPO_OWNER="BitcoinSchema"
endif

## Default branch
ifndef REPO_BRANCH
override REPO_BRANCH="master"
endif

.PHONY: clean release test

audit: ## Checks for vulnerabilities in dependencies
@npm audit

build: ## Builds the package for web distribution
@npm run build

clean: ## Remove previous builds and any test cache data
@npm run clean
@if [ -d $(DISTRIBUTIONS_DIR) ]; then rm -r $(DISTRIBUTIONS_DIR); fi
@if [ -d build ]; then rm -r build; fi
@if [ -d build_cache ]; then rm -r build_cache; fi
@if [ -d node_modules ]; then rm -r node_modules; fi

install: ## Installs the dependencies for the package
@npm install

lint: ## Runs the standard-js lint tool
@npm run lint

outdated: ## Checks for outdated packages via npm
@npm outdated

release:: ## Deploy to npm
@npm run deploy

start: ## Start the documentation site
@npm run start

test: ## Runs all tests
@npm run test
13 changes: 13 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Security Policy

## Supported & Maintained Versions

| Version | Supported |
| ------- | ------------------ |
| 0.x.x | :white_check_mark: |

## Reporting a Vulnerability

Individuals or organizations that are experiencing a product security issue are strongly encouraged to contact the [project maintainers](mailto:security@bitcoinschema.org).
We welcome reports from independent researchers, industry organizations, vendors, customers, and other sources concerned with our project security.
The minimal data needed for reporting a security issue is a description of the potential vulnerability.
Loading

0 comments on commit f4291d4

Please sign in to comment.