Skip to content

Commit

Permalink
Rewrite to use WASM (#4)
Browse files Browse the repository at this point in the history
* Fix build at least

* Rename bundle

* Now everything is fixed

* Almost complete rewrite
- Remove CMake because it does not play well with windows machines
- Anitomyscript now uses WASM as it was supposed to be from the start
- Organize folder structure

* Optimize build

* Update README.md

* More optimizations
- Compile with latest emscripten version to fix filesystem bug
- Use tinyify plugin

* Prepare release
- Fix failing test cases
- Update package.json
- Add note on README about the native bindings
  • Loading branch information
skiptirengu authored May 21, 2019
1 parent f4997aa commit 67f81a6
Show file tree
Hide file tree
Showing 22 changed files with 4,003 additions and 4,680 deletions.
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "anitomy"]
path = anitomy
url = https://github.com/erengy/anitomy
[submodule "include"]
path = include
url = https://github.com/erengy/anitomy.git
4 changes: 3 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
build.project
output
.travis.yml
anitomy
.vscode
.gitmodules
.gitmodules
output
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ before_install:
- docker run -dit --name emscripten -v $(pwd):/src trzeci/emscripten:sdk-incoming-64bit bash

script:
- docker exec -it emscripten npm run rebuild
- docker exec -it emscripten npm run build
- npm test
52 changes: 0 additions & 52 deletions CMakeLists.txt

This file was deleted.

43 changes: 10 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

Pure javascript bindings for [Anitomy](https://github.com/erengy/anitomy), ported with emscripten. Runs on Node or the browser!

Checkout the [native node bindings](https://github.com/skiptirengu/anitomy-js) for anitomy too!

## Demo
You can test it [here](https://skiptirengu.github.io/anitomyscript/).

Expand All @@ -16,26 +18,26 @@ and you're good to go!
## Usage
Node
```js
var anitomy = require('anitomyscript');
anitomy.parse(file);
const anitomy = require('anitomyscript');
await anitomy(file);
```

Browser
```html
<script src="dist/bundle.min.js"></script>
<script src="dist/anitomyscript.bundle.min.js"></script>
<script>
window.anitomyscript.parse(file);
window.anitomyscript(file).then((res) => console.log(res));
</script>
```

## API

### parse(file, [options])
### parse(file) -> Promise<Array|Object>
Parses a file or an array of files.

```js
console.log(
anitomy.parse("[tlacatlc6] Natsume Yuujinchou Shi Vol. 1v2 & Vol. 2 (BD 1280x720 x264 AAC)")
await anitomy("[tlacatlc6] Natsume Yuujinchou Shi Vol. 1v2 & Vol. 2 (BD 1280x720 x264 AAC)")
);
/*
{
Expand All @@ -55,30 +57,5 @@ console.log(
*/
```

### AnitomyNative
If you need more control over anitomy's behavior, anitomyscript exposes an
object with native anitomy symbols. For more exemples check out the [tests](https://github.com/skiptirengu/anitomyscript/blob/master/test/anitomyscript.spec.js).

```js
const native = new anitomyscript.AnitomyNative();
const elements = new native.Anitomy().parse(file, options);
console.log(elements.size());
```

#### AnitomyNative.Anitomy
Anitomy instance with some native methods like parse(), elements(), options() and tokens()

#### AnitomyNative.Elements
Parsed elements

#### AnitomyNative.Options
Anitomy's parse options

#### AnitomyNative.ElementCategory
Anitomy's parsed elements categories

#### AnitomyNative.VectorString_t
Vector of strings

#### AnitomyNative.VectorElements
Vector of elements
## License
Licensed under [BSD-2-Clause](./LICENSE)
1 change: 0 additions & 1 deletion anitomy
Submodule anitomy deleted from 1a6c27
2 changes: 0 additions & 2 deletions build.project/.gitignore

This file was deleted.

122 changes: 0 additions & 122 deletions build/anitomy-build.js

This file was deleted.

Loading

0 comments on commit 67f81a6

Please sign in to comment.