UNPKG

3.41 kBMarkdownView Raw
1Firescript
2==========
3
4=======
5[![Build Status](https://travis-ci.com/Andifeind/firescript.svg?branch=master)](https://travis-ci.com/Andifeind/firescript)
6
7Firescript is a language which gets transpiled into Javascript.
8A language which uses indention for block scoping, has a clear and strict syntax, it supports dynamic typing and it's lesser code to write. The transpiled output is clean and readable Javascript.
9
10Syntax
11------
12
13```ts
14import Fruits from './fruits'
15
16class Banana extends Fruits
17 constructor ()
18 super()
19
20 this.name = 'Banana'
21 this.color = 'yellow'
22
23 getName ()
24 return this.name
25
26 setName (str name)
27 return this.name = name
28
29export Banana
30```
31
32```ts
33import Banana from './banana'
34
35const banana = new Banana()
36print(banana.getName())
37```
38
39Requirements
40------------
41
42Firescript requires Node.js 8 or higher.
43
44Install
45-------
46
47There are two options to install firescript. The most common option is to install it globaly using **npm**.
48
49`npm install -g firescript`
50
51We recommend to install firescript localy. This installs an executable in `./node_modules/.bin` which makes Firescript accessable for NPM. Adding `../node_modules/.bin` to yout `$PATH` in your `.bashrc` makes the Firescript CLI executable by the command `fire` from the project root.
52
53`npm install firescript`
54
55Firescript is accessable on commandline by using the `fire` command.
56
57Usage
58-----
59
60### Command Line
61
62Firescript comes with a commandline. If you've installed Firescript globally, you should have access to it by the `fire` command. Run `fire help` to get an overview of all available sub-commands or run `fire help <command>` to get a command's help page.
63
64#### Commands
65
66| Command | Description |
67|----------|--|
68| `build` | Transpiles all `.fire` files and copies assets, reads project configuration from `.firerc.json` |
69| `copy` | Copies all assets, configured in `.firerc.json` by `copy` option to `dest` folder |
70| `init` | Initialize new Firescript project at current working dir |
71| `help` | Print a command overview |
72| `parse` | Parse a `.fire` or `.js` file into an AST tree |
73| `tokenize` | Tokenize a `.fire` or a `.js` file |
74| `transpile` | Transpiles a `.fire` file into Javascript or a `.js` file into Firescript |
75| `watch` | Watch `src` dir for changes und transpiles changed `.fire` files |
76
77
78
79
80Getting started
81--------------
82
83
84Create a Firescript project by using the `init` command. Create a project folder, change into it and run `fire init` to initialize a Firescript project.
85
86```shell
87mkdir ~/Projects/myfsproject
88cd myfsproject
89fire init
90```
91
92You'll find a `.firerc.json` file within your project folder. This file contains build and feature configuration.
93
94Firescript uses `.fire` as file extension. The `build` command transpiles all `.fire` files found in the source folder and writes the output to the destination folder. All other file are being ignored during the build process.
95
96Use the [Firescript Example](
97https://github.com/Andifeind/firescript-example) project to play a little with it.
98
99Code transpilation
100------------------
101
102Run `fire build` to build the project. The `fire watch` command re-transpiles files when their content changes. Both commands overwriting existing files without prompting.
103
104Author
105------
106
107Andi Heinkelein <andifeind@noname-media.com>
108
109License
110-------
111
112Firescript is licensed under the MIT license.
113See [LICENSE.md](./LICENSE.md)