@maccesar/titools 5.2.5 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/CONTRIBUTING.md +1 -1
  2. package/README.md +58 -97
  3. package/agents/ti-pro.md +4 -2
  4. package/commands/ti-audit.md +7 -5
  5. package/docs/examples.md +24 -13
  6. package/docs/knowledge-index.md +2 -1
  7. package/lib/config.js +1 -0
  8. package/package.json +1 -1
  9. package/skills/alloy-guides/SKILL.md +18 -179
  10. package/skills/alloy-guides/references/CLI_TASKS.md +17 -216
  11. package/skills/alloy-guides/references/CONCEPTS.md +27 -162
  12. package/skills/alloy-guides/references/CONTROLLERS.md +38 -236
  13. package/skills/alloy-guides/references/MODELS.md +47 -723
  14. package/skills/alloy-guides/references/MODELS_ADVANCED.md +21 -482
  15. package/skills/alloy-guides/references/VIEWS_DYNAMIC.md +12 -222
  16. package/skills/alloy-guides/references/VIEWS_STYLES.md +39 -358
  17. package/skills/alloy-guides/references/VIEWS_XML.md +36 -552
  18. package/skills/alloy-guides/references/WIDGETS.md +49 -127
  19. package/skills/alloy-howtos/SKILL.md +14 -169
  20. package/skills/alloy-howtos/references/best_practices.md +9 -113
  21. package/skills/alloy-howtos/references/cli_reference.md +18 -223
  22. package/skills/alloy-howtos/references/config_files.md +50 -133
  23. package/skills/alloy-howtos/references/debugging_troubleshooting.md +19 -63
  24. package/skills/alloy-howtos/references/samples.md +21 -138
  25. package/skills/ti-api/SKILL.md +10 -2
  26. package/skills/ti-api/references/api-android.md +36 -2
  27. package/skills/ti-api/references/api-app-platform.md +39 -3
  28. package/skills/ti-api/references/api-core.md +50 -18
  29. package/skills/ti-api/references/api-data-network.md +49 -35
  30. package/skills/ti-api/references/api-media.md +45 -27
  31. package/skills/ti-api/references/api-services.md +39 -9
  32. package/skills/ti-api/references/api-ui-android.md +33 -13
  33. package/skills/ti-api/references/api-ui-extras.md +41 -15
  34. package/skills/ti-api/references/api-ui-ios-animator.md +42 -26
  35. package/skills/ti-api/references/api-ui-ios.md +74 -2
  36. package/skills/ti-api/references/api-ui-lists.md +32 -16
  37. package/skills/ti-api/references/api-ui-text-input.md +34 -17
  38. package/skills/ti-api/references/api-ui-views.md +27 -1
  39. package/skills/ti-api/references/api-ui-windows-navigation.md +32 -18
  40. package/skills/ti-api/references/api-xml-global.md +66 -16
  41. package/skills/ti-create-release/SKILL.md +98 -0
  42. package/skills/ti-create-release/references/module-discovery.md +69 -0
  43. package/skills/ti-expert/references/adaptive-layouts.md +1 -1
  44. package/skills/ti-guides/SKILL.md +37 -76
  45. package/skills/ti-guides/references/advanced-data-and-images.md +122 -126
  46. package/skills/ti-guides/references/android-manifest.md +24 -83
  47. package/skills/ti-guides/references/app-distribution.md +31 -377
  48. package/skills/ti-guides/references/application-frameworks.md +127 -335
  49. package/skills/ti-guides/references/cli-reference.md +184 -633
  50. package/skills/ti-guides/references/commonjs-advanced.md +81 -231
  51. package/skills/ti-guides/references/compatibility-matrix.md +36 -75
  52. package/skills/ti-guides/references/hello-world.md +95 -70
  53. package/skills/ti-guides/references/hyperloop-native-access.md +52 -448
  54. package/skills/ti-guides/references/resources.md +174 -142
  55. package/skills/ti-guides/references/sdk-release-notes.md +28 -71
  56. package/skills/ti-guides/references/tiapp-config.md +222 -598
  57. package/skills/ti-howtos/SKILL.md +23 -123
  58. package/skills/ti-howtos/references/cross-platform-development.md +119 -324
  59. package/skills/ti-howtos/references/debugging-profiling.md +77 -445
  60. package/skills/ti-howtos/references/extending-titanium.md +199 -673
  61. package/skills/ti-howtos/references/local-data-sources.md +87 -300
  62. package/skills/ti-howtos/references/location-and-maps.md +86 -213
  63. package/skills/ti-howtos/references/media-apis.md +103 -223
  64. package/skills/ti-howtos/references/notification-services.md +86 -506
  65. package/skills/ti-howtos/references/remote-data-sources.md +97 -316
  66. package/skills/ti-howtos/references/using-modules.md +77 -133
  67. package/skills/ti-synthengine/SKILL.md +62 -111
  68. package/skills/ti-synthengine/assets/example/README.md +50 -59
  69. package/skills/ti-synthengine/assets/example/app.js +67 -65
  70. package/skills/ti-synthengine/assets/example/lib/sequenceOwner.js +39 -40
  71. package/skills/ti-synthengine/assets/example/lib/soundPreset.js +34 -0
  72. package/skills/ti-synthengine/assets/index.d.ts +122 -2
  73. package/skills/ti-synthengine/references/advanced-examples.md +4 -4
  74. package/skills/ti-synthengine/references/api.md +40 -18
  75. package/skills/ti-synthengine/references/audio-engine.md +15 -57
  76. package/skills/ti-synthengine/references/examples.md +63 -6
  77. package/skills/ti-synthengine/references/guide.md +61 -57
  78. package/skills/ti-synthengine/references/instruments-and-effects.md +15 -15
  79. package/skills/ti-synthengine/references/native-variation.md +53 -14
  80. package/skills/ti-synthengine/references/recipes-interaction.md +25 -20
  81. package/skills/ti-synthengine/references/recipes.md +19 -16
  82. package/skills/ti-synthengine/references/recommendations.md +12 -12
  83. package/skills/ti-synthengine/references/sound-api.md +197 -0
  84. package/skills/ti-synthengine/references/sound-design.md +7 -7
  85. package/skills/ti-synthengine/references/source-notes.md +62 -172
  86. package/skills/ti-synthengine/references/troubleshooting.md +17 -19
  87. package/skills/ti-synthengine/references/upgrade-2.0.0.md +40 -0
  88. package/skills/ti-ui/SKILL.md +28 -143
  89. package/skills/ti-ui/references/icons-and-splash-screens.md +74 -403
  90. package/skills/ti-ui/references/layouts-and-positioning.md +175 -402
  91. package/skills/ti-ui/references/listviews-and-performance.md +100 -703
  92. package/skills/ti-ui/references/platform-conventions.md +180 -0
  93. package/skills/ti-ui/references/user-interface.md +43 -0
  94. package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +0 -102
  95. package/skills/alloy-howtos/references/custom_tags.md +0 -148
  96. package/skills/ti-guides/references/coding-best-practices.md +0 -149
  97. package/skills/ti-guides/references/javascript-primer.md +0 -414
  98. package/skills/ti-guides/references/reserved-words.md +0 -36
  99. package/skills/ti-guides/references/style-and-conventions.md +0 -103
  100. package/skills/ti-howtos/references/android-platform-deep-dives.md +0 -624
  101. package/skills/ti-howtos/references/automation-fastlane-appium.md +0 -96
  102. package/skills/ti-howtos/references/buffer-codec-streams.md +0 -162
  103. package/skills/ti-howtos/references/google-maps-v2.md +0 -172
  104. package/skills/ti-howtos/references/ios-map-kit.md +0 -149
  105. package/skills/ti-howtos/references/ios-platform-deep-dives.md +0 -611
  106. package/skills/ti-howtos/references/tutorials.md +0 -565
  107. package/skills/ti-howtos/references/web-content-integration.md +0 -287
  108. package/skills/ti-howtos/references/webpack-build-pipeline.md +0 -124
  109. package/skills/ti-synthengine/references/android-sim80-correction-evidence.zip +0 -0
  110. package/skills/ti-synthengine/references/android-sim80-correction.json +0 -162
  111. package/skills/ti-synthengine/references/audio-pipeline-validation.md +0 -19
  112. package/skills/ti-synthengine/references/bypass-physical-recheck-evidence.zip +0 -0
  113. package/skills/ti-synthengine/references/frontier-android-evidence.zip +0 -0
  114. package/skills/ti-synthengine/references/frontier-ipad-evidence.zip +0 -0
  115. package/skills/ti-synthengine/references/frontier-physical-validation.json +0 -1918
  116. package/skills/ti-synthengine/references/native-tone-repetition-validation.md +0 -59
  117. package/skills/ti-synthengine/references/native-variation-proposal.md +0 -182
  118. package/skills/ti-synthengine/references/native-variation-validation.md +0 -63
  119. package/skills/ti-synthengine/references/performance-review-evidence.zip +0 -0
  120. package/skills/ti-synthengine/references/performance-review.json +0 -1146
  121. package/skills/ti-synthengine/references/physical-validation.json +0 -1457
  122. package/skills/ti-synthengine/references/source-snapshot.json +0 -542
  123. package/skills/ti-synthengine/references/stats-performance.json +0 -2992
  124. package/skills/ti-synthengine/references/stats-performance.md +0 -82
  125. package/skills/ti-synthengine/references/studio-validation.json +0 -6202
  126. package/skills/ti-synthengine/references/unified-bypass-performance.json +0 -22425
  127. package/skills/ti-synthengine/references/unified-validation.json +0 -314
  128. package/skills/ti-ui/references/accessibility-deep-dive.md +0 -288
  129. package/skills/ti-ui/references/animation-and-matrices.md +0 -569
  130. package/skills/ti-ui/references/application-structures.md +0 -626
  131. package/skills/ti-ui/references/custom-fonts-styling.md +0 -549
  132. package/skills/ti-ui/references/event-handling.md +0 -401
  133. package/skills/ti-ui/references/gestures.md +0 -448
  134. package/skills/ti-ui/references/orientation.md +0 -374
  135. package/skills/ti-ui/references/platform-ui-android.md +0 -727
  136. package/skills/ti-ui/references/platform-ui-ios.md +0 -576
  137. package/skills/ti-ui/references/scrolling-views.md +0 -288
  138. package/skills/ti-ui/references/tableviews.md +0 -542
@@ -1,230 +1,25 @@
1
- # Alloy command-line interface reference
1
+ # Alloy CLI workflow in the current guides
2
2
 
3
- The Alloy CLI manages and builds Alloy projects.
3
+ Install Alloy separately with `npm install -g alloy`. The Titanium CLI and platform toolchain must already work; run `ti info` before creating or building the app.
4
4
 
5
- ## Installation
5
+ | Task | Command |
6
+ | --- | --- |
7
+ | Create an app and convert it to Alloy | `ti create --type app --alloy --name Hello --id com.example.hello --platforms android,ios --workspace-dir .` |
8
+ | Convert an existing Classic app | `alloy new` from its project root |
9
+ | Generate a reusable widget | `alloy generate widget com.example.rating` |
10
+ | Build and run on Android | `ti build --platform android` |
11
+ | Build and run on iOS | `ti build --platform ios` |
12
+ | Compile without installing/launching | Add `--build-only` |
13
+ | Reload JavaScript on save | Add `--liveview` |
14
+ | Select real hardware | Add `--target device` |
15
+ | Select one device | Add `--device-id <id>` |
6
16
 
7
- The Alloy CLI is installed when you install the `alloy` package.
17
+ Without Alloy on `PATH`, `ti create --alloy` leaves a Classic project and reports what to install. `ti create` without arguments prompts; noninteractive use needs the creation values shown above, including `--type` and `--workspace-dir`.
8
18
 
9
- ### Manual Installation
19
+ Use `ios` for iPhone and iPad; `iphone` selects iPhone only. A new app ID after publication creates a separate store listing. Default build targets are Android emulator and iOS simulator, with prompts when more than one device is available. iOS builds require macOS and Xcode.
10
20
 
11
- Install Node.js from [nodejs.org](http://nodejs.org/#download) first, then:
21
+ The current guides do not provide a complete Alloy command/options catalog. Use the installed released CLI's `alloy --help` / `alloy <command> --help` when an unlisted operation is required, and verify its behavior rather than importing an archived recipe.
12
22
 
13
- ```bash
14
- sudo npm install -g alloy
15
- ```
23
+ See [creating and running an app](../../alloy-guides/references/CLI_TASKS.md) for prerequisites and device signing, and [debugging](./debugging_troubleshooting.md) for LiveView limitations.
16
24
 
17
- For a specific version:
18
- ```bash
19
- sudo npm install -g alloy@1.10.0
20
- ```
21
-
22
- ### Development install
23
-
24
- ```bash
25
- git clone https://github.com/tidev/alloy.git
26
- cd alloy
27
- [sudo] npm install -g .
28
- ```
29
-
30
- ## Commands
31
-
32
- ### new
33
-
34
- Creates a new Alloy project on top of an existing Titanium project (create the classic Titanium project first, then run this command from inside the project directory).
35
-
36
- ```bash
37
- alloy new [<project_path>] [<project_template>] [--force] [--no-colors]
38
- ```
39
-
40
- | Option | Description |
41
- | -------------------- | --------------------------------------------------------------------------------- |
42
- | `<project_path>` | Path to skeleton Titanium project (default: current directory) |
43
- | `<project_template>` | **default** (single pane) or **two_tabbed** (tabbed app) |
44
- | `--testapp <path>` | Relative path to a test application in the Alloy GitHub repo (under `test/apps/`) |
45
- | `-f, --force` | Force execution |
46
- | `-n, --no-colors` | Disable color output |
47
-
48
- ### generate
49
-
50
- Creates skeleton Alloy components.
51
-
52
- ```bash
53
- alloy generate <component> [--widgetname <widget_name>] [--outputPath <output_path>] [--platform <platform>] [--force] [--no-colors]
54
- ```
55
-
56
- | Component | Description |
57
- | --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
58
- | `controller <name>` | Create controller, view and style |
59
- | `jmk` | Create `alloy.jmk` |
60
- | `model <name> <adapter> [schema]` | Create model (see Model Format below) |
61
- | `migration <model_name>` | Create migration file |
62
- | `style <name>` or `--all` | Create style file (or all styles). If name matches a view-controller, it populates using IDs/classes from markup. Running again updates existing files with new attributes. |
63
- | `view <name>` | Create view and style |
64
- | `widget <name>` | Create widget |
65
-
66
- | Option | Description |
67
- | ------------------------- | ------------------------------------------------ |
68
- | `--widgetname <name>` | Create component for specified widget |
69
- | `-o, --outputPath <path>` | Output path (point to 'app' directory) |
70
- | `--platform <platform>` | Create platform-specific component (android/ios) |
71
- | `-f, --force` | Force execution |
72
- | `-n, --no-colors` | Disable color output |
73
-
74
- #### Model format
75
-
76
- Select adapter type:
77
- - `sql` - SQLite database for Android/iOS (also generates a migration file)
78
- - `properties` - Local storage in Titanium SDK context
79
-
80
- Schema format: space-delimited list of `field:type`
81
- - Example: `name:string age:number sex:varchar dob:date`
82
-
83
- SQLite type mapping:
84
-
85
- | Datatype | SQLite Type |
86
- | ---------------------------------------- | ----------- |
87
- | string, varchar, text | TEXT |
88
- | int, tinyint, smallint, bigint, integer | INTEGER |
89
- | double, float, real | REAL |
90
- | blob | BLOB |
91
- | decimal, number, date, datetime, boolean | NUMERIC |
92
- | null | NULL |
93
- | unknown | TEXT |
94
-
95
- ### install
96
-
97
- Installs special Alloy project components.
98
-
99
- ```bash
100
- alloy install <module> [<project_path>]
101
- ```
102
-
103
- | Module | Description |
104
- | ---------------- | ----------------------------------------- |
105
- | `plugin` | Install compiler plugin for Studio |
106
- | `<project_path>` | Project path (default: current directory) |
107
-
108
- ### compile
109
-
110
- Compiles Alloy code to Titanium SDK code.
111
-
112
- ```bash
113
- alloy compile [<project_path>] [--config <compiler_options>] [--no-colors]
114
- ```
115
-
116
- | Option | Description |
117
- | ------------------------ | ------------------------------------------------------------------------- |
118
- | `<project_path>` | Project path (default: current directory) |
119
- | `-c, --config <options>` | Comma-delimited compiler options (e.g., `beautify=false,deploytype=test`) |
120
- | `-n, --no-colors` | Disable color output |
121
-
122
- Compiler options reference the `event.alloyConfig` object in [Build Configuration File (alloy.jmk)](config_files.md).
123
-
124
- ### run
125
-
126
- Use `titanium build` command to run Alloy projects. See [Titanium Command-Line Interface Reference](https://titaniumsdk.com/docs/reference/cli).
127
-
128
- > **💡 Common ti build pitfalls**
129
- >
130
- > Using `-C` flag without UDID:
131
- > ```bash
132
- > # Prompts for simulator selection interactively
133
- > ti build -p ios -T simulator -C
134
- > ```
135
- >
136
- > Correct approach for simulator:
137
- > ```bash
138
- > # Runs on default simulator
139
- > ti build -p ios -T simulator
140
- > ```
141
- >
142
- > Using `--no-prompt` incorrectly:
143
- > ```bash
144
- > # Still may prompt for device selection if not specific
145
- > ti build -p ios --no-prompt
146
- > ```
147
- >
148
- > Always specify target:
149
- > ```bash
150
- > # Clear target specification
151
- > ti build -p ios -T simulator --no-prompt
152
- > ```
153
- >
154
- > **Common patterns:**
155
- > ```bash
156
- > # iOS Simulator (most common during development)
157
- > ti build -p ios -T simulator
158
- >
159
- > # iOS Device (requires UDID)
160
- > ti build -p ios -T device -V <udid>
161
- >
162
- > # Android Emulator
163
- > ti build -p android -T emulator
164
- >
165
- > # Build only (don't run)
166
- > ti build -p ios -T simulator --build-only
167
- > ```
168
-
169
- ### i18n-extract
170
-
171
- Extracts i18n keys from TSS and JS files to strings.xml.
172
-
173
- ```bash
174
- alloy extract-i18n [<language>] [--apply]
175
- ```
176
-
177
- | Option | Description |
178
- | ------------ | ------------------------------------------ |
179
- | `<language>` | Two-letter language code (default: **en**) |
180
- | `--apply` | Write to strings.xml (preview if absent) |
181
-
182
- Supported functions:
183
- - `Ti.Locale.getString()`
184
- - `L()`
185
-
186
- Usage examples:
187
- ```bash
188
- # Preview changes for default (English)
189
- alloy extract-i18n
190
-
191
- # Write changes to "app/i18n/en/strings.xml"
192
- alloy extract-i18n --apply
193
-
194
- # Specify "es" as the language and write the changes to "app/i18n/es/strings.xml"
195
- alloy extract-i18n es --apply
196
-
197
- # Preview Spanish changes
198
- alloy extract-i18n es
199
- ```
200
-
201
- ### copy
202
-
203
- Copy a view-controller (controller, XML, TSS).
204
-
205
- ```bash
206
- alloy copy <CONTROLLER_NAME> <COPIED_CONTROLLER_NAME>
207
- ```
208
-
209
- ### move
210
-
211
- Rename a view-controller.
212
-
213
- ```bash
214
- alloy move <CONTROLLER_NAME> <NEW_CONTROLLER_NAME>
215
- ```
216
-
217
- ### remove
218
-
219
- Remove a view-controller.
220
-
221
- ```bash
222
- alloy remove <CONTROLLER_NAME>
223
- ```
224
-
225
- ## Additional Options
226
-
227
- | Option | Description |
228
- | --------------- | --------------------- |
229
- | `-h, --help` | Output command usage |
230
- | `-v, --version` | Output version number |
25
+ Sources: [first app](https://titaniumsdk.com/docs/build/first-app.md), [Alloy](https://titaniumsdk.com/docs/alloy.md), [widgets](https://titaniumsdk.com/docs/alloy/widgets.md).
@@ -1,158 +1,75 @@
1
- # Alloy configuration files reference
1
+ # Alloy configuration
2
2
 
3
- ## Build configuration file (alloy.jmk)
3
+ `app/config.json` holds runtime settings and compiler configuration. A generated project uses these sections:
4
4
 
5
- Alloy exposes hooks to customize compilation with a JS Makefile (JMK).
6
-
7
- **Location:** `app/alloy.jmk`
8
-
9
- **Example:**
10
- ```javascript
11
- task('pre:compile', (event, logger) => {
12
- logger.showTimestamp = true;
13
- logger.info(`building project at ${event.dir.project}`);
14
- });
15
-
16
- task('post:compile', (event, logger) => {
17
- logger.info('compile finished!');
18
- });
5
+ ```json
6
+ {
7
+ "global": {},
8
+ "env:development": {},
9
+ "env:test": {},
10
+ "env:production": {},
11
+ "os:android": {},
12
+ "os:ios": {},
13
+ "dependencies": {},
14
+ "backbone": "1.4.0"
15
+ }
19
16
  ```
20
17
 
21
- ### Compiler tasks (event names)
22
-
23
- | Task | When Called |
24
- | ---------------- | --------------------------------------------------------- |
25
- | `pre:load` | After project clean, before copying assets to `Resources` |
26
- | `pre:compile` | Before compiler starts |
27
- | `post:compile` | After compiler finishes, before exit |
28
- | `compile:app.js` | After compiling `app.js`, before writing to disk |
29
-
30
- ### Event object
31
-
32
- | Property | Type | Description |
33
- | -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
34
- | `adapters` | Array | List of adapters |
35
- | `alloyConfig` | Object | Compiler config: `platform` (android/ios), `file` (selective compile), `deploytype` (development/test/production), `beautify` (Boolean) |
36
- | `autoStyle` | Boolean | Autostyle enabled for project |
37
- | `dependencies` | Object | Value of `dependencies` key in config.json |
38
- | `dir` | Object | Directory paths: `home` (app path), `project` (root path), `resources`, `resourcesAlloy`, `assets`, `config`, `controllers`, `migrations`, `models`, `styles`, `themes`, `views`, `widgets`, `builtins`, `template` |
39
- | `sourcemap` | Boolean | If `true`, generates mapping files to link generated Titanium files in `Resources` back to the source files in `app` for debugging. |
40
- | `theme` | String | Theme name being used |
41
- | `code` | String | *(compile:app.js only)* Contents of `app.js` |
42
- | `appJSFile` | String | *(compile:app.js only)* Absolute path to `app.js` |
43
-
44
- ### Logger object
45
-
46
- The `logger` object controls compilation log output.
47
-
48
- #### Properties
49
-
50
- | Property | Type | Description |
51
- | --------------- | ------- | ----------------------------------------------- |
52
- | `DEBUG` | Number | READONLY. Output all log messages. |
53
- | `INFO` | Number | READONLY. Output all except debug messages. |
54
- | `WARN` | Number | READONLY. Output only warning and error. |
55
- | `ERROR` | Number | READONLY. Output only error messages. |
56
- | `NONE` | Number | READONLY. Disable log messages. |
57
- | `logLevel` | Number | Sets which log messages to output. |
58
- | `showTimestamp` | Boolean | If `true`, outputs timestamp with log messages. |
59
- | `stripColors` | Boolean | If `true`, suppresses color output. |
18
+ ## Runtime values and overrides
60
19
 
61
- #### Methods
20
+ ```json
21
+ {
22
+ "global": { "apiRoot": "https://example.com/api", "pageSize": 20 },
23
+ "env:production": { "apiRoot": "https://api.example.com" },
24
+ "os:android": { "pageSize": 10 }
25
+ }
26
+ ```
62
27
 
63
- | Method | Description |
64
- | -------------------- | ------------------------------ |
65
- | `debug(msg: String)` | Outputs a debug log message. |
66
- | `info(msg: String)` | Outputs an info log message. |
67
- | `warn(msg: String)` | Outputs a warning log message. |
68
- | `error(msg: String)` | Outputs an error log message. |
28
+ Read the resulting values with `Alloy.CFG.apiRoot`. The selected `env:` is the build deploy type, not its target. Simulator builds normally use `development`; `--deploy-type production` selects production.
69
29
 
70
- ---
30
+ For conflicting keys, released Alloy 3.0.1 merges `global`, then the matching `env:`, then `os:`: the OS value wins. The current published configuration page reverses the last two in its prose. Do not rely on that wording; verify the installed compiler when a collision matters.
71
31
 
72
- ## Global initializer (alloy.js)
32
+ The merged configuration ships in the app and can be extracted. API roots belong here; secrets belong on a server. Compiler settings can also appear in the generated configuration: do not treat it as a secret store or assume compiler-only keys are stripped.
73
33
 
74
- **Location:** `app/alloy.js`
34
+ ## Compile-time constants
75
35
 
76
- Runs before any controllers load. Use it to set up globals and singletons.
36
+ | Constant | True when |
37
+ | --- | --- |
38
+ | `OS_IOS`, `OS_ANDROID` | Building that platform |
39
+ | `ENV_DEV`, `ENV_DEVELOPMENT` | Development deploy type |
40
+ | `ENV_TEST` | Test deploy type |
41
+ | `ENV_PROD`, `ENV_PRODUCTION` | Production deploy type |
42
+ | `DIST_ADHOC` | Target `dist-adhoc` |
43
+ | `DIST_STORE` | Target `dist-appstore` or `dist-playstore` |
77
44
 
78
- Common uses:
79
- - Creating `Alloy.Collections` (e.g., `Alloy.Collections.myModel = Alloy.createCollection('myModel');`)
80
- - Setting up `Alloy.Globals` (shared references, utility functions)
81
- - Initializing singletons (analytics, logging, network managers)
82
- - Configuring global event listeners
45
+ These are compiler-provided, not entries in `config.json`. Write the platform condition explicitly so the compiler can remove the other branch:
83
46
 
84
- **Example:**
85
47
  ```javascript
86
- // app/alloy.js
87
- Alloy.Globals.loading = Alloy.createWidget('com.example.loading');
88
- Alloy.Collections.users = Alloy.createCollection('user');
89
-
90
- // Global utility
91
- Alloy.Globals.alert = (title, message) => {
92
- Ti.UI.createAlertDialog({ title, message }).show();
93
- };
48
+ if (OS_IOS) {
49
+ // iOS-specific implementation.
50
+ }
94
51
  ```
95
52
 
96
- ---
97
-
98
- ## Project configuration file (config.json)
53
+ Guard or remove logging before distribution; release logging can expose interpolated private data. Do not infer a target named `dist-store` from the constant.
99
54
 
100
- **Location:** `app/config.json`
55
+ ## Themes, widgets and Backbone
101
56
 
102
- Alloy uses `config.json` for global values, environment and platform overrides, and widget dependencies.
103
- ### Objects
57
+ Set a build-time theme using `{ "global": { "theme": "dark" } }` and provide its directory under `app/themes/dark`. See [styles and themes](../../alloy-guides/references/VIEWS_STYLES.md#themes).
104
58
 
105
- | Object | Description |
106
- | ----------------- | ----------------------------------------------------------- |
107
- | `global` | Key-value pairs for all environments and platforms |
108
- | `env:development` | Development builds (simulator/emulator) |
109
- | `env:test` | Test builds on device |
110
- | `env:production` | Production builds (after package installation) |
111
- | `os:android` | Android-specific values |
112
- | `os:ios` | iOS-specific values |
113
- | `dependencies` | Widget dependencies (name: version) |
114
- | `autoStyle` | Enable autostyle for entire project |
115
- | `backbone` | Backbone.js version: `0.9.2` (default), `1.1.2`, or `1.3.3` |
59
+ `dependencies` lists widget IDs and versions. Provide those widget directories under `app/widgets`; an undeclared widget is not compiled. See [widgets](../../alloy-guides/references/WIDGETS.md).
116
60
 
117
- **Precedence:** `os` > `env` > `global`. Combinations (for example, `os:ios env:production`) override single values.
61
+ `backbone` pins the bundled Backbone version. The released Alloy 3.0.1 template already selects `1.4.0`; do not infer that the project needs unreleased Alloy 3.1.0 from the current model guide's attribution. Check the actual config and `alloy --version`.
118
62
 
119
- **Runtime access:** Values are available at runtime via `Alloy.CFG.<key>`.
63
+ ## Build hooks
120
64
 
121
- **Example:**
65
+ `app/alloy.jmk` runs around compilation and can copy inputs or adjust generated output:
122
66
 
123
- ```json
124
- {
125
- "global": { "foo": 1 },
126
- "env:development": { "foo": 2 },
127
- "env:test": { "foo": 3 },
128
- "env:production": { "foo": 4 },
129
- "os:ios env:production": { "foo": 5 },
130
- "os:ios env:development": { "foo": 6 },
131
- "os:ios env:test": { "foo": 7 },
132
- "os:android": { "foo": 8 },
133
- "dependencies": {
134
- "com.foo.widget": "1.0"
135
- }
136
- }
67
+ ```javascript
68
+ task('post:compile', (event, logger) => {
69
+ logger.info(`compiled ${event.dir.project}`);
70
+ });
137
71
  ```
138
72
 
139
- Accessing values: `Ti.API.info(Alloy.CFG.foo)` on iPhone simulator returns `6`.
140
-
141
- ---
142
-
143
- ## Widget configuration file (widget.json)
144
-
145
- **Location:** Root directory of the widget. Follows the npm `package.json` format with a few exceptions.
146
- ### Keys
147
-
148
- | Key | Type | Required | Description |
149
- | ---------------------- | ------ | -------- | ------------------------------------- |
150
- | `id` | String | Yes | Must match widget root folder name |
151
- | `copyright` | String | No | Copyright information |
152
- | `license` | String | No | License information |
153
- | `min-alloy-version` | Float | No* | Minimum Alloy version required |
154
- | `min-titanium-version` | Float | No* | Minimum Titanium version required |
155
- | `tags` | String | No | Comma-delimited keywords |
156
- | `platforms` | String | No* | Supported platforms (comma-delimited) |
73
+ Keep hooks small: they execute on each build. The current guide names `pre:load`, `post:load`, `pre:compile` and `post:compile`; released Alloy 3.0.1 implements `pre:load`, `pre:compile` and `post:compile`, but not `post:load`. Do not write a `post:load` recipe without checking support in the version actually installed.
157
74
 
158
- (*) Currently, `min-alloy-version`, `min-titanium-version`, and `platforms` are not strictly enforced, but Alloy will perform checks against these in future versions.
75
+ Sources: [configuration](https://titaniumsdk.com/docs/alloy/config.md), [models](https://titaniumsdk.com/docs/alloy/models.md). The precedence, Backbone and hook caveats are verified against released Alloy 3.0.1.
@@ -1,78 +1,34 @@
1
- # Alloy debugging and troubleshooting
1
+ # Debugging an Alloy application
2
2
 
3
- ## Debugging
3
+ First separate a compiler/native build failure from a failure in the running app.
4
4
 
5
- ### Compiler error messages
5
+ ## Build failures
6
6
 
7
- The Alloy compiler reports syntax errors in JavaScript, JSON, TSS, and XML. Error messages include:
8
- - File path
9
- - Line and character position
10
- - Description of the error
7
+ 1. Run `ti info` and fix toolchain errors first.
8
+ 2. If generated files are stale, run `ti clean` and rebuild.
9
+ 3. Read upward to the first Gradle/Xcode error; later messages can be consequences.
10
+ 4. For linker failures, inspect native-module compatibility with the SDK through `ti-guides`.
11
11
 
12
- ## Troubleshooting
12
+ `Resources/` and `build/` are generated in an Alloy app. Do not repair generated output by editing it.
13
13
 
14
- ### Error: No app.js found
14
+ ## Runtime diagnosis
15
15
 
16
- **Error:** `[ERROR] No app.js found. Ensure the app.js file exists in your project's Resources directory.`
16
+ Use `Ti.API.trace`, `debug`, `info`, `warn`, `error` and `log`. `info` is the default build log level; add `--log-level warn` to reduce output or `--log-level trace` for build diagnostics. Logs ship with release builds and can expose tokens, email addresses or other interpolated private data; guard or remove them before distribution.
17
17
 
18
- **Solution:** If part of the contents of your `Resources` folder were deleted, run:
19
- ```bash
20
- alloy compile --config platform=<platform>
21
- ```
22
-
23
- ### Android: images, HTML, and assets not displaying
24
-
25
- **Problem:** Assets display on iOS and Mobile Web but not Android.
26
-
27
- **Solution:** Android requires absolute paths. Precede asset paths with a slash ('/'). iOS and Mobile Web accept both relative and absolute paths.
18
+ The VS Code Titanium extension provides the `titanium` debug type for breakpoints. The JetBrains integration uses Chrome DevTools Protocol and also needs `ios-webkit-debug-proxy` for iOS. Without an editor integration, use logs rather than assuming breakpoints are available.
28
19
 
29
- ### Android runtime error: cannot call method of undefined
20
+ For native crashes, inspect Android `adb logcat`, or macOS Console with the iOS device selected and filtered by app name. Xcode also retains device crash reports.
30
21
 
31
- **Error:** `Uncaught TypeError: Cannot call method xxx of undefined`
22
+ ## LiveView
32
23
 
33
- **Causes:**
34
- 1. Creating an iOS-only Titanium object. Use the `platform` attribute in views to enforce platform-specific objects.
35
- 2. Top-level UI component has an assigned ID. The controller cannot use `$.<controller_name>` to reference it; use the assigned ID instead.
36
-
37
- ### Android runtime error: Alloy is not defined
38
-
39
- **Error:** `Uncaught ReferenceError: Alloy is not defined`
40
-
41
- **Cause:** Non-controller JavaScript files are not automatically wrapped by Alloy. See [best_practices.md](best_practices.md) for the safe require pattern for non-controller files.
42
-
43
- **Solution:** Require the 'alloy' module:
44
- ```javascript
45
- const Alloy = require('alloy');
24
+ ```bash
25
+ ti build --platform android --liveview
46
26
  ```
47
27
 
48
- ### iOS application error: invalid method passed to UIModule
49
-
50
- **Error:** `invalid method (xxx) passed to UIModule (unknown file)`
51
-
52
- **Cause:** Trying to create an Android-only Titanium object.
53
-
54
- **Solution:** Use the `platform` attribute in the view to enforce platform-specific objects.
55
-
56
- ### iOS application error: undefined is not an object
57
-
58
- **Error:** `undefined is not an object (evaluating $.xxx.open) (unknown file)`
59
-
60
- **Cause:** Top-level UI component has an assigned ID in XML markup.
61
-
62
- **Solution:** The controller cannot use `$.<controller_name>` to reference it; use the assigned ID instead.
63
-
64
- ## Getting help
65
-
66
- Use the [TiDev Community Slack](https://slack.tidev.io/) or [GitHub Discussions](https://github.com/tidev/titanium-sdk/discussions):
67
- - Include 'alloy' as a tag
68
- - Include the Alloy version (run `alloy --version`)
69
- - Include platform information
28
+ LiveView re-runs JavaScript against the installed app. Changes to `tiapp.xml`, modules, native dependencies or `app/platform/` require a real build. Check this when a saved change appears ineffective.
70
29
 
71
- ## Submitting a bug report
30
+ ## Profiling
72
31
 
73
- Search [existing issues](https://github.com/tidev/alloy/issues) first to avoid duplicates. If none match, create a new issue:
74
- - Select 'Alloy' as the component
75
- - Include Alloy version (`alloy --version`)
76
- - Include environment information
32
+ Use Android Studio Profiler on a debug build or Xcode Instruments on iOS. Allocations and Leaks help investigate memory growth. Native frames may show JavaScript work as bridge time rather than a precise source line. For list performance, inspect row/template work and use the current lists guidance through `ti-ui`.
77
33
 
78
- For detailed instructions, see [How to Report a Bug or Make a Feature Request](https://titaniumsdk.com/contribute).
34
+ Source: [debugging and profiling](https://titaniumsdk.com/docs/build/debugging.md).