# mcs

> A pre-processor to write Minecraft Functions more efficiently

Latest version **2.2.1** (published 2017-08-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install mcs
pnpm add mcs
yarn add mcs
bun add mcs
```

Provides the command `mcs`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.1 |
| Published | 2017-08-30 |
| First published | 2017-07-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Pandawan |
| Maintainers | pandawan |
| Keywords | Minecraft, MC, Script, JS |

## Links

- npm: https://www.npmjs.com/package/mcs
- Repository: https://github.com/PandawanFr/mcs
- Homepage: https://github.com/PandawanFr/mcs#readme
- Issues: https://github.com/PandawanFr/mcs/issues
- npm.io page: https://npm.io/package/mcs

## Dependencies (2)

- [chalk](https://npm.io/package/chalk.md) ^2.1.0
- [pkginfo](https://npm.io/package/pkginfo.md) ^0.4.1

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 2.2.1 (latest) — 2017-08-30
- 2.1.1 — 2017-08-14
- 2.0.1 — 2017-08-07
- 2.0.0 — 2017-08-07
- 1.0.3 — 2017-07-27
- 1.0.2 — 2017-07-25
- 1.0.1 — 2017-07-25
- 1.0.0 — 2017-07-25

## README

# mcs: Minecraft Script

[![npm](https://img.shields.io/npm/v/mcs.svg?style=flat-square)](https://www.npmjs.com/package/mcs)
[![license](https://img.shields.io/github/license/pandawanfr/mcs.svg?style=flat-square)](https://github.com/pandawanfr/mcs)

#### A pre-processor to write Minecraft Functions more efficiently.

Try it with the [Online Editor](https://pandawanfr.github.io/MCSEditor/)!

Check out the [changelog](https://github.com/PandawanFr/mcs/blob/master/Changelog.md) for a list of new features!

*Latest Compatible Minecraft Version: 1.12*

Note: I called it Script because it has a syntax similar to JavaScript.

# Documentation
Learn how to write in Minecraft Script in the [Wiki](https://github.com/PandawanFr/mcs/wiki).

# Installation
`mcs` has been tested with node and as a standalone (web) script. Though it should also support CommonJS (node, browserify) and AMD (RequireJS).

## Node
Installation via `npm`:

```shell
$ npm install mcs

> var mcs = require('mcs');
> mcs('function hello { say hello world; }');
```
Alternatively you can install mcs globally so that it may be run from the command line.

```shell
$ npm install mcs -g
$ mcs ./input.mcs ./output/
```

## Standalone/Script

Add to your html

```html
<script src="https://unpkg.com/mcs"></script>
```

### Or include it manually

Download [mcs.min.js](https://github.com/PandawanFr/mcs/blob/master/dist/mcs.min.js)

Add to your html

```html
<script src="path/to/mcs.min.js"></script>
```

# Usage

## JS
```javascript
var input = 'function hello { say hello world; }'
var result = mcs(input)
// result = { "_namespace": { "_type": "namespace", "hello": { "_type": "function", "value": "say hello world\n" } } }
```
`mcs()` takes one required argument, the input (string to convert), and returns a JSON object with namespaces, groups, and functions (you can differentiate them using _type).

## CLI
```shell
$ mcs [input] [output (optional)]
```
Using `mcs` in the CLI takes one require argument, the `input` file (.mcs file), and outputs to the (optional) `output` directory. If no output directory is given, `./` is used.

# TODO
Check out the current todo list [here](https://github.com/PandawanFr/mcs/blob/master/Todo.md).

# Contributing
1. Create an issue and describe your idea
2. [Fork it](https://github.com/PandawanFr/mcs/fork)
3. Checkout this repository
4. Install the dependencies `npm install` or `yarn`
5. Edit the files in `/src`
6. Test your changes with
```shell
# Use your own input/output
$ npm run build
$ node index.js [input] [output]


# Alternatively:
# Use test/new_syntax.mcs as input, and test/output/ as output
$ npm run test

# Build the source files AND use test/new_syntax.mcs as input, and test/output/ as output
$ npm run bnt

# Autocompile/build whenever you change the src files (instead of npm run build)
$ gulp
```
8. You can also test your changes on the web by copying the `dist/mcs.min.js` file after building
9. Once done, create a pull request

# Authors
Made by [Pandawan](http://twitter.com/PandawanYT).  
Thanks to [@coolsa](https://github.com/coolsa) for contributing.
Thanks to [Andrew Mast](https://github.com/AndrewMast) and [Chris Smith](https://github.com/chris13524) for helping out and providing feedback!

# License
Please see the [LICENSE](https://github.com/PandawanFr/mcs/blob/master/LICENSE) file

`mcs` is not affiliated with Minecraft or Mojang AB.

---
_Source: https://npm.io/package/mcs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
