@maccesar/titools 2.2.3 → 2.2.8

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 (96) hide show
  1. package/README.md +28 -27
  2. package/lib/commands/update.js +80 -101
  3. package/package.json +1 -1
  4. package/skills/alloy-guides/SKILL.md +31 -31
  5. package/skills/alloy-guides/references/CONCEPTS.md +3 -3
  6. package/skills/alloy-guides/references/CONTROLLERS.md +1 -1
  7. package/skills/alloy-guides/references/MODELS.md +6 -6
  8. package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +1 -1
  9. package/skills/alloy-guides/references/VIEWS_XML.md +1 -1
  10. package/skills/alloy-guides/references/WIDGETS.md +1 -1
  11. package/skills/alloy-howtos/SKILL.md +27 -27
  12. package/skills/alloy-howtos/references/best_practices.md +9 -9
  13. package/skills/alloy-howtos/references/cli_reference.md +14 -14
  14. package/skills/alloy-howtos/references/config_files.md +16 -16
  15. package/skills/alloy-howtos/references/custom_tags.md +16 -16
  16. package/skills/alloy-howtos/references/debugging_troubleshooting.md +11 -15
  17. package/skills/alloy-howtos/references/samples.md +19 -19
  18. package/skills/purgetss/SKILL.md +11 -1
  19. package/skills/purgetss/references/animation-system.md +1 -1
  20. package/skills/purgetss/references/cli-commands.md +3 -3
  21. package/skills/purgetss/references/customization-deep-dive.md +1 -1
  22. package/skills/purgetss/references/dynamic-component-creation.md +1 -1
  23. package/skills/purgetss/references/icon-fonts.md +4 -0
  24. package/skills/purgetss/references/installation-setup.md +8 -1
  25. package/skills/purgetss/references/migration-guide.md +4 -0
  26. package/skills/purgetss/references/tikit-components.md +193 -204
  27. package/skills/purgetss/references/ui-ux-design.md +1 -1
  28. package/skills/ti-expert/SKILL.md +78 -118
  29. package/skills/ti-expert/references/alloy-builtins.md +18 -18
  30. package/skills/ti-expert/references/alloy-structure.md +21 -21
  31. package/skills/ti-expert/references/anti-patterns.md +15 -15
  32. package/skills/ti-expert/references/cli-expert.md +15 -15
  33. package/skills/ti-expert/references/code-conventions.md +38 -38
  34. package/skills/ti-expert/references/contracts.md +8 -8
  35. package/skills/ti-expert/references/controller-patterns.md +14 -14
  36. package/skills/ti-expert/references/error-handling.md +11 -11
  37. package/skills/ti-expert/references/examples.md +12 -12
  38. package/skills/ti-expert/references/migration-patterns.md +24 -24
  39. package/skills/ti-expert/references/patterns.md +10 -10
  40. package/skills/ti-expert/references/performance-listview.md +16 -16
  41. package/skills/ti-expert/references/performance-optimization.md +41 -41
  42. package/skills/ti-expert/references/security-device.md +22 -22
  43. package/skills/ti-expert/references/security-fundamentals.md +19 -19
  44. package/skills/ti-expert/references/state-management.md +33 -33
  45. package/skills/ti-expert/references/testing-e2e-ci.md +25 -25
  46. package/skills/ti-expert/references/testing-unit.md +24 -24
  47. package/skills/ti-expert/references/theming.md +15 -15
  48. package/skills/ti-guides/SKILL.md +58 -60
  49. package/skills/ti-guides/references/advanced-data-and-images.md +33 -33
  50. package/skills/ti-guides/references/android-manifest.md +15 -15
  51. package/skills/ti-guides/references/app-distribution.md +70 -166
  52. package/skills/ti-guides/references/application-frameworks.md +96 -114
  53. package/skills/ti-guides/references/cli-reference.md +294 -294
  54. package/skills/ti-guides/references/coding-best-practices.md +42 -33
  55. package/skills/ti-guides/references/commonjs-advanced.md +57 -51
  56. package/skills/ti-guides/references/hello-world.md +36 -36
  57. package/skills/ti-guides/references/hyperloop-native-access.md +66 -66
  58. package/skills/ti-guides/references/javascript-primer.md +83 -101
  59. package/skills/ti-guides/references/reserved-words.md +9 -9
  60. package/skills/ti-guides/references/resources.md +75 -83
  61. package/skills/ti-guides/references/style-and-conventions.md +35 -28
  62. package/skills/ti-guides/references/tiapp-config.md +110 -74
  63. package/skills/ti-howtos/SKILL.md +88 -92
  64. package/skills/ti-howtos/references/android-platform-deep-dives.md +104 -104
  65. package/skills/ti-howtos/references/automation-fastlane-appium.md +39 -39
  66. package/skills/ti-howtos/references/buffer-codec-streams.md +60 -60
  67. package/skills/ti-howtos/references/cross-platform-development.md +115 -136
  68. package/skills/ti-howtos/references/debugging-profiling.md +167 -181
  69. package/skills/ti-howtos/references/extending-titanium.md +121 -121
  70. package/skills/ti-howtos/references/google-maps-v2.md +84 -82
  71. package/skills/ti-howtos/references/ios-map-kit.md +65 -60
  72. package/skills/ti-howtos/references/ios-platform-deep-dives.md +123 -123
  73. package/skills/ti-howtos/references/local-data-sources.md +79 -78
  74. package/skills/ti-howtos/references/location-and-maps.md +116 -120
  75. package/skills/ti-howtos/references/media-apis.md +87 -86
  76. package/skills/ti-howtos/references/notification-services.md +250 -260
  77. package/skills/ti-howtos/references/remote-data-sources.md +98 -93
  78. package/skills/ti-howtos/references/tutorials.md +226 -216
  79. package/skills/ti-howtos/references/using-modules.md +73 -102
  80. package/skills/ti-howtos/references/web-content-integration.md +101 -103
  81. package/skills/ti-howtos/references/webpack-build-pipeline.md +52 -44
  82. package/skills/ti-ui/SKILL.md +85 -85
  83. package/skills/ti-ui/references/accessibility-deep-dive.md +57 -57
  84. package/skills/ti-ui/references/animation-and-matrices.md +79 -79
  85. package/skills/ti-ui/references/application-structures.md +96 -99
  86. package/skills/ti-ui/references/custom-fonts-styling.md +99 -99
  87. package/skills/ti-ui/references/event-handling.md +58 -58
  88. package/skills/ti-ui/references/gestures.md +62 -64
  89. package/skills/ti-ui/references/icons-and-splash-screens.md +88 -88
  90. package/skills/ti-ui/references/layouts-and-positioning.md +87 -97
  91. package/skills/ti-ui/references/listviews-and-performance.md +107 -107
  92. package/skills/ti-ui/references/orientation.md +87 -88
  93. package/skills/ti-ui/references/platform-ui-android.md +87 -81
  94. package/skills/ti-ui/references/platform-ui-ios.md +63 -61
  95. package/skills/ti-ui/references/scrolling-views.md +29 -29
  96. package/skills/ti-ui/references/tableviews.md +56 -56
@@ -1,36 +1,40 @@
1
- # Coding Best Practices
1
+ # Coding best practices
2
2
 
3
- The recommended standard for Titanium apps is a single-context, modular pattern with well-structured code and well-organized resources.
3
+ Titanium apps are easiest to maintain when they use a single-context, modular pattern with clear structure and organized resources.
4
4
 
5
- ## 1. Scope Management
6
- - **Avoid Global Scope**: Global variables are not automatically garbage collected and can cause naming conflicts.
7
- - **Always use `let` or `const`**: (Original guide says `var`, but modernization rules apply). Omitting declarations places variables in the global scope.
5
+ ## 1. Scope management
8
6
 
9
- ## 2. Memory Leak Prevention
10
- - **Global Event Listeners**: Listeners on `Ti.App`, `Ti.Geolocation`, etc., will leak memory if they reference locally scoped objects unless explicitly removed.
7
+ - Avoid global scope. Global variables are not automatically garbage collected and can create naming conflicts.
8
+ - Always use `let` or `const`. The original guide uses `var`, but modern code should not. Omitting declarations places variables in global scope.
9
+
10
+ ## 2. Memory leak prevention
11
+
12
+ - Listeners on `Ti.App`, `Ti.Geolocation`, and similar globals can leak memory if they reference local objects and are not removed.
11
13
  ```javascript
12
- // ANTI-PATTERN
14
+ // Anti-pattern
13
15
  Ti.App.addEventListener('data:sync', (e) => {
14
16
  localView.text = e.text // localView is now leaked
15
17
  })
16
18
  ```
17
- - **Rule**: Global events should only handle global objects. Always `removeEventListener` during cleanup.
19
+ - Rule: global events should only handle global objects. Always `removeEventListener` during cleanup.
20
+
21
+ ## 3. Event naming conventions
18
22
 
19
- ## 3. Event Naming Conventions
20
- - **No Spaces in Event Names**: Using spaces in custom event names causes issues with Backbone.js and other libraries that use spaces as delimiters.
23
+ - Do not use spaces in event names. Spaces can cause issues with Backbone.js and other libraries that split event names on spaces.
21
24
  ```javascript
22
- // WRONG - may fire multiple times
25
+ // Wrong - may fire multiple times
23
26
  Ti.App.fireEvent('my event')
24
27
 
25
- // CORRECT - use colon or underscore
28
+ // Correct - use colon or underscore
26
29
  Ti.App.fireEvent('my:event')
27
30
  Ti.App.fireEvent('my_event')
28
31
  ```
29
32
 
30
33
  ## 4. Performance
31
- - **Defer Script Loading**: Evaluate JavaScript only when needed. Don't `require` modules at startup if they are only for specific screens.
32
34
 
33
- **Lazy script loading example:**
35
+ - Defer script loading. Only `require` modules when you need them.
36
+
37
+ Lazy script loading example:
34
38
  ```javascript
35
39
  // must be loaded at launch
36
40
  const WindowOne = require('ui/WindowOne').WindowOne;
@@ -52,15 +56,16 @@ win1.addEventListener('click', () => {
52
56
  });
53
57
  ```
54
58
 
55
- - **Bridge Efficiency**: Minimize requests for device properties like `Ti.Platform.osname`. Store them in a local variable once.
56
- - **Avoid Extending Ti Namespace**: Ti namespace objects are proxy representations of native OS components. Properties set on them may be stored on the proxy but won't be passed to the native object. Arrays stored on proxies return copies, not live references. There is no guarantee properties will persist across SDK versions. Use native modules instead to extend core functionality.
59
+ - Bridge efficiency: minimize requests for device properties like `Ti.Platform.osname`. Store them in a local variable.
60
+ - Avoid extending the `Ti` namespace. `Ti` objects are proxies to native components. Properties set on them may not reach the native object, arrays return copies, and persistence across SDK versions is not guaranteed. Use modules instead.
61
+
62
+ ## 5. App architecture recommendations
57
63
 
58
- ## 5. App Architecture Recommendations
64
+ ### Modular components with CommonJS (recommended)
59
65
 
60
- ### Modular Components with CommonJS (Recommended)
61
- Titanium's primary recommended architecture. Discrete and independent building blocks that eliminate global variables. See `commonjs-advanced.md` for detailed module patterns and path resolution.
66
+ Titanium's primary recommended architecture. It uses discrete modules and avoids globals. See `commonjs-advanced.md` for module patterns and path resolution.
62
67
 
63
- **MyModule.js**
68
+ MyModule.js:
64
69
  ```javascript
65
70
  // Private variable
66
71
  const defaultMessage = "Hello world";
@@ -74,14 +79,15 @@ exports.helloWorld = () => {
74
79
  }
75
80
  ```
76
81
 
77
- **app.js**
82
+ app.js:
78
83
  ```javascript
79
84
  const myModule = require('/MyModule');
80
85
  myModule.sayHello('User');
81
86
  ```
82
87
 
83
- ### Custom Objects as Components
84
- Popular for rapid deployment. Uses a namespace hierarchy. However, this pattern is less performant than CommonJS modules. Memory management can be difficult as object references may persist after they're no longer needed.
88
+ ### Custom objects as components
89
+
90
+ Popular for rapid deployment. It uses a namespace hierarchy. This pattern is less efficient than CommonJS modules, and object references can persist after they are no longer needed.
85
91
 
86
92
  ```javascript
87
93
  const myapp = {};
@@ -94,19 +100,22 @@ const myapp = {};
94
100
  })();
95
101
  ```
96
102
 
97
- ### Classical-based Patterns
98
- Not recommended as JavaScript is not a class-based language. It confuses classes and objects and is slower to implement in rapid prototyping.
103
+ ### Classical-based patterns
104
+
105
+ Not recommended. JavaScript is not class-based in the same way, and this approach adds overhead during rapid prototyping.
99
106
 
100
- ## 6. Security Best Practices
101
- - **No Sensitive Data in Non-JS Files**: JavaScript files are minified and obfuscated during build, but images, JSON files, SQLite databases, and other non-.js files are packaged as-is. APK and IPA files are essentially ZIP files that can be extracted.
107
+ ## 6. Security best practices
108
+
109
+ - Do not store sensitive data in non-JS files. JavaScript files are minified and obfuscated, but images, JSON, SQLite databases, and other non-JS files are packaged as-is. APK and IPA files are ZIP files that can be extracted.
102
110
  ```javascript
103
- // WRONG - API keys visible in app/assets/config.json
111
+ // Wrong - API keys visible in app/assets/config.json
104
112
  const config = require('assets/config.json')
105
113
 
106
- // CORRECT - Store in code or use secure storage
114
+ // Correct - store in code or use secure storage
107
115
  const API_KEY = Ti.App.Properties.getString('api_key')
108
116
  ```
109
117
 
110
- ## 7. Multiplatform Strategies
111
- - **Code Branching**: Use for small differences.
112
- - **Platform Files**: Use `.ios.js` or `.android.js` for major logic differences to keep code readable.
118
+ ## 7. Multiplatform strategies
119
+
120
+ - Code branching: use for small differences.
121
+ - Platform files: use `.ios.js` or `.android.js` for major logic differences so code stays readable.
@@ -1,19 +1,20 @@
1
- # CommonJS Advanced Patterns
1
+ # CommonJS advanced patterns
2
2
 
3
- > For more on CommonJS in Titanium, see the official CommonJS Modules guide in the Titanium SDK documentation.
3
+ For more on CommonJS in Titanium, see the official CommonJS Modules guide in the Titanium SDK documentation.
4
4
 
5
5
  ## Definitions
6
6
 
7
- - **Module** - Any CommonJS-compliant module consumed in a Titanium SDK application. This can be a JavaScript file included with the app, or a native extension to Titanium which exposes a JavaScript API.
8
- - **Resources** - The Resources directory of a Titanium application, where user source code lives before processing by the build system. **Note**: For Alloy, CommonJS modules are placed in `app/lib`.
9
- - **`exports`** - A free variable within a module, to which multiple properties may be added to create a public interface.
10
- - **`module.exports`** - An object within a module, which may be REPLACED by an object representing the public interface to the module.
7
+ - Module: any CommonJS-compliant module used in a Titanium SDK application. This can be a JavaScript file bundled with the app or a native extension that exposes a JavaScript API.
8
+ - Resources: the Resources directory of a Titanium application, where source code lives before the build system processes it. In Alloy, CommonJS modules live in `app/lib`.
9
+ - `exports`: a free variable within a module. Add properties to expose a public API.
10
+ - `module.exports`: an object you can replace to define the module's public API.
11
11
 
12
- ## 1. Stateful Modules (Singleton Pattern)
12
+ ## 1. Stateful modules (singleton pattern)
13
13
 
14
- Modules in Titanium are created once per JavaScript context and then passed by reference on subsequent `require()` calls. This makes them ideal for maintaining application state.
14
+ Modules in Titanium are created once per JavaScript context and reused on subsequent `require()` calls. This makes them useful for shared state.
15
+
16
+ ### Example: stateful counter module
15
17
 
16
- ### Example: Stateful Counter Module
17
18
  ```javascript
18
19
  // app/lib/counter.js
19
20
  let _count = 0
@@ -31,14 +32,13 @@ exports.reset = () => {
31
32
  }
32
33
  ```
33
34
 
34
- **Usage**: Multiple controllers requiring this module share the same `_count` state.
35
+ Usage: multiple controllers that require this module share the same `_count` state.
35
36
 
36
- ### Critical Note
37
- A module is created once **per Titanium JavaScript context**. Additional contexts create new module instances.
37
+ A module is created once per Titanium JavaScript context. Additional contexts create new module instances.
38
38
 
39
- ## 2. Native/Compiled Modules
39
+ ## 2. Native/compiled modules
40
40
 
41
- When `require()` is called, Titanium first checks for a native/compiled module before looking for a JavaScript module. Native modules take priority.
41
+ When `require()` is called, Titanium checks for a native/compiled module before it looks for a JavaScript module. Native modules take priority.
42
42
 
43
43
  Native modules are identified by a single string and configured in `tiapp.xml`:
44
44
 
@@ -52,18 +52,18 @@ Native modules are identified by a single string and configured in `tiapp.xml`:
52
52
  const paypal = require('ti.paypal')
53
53
  ```
54
54
 
55
- Titanium loads `ti.paypal` as a native module and will NOT look for a JavaScript file in Resources. Only if no native module matches does Titanium fall back to JavaScript module resolution.
55
+ Titanium loads `ti.paypal` as a native module and will not look for a JavaScript file in Resources. If no native module matches, it falls back to JavaScript module resolution.
56
56
 
57
- ## 3. Module Path Resolution
57
+ ## 3. Module path resolution
58
58
 
59
- The string passed to `require()` is treated as a path to a JavaScript file, minus the `.js` extension.
59
+ The string passed to `require()` is treated as a path to a JavaScript file, without the `.js` extension.
60
60
 
61
- **Resolution rules:**
62
- - **No prefix** (`require('app/lib/myModule')`) - resolved relative to the `Resources` directory (or `app/lib` in Alloy)
63
- - **`/` prefix** (`require('/app/lib/myModule')`) - also resolved relative to the `Resources` directory
64
- - **`./` or `../` prefix** (`require('./widgets/SomeView')`) - resolved relative to the current module file
61
+ Resolution rules:
62
+ - No prefix (`require('app/lib/myModule')`): resolved relative to the `Resources` directory (or `app/lib` in Alloy)
63
+ - `/` prefix (`require('/app/lib/myModule')`): also resolved relative to the `Resources` directory
64
+ - `./` or `../` prefix (`require('./widgets/SomeView')`): resolved relative to the current module file
65
65
 
66
- **Example with relative paths:**
66
+ Example with relative paths:
67
67
 
68
68
  Given these files:
69
69
  - `Resources/app/ui/SomeCustomView.js`
@@ -76,24 +76,24 @@ const myModule = require('../lib/myModule')
76
76
  const SomeOtherCustomView = require('./widgets/SomeOtherCustomView')
77
77
  ```
78
78
 
79
- The `.js` extension is always omitted in `require()` calls.
79
+ The `.js` extension is omitted in `require()` calls.
80
80
 
81
- ## 4. Caching Behavior
81
+ ## 4. Caching behavior
82
82
 
83
- Titanium caches the object returned by `require()` and provides the same reference without re-evaluating the code.
83
+ Titanium caches the object returned by `require()` and returns the same reference without re-evaluating the code.
84
84
 
85
- **Implication**: If you think you need code evaluated multiple times, create a module with a callable function instead.
85
+ If you need code evaluated multiple times, export a function that creates what you need instead.
86
86
 
87
87
  ```javascript
88
- // Good - factory pattern
88
+ // Good: factory pattern
89
89
  exports.createView = (args) => {
90
90
  return Ti.UI.createView(args)
91
91
  }
92
92
 
93
- // Bad - expecting re-evaluation
93
+ // Bad: expecting re-evaluation
94
94
  ```
95
95
 
96
- ## 5. ES6+ Support (SDK 7.1.0+)
96
+ ## 5. ES6+ support (SDK 7.1.0+)
97
97
 
98
98
  Since Titanium SDK 7.1.0, you can use ES6+ module syntax. Code is transpiled to ES5 for all platforms.
99
99
 
@@ -114,9 +114,10 @@ import MyClass from 'MyClass'
114
114
  const instance = new MyClass('World')
115
115
  ```
116
116
 
117
- ## 6. Module Composition Patterns
117
+ ## 6. Module composition patterns
118
+
119
+ ### Exports object pattern
118
120
 
119
- ### Exports Object Pattern
120
121
  ```javascript
121
122
  exports.sayHello = (name) => {
122
123
  Ti.API.info(`Hello ${name}`)
@@ -125,7 +126,8 @@ exports.sayHello = (name) => {
125
126
  exports.version = 1.4
126
127
  ```
127
128
 
128
- ### Constructor Pattern (module.exports)
129
+ ### Constructor pattern (`module.exports`)
130
+
129
131
  ```javascript
130
132
  class Person {
131
133
  constructor(firstName, lastName) {
@@ -141,7 +143,8 @@ class Person {
141
143
  module.exports = Person
142
144
  ```
143
145
 
144
- ### Utility Library Pattern
146
+ ### Utility library pattern
147
+
145
148
  ```javascript
146
149
  // app/lib/logger.js
147
150
  exports.info = (str) => {
@@ -153,15 +156,15 @@ exports.debug = (str) => {
153
156
  }
154
157
  ```
155
158
 
156
- **Usage:**
159
+ Usage:
157
160
  ```javascript
158
161
  const logger = require('logger')
159
162
  logger.info('some log statement with a timestamp')
160
163
  ```
161
164
 
162
- ## 7. Inter-Module State Sharing
165
+ ## 7. Inter-module state sharing
163
166
 
164
- When a module assigns a primitive value to `exports`, the consumer gets a **copy**, not a live reference. Subsequent changes to the internal variable are NOT reflected in the exported property.
167
+ When a module assigns a primitive value to `exports`, the consumer gets a copy, not a live reference. Changes to the internal variable are not reflected in the exported property.
165
168
 
166
169
  ```javascript
167
170
  // app/lib/statefulModule.js
@@ -175,43 +178,46 @@ exports.getPointStep = () => {
175
178
  return _stepVal
176
179
  }
177
180
 
178
- exports.stepVal = _stepVal // This is a COPY of _stepVal (value: 5)
181
+ exports.stepVal = _stepVal // This is a copy of _stepVal (value: 5)
179
182
  ```
180
183
 
181
184
  ```javascript
182
185
  const stateful = require('statefulModule')
183
186
  stateful.setPointStep(10)
184
187
  Ti.API.info(stateful.getPointStep()) // 10 - correct, uses getter
185
- Ti.API.info(stateful.stepVal) // 5 - still the original copy!
188
+ Ti.API.info(stateful.stepVal) // 5 - still the original copy
186
189
  ```
187
190
 
188
- **Rule**: Always use getter/setter functions for stateful values. Direct property exports of primitives are snapshots at module load time.
191
+ Rule: use getter/setter functions for stateful values. Direct property exports of primitives are snapshots at module load time.
189
192
 
190
- ## 8. Antipatterns to Avoid
193
+ ## 8. Antipatterns to avoid
194
+
195
+ ### Do not assign directly to `exports`
191
196
 
192
- ### Don't Assign Directly to exports
193
197
  ```javascript
194
- // ❌ WRONG - won't work
198
+ // Wrong
195
199
  function Person() {}
196
200
  exports = Person
197
201
 
198
- // ✅ CORRECT
202
+ // Correct
199
203
  module.exports = Person
200
204
  ```
201
205
 
202
- ### Don't Mix module.exports and exports.*
206
+ ### Do not mix `module.exports` and `exports.*`
207
+
203
208
  ```javascript
204
- // ❌ DISCOURAGED
209
+ // Discouraged
205
210
  module.exports = Person
206
211
  exports.foo = 'bar'
207
212
 
208
- // Use one consistently
213
+ // Use one consistently
209
214
  ```
210
215
 
211
- ### No Global Variables Across Modules
212
- Any data a module needs must be passed during construction or initialization. Never rely on globals shared across modules.
216
+ ### Avoid globals across modules
217
+
218
+ Any data a module needs should be passed during construction or initialization. Avoid globals shared across modules.
213
219
 
214
- ## 9. Security and Scope
220
+ ## 9. Security and scope
215
221
 
216
222
  All modules have private scope. Variables declared within the module are private unless added to `exports`.
217
223
 
@@ -224,8 +230,8 @@ exports.publicMethod = () => {
224
230
  }
225
231
  ```
226
232
 
227
- ## 10. Node.js Compatibility
233
+ ## 10. Node.js compatibility
228
234
 
229
235
  Titanium supports Node.js module patterns and `require()` resolution. Node.js modules can often be used directly.
230
236
 
231
- For detailed Node.js support information, refer to the official Titanium Node.js guide.
237
+ For details, refer to the official Titanium Node.js guide.
@@ -1,8 +1,8 @@
1
- # Hello World - Project Creation
1
+ # Hello world: project creation
2
2
 
3
3
  Quick guide to creating your first Titanium project.
4
4
 
5
- ## Creating a New Project
5
+ ## Creating a new project
6
6
 
7
7
  ### Using CLI
8
8
 
@@ -10,39 +10,39 @@ Quick guide to creating your first Titanium project.
10
10
  ti create -t app --id <APP_ID> -n <APP_NAME> -p <PLATFORMS> -d <WORKSPACE>
11
11
  ```
12
12
 
13
- **Example:**
13
+ Example:
14
14
  ```bash
15
15
  ti create -t app --id com.example.hello -n HelloWorld -p android,ios -d ~/Projects
16
16
  ```
17
17
 
18
18
  ### Using Studio/VS Code
19
19
 
20
- **File** > **New** > **Mobile App Project**
20
+ File > New > Mobile App Project
21
21
 
22
- Choose template:
23
- - **Alloy** - MVC framework (recommended)
24
- - **Classic** - No framework
22
+ Choose a template:
23
+ - Alloy: MVC framework (recommended)
24
+ - Classic: no framework
25
25
 
26
- ## Project Fields
26
+ ## Project fields
27
27
 
28
- | Field | Description | Rules |
29
- | ---------------------- | ----------------------- | -------------------------- |
30
- | **Project name** | App name shown to users | - |
31
- | **App ID** | Reverse domain notation | `com.company.appname` |
32
- | **Company URL** | Your website | - |
33
- | **SDK Version** | Titanium SDK to use | Use latest |
34
- | **Deployment Targets** | Platforms to support | android, ios, ipad, iphone |
28
+ | Field | Description | Rules |
29
+ | --- | --- | --- |
30
+ | Project name | App name shown to users | - |
31
+ | App ID | Reverse domain notation | `com.company.appname` |
32
+ | Company URL | Your website | - |
33
+ | SDK Version | Titanium SDK to use | Use latest |
34
+ | Deployment Targets | Platforms to support | android, ios, ipad, iphone |
35
35
 
36
- ### App ID Naming Guidelines
36
+ ### App ID naming guidelines
37
37
 
38
- - Use Java Package Name style: `com.yourdomain.yourappname`
38
+ - Use Java package style: `com.yourdomain.yourappname`
39
39
  - No spaces or special characters
40
40
  - All lowercase (Android issues with uppercase)
41
41
  - No Java keywords (`case`, `package`, etc.)
42
42
  - Cannot change after publishing
43
- - **Platform Relationship**: On iOS, the App ID must match the Bundle Identifier; on Android, it serves as the Application Package Name
43
+ - On iOS, the App ID must match the Bundle Identifier. On Android, it becomes the Application Package Name.
44
44
 
45
- ## Project Structure
45
+ ## Project structure
46
46
 
47
47
  ```
48
48
  MyApp/
@@ -64,40 +64,40 @@ MyApp/
64
64
  └── app.js # Bootstrap file loaded first when app launches
65
65
  ```
66
66
 
67
- ## Running Your App
67
+ ## Running your app
68
68
 
69
- ### iOS Simulator
69
+ ### iOS simulator
70
70
  ```bash
71
71
  ti build -p ios -C "iPhone 15"
72
72
  ```
73
73
 
74
- ### Android Emulator
74
+ ### Android emulator
75
75
  ```bash
76
76
  ti build -p android -C "Pixel_4_API_34"
77
77
  ```
78
78
 
79
- ### Physical Device
79
+ ### Physical device
80
80
  ```bash
81
81
  ti build -p ios -T device
82
82
  ti build -p android -T device
83
83
  ```
84
84
 
85
- ## Simulator vs Emulator
85
+ ## Simulator vs emulator
86
86
 
87
- - **iOS Simulator**: The software simulates the environment within an iOS device. It's an OS X executable that runs your cross-compiled code.
88
- - **Android Emulator**: Provides a virtual hardware environment that runs the actual Android OS and platform components.
87
+ - iOS simulator: simulates the environment within an iOS device. It is a macOS executable that runs your cross-compiled code.
88
+ - Android emulator: provides a virtual hardware environment that runs the Android OS and platform components.
89
89
 
90
- **CRITICAL**: Neither environment is a perfect representation of a physical device. Always test on real hardware before publishing.
90
+ Neither environment is a perfect representation of a physical device. Always test on real hardware before publishing.
91
91
 
92
- ## How Titanium Works (Under the Covers)
92
+ ## How Titanium works (under the covers)
93
93
 
94
- 1. **Pre-compile**: JavaScript is minified and statically analyzed to build a dependency hierarchy of Titanium APIs used.
95
- 2. **Stub Generation**: A front-end compiler creates native stub files, native project files, and platform-specific code necessary for compilation.
96
- 3. **Native Build**: Titanium calls platform-specific compilers (e.g., `xcodebuild` for iOS, Gradle for Android) to build the final native application.
97
- 4. **Encryption**: JavaScript code is encrypted when building for "production" (release) or for device. Original code is not retrievable in human-readable form.
94
+ 1. Pre-compile: JavaScript is minified and statically analyzed to build a dependency hierarchy of Titanium APIs used.
95
+ 2. Stub generation: a front-end compiler creates native stub files, native project files, and platform-specific code needed for compilation.
96
+ 3. Native build: Titanium calls platform-specific compilers (for example, `xcodebuild` for iOS and Gradle for Android) to build the native app.
97
+ 4. Encryption: JavaScript code is encrypted when building for production (release) or for device. Original code is not retrievable in human-readable form.
98
98
 
99
- ## Best Practices
99
+ ## Best practices
100
100
 
101
- 1. **Always test on physical devices** - Simulator/emulator isn't perfect
102
- 2. **Use Alloy for new projects** - Better structure and maintainability
103
- 3. **Keep App ID consistent** - Match Bundle ID (iOS) and Package ID (Android)
101
+ 1. Test on physical devices. The simulator/emulator is not a perfect proxy.
102
+ 2. Use Alloy for new projects for better structure and maintainability.
103
+ 3. Keep the App ID consistent. Match Bundle ID (iOS) and Package ID (Android).