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

Improve workflow and fix ESM modules #3

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": true,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
}
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

on:
pull_request:
push:
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
ci:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Install pnpm
run: npm install -g pnpm

- name: Install dependencies
run: pnpm install

- name: Run CI
run: npm run ci
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
build
dist
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": true,
"singleQuote": false,
"trailingComma": "all",
"printWidth": 100,
"tabWidth": 2
}
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# @colyseus/clock

## 1.1.0

### Minor Changes

- e5e81ee: Enhance project deps and export for ESM.
18 changes: 7 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

A simple clock/ticker implementation to track delta/elapsed time.

API
---
## API

- `new Clock([useInterval=false])`
- `clock.start([useInterval=false])`
Expand All @@ -13,8 +12,7 @@ API
- `clock.deltaTime`
- `clock.currentTime`

Usage example
---
## Usage example

There's two ways you can use clock.js: manual or automatic.

Expand All @@ -24,14 +22,14 @@ By initializing `Clock` with `true` as the first argument, a interval will be
created, in which `tick()` is called 60 times per second.

```typescript
import Clock from '@colyseus/clock';
import Clock from "@colyseus/clock";
let clock = new Clock(true);
```

You can also call `start(true)` to create the interval.

```javascript
import Clock from '@colyseus/clock';
import Clock from "@colyseus/clock";
let clock = new Clock();
clock.start(true);
```
Expand All @@ -41,19 +39,17 @@ clock.start(true);
You call `tick()` manually in your existing loop.

```typescript
import Clock from '@colyseus/clock';
import Clock from "@colyseus/clock";
var clock = new Clock();

setInterval(function() {
setInterval(function () {
clock.tick();
console.log("Delta time: ", clock.deltaTime);
console.log("Elapsed time: ", clock.elapsedTime);
console.log("Current time: ", clock.currentTime);
}, 1000 / 60);
```


License
---
## License

MIT
50 changes: 0 additions & 50 deletions build.mjs

This file was deleted.

Loading