Skip to content

Commit

Permalink
build: bundle all with ncc
Browse files Browse the repository at this point in the history
  • Loading branch information
ianwremmel committed Aug 16, 2020
1 parent 79e3428 commit 0f27752
Show file tree
Hide file tree
Showing 5 changed files with 1,691 additions and 73 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
node_modules

.sentinel
build
59 changes: 59 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# This Makefile has been written according to guidelines at
# https://tech.davis-hansson.com/p/make/

# Use ">" instead of "\t" for blocks to avoid surprising whitespace issues
ifeq ($(origin .RECIPEPREFIX), undefined)
$(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later. If you've installed an up-to-date Make with homebrew, you maye need to invoke 'gmake' instead of 'make'.)
endif
.RECIPEPREFIX = >

# Make sure we use actual bash instead of zsh or sh
SHELL := bash

# Enfore bash "strict mode"
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
.SHELLFLAGS := -euo pipefail -c

# Use one shell session per rule instead of one shell session per line
.ONESHELL:

# Delete the target of a Make rule if the rule fails
.DELETE_ON_ERROR:

# Warn on undefined variables
MAKEFLAGS += --warn-undefined-variables

# Disabling all the magical-but-unreadable bits of Make
MAKEFLAGS += --no-builtin-rules

# Wrap npx so it only uses local dependencies
NPX := npx --no-install

SRC := $(shell find src -type f)

# The first entry in a make file is the one that gets called by `make` without
# arguments
default: dist/index.js
.PHONY: default

clean:
> rm -rf .sentinel build dist
.PHONY: clean

.sentinel/lint/es: $(SRC)
> npm run lint:es
> @mkdir -p $(@D)
> @touch $@

.sentinel/lint/types: $(SRC)
> npm run lint:types
> @mkdir -p $(@D)
> @touch $@

.sentinel/build: $(SRC)
> $(NPX) babel --extensions '.js,.ts' --source-maps -d build src
> @mkdir -p $(@D)
> @touch $@

dist/index.js: .sentinel/build
> $(NPX) ncc build build/index.js --source-map
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ inputs:
required: false
runs:
using: 'node12'
main: 'index.js'
main: 'dist/index.js'
Loading

0 comments on commit 0f27752

Please sign in to comment.