-
Notifications
You must be signed in to change notification settings - Fork 32
/
Makefile
44 lines (32 loc) · 816 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Makefile for building a TypeScript GitHub Action
# Variables
SHELL := /bin/bash
SRC_DIR := src
BUILD_DIR := lib
ENTRY_POINT := $(SRC_DIR)/index.ts
# Binaries
TS_NODE := ./node_modules/.bin/ts-node
TS_C := ./node_modules/.bin/tsc
ESLINT := ./node_modules/.bin/eslint
PRETTIER := ./node_modules/.bin/prettier
# Targets
.PHONY: all clean install build format
all: clean install build
# Clean up the dist directory
clean:
rm -rf $(BUILD_DIR)
# Install npm dependencies
install:
npm install
# Build the TypeScript code
build: clean
$(TS_C) --outDir $(BUILD_DIR) --rootDir $(SRC_DIR)
# Lint the TypeScript code
lint:
$(ESLINT) $(SRC_DIR)
# Format the TypeScript code
format:
$(PRETTIER) --write "$(SRC_DIR)/**/*.ts"
# Run the action locally (for testing purposes)
run: build
node $(BUILD_DIR)/index.js