https://github.com/mangudai/mangudai
AoE2 Random Map Scripting for humans
https://github.com/mangudai/mangudai
age-of-empires aoe ast npm-package rms typescript
Last synced: about 2 months ago
JSON representation
AoE2 Random Map Scripting for humans
- Host: GitHub
- URL: https://github.com/mangudai/mangudai
- Owner: mangudai
- License: mit
- Created: 2017-05-11T21:23:26.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-08T12:01:42.000Z (about 7 years ago)
- Last Synced: 2024-04-29T19:41:58.994Z (over 1 year ago)
- Topics: age-of-empires, aoe, ast, npm-package, rms, typescript
- Language: TypeScript
- Homepage: https://mangudai.github.io
- Size: 360 KB
- Stars: 11
- Watchers: 4
- Forks: 1
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Mangudai
> AoE2 Random Map Scripting for humans
JavaScript parser and linter for [Random Map Scripts](http://aok.heavengames.com/cgi-bin/forums/display.cgi?action=ct&f=28,42485,,30) (RMS) for the [Age of Empires II](https://en.wikipedia.org/wiki/Age_of_Empires_II) video game.
- [Online playground](https://mangudai.github.io/) ([repo](https://github.com/mangudai/mangudai.github.io))
- [VS Code extension](https://marketplace.visualstudio.com/items?itemName=deltaidea.aoe2-rms) ([repo](https://github.com/mangudai/vscode))
- [Sublime Text package](https://packagecontrol.io/packages/AoE2%20RMS%20Syntax%20Highlighting) ([repo](https://github.com/mangudai/sublime-text))
## Install
Mangudai is published as an [NPM](https://docs.npmjs.com/getting-started/what-is-npm) package compatible with [Node.js](https://nodejs.org/en/) and browsers.
```Bash
npm install mangudai
```
Use a tool like [Webpack](https://webpack.js.org) or [Rollup](https://rollupjs.org/) to include Mangudai in your front-end app.
The code is compiled to ES5 (old and stable JavaScript) before publishing, so the module has maximum compatibility out-of-the-box.
## Usage
Let's parse an RMS script into an [Abstract Syntax Tree](https://en.wikipedia.org/wiki/Abstract_syntax_tree) (AST) and lint it.
```JavaScript
import { parse, lint } from 'mangudai'
const { ast, errors } = parse(' \n random_placement')
if (errors.length) {
console.log('Unable to parse the script! Probably invalid syntax.', errors)
} else {
const lintErrors = lint(ast)
console.log(`Linter found ${lintErrors.length} problems.`, lintErrors)
}
```
Mangudai is written in [TypeScript](https://www.typescriptlang.org/) and exports all relevant typings.
## API
- ### parse( script: `string` ) => { ast: [`Script`](docs/ast-spec.md), errors: [`ParseError[]`](docs/errors.md) }
- ### lint( ast: [`Script`](docs/ast-spec.md) ) => [`LintError[]`](docs/errors.md)
## Contribute
[](https://travis-ci.org/mangudai/mangudai)
[](https://codecov.io/gh/mangudai/mangudai)
[](https://standardjs.com/)
[](https://github.com/RichardLitt/standard-readme)
This project is still in its early development stage. Any help is greatly appreciated! Feel free to ask questions in issues. PRs accepted.
## License
[MIT](./LICENSE.md) © Mangudai contributors