Skip to content

Commit

Permalink
breaking: Extend Makefile from @patternslib/dev.
Browse files Browse the repository at this point in the history
  • Loading branch information
thet committed Jun 15, 2022
1 parent 078daa9 commit 9906b70
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 84 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ jobs:
- uses: actions/setup-node@v1
with:
node-version: '14'
- run: npm install yarn
- run: make check
- run: |
make install
make check
98 changes: 16 additions & 82 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,96 +1,30 @@
-include .env
export

ESLINT ?= npx eslint
YARN ?= npx yarn


stamp-yarn:
$(YARN) install
# Install pre commit hook
$(YARN) husky install
touch stamp-yarn


clean-dist:
rm -Rf dist/


.PHONY: clean
clean: clean-dist
rm -f stamp-yarn
rm -Rf node_modules/


eslint: stamp-yarn
$(ESLINT) ./src


.PHONY: check
check:: stamp-yarn eslint
$(YARN) run test


.PHONY: bundle
bundle: stamp-yarn
$(YARN) run build
##############
## Please note
##############

# First, run ``make install``.
# After that you have through Makefile extension all the other base targets available.

# If you want to release on GitHub, make sure to have a .env file with a GITHUB_TOKEN.
# Also see:
# https://github.com/settings/tokens
# and https://github.com/release-it/release-it/blob/master/docs/github-releases.md#automated


release-zip: clean-dist bundle
$(eval PACKAGE_NAME := $(subst @patternslib/,,$(shell node -p "require('./package.json').name")))
$(eval PACKAGE_VERSION := $(shell node -p "require('./package.json').version"))
@echo name is $(PACKAGE_NAME)
@echo version is $(PACKAGE_VERSION)
mkdir -p dist/$(PACKAGE_NAME)-bundle-$(PACKAGE_VERSION)
-mv dist/* dist/$(PACKAGE_NAME)-bundle-$(PACKAGE_VERSION)
cd dist/ && zip -r $(PACKAGE_NAME)-bundle-$(PACKAGE_VERSION).zip $(PACKAGE_NAME)-bundle-$(PACKAGE_VERSION)/


.PHONY: release-major
release-major: check
npx release-it major && \
make release-zip && \
npx release-it --github.release --github.update --github.assets=dist/*.zip --no-github.draft --no-increment --no-git --no-npm && \
git checkout CHANGES.md

.PHONY: release-minor
release-minor: check
npx release-it minor && \
make release-zip && \
npx release-it --github.release --github.update --github.assets=dist/*.zip --no-github.draft --no-increment --no-git --no-npm && \
git checkout CHANGES.md
# Include base Makefile
-include node_modules/@patternslib/dev/Makefile

.PHONY: release-patch
release-patch: check
npx release-it patch && \
make release-zip && \
npx release-it --github.release --github.update --github.assets=dist/*.zip --no-github.draft --no-increment --no-git --no-npm && \
git checkout CHANGES.md

.PHONY: prerelease-alpha
prerelease-alpha: clean install
npx release-it --preRelease=alpha && \
make release-zip && \
npx release-it --github.release --github.update --github.assets=dist/*.zip --no-github.draft --no-increment --no-git --no-npm && \
git checkout CHANGES.md

.PHONY: prerelease-beta
prerelease-beta: clean install
npx release-it --preRelease=beta && \
make release-zip && \
npx release-it --github.release --github.update --github.assets=dist/*.zip --no-github.draft --no-increment --no-git --no-npm && \
git checkout CHANGES.md
# Define the GITHUB_TOKEN in the .env file for usage with release-it.
-include .env
export


.PHONY: serve
serve:: stamp-yarn
$(YARN) run start
.PHONY: install
stamp-yarn install:
npx yarn install
# Install pre commit hook
npx yarn husky install
touch stamp-yarn


#

0 comments on commit 9906b70

Please sign in to comment.