https://github.com/daiz/ls-module-bootstrap
Node.js module bootstrap for LiveScript
https://github.com/daiz/ls-module-bootstrap
Last synced: 5 months ago
JSON representation
Node.js module bootstrap for LiveScript
- Host: GitHub
- URL: https://github.com/daiz/ls-module-bootstrap
- Owner: Daiz
- License: cc0-1.0
- Created: 2014-01-20T10:39:26.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2014-02-03T15:42:53.000Z (over 12 years ago)
- Last Synced: 2025-02-16T14:48:41.812Z (over 1 year ago)
- Language: LiveScript
- Size: 148 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# LiveScript Node.js Module Bootstrap
I like using [LiveScript](http://livescript.net/), so I decided to write this little bootstrap to make life simpler when it comes to writing Node.js modules with it.
## How to use it
Put all your LiveScript code to a directory called `src`. The default entry point for the application is `index.js`, so the source file for that should be called `index.ls`.
The makefile exists to compile your LiveScript code to JavaScript when the user installs your module via npm. Your code is compiled to the `lib` folder, so if for example you have the following source code structure:
```
src/index.ls
src/main/parser.ls
src/main/linter.ls
```
The files would be compiled to
```
lib/index.js
lib/main/parser.js
lib/main/linter.js
```
Due to this, you should make sure to not use file extensions when using `require` to load your submodules, so in your index.ls, you should have `require './main/parser'`, **not** `require './main/parser.ls'`.
## Important bits of package.json
Here are the important things that your package.json should have:
```json
"dependencies": {
"LiveScript": "~1.2.0",
"shelljs": "~0.2.6"
},
```
`LiveScript` and `shelljs` are used for the compilation.
```json
"scripts": {
"postinstall": "lsc make"
},
```
This is responsible for running the compilation to JS on install.