From e5fe406111f97269b8a552e9fc5ee285e05941fa Mon Sep 17 00:00:00 2001 From: Bruno Dias Date: Mon, 9 Dec 2019 20:50:44 -0300 Subject: [PATCH] [chore] moving documentation to mkdocs. --- Makefile | 40 ++-- docs/README.md | 184 ----------------- docs/SUMMARY.md | 31 --- docs/accessibility/{README.md => index.md} | 12 +- docs/contributing/development.md | 18 +- docs/contributing/{README.md => index.md} | 2 - docs/examples/css_classes.md | 2 +- docs/examples/global_overrides.md | 2 +- docs/examples/{README.md => index.md} | 11 +- docs/examples/inline_styles.md | 2 +- docs/examples/minimal.md | 2 +- docs/examples/on_request_close.md | 4 +- docs/examples/set_app_element.md | 2 +- .../examples/should_close_on_overlay_click.md | 1 + docs/index.md | 185 ++++++++++++++++++ docs/styles/classes.md | 2 - docs/styles/{README.md => index.md} | 2 - docs/styles/transitions.md | 2 - docs/testing/{README.md => index.md} | 0 mkdocs.yml | 26 +++ 20 files changed, 255 insertions(+), 275 deletions(-) delete mode 100644 docs/README.md delete mode 100644 docs/SUMMARY.md rename docs/accessibility/{README.md => index.md} (96%) rename docs/contributing/{README.md => index.md} (98%) rename docs/examples/{README.md => index.md} (85%) create mode 100644 docs/index.md rename docs/styles/{README.md => index.md} (98%) rename docs/testing/{README.md => index.md} (100%) create mode 100644 mkdocs.yml diff --git a/Makefile b/Makefile index 4a2f1921..b293eca9 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,11 @@ REMOTE="git@github.com:reactjs/react-modal" CURRENT_VERSION:=$(shell jq ".version" package.json) COVERAGE?=true +BRANCH=$(shell git rev-parse --abbrev-ref HEAD) +CURRENT_VERSION:=$(shell jq ".version" package.json) + +VERSION:=$(if $(RELEASE),$(shell read -p "Release $(CURRENT_VERSION) -> " V && echo $$V),$(subst /,-,$(BRANCH))) + help: info @echo @echo "Current version: $(CURRENT_VERSION)" @@ -38,10 +43,10 @@ info: deps: deps-project deps-docs deps-project: - @[[ ! -z "$(YARN)" ]] && $(YARN) install || $(NPM) install + @$(PKM) install deps-docs: - @gitbook install + @pip install --user mkdocs mkdocs-material jsx-lexer # Rules for development @@ -64,27 +69,20 @@ lint: @npm run lint docs: build-docs - gitbook serve + mkdocs serve # Rules for build and publish check-working-tree: - @sh ./scripts/repo_status - -version: - @echo "[Updating react-modal version]" - @sh ./scripts/version $(CURRENT_VERSION) - @$(JQ) '.version' package.json | cut -d\" -f2 > .version - -branch: - @echo "[Release from branch]" - @git branch | grep '^*' | awk '{ print $$2 }' > .branch - @[[ "`cat .branch`" != "master\n" ]] && echo "Current branch: `cat .branch`" || (echo "Fail. Current branch is not master." && exit 1) + @[[ ! -z "`git status -s`" ]] && \ + echo "Stopping publish. There are change to commit or discard." && \ + exit 1 changelog: - @echo "[Updating CHANGELOG.md $(CURRENT_VERSION) > `cat .version`]" - @python3 ./scripts/changelog.py v$(CURRENT_VERSION) v`cat .version` > .changelog_update + @echo "[Updating CHANGELOG.md $(CURRENT_VERSION)]" + @python3 ./scripts/changelog.py v$(CURRENT_VERSION) v$(VERSION) > .changelog_update @cat .changelog_update CHANGELOG.md > tmp && mv tmp CHANGELOG.md + @rm .changelog_update compile: @echo "[Compiling source]" @@ -92,19 +90,19 @@ compile: build: compile @echo "[Building dists]" - @./node_modules/.bin/webpack --config ./scripts/webpack.dist.config.js + @npx webpack --config ./scripts/webpack.dist.config.js release-commit: - git commit --allow-empty -m "Release v`cat .version`." + git commit --allow-empty -m "Release v$(VERSION)." @git add . @git commit --amend -m "`git log -1 --format=%s`" release-tag: - git tag "v`cat .version`" + git tag "v$(VERSION)" publish-version: release-commit release-tag @echo "[Publishing]" - git push $(REMOTE) "`cat .branch`" "v`cat .version`" + git push $(REMOTE) "$(BRANCH)" "v$(VERSION)" npm publish pre-publish: clean branch version changelog @@ -122,7 +120,7 @@ init-docs-repo: build-docs: @echo "[Building documentation]" @rm -rf _book - @gitbook build -g reactjs/react-modal + @mkdocs build pre-publish-docs: clean-docs init-docs-repo deps-docs diff --git a/docs/README.md b/docs/README.md deleted file mode 100644 index bd74a76a..00000000 --- a/docs/README.md +++ /dev/null @@ -1,184 +0,0 @@ -# react-modal - -> Accessible modal dialog component for React.JS - -We maintain that accessibility is a key component of any modern web application. As such, we have created this modal in such a way that it fulfills the accessibility requirements of the modern web. We seek to keep the focus on accessibility while providing a functional, capable modal component for general use. - -## Installation {#installation} - -To install the stable version you can use [npm](https://npmjs.org/) or [yarn](https://yarnpkg.com): - - - $ npm install react-modal - $ yarn add react-modal - - -## General Usage {#usage} - -The only required prop for the modal object is `isOpen`, which indicates -whether the modal should be displayed. The following is an example of using -react-modal specifying all the possible props and options: - -```js -import ReactModal from 'react-modal'; - -