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

make little runtime as bin that loads in this dir so npx will work #2

Open
wants to merge 3 commits into
base: main
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
77 changes: 52 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,26 +85,53 @@ While I am a big fan of Tiled and LdTk, for my case I was looking for something

## :eyeglasses: Getting started

```bash
$ git clone https://github.com/blurymind/tilemap-editor.git
$ yarn
$ yarn start
```
There are a few ways to get started, depending on how you have things setup. You will need [node](https://nodejs.org/en/) installed.

### local - quick

If you just want to run the editor locally, but aren't going to be developing on it, and just want to run the latest version:

```sh
npx tilemap-editor@latest
```

### global - quick

If you'd like to install it, globally:

```sh
npm i -g tilemap-editor
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that works even now though, right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no. did you try it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here is an example of it not working: https://asciinema.org/a/gPMlSSiDh2lNbbB6ahazONJ9B

tilemap-editor
```

### local - modify

If you'd like to modify how it works:

```sh
git clone https://github.com/blurymind/tilemap-editor.git
cd tilemap-editor
npm i
npm start
```


## :book: Api

To get it from npm, you can run

```bash
$ npm i tilemap-editor
or
$ yarn add tilemap-editor
npm i tilemap-editor

# or

yarn add tilemap-editor
```

To use it, you can import it via require or in the index file like so
To use it, you can import it via require or in the HTML file like so

```js
// include the js and css files
```html
<!-- include the js and css files -->
<link rel="stylesheet" href="styles.css"/>
<script src="tilemap-editor.js"></script>

Expand Down Expand Up @@ -193,7 +220,7 @@ TilemapEditor.init("tileMapEditor",{ // The id of the element that will become t
},
})
</script>
```
```


## :wrench: How to Contribute
Expand All @@ -203,27 +230,27 @@ You are welcome to add new features or fix some bugs:
1. Fork this repository

2. Clone your fork
```bash
$ git clone https://github.com/blurymind/tilemap-editor.git
```
```sh
git clone https://github.com/blurymind/tilemap-editor.git
```

- Create a branch with your changes

```bash
$ git checkout -b my-awesome-changes
```
```sh
git checkout -b my-awesome-changes
```

- Make the commit with your changes

```bash
$ git commit -m 'feat: add a shortcut to copy a tile of the canvas'
```
```bash
git commit -m 'feat: add a shortcut to copy a tile of the canvas'
```

- Push your branch

```bash
# Send the code to your remote branch
$ git push origin my-awesome-changes
```
```sh
# Send the code to your remote branch
git push origin my-awesome-changes
```

- Create a _Pull Request_
14 changes: 14 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env node

const handler = require('serve-handler');
const http = require('http');

const { PORT = 3000 } = process.env

// change to file directory
process.chdir(__dirname)

const server = http.createServer((request, response) => handler(request, response))
server.listen(PORT, () => {
console.log(`🚀 Running at http://localhost:${PORT}`)
})
Loading