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