1 | [![Build Status](https://travis-ci.org/Industrial/id-builder.svg?branch=master)](https://travis-ci.org/Industrial/id-builder)
|
2 |
|
3 | # id-builder
|
4 | id-builder compiles your code, runs your tests and servers, recompiles and
|
5 | restarts on changes and reloads the browser for you.
|
6 |
|
7 | ## Getting Started
|
8 | 1. id-builder assumes the following directory structure but all paths can be configured to point to a different location.
|
9 | ```
|
10 | // Source Directory
|
11 | src/
|
12 | client/
|
13 | app.js
|
14 | server/
|
15 | app.js
|
16 | tests/
|
17 | anything.js
|
18 |
|
19 | // Target Directory (created automatically)
|
20 | build/
|
21 | client/
|
22 | app.js
|
23 | server/
|
24 | app.js
|
25 | tests/
|
26 | anything.js
|
27 | ```
|
28 |
|
29 | 2. Create a file with any name in your project for example `id-builder.js`.
|
30 | ```javascript
|
31 | var idBuilder = require("id-builder");
|
32 |
|
33 | idBuilder();
|
34 | ```
|
35 |
|
36 | or just
|
37 |
|
38 | ```javascript
|
39 | require("id-builder")();
|
40 | ```
|
41 |
|
42 | 3. Run the file.
|
43 | ```bash
|
44 | node id-builder.js
|
45 |
|
46 | ```
|
47 |
|
48 | ## API
|
49 | ### idBuilder([options]);
|
50 | Takes an optional options object. By default, all tasks are enabled.
|
51 |
|
52 | Default options:
|
53 | ```javascript
|
54 | idBuilder({
|
55 | // These aren't used at the moment.
|
56 | sourceDirectory: "src",
|
57 | targetDirectory: "build",
|
58 | testsDirectory: "build/tests",
|
59 |
|
60 | tasks: {
|
61 | clean: {
|
62 | enabled: true,
|
63 | path: "build"
|
64 | },
|
65 |
|
66 | compileBrowserify: {
|
67 | enabled: true,
|
68 | sourceDirectory: "build/client/js",
|
69 | sourcePath: "build/client/js/app.js",
|
70 | targetPath: "build/client/js/app.bundle.js"
|
71 | },
|
72 |
|
73 | compileCoffeescript: {
|
74 | enabled: true,
|
75 | sourcePath: "src",
|
76 | targetPath: "build"
|
77 | },
|
78 |
|
79 | compileJade: {
|
80 | enabled: true,
|
81 | sourcePath: "src/client",
|
82 | targetPath: "build/client"
|
83 | },
|
84 |
|
85 | compileLess: {
|
86 | enabled: true,
|
87 | sourcePath: "src/client",
|
88 | targetPath: "build/client"
|
89 | },
|
90 |
|
91 | compileLivescript: {
|
92 | enabled: true,
|
93 | sourcePath: "src",
|
94 | targetPath: "build"
|
95 | },
|
96 |
|
97 | compileSixToFive: {
|
98 | enabled: true,
|
99 | sourcePath: "src",
|
100 | targetPath: "build"
|
101 | },
|
102 |
|
103 | compileStylus: {
|
104 | enabled: true,
|
105 | sourcePath: "src/client",
|
106 | targetPath: "build/client"
|
107 | },
|
108 |
|
109 | compileCopy: {
|
110 | enabled: true,
|
111 | sourcePath: "src",
|
112 | targetPath: "build"
|
113 | },
|
114 |
|
115 | runBrowsersyncServer: {
|
116 | enabled: true
|
117 | },
|
118 |
|
119 | runServers: {
|
120 | enabled: true,
|
121 | sourcePath: "build/server",
|
122 | paths: ["app.js"]
|
123 | },
|
124 |
|
125 | runTests: {
|
126 | enabled: true,
|
127 | sourcePath: "build/test",
|
128 | reporter: "spec"
|
129 | },
|
130 |
|
131 | watchBrowserify: {
|
132 | enabled: true,
|
133 | sourceDirectory: "build/client/js",
|
134 | sourcePath: "build/client/js/app.js",
|
135 | targetPath: "build/client/js/app.bundle.js"
|
136 | },
|
137 |
|
138 | watchBrowsersync: {
|
139 | enabled: true,
|
140 | sourcePath: "build/client"
|
141 | },
|
142 |
|
143 | watchCoffeescript: {
|
144 | enabled: true,
|
145 | sourcePath: "src",
|
146 | targetPath: "build"
|
147 | },
|
148 |
|
149 | watchJade: {
|
150 | enabled: true,
|
151 | sourcePath: "src/client",
|
152 | targetPath: "build/client"
|
153 | },
|
154 |
|
155 | watchLess: {
|
156 | enabled: true,
|
157 | sourcePath: "src/client",
|
158 | targetPath: "build/client"
|
159 | },
|
160 |
|
161 | watchLivescript: {
|
162 | enabled: true,
|
163 | sourcePath: "src",
|
164 | targetPath: "build"
|
165 | },
|
166 |
|
167 | watchServers: {
|
168 | enabled: true,
|
169 | sourcePath: "build/server",
|
170 | paths: ["app.js"]
|
171 | },
|
172 |
|
173 | watchTests: {
|
174 | enabled: true,
|
175 | sourcePath: "build/test",
|
176 | reporter: "spec"
|
177 | },
|
178 |
|
179 | watchSixToFive: {
|
180 | enabled: true,
|
181 | sourcePath: "src/client",
|
182 | targetPath: "build/client"
|
183 | },
|
184 |
|
185 | watchStylus: {
|
186 | enabled: true,
|
187 | sourcePath: "src/client",
|
188 | targetPath: "build/client"
|
189 | },
|
190 |
|
191 | watchCopy: {
|
192 | enabled: true,
|
193 | sourcePath: "src",
|
194 | targetPath: "build"
|
195 | },
|
196 |
|
197 | watch: {
|
198 | enabled: true,
|
199 | paths: ['src', 'build']
|
200 | }
|
201 | }
|
202 | });
|
203 | ```
|
204 |
|
205 | ## Tasks
|
206 |
|
207 | ### Clean
|
208 | Removes all files from the build directory.
|
209 |
|
210 | ### Copy
|
211 | Copies files that are not compiled to another format.
|
212 |
|
213 | ### Compile
|
214 | These tasks all compile an input language to HTML, JavaScript or CSS.
|
215 |
|
216 | #### Browserify
|
217 | Compiles all Client code into one file. Uses
|
218 | [Browserify](https://github.com/substack/node-browserify).
|
219 |
|
220 | #### CoffeeScript
|
221 | Compiles CoffeeScript files to JavaScript.
|
222 |
|
223 | #### Jade
|
224 | Compiles Jade files to JavaScript.
|
225 |
|
226 | #### Less
|
227 | Compiles Less files to CSS.
|
228 |
|
229 | #### LiveScript
|
230 | Compiles LiveScript files to JavaScript.
|
231 |
|
232 | #### Stylus
|
233 | Compiles Stylus files to CSS.
|
234 |
|
235 | ### Run
|
236 | These tasks run one or more processes to facilitate the development process.
|
237 |
|
238 | #### Servers
|
239 | Runs one or more servers used in your project. These run under separate
|
240 | processes and are started/stopped/restarted together.
|
241 |
|
242 | #### Tests
|
243 | Runs all the tests. For now, the only output is to the console. Later this
|
244 | could include growl style desktop notifications, etc.
|
245 |
|
246 | ### Watch
|
247 | Watches for changes in the source and test directory and takes appropriate
|
248 | actions. There is a separate watch task for each compile and run task. There is
|
249 | only one watcher in your entire project to increase speed and not hit the
|
250 | inodes limit.
|
251 |
|
252 | ## Planned Features
|
253 |
|
254 | ### Options
|
255 |
|
256 | #### Paths
|
257 | It would be a good idea to have root paths configured so other paths may be
|
258 | specified relative to these root paths. I'm not sure how to make these paths
|
259 | both configurable and DRY other then putting variables in the paths;
|
260 |
|
261 | ### Documentation
|
262 | At some point it would be good to have an automated documentation facility.
|
263 | The documentation would be JavaScript based so Languages that compile to
|
264 | JavaScript should include the documentation in their output.
|
265 |
|
266 | ### Command Line
|
267 | It would be nice to be able to start tasks (and all their dependencies before
|
268 | them) based on a command line interface.
|
269 |
|
270 | ### Web Interface
|
271 | Building on the command line interface, one of the commands could start a
|
272 | webserver hosting a webapplication to manage process instead of having to use
|
273 | the commandline.
|
274 |
|
275 | Acting as a "central hub" to your project, it could include code stats, test run
|
276 | stats, complete control over all the processes that are running for your
|
277 | project, running different environments (OTAP), etc.
|
278 |
|
279 | ### Continuous Integration & Deployment
|
280 | Provide integration with CI and CD, allowing you to easily deploy new
|
281 | versions of your code. |
\ | No newline at end of file |