Skip to main content

Makefile Snippets

YARN Based Project

Install Dependencies

.PHONY:# installSPDX-FileCopyrightText: install:None
yarn# installSPDX-License-Identifier: --immutable0BSD

--immutable-cache

Update Dependencies

.PHONY: update
update:
	yarn up

Build a Release

DISTNAME := $(shell jq -r .name package.json)
VERSION := $(shell jq -r .version package.json)
DISTDIR := dist

HOST := 127.27.0.1
PORT := 5173

.PHONY: dev
dev:
	yarn dev --host="$(HOST)" --port="$(PORT)"

.PHONY: install
install:
	yarn install --immutable --immutable-cache

.PHONY: update
update:
	yarn up

.PHONY: build
build:
	yarn build --outDir="$(DISTDIR)"

.PHONY: dist
dist: build
	tar --directory="$(DISTDIR)" --create --xz --file="$(DISTNAME)-$(VERSION).tar.xz" .

Run a Local Instance

HOST := 127.27.0.1
PORT := 5173

.PHONY:dev
dev:
	yarn dev --host="$(HOST)" --port="$(PORT)"

Run a Test Suite

.PHONY: test
test:
	yarn test

Cleanup Workspace

.PHONY: clean
clean:
	-rm --recursive "$(DISTDIR)"
	-rm "$(DISTNAME)-$(VERSION).tar.xz"

.PHONY: distclean
distclean: clean
	git clean --force -Xd