-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
33 lines (22 loc) · 1.09 KB
/
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
SRC = $(shell find src)
.DEFAULT_GOAL := help
.PHONY: clean example help lint prepack
clean: ## Clean all build and install artifacts
@git clean -dfX
dist-cjs: node_modules $(SRC)
pnpm exec swc ./src --config-file .swcrc-cjs --out-dir dist-cjs
pnpm exec tsc --emitDeclarationOnly --declaration --declarationMap false --declarationDir dist-cjs
dist-esm: node_modules $(SRC)
pnpm exec swc ./src --config-file .swcrc-esm --out-dir dist-esm
pnpm exec tsc --emitDeclarationOnly --declaration --declarationMap false --declarationDir dist-esm
dist-iife: node_modules $(SRC)
pnpm exec esbuild src/index.ts --bundle --minify --sourcemap --format=iife --global-name=SmartIcon --outfile=dist-browser/smart-icon.iife.min.js
example: dist-iife ## Run an example server
pnpm exec serve
lint: node_modules $(SRC)
pnpm exec eslint src --ext=ts
node_modules: package.json pnpm-lock.yaml
@pnpm install
prepack: dist-cjs dist-esm dist-iife ## Build for publication to npm
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'