Skip to content

Commit

Permalink
style: apply prettier as formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
lajbel committed Nov 8, 2024
1 parent 113ab2e commit d389f42
Show file tree
Hide file tree
Showing 107 changed files with 112,003 additions and 3,823 deletions.
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/**
**/kaplay/**
**/books/**
/dist/**
29 changes: 29 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"printWidth": 80,
"tabWidth": 4,
"useTabs": false,
"htmlWhitespaceSensitivity": "strict",
"plugins": ["prettier-plugin-astro", "prettier-plugin-tailwindcss"],
"overrides": [
{
"files": "*.astro",
"options": {
"parser": "astro"
}
},
{
"files": "*.json",
"options": {
"tabWidth": 2,
"parser": "json"
}
},
{
"files": "*.{yml,yaml}",
"options": {
"tabWidth": 2,
"parser": "yaml"
}
}
]
}
5 changes: 1 addition & 4 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"recommendations": [
"astro-build.astro-vscode",
"unifiedjs.vscode-mdx"
],
"recommendations": ["astro-build.astro-vscode", "unifiedjs.vscode-mdx"],
"unwantedRecommendations": []
}
11 changes: 6 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
"editor.defaultFormatter": "dprint.dprint"
},
"[astro]": {
"editor.defaultFormatter": "dprint.dprint"
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"cSpell.words": [
"KAPLAY"
]
}
"cSpell.words": ["KAPLAY"],
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
24 changes: 12 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
Follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
specification

- feat: A new feature
- fix: A bug fix
- docs: Documentation only changes
- style: Changes that do not affect the meaning of the code (white-space,
formatting, missing semi-colons, etc)
- refactor: A code change that neither fixes a bug nor adds a feature
- perf: A code change that improves performance
- test: Adding missing tests or correcting existing tests
- chore: Daily tasks, maintenance, etc
- build: Changes that affect the build system or external dependencies
- ci: Changes to our CI configuration files and scripts
- revert: Reverts a previous commit
- feat: A new feature
- fix: A bug fix
- docs: Documentation only changes
- style: Changes that do not affect the meaning of the code (white-space,
formatting, missing semi-colons, etc)
- refactor: A code change that neither fixes a bug nor adds a feature
- perf: A code change that improves performance
- test: Adding missing tests or correcting existing tests
- chore: Daily tasks, maintenance, etc
- build: Changes that affect the build system or external dependencies
- ci: Changes to our CI configuration files and scripts
- revert: Reverts a previous commit
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This is the website and documentation of [KAPLAY](https://kaplayjs.com), the
JavaScript game library to make games fast and fun.

- Documentation for KAPLAY library
- Guides to help you get started
- Blogs about the latest on KAPLAY
- Landing page, presenting the library
- Documentation for KAPLAY library
- Guides to help you get started
- Blogs about the latest on KAPLAY
- Landing page, presenting the library
4 changes: 1 addition & 3 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ export default defineConfig({
transformerNotationWordHighlight(),
],
},
remarkPlugins: [
remarkMath,
],
remarkPlugins: [remarkMath],
rehypePlugins: [
[rehypeKatex, {}],
[rehypeKAPLAY, {}],
Expand Down
52,830 changes: 52,829 additions & 1 deletion doc.json

Large diffs are not rendered by default.

10 changes: 0 additions & 10 deletions dprint.json

This file was deleted.

48 changes: 24 additions & 24 deletions guides/en/0_making_your_first_game/0_creating_your_first_game.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ onKeyPress("space", () => {

Let's see what components we're using:

- `sprite()` makes it render as a sprite, with the `"bean"` sprite we just
loaded with `loadSprite()`
- `pos()` gives it a position on screen, at X: 80 Y: 40
- `area()` gives it a collider area, so we can check for collisions with other
characters later on
- `body()` gives it a physical body, making it fall due to gravity and ability
to jump,
- `sprite()` makes it render as a sprite, with the `"bean"` sprite we just
loaded with `loadSprite()`
- `pos()` gives it a position on screen, at X: 80 Y: 40
- `area()` gives it a collider area, so we can check for collisions with other
characters later on
- `body()` gives it a physical body, making it fall due to gravity and ability
to jump,

We're also testing out our player character with a little interaction here.
`onKeyPress()` registers an event that runs every time user presses a certain
Expand All @@ -122,17 +122,17 @@ add([
Woah! That looks like a lot, but it's actually really simple, let's look at each
component

- `rect()` renders a rectangle. It accepts 2 arguments, the width and height,
which we give it the game width (returned by `width()`) and height of 48
pixels
- `pos()` position. We give it a x: 0 and y: `height() - 48` so it sits right on
the bottom of the screen
- `outline()` renders an outline of `4` pixels
- `area()` adds a collider to it
- `body({ isStatic: true })` the object won't move, and all non static objects
won't move past it
- `color()` makes it render with an RGB color, we give it a R: 127 G: 200 B: 255
which is a blue-ish color
- `rect()` renders a rectangle. It accepts 2 arguments, the width and height,
which we give it the game width (returned by `width()`) and height of 48
pixels
- `pos()` position. We give it a x: 0 and y: `height() - 48` so it sits right on
the bottom of the screen
- `outline()` renders an outline of `4` pixels
- `area()` adds a collider to it
- `body({ isStatic: true })` the object won't move, and all non static objects
won't move past it
- `color()` makes it render with an RGB color, we give it a R: 127 G: 200 B: 255
which is a blue-ish color

Now, before run, we should define the gravity of our world:

Expand Down Expand Up @@ -178,12 +178,12 @@ add([
A lot of these we have already seen you should know what they do, but some new
ones here:

- `anchor()` defines the origin point of positioning. By default `pos()` defines
the top left point of the shape, here we change it to the bottom left point
because we want it to be just above the platform, so we give it Y position of
`height() - 48`
- `move()` makes it move towards a direction infinitely. In this case we move
towards the `LEFT` by `480` pixels per second
- `anchor()` defines the origin point of positioning. By default `pos()` defines
the top left point of the shape, here we change it to the bottom left point
because we want it to be just above the platform, so we give it Y position of
`height() - 48`
- `move()` makes it move towards a direction infinitely. In this case we move
towards the `LEFT` by `480` pixels per second

![tree](intro/tree.png)

Expand Down
18 changes: 9 additions & 9 deletions guides/en/1_getting_started/0_why_kaplay.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ should I use KAPLAY instead of X library?"_.

There's some reasons why you should use KAPLAY:

- 🧪 **Simplicity**: KAPLAY design and API looks for the simplicity to create
games. You can create a game with a few lines of code.
- 📏 **Flexibility**: KAPLAY is a **library**, not a framework or game engine.
You can use KAPLAY with other libraries or frameworks, do you want to use
_React_? _Vue_? No problem, you can use it with KAPLAY.
- 🍳 **Pre-cooked**: KAPLAY comes with a lot of features pre-cooked. Pre-made
arcade physics, input manager, tilemap levels, assets and more.
- ❤️ **Open Source**: KAPLAY is **open source** and the KAPLAY Team is a
**collective** of developers **non-profit**.
- 🧪 **Simplicity**: KAPLAY design and API looks for the simplicity to create
games. You can create a game with a few lines of code.
- 📏 **Flexibility**: KAPLAY is a **library**, not a framework or game engine.
You can use KAPLAY with other libraries or frameworks, do you want to use
_React_? _Vue_? No problem, you can use it with KAPLAY.
- 🍳 **Pre-cooked**: KAPLAY comes with a lot of features pre-cooked. Pre-made
arcade physics, input manager, tilemap levels, assets and more.
- ❤️ **Open Source**: KAPLAY is **open source** and the KAPLAY Team is a
**collective** of developers **non-profit**.

# FAQ

Expand Down
36 changes: 18 additions & 18 deletions guides/en/1_getting_started/1_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ url: install

This guide covers:

- [create-kaplay](https://npmjs.com/package/create-kaplay) for create KAPLAY
projects easily
- Using KAPLAY with a CDN
- Using KAPLAY with Node.js
- Loading assets
- Running a static file server
- [create-kaplay](https://npmjs.com/package/create-kaplay) for create KAPLAY
projects easily
- Using KAPLAY with a CDN
- Using KAPLAY with Node.js
- Loading assets
- Running a static file server

The most easy way to get started with KAPLAY is to use the
[CLI tool](https://www.npmjs.com/package/create-kaplay), which will generate a
Expand Down Expand Up @@ -72,10 +72,10 @@ $ npm install kaplay
You'll need to use a bundler to use Kaboom with NPM. There's a lot of options
like:

- `esbuild`,
- `webpack`,
- `parcel`,
- `vitejs`,
- `esbuild`,
- `webpack`,
- `parcel`,
- `vitejs`,

This is a short example of how to use Kaboom with
["esbuild"](https://esbuild.github.io/).
Expand Down Expand Up @@ -105,14 +105,14 @@ system, that is because browser won't allow loading local files with JavaScript.
To get around that you'll need to use a static file that serves the files
through HTTP. There're a lot of programs that helps you to do that.

- `$ python3 -m http.server` if you have [python3](https://www.python.org)
installed
- `$ python -m SimpleHTTPServer` if you have [python2](https://www.python.org)
installed
- `$ serve` if you have [serve](https://github.com/vercel/serve) installed
- `$ caddy file-server` if you have [caddy](https://caddyserver.com/) installed
- `$ static-here` if you have
[static-here](https://github.com/amasad/static-here) installed
- `$ python3 -m http.server` if you have [python3](https://www.python.org)
installed
- `$ python -m SimpleHTTPServer` if you have [python2](https://www.python.org)
installed
- `$ serve` if you have [serve](https://github.com/vercel/serve) installed
- `$ caddy file-server` if you have [caddy](https://caddyserver.com/) installed
- `$ static-here` if you have
[static-here](https://github.com/amasad/static-here) installed

Let's say you have a folder structure like this:

Expand Down
6 changes: 3 additions & 3 deletions guides/en/1_getting_started/2_basic_concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ the object, like how it moves, looks, and interacts with other objects.
In KAPLAY, there are many built-in components that you can use to create your
game objects. For example:

- `pos(x, y)` sets the position of the object.
- `rect(width, height)` draws a rectangle.
- `color(r, g, b)` sets the color of the object.
- `pos(x, y)` sets the position of the object.
- `rect(width, height)` draws a rectangle.
- `color(r, g, b)` sets the color of the object.

We will go in deep on components in the [**Components**](/guides/components)
guide.
Expand Down
Loading

0 comments on commit d389f42

Please sign in to comment.