1 | Firescript
|
2 | ==========
|
3 |
|
4 | =======
|
5 | [![Build Status](https://travis-ci.com/Andifeind/firescript.svg?branch=master)](https://travis-ci.com/Andifeind/firescript)
|
6 |
|
7 | Firescript is a language which gets transpiled into Javascript.
|
8 | A 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 |
|
10 | Syntax
|
11 | ------
|
12 |
|
13 | ```ts
|
14 | import Fruits from './fruits'
|
15 |
|
16 | class 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 |
|
29 | export Banana
|
30 | ```
|
31 |
|
32 | ```ts
|
33 | import Banana from './banana'
|
34 |
|
35 | const banana = new Banana()
|
36 | print(banana.getName())
|
37 | ```
|
38 |
|
39 | Requirements
|
40 | ------------
|
41 |
|
42 | Firescript requires Node.js 8 or higher.
|
43 |
|
44 | Install
|
45 | -------
|
46 |
|
47 | There are two options to install firescript. The most common option is to install it globaly using **npm**.
|
48 |
|
49 | `npm install -g firescript`
|
50 |
|
51 | We 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 |
|
55 | Firescript is accessable on commandline by using the `fire` command.
|
56 |
|
57 | Usage
|
58 | -----
|
59 |
|
60 | ### Command Line
|
61 |
|
62 | Firescript 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 |
|
80 | Getting started
|
81 | --------------
|
82 |
|
83 |
|
84 | Create 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
|
87 | mkdir ~/Projects/myfsproject
|
88 | cd myfsproject
|
89 | fire init
|
90 | ```
|
91 |
|
92 | You'll find a `.firerc.json` file within your project folder. This file contains build and feature configuration.
|
93 |
|
94 | Firescript 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 |
|
96 | Use the [Firescript Example](
|
97 | https://github.com/Andifeind/firescript-example) project to play a little with it.
|
98 |
|
99 | Code transpilation
|
100 | ------------------
|
101 |
|
102 | Run `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 |
|
104 | Author
|
105 | ------
|
106 |
|
107 | Andi Heinkelein <andifeind@noname-media.com>
|
108 |
|
109 | License
|
110 | -------
|
111 |
|
112 | Firescript is licensed under the MIT license.
|
113 | See [LICENSE.md](./LICENSE.md)
|