[ALOY-1549] Remove autoloading of index controller from Alloy.js
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | n/a |
| Status | Open |
| Resolution | Unresolved |
| Affected Version/s | n/a |
| Fix Version/s | Alloy 2.0.0 |
| Components | n/a |
| Labels | alloy.js, app.js, createController, index |
| Reporter | Creative |
| Assignee | Unknown |
| Created | 2017-02-07T13:09:56.000+0000 |
| Updated | 2020-01-31T12:13:59.000+0000 |
Description
During compilation, Alloy apparently appends a line named "Alloy.createController('index');" to the alloy.js file. We should remove any magic like this and make it visible/editable by the user.
Use cases:
- Run a different controller than index.js
- Run unit tests before loading anything else
- Run no controller at all but run a different setup (like keeping the splash screen on and doing stuff which does not require user interaction)
https://github.com/appcelerator/alloy/pull/815
Thanks for creating the ticket and the PR. Our engineers will consider it. Moving to TIMOB.
I currently use "main" to define the primary entry point for the application (similar to what Node.js does in package.json) . https://docs.npmjs.com/files/package.json#main We can either use the existing "main" property in package.json or use a "main" property in config.json.
That's a pretty nice solution [~bhouse], maybe rather than completely changing this and moving it to the alloy.js file. We could look at allowing it to be configured using something like the following: 1. Prefer main in config.json 2. Fallback to main in package.json 3. If nothing else exists we maintain the
Alloy.createController('index');I'd imagine we should still consider this a breaking change though just incase folks are using main in package.json/config.json already