UNPKG

4.91 kBMarkdownView Raw
1# @aofl/aofljs-cli
2aofljs-cli is a command line tool for running aofljs/0.5.0 local server and automate the
3build process of aofljs apps.
4
5---
6## Installation
71. Make sure you have the latest stable versions of git, node and npm installed
82. Install as global package:
9
10```
11$ npm install -g @aofl/aofljs-cli
12```
13
14---
15## Usage
16```
17 $ aofljs-cli [options]
18 $ aofljs-cli [command] [options]
19```
20
21
22### Options:
23```
24 -h, --help output usage information
25 -V, --version output the version number
26
27 Examples:
28
29 $ aofljs-cli --help
30 $ aofljs-cli --version
31```
32
33### Commands:
34```
35 build runs r.js in a directory containing __build.js file.
36 server start http server
37 help [cmd] display help for [cmd]
38
39 Examples:
40
41 $ aofljs-cli build -r
42 $ aofljs-cli server -dl
43 $ aofljs-cli help build
44```
45
46#### help
47```
48 Usage: aofljs-cli help [options]
49
50 Options:
51 build output usage information for the build command. Equivalent to aofljs-cli build -h.
52 server output usage information for the server command. Equivalent to aofljs-cli server -h.
53```
54
55#### server
56aofljs-cli comes with a web server based on [express](https://www.npmjs.com/package/express).
57It supports development mode and live reload functionality.
58
59Install [livereload extensions](http://livereload.com/extensions/) in your browser to use this functionality.
60
61```
62 Usage: aofljs-cli server [options]
63
64 Options:
65
66 -h, --help output usage information
67 -d, --dev dev mode, *.js instead of *.min.js
68 -H, --host [host] set hostname
69 -l, --livereload enable livereload. Requires livereload browser extension
70 -p, --port [port] set port
71
72 Examples:
73
74 $ aofljs-cli server
75 $ aofljs-cli server -r
76 $ aofljs-cli server -d -l -H example.localhost.com -p 3000
77```
78
79#### build-app
80aofljs-cli build-app will rebuild desired directories into the output directory.
81The following files/directories will be filtered out:
82 - .git
83 - .spec.js
84 - node_modules
85 - bower_components
86 - karma.conf.js
87 - main.karma.js
88 - .md
89
90Names may be provided as additional arguments with a config file to filter desired
91apps within the config file.
92
93```json
94 Usage: aofljs-cli build-app [options]
95
96 Options:
97
98 -h, --help output usage information
99 -c, --config <path> path to config file
100 -o, --output <path> path to output directory
101
102 Examples:
103
104 $ aofljs-cli build-app
105 $ aofljs-cli build-app myDir -o path/to/output/dir
106 $ aofljs-cli build-app -c path/to/config.json
107 $ aofljs-cli build-app -c path/to/config.json name_one name_two
108
109 Config format:
110
111 {
112 apps: [
113 {
114 "name": "app_name",
115 "src": "dir_to_copy",
116 "output": "output_dir"
117 }, ...
118 ]
119 }
120
121
122```
123
124#### build
125aofljs-cli build command runs [requirejs optimizer](http://requirejs.org/docs/optimization.html)
126on __build.js file. The recursive option can be used to traverse the subdirectories of the working directory
127to optimize all __build.js scripts.
128
129```
130 Usage: aofljs-cli build [options]
131
132 Options:
133
134 -h, --help output usage information
135 -r [path] recursive build. Path is optional and if unspecified PWD will be used.
136
137 Examples:
138
139 $ aofljs-cli build
140 $ aofljs-cli build -r
141 $ aofljs-cli build -r path/to/dir1
142 $ aofljs-cli build -r path/to/dir1 path/to/dir2 ptah/to/dir3
143
144```
145
146*note:\**
147main.js builds fail in some cases with `Error: /abs/path/to/main.js does not exist.`
148To fix this issue update `mainConfigFile` path.
149```
150 mainConfigFile: './main.js',
151to
152 mainConfigFile: '../../app-directory/js/main.js',
153```
154
155#### translate
156aofljs-cli pot translates marked text within html elements that have a translate attribute.
157
158```
159 Usage: aofljs-cli pot
160
161 Examples:
162
163 $ aofljs-cli pot dir/to/translate
164
165```
166
167## License
168The MIT License (MIT)
169Copyright (c) 2017 Age of Learning
170
171Permission is hereby granted, free of charge, to any person obtaining a copy of
172this software and associated documentation files (the "Software"), to deal in
173the Software without restriction, including without limitation the rights to
174use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
175of the Software, and to permit persons to whom the Software is furnished to do
176so, subject to the following conditions:
177
178The above copyright notice and this permission notice shall be included in all
179copies or substantial portions of the Software.
180
181THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
182IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
183FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
184COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
185IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
186CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.