git hooks

This commit is contained in:
Alexander Popov 2023-04-30 15:55:44 +03:00
parent f67def6a8d
commit 448fa22705
Signed by: iiiypuk
GPG Key ID: E47FE0AB36CD5ED6
5 changed files with 84 additions and 3 deletions

View File

@ -26,6 +26,11 @@ indent_size = 4
[*.md]
trim_trailing_whitespace = false
indent_size = unset
[.githooks/**]
indent_style = space
indent_size = 2
[{node_modules/**,.git/**}]
charset = unset

23
.githooks/pre-commit Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
# prettier
echo "Checking by Prettier..."
prettier --check . &> /dev/null
if [[ "$?" == 0 ]]; then
echo "✅ Prettier"
else
echo "⛔ Prettier error"
exit 1
fi
# editorconfig
echo "Checking by EditorConfig..."
ec . &> /dev/null
if [[ "$?" == 0 ]]; then
echo "✅ EditorConfig"
else
echo "⛔ EditorConfig error"
exit 1
fi

View File

@ -1,6 +1,6 @@
![engine_icon](/src/icons/apple-touch-icon.png)
## Build `ENGINE`
# Build `ENGINE`
```sh
# install rollup
@ -10,3 +10,15 @@ npm install --global rollup
cd src/js/
rollup main.js --file engine.js --format es
```
# Contribute
## Git hooks
### pre-commit
**Requiments:**
1. NPM module `prettier`.
2. [editorconfig-checker](https://github.com/editorconfig-checker/editorconfig-checker)
(_Go application_).

42
docs/ru.md Normal file
View File

@ -0,0 +1,42 @@
# Документация
## App
Основной класс движка.
При инициализации самостоятельно добавляет HTML элемент `<canvas>`
в тег `<body>`.
### Параметры
- `w` — ширина холста в пикселях.
- `h` — высота холста в пикселях.
- `options` — объект опций.
**Имеет следующую структуру:**
```text
{
backgroundColor: '#ffcc68',
welcome: true,
}
```
- backgroundColor — фон холста.
По умолчанию `#ffcc68`.
- welcome — `bool` тип.
Отображает информацию о движке в **Console**.
По умолчанию `true`.
### Пример использования
```javascript
// init app
let app = new App(400, 400);
// add app view in document
window.addEventListener('DOMContentLoaded', () => {
document.body.appendChild(app.view);
});
```

View File

@ -7,7 +7,6 @@ export class App {
#version;
constructor(
canvas,
w,
h,
options = {
@ -15,7 +14,7 @@ export class App {
welcome: true,
}
) {
this.#version = '0.1.0';
this.#version = 'beeeeeeta';
this.view = document.createElement('canvas');