astrojs new [project name] astrojs class [class name] astrojs server astrojs build
Upon installation of Node a package manager called NPM will be available. The astrojs module is available via the Node Packaged Modules service. To install the astrojs module run
npm install astrojs -g
This will install astrojs globally, and it will function as a command line utility. (It most likely needs to be run using sudo).
creating an astrojs project
To create an astrojs project run
astrojs new [project name]
This will generate the following project files under a directory named by
Cakefile index.js lib/ package.json README.md src/ |----[project name].coffee test/ |----favicon.ico |----lib/jasmine-html.js |----lib/jasmine.css |----lib/jasmine.js |----lib/MIT.LICENSE |----SpecRunner.html |----specs/
generating a new class
astrojs new [class name]
from within an astrojs project directory will generate template code for a new class and test functions.
starting a local development server
Development always requires testing. When developing an astrojs module, it is encouraged to test all functionality. Frequently a local testing server is needed. Calling
will spin up a local testing server at http://0.0.0.0:8000. This is useful when tests require data that must be accessed on the same domain as the script (e.g. ajax requests for json or binary files).
This command support two options.
astrojs server -p 8001
allows a port to be specified, and
astrojs server -m
minifies the code, which is useful in some development edge cases.
building an astrojs project
concatenates all files in the
src directory, and provides the final product in the
lib directory. It is important to specify the dependency order using the key
_dependencyOrder in package.json.
For an example of using this module for development, please refer to the fitsjs library.