Skip to content

Commit

Permalink
feat: initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
KeSuave committed Nov 19, 2024
0 parents commit 690e6e8
Show file tree
Hide file tree
Showing 34 changed files with 12,401 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release

on:
push:
branches:
- main

jobs:
release:
runs-on: ubuntu-latest
outputs:
new_tag_version: ${{ steps.create_release.outputs.new_release_tag }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
persist-credentials: false

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20'

- name: Install dependencies
run: npm install

- name: Run tests
run: npm test

- name: Build the project
run: npm run build

- name: Dry Run
id: tag_version
run: |
export NEW_TAG_VERSION=$(npx semantic-release --dry-run | grep "The next release version is" | awk '{print $6}')
echo "new_tag_version=$NEW_TAG_VERSION" >> $GITHUB_ENV
- name: Generate Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
21 changes: 21 additions & 0 deletions .github/workflows/semanticPR.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: "Lint PR"

on:
pull_request_target:
types:
- opened
- edited
- synchronize
- reopened

permissions:
pull-requests: read

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"tabWidth": 2,
"useTabs": false
}
25 changes: 25 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"branches": [
"main"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/npm",
[
"@semantic-release/github",
{
"assets": [
"dist/**"
]
}
],
[
"@semantic-release/git",
{
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
]
}
68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# KaPlanck

A KaPlay plugin that integrates Planck, while keeping the simple/fun API of KaPlay.

## Installation

```shell
npm i kaplanck
```

## Usage

<sub><sup>For more example check the examples folder</sup></sub>

```ts
import KaPlanckPlugin from "kaplanck";
import kaplay from "kaplay";
import { Vec2 } from "planck";

const k = kaplay({
global: false,
background: [20, 20, 20],
plugins: [
KaPlanckPlugin({
lengthUnitsPerMeter: 20,
}),
],
debug: true,
debugKey: "d",
});

const worldContainer = k.add([
k.kpWorld({
gravity: new Vec2(0, 10),
}),
]);

worldContainer.add([
k.color(100, 100, 100),
k.kpPos(k.kpCenter()),
k.kpRotate(Math.PI * 0.1),
k.kpEdgeShape({
v1: new Vec2(-10, 0),
v2: new Vec2(10, 0),
draw: true,
}),
k.kpBody({
type: "static",
}),
k.kpFixture(),
]);

worldContainer.add([
k.color(200, 200, 200),
k.kpPos(k.kpCenter().sub({ x: k.rand(-10, 10), y: k.rand(10, 15) })),
k.kpCircleShape({
radius: 1,
draw: true,
}),
k.kpBody({ type: "dynamic" }),
k.kpFixture({ density: 1, friction: 0.3 }),
k.offscreen({ destroy: true }),
]);
```

## Documentation

WIP
13 changes: 13 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pluginJs from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import globals from "globals";
import tseslint from "typescript-eslint";

/** @type {import('eslint').Linter.Config[]} */
export default [
{ files: ["**/*.{js,mjs,cjs,ts}"] },
{ languageOptions: { globals: globals.browser } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
eslintConfigPrettier,
];
12 changes: 12 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>KaPlank</title>
</head>
<body style="overflow: hidden">
<script type="module" src="/src/main.ts"></script>
</body>
</html>
Loading

0 comments on commit 690e6e8

Please sign in to comment.