Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation: create documentation site #36

Merged
merged 18 commits into from
Apr 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ module.exports = {
jest: true,
},
extends: ["standard", "prettier"],
ignorePatterns: ["node_modules/**", "dist/**", "build/**", ".coverage/**"],
ignorePatterns: ["**/node_modules/**", "**/dist/**", "**/build/**", "**/.coverage/**"],
};
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
.vscode

site
tools/mkdocs/reference/tmp/
node_modules
package-lock.json

dist
__pycache__

build
dist

.coverage

.venv_vizzu_story
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
node_modules
package-lock.json

dist
build

.coverage

*.md
1 change: 1 addition & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = {
printWidth: 80,
endOfLine: "auto",
};
4 changes: 3 additions & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Code of Conduct

See [Code of Conduct](https://github.com/vizzuhq/vizzu-lib/blob/main/CODE_OF_CONDUCT.md) of the Vizzu community.
See
[Code of Conduct](https://github.com/vizzuhq/vizzu-lib/blob/main/CODE_OF_CONDUCT.md)
of the Vizzu community.
55 changes: 41 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,41 @@

## Issues

You can find our open issues in the project's [issue tracker](https://github.com/vizzuhq/vizzu-ext-js-story/issues). Please let us know if you find any issues or have any feature requests there.
You can find our open issues in the project's
[issue tracker](https://github.com/vizzuhq/vizzu-ext-js-story/issues). Please
let us know if you find any issues or have any feature requests there.

## Contributing

If you want to contribute to the project, your help is very welcome. Just fork the project, make your changes and send us a pull request.
You can find the detailed description of how to do this in
If you want to contribute to the project, your help is very welcome. Just fork
the project, make your changes and send us a pull request. You can find the
detailed description of how to do this in
[Github's guide to contributing to projects](https://docs.github.com/en/get-started/quickstart/contributing-to-projects).

## CI-CD

### Development environment

You can initialize the development environment of vizzu-story with npm.
You can initialize the development environment of `vizzu-story` with npm.

Run `npm install` or `npm update --dev` command to set up your environment.

```sh
npm install # npm update --dev
```

**Note:** You can set up git hooks into your local git repository with the `prepare` script. Pre-commit hook is going to format the code with `prettier` and pre-push hook is going to run the CI steps.
**Note:** You can set up git hooks into your local git repository with the
`prepare` script. Pre-commit hook is going to format the code with `prettier`
and pre-push hook is going to run the CI steps.

```sh
npm run prepare
```

### CI

The CI steps check code formatting, run code analyses and run unit tests over the vizzu-story project.
The CI steps check code formatting, run code analyses and run unit tests over
the `vizzu-story` project.

The `check` script runs the above tasks.

Expand All @@ -40,7 +46,7 @@ npm run check

#### Formatting

The vizzu-story project is formatted with `prettier`.
The `vizzu-story` project is formatted with `prettier`.

Run the `prettier` script to format your code.

Expand All @@ -56,7 +62,7 @@ npm run check-prettier

#### Code analyses

The vizzu-story project is analysed with `eslint`.
The `vizzu-story` project is analysed with `eslint`.

Run the `check-eslint` script to run code analyses.

Expand All @@ -72,25 +78,46 @@ npm run eslint

#### Testing

The vizzu-story project is tested with `jest` testing framework.
The `vizzu-story` project is tested with `jest` testing framework.

Run the `test` script to run the tests.

```sh
npm test
```

### Documentation

Run the doc make target to build the documentation.

```sh
make dev

make check

make doc
```

Online version can be read at
[vizzu-story.vizzuhq.com](https://vizzu-story.vizzuhq.com/latest/).

### Release

vizzu-story is distributed on [npm](https://www.npmjs.com/package/vizzu-story). **Note:** You need to be an administrator to release the project.
`vizzu-story` is distributed on
[npm](https://www.npmjs.com/package/vizzu-story). **Note:** You need to be an
administrator to release the project.

If you want to release vizzu-story follow the steps below.
If you want to release `vizzu-story` follow the steps below.

- You should increase the version number in `package.json`. The version bump should be in a separated commit.
- You should increase the version number in `package.json`. The version bump
should be in a separated commit.

- Generate the release notes and publish the new release on [Releases](https://github.com/vizzuhq/vizzu-ext-js-story/releases).
- Generate the release notes and publish the new release on
[Releases](https://github.com/vizzuhq/vizzu-ext-js-story/releases).

**Note:** Publishing a new release will automatically trigger the `release` workflow which builds and uploads the vizzu-story package to [npm](https://www.npmjs.com/package/vizzu-story).
**Note:** Publishing a new release will automatically trigger the `release`
workflow which builds and uploads the `vizzu-story` package to
[npm](https://www.npmjs.com/package/vizzu-story).

You can build the package before a release with the `build` script.

Expand Down
119 changes: 119 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
PACKAGE = vizzu-story
OS_TYPE = linux
PYTHON_BIN = python3
BIN_PATH = bin
ifeq ($(OS), Windows_NT)
OS_TYPE = windows
PYTHON_BIN = python
BIN_PATH = Scripts
endif



.PHONY: clean \
clean-dev update-dev-req install-dev-req touch-dev \
clean-dev-js touch-dev-js \
check format check-format lint check-lint check-typing \
clean-doc doc

VIRTUAL_ENV = .venv_vizzu_story

DEV_BUILD_FLAG = $(VIRTUAL_ENV)/DEV_BUILD_FLAG
DEV_JS_BUILD_FLAG = $(VIRTUAL_ENV)/DEV_JS_BUILD_FLAG



clean: clean-dev clean-dev-js clean-doc



# init

clean-dev:
$(PYTHON_BIN) -c "import os, shutil;shutil.rmtree('$(VIRTUAL_ENV)') if os.path.exists('$(VIRTUAL_ENV)') else print('Nothing to be done for \'clean-dev\'')"

clean-dev-js:
$(PYTHON_BIN) -c "import os, shutil;shutil.rmtree('node_modules') if os.path.exists('node_modules') else print('Nothing to be done for \'clean-dev-js\'')"

update-dev-req: $(DEV_BUILD_FLAG)
$(VIRTUAL_ENV)/$(BIN_PATH)/pip-compile --upgrade dev-requirements.in

install-dev-req:
$(VIRTUAL_ENV)/$(BIN_PATH)/pip install --use-pep517 -r dev-requirements.txt

touch-dev:
$(VIRTUAL_ENV)/$(BIN_PATH)/$(PYTHON_BIN) tools/make/touch.py -f $(DEV_BUILD_FLAG)

touch-dev-js:
$(VIRTUAL_ENV)/$(BIN_PATH)/$(PYTHON_BIN) tools/make/touch.py -f $(DEV_JS_BUILD_FLAG)

dev: $(DEV_BUILD_FLAG)

dev-js: $(DEV_BUILD_FLAG) $(DEV_JS_BUILD_FLAG)

$(DEV_BUILD_FLAG):
$(PYTHON_BIN) -m venv $(VIRTUAL_ENV)
$(VIRTUAL_ENV)/$(BIN_PATH)/$(PYTHON_BIN) -m pip install --upgrade pip
$(MAKE) -f Makefile install-dev-req
$(MAKE) -f Makefile touch-dev

$(DEV_JS_BUILD_FLAG):
npm install .
$(MAKE) -f Makefile touch-dev-js



# ci

check: check-format check-lint check-typing

format: $(DEV_BUILD_FLAG) $(DEV_JS_BUILD_FLAG)
$(VIRTUAL_ENV)/$(BIN_PATH)/black tools
$(VIRTUAL_ENV)/$(BIN_PATH)/black -l 70 docs
$(VIRTUAL_ENV)/$(BIN_PATH)/$(PYTHON_BIN) tools/mdformat/mdformat.py $(VIRTUAL_ENV)/$(BIN_PATH)/mdformat \
--wrap 80 \
--end-of-line keep \
--line-length 70 \
docs README.md CONTRIBUTING.md CODE_OF_CONDUCT.md
npx prettier -w docs/ tools/

check-format: $(DEV_BUILD_FLAG) $(DEV_JS_BUILD_FLAG)
$(VIRTUAL_ENV)/$(BIN_PATH)/black --check tools
$(VIRTUAL_ENV)/$(BIN_PATH)/black --check -l 70 docs
$(VIRTUAL_ENV)/$(BIN_PATH)/$(PYTHON_BIN) tools/mdformat/mdformat.py $(VIRTUAL_ENV)/$(BIN_PATH)/mdformat \
--check \
--wrap 80 \
--end-of-line keep \
--line-length 70 \
docs README.md CONTRIBUTING.md CODE_OF_CONDUCT.md
npx prettier -c docs/ tools/

lint: $(DEV_BUILD_FLAG) $(DEV_JS_BUILD_FLAG)
$(VIRTUAL_ENV)/$(BIN_PATH)/pylint tools
npx eslint --ext .js,.cjs,.mjs -c .eslintrc.cjs --fix docs/

check-lint: $(DEV_BUILD_FLAG) $(DEV_JS_BUILD_FLAG)
$(VIRTUAL_ENV)/$(BIN_PATH)/pylint tools
npx eslint --ext .js,.cjs,.mjs -c .eslintrc.cjs docs/

check-typing: $(DEV_BUILD_FLAG)
$(VIRTUAL_ENV)/$(BIN_PATH)/mypy tools



# doc

clean-doc:
ifeq ($(OS_TYPE), windows)
if exist site ( rd /s /q site )
for /d /r docs %%d in (.ipynb_checkpoints) do @if exist "%%d" rd /s /q "%%d"
else
rm -rf site
rm -rf `find docs -name '.ipynb_checkpoints'`
endif

doc: $(DEV_BUILD_FLAG)
$(VIRTUAL_ENV)/$(BIN_PATH)/mkdocs build -f ./tools/mkdocs/mkdocs.yml

deploy: $(DEV_BUILD_FLAG) $(DEV_JS_BUILD_FLAG)
. $(VIRTUAL_ENV)/$(BIN_PATH)/activate; $(PYTHON_BIN) tools/release/deploy.py
Loading