Skip to content

Commit

Permalink
Merge pull request digitsensitive#48 from digitsensitive/release/v1.2.7
Browse files Browse the repository at this point in the history
Release/v1.2.7
  • Loading branch information
digitsensitive committed Apr 26, 2023
2 parents 374d55e + 0f0153a commit 8607ffa
Show file tree
Hide file tree
Showing 23 changed files with 499 additions and 72 deletions.
13 changes: 0 additions & 13 deletions .github/workflows/learn-github-actions.yml

This file was deleted.

19 changes: 19 additions & 0 deletions .github/workflows/publish-package-to-npmjs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Publish Package to npmjs
run-name: ${{ github.actor }} published a new Package to npmjs
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
11 changes: 8 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

---

## [1.X.X] - 2023-XX-XX
## [1.2.7] - 2023-04-26

### Added

- Implement `Get as close as possible` option when the path is blocked ([Issue #10, @sefabaser](https://github.com/digitsensitive/astar-typescript/issues/10))

### Changed

- Update most dependencies in `./` and `./example`
- Update Copyright to 2013 in different locations
- Small optimizations in `grid.ts`
- Update Copyright to 2023 in different locations
- Small optimizations in `grid.ts` and `util.ts`
- Add `CopyPlugin` and `HtmlWebpackPlugin` to webpack

---

Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ let myPathway = this.aStarInstance.findPath(startPos, goalPos);

Additional parameters may be passed to adapt your finder.

### Diagonal movements

If you want to disable `diagonal movements`:

```ts
Expand All @@ -143,6 +145,8 @@ this.aStarInstance = new AStarFinder({
});
```

### Heuristic function

Set the `heuristic function` (Manhattan, Euclidean, Chebyshev or Octile):

```ts
Expand Down Expand Up @@ -172,6 +176,8 @@ this.aStarInstance = new AStarFinder({
});
```

### Start and End Node

Include or Exclude the `start and end node`:

```ts
Expand All @@ -185,6 +191,18 @@ this.aStarInstance = new AStarFinder({
});
```

### Allow path as close as possible

```ts
this.aStarInstance = new AStarFinder({
grid: {
width: 8,
height: 8
},
allowPathAsCloseAsPossible: true
});
```

## Prettier

This library uses [Prettier](https://github.com/prettier/prettier).
Expand Down
2 changes: 2 additions & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
},
"devDependencies": {
"@types/dat.gui": "0.7.7",
"copy-webpack-plugin": "11.0.0",
"expose-loader": "4.1.0",
"html-webpack-plugin": "5.5.1",
"ts-loader": "9.4.2",
"typescript": "5.0.4",
"webpack": "5.80.0",
Expand Down
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 6 additions & 2 deletions example/index.html → example/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="author" content="digitsensitive" />
<title>astar-typescript-example</title>
<link rel="stylesheet" type="text/css" href="styles/css/styles.css" />
<script src="dist/bundle.js"></script>
<link
rel="stylesheet"
type="text/css"
href="assets/styles/css/styles.css"
/>
</head>
<body>
<div id="game"></div>
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/

import { AStarFinder } from '../../lib/astar';
import { AStarFinder } from '../../../dist/astar';
import { DatGuiService } from '../services/dat-gui.service';
import { GameObject } from '../objects/gameobject';

Expand Down
File renamed without changes.
61 changes: 49 additions & 12 deletions example/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
const path = require('path');

// Copy files or entire directories, which already exist, to the build folder
const CopyPlugin = require('copy-webpack-plugin');

// Simplify creation of HTML files to serve your webpack bundles
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
entry: path.resolve(__dirname, 'game.ts'),
entry: './src/game.ts',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
// It is generally better to use [chunkhash] in the filename instead of a
// fixed filename, especially in production builds.
// When you use a fixed filename, the browser may cache the file and reuse
// it even if you make updates to your code. This means that users may not
// see the updated code until they clear their cache, which can lead to
// confusion and errors.
// By using [chunkhash] in the filename, webpack will generate a unique hash
// for each chunk based on its contents. When the contents of a chunk change,
// the hash value changes, resulting in a new filename.
filename: '[name].[chunkhash].js',
chunkFilename: '[name].[chunkhash].js',
// Remove all files in the output directory that are not generated by the
// current build
clean: true
},
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader',
exclude: /node_modules/
include: path.resolve(__dirname, 'src'),
loader: 'ts-loader'
},
{
test: require.resolve('Phaser'),
Expand All @@ -21,15 +40,33 @@ module.exports = {
]
},
devServer: {
static: path.resolve(__dirname, './'),
host: 'localhost',
port: 8080,
open: false
static: path.join(__dirname, 'dist')
},
resolve: {
extensions: ['.ts', '.js'],
alias: {
phaser: path.join(__dirname, '/node_modules/phaser/dist/phaser.js')
extensions: ['.ts', '.js']
},
// The SplitChunksPlugin is a built-in plugin in webpack that helps to split
// your code into separate chunks, which can improve the performance of your
// application by reducing the size of each individual bundle.
optimization: {
splitChunks: {
chunks: 'all'
}
}
},
plugins: [
new CopyPlugin({
patterns: [
{
from: 'src/assets/',
to: 'assets/'
}
]
}),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'src/index.html'),
filename: 'index.html',
title: 'astar-typescript-example',
inject: 'head'
})
]
};
Loading

0 comments on commit 8607ffa

Please sign in to comment.