@@ -11,6 +11,11 @@ REMOTE="git@github.com:reactjs/react-modal"
1111CURRENT_VERSION: =$(shell  jq ".version" package.json) 
1212COVERAGE? =true
1313
14+ BRANCH =$(shell  git rev-parse --abbrev-ref HEAD) 
15+ CURRENT_VERSION: =$(shell  jq ".version" package.json) 
16+ 
17+ VERSION: =$(if  $(RELEASE ) ,$(shell  read -p "Release $(CURRENT_VERSION )  -> " V && echo $$V) ,$(subst  /,-,$(BRANCH ) ) ) 
18+ 
1419help : info
1520	@echo
1621	@echo " Current version: $( CURRENT_VERSION) " 
@@ -38,10 +43,10 @@ info:
3843deps : deps-project deps-docs
3944
4045deps-project :
41- 	@[[  !   -z   " $( YARN ) "  ]]  &&   $( YARN )  install  ||   $( NPM )
46+ 	@$( PKM )
4247
4348deps-docs :
44- 	@gitbook  install
49+ 	@pip  install --user mkdocs mkdocs-material jsx-lexer 
4550
4651#  Rules for development
4752
@@ -64,47 +69,40 @@ lint:
6469	@npm run lint
6570
6671docs : build-docs
67- 	gitbook  serve
72+ 	mkdocs  serve
6873
6974#  Rules for build and publish
7075
7176check-working-tree :
72- 	@sh ./scripts/repo_status
73- 
74- version :
75- 	@echo " [Updating react-modal version]" 
76- 	@sh ./scripts/version $(CURRENT_VERSION ) 
77- 	@$(JQ )  ' .version' |  cut -d\"  -f2 >  .version
78- 
79- branch :
80- 	@echo " [Release from branch]" 
81- 	@git branch |  grep ' ^*' |  awk ' { print $$2 }' >  .branch
82- 	@[[ " ` cat .branch` " !=  " master\n" &&  echo  " Current branch: ` cat .branch` " ||  (echo " Fail. Current branch is not master." &&  exit  1)
77+ 	@[[ !  -z  " ` git status -s` " &&  \ 
78+ 	echo  " Stopping publish. There are change to commit or discard." &&  \ 
79+ 	exit  1
8380
8481changelog :
85- 	@echo " [Updating CHANGELOG.md $( CURRENT_VERSION)  >  ` cat .version ` " 
86- 	@python3 ./scripts/changelog.py v$(CURRENT_VERSION )  v` cat .version ` >  .changelog_update
82+ 	@echo " [Updating CHANGELOG.md $( CURRENT_VERSION) " 
83+ 	@python3 ./scripts/changelog.py v$(CURRENT_VERSION )  v$( VERSION ) >  .changelog_update
8784	@cat .changelog_update CHANGELOG.md >  tmp &&  mv tmp CHANGELOG.md
85+ 	@rm .changelog_update
8886
8987compile :
9088	@echo " [Compiling source]" 
9189	$(BABEL )  src --out-dir lib
9290
9391build : compile
9492	@echo " [Building dists]" 
95- 	@./node_modules/.bin/ webpack --config ./scripts/webpack.dist.config.js
93+ 	@npx  webpack --config ./scripts/webpack.dist.config.js
9694
9795release-commit :
98- 	git commit --allow-empty -m " Release v` cat .version ` " 
96+ 	git commit --allow-empty -m " Release v$( VERSION ) " 
9997	@git add . 
10098	@git commit --amend -m " ` git log -1 --format=%s` " 
10199
102100release-tag :
103- 	git tag " v` cat .version ` " 
101+ 	git tag " v$( VERSION ) " 
104102
105103publish-version : release-commit release-tag
106104	@echo " [Publishing]" 
107- 	git push $(REMOTE )  " ` cat .branch ` " " v` cat .version ` " 
105+ 	git push $(REMOTE )  " $( BRANCH ) " " v$( VERSION ) " 
108106	npm publish
109107
110108pre-publish : clean branch version changelog
@@ -122,7 +120,7 @@ init-docs-repo:
122120build-docs :
123121	@echo " [Building documentation]" 
124122	@rm -rf _book
125- 	@gitbook  build -g reactjs/react-modal 
123+ 	@mkdocs  build 
126124
127125pre-publish-docs : clean-docs init-docs-repo deps-docs
128126
0 commit comments