@maccesar/titools 3.2.0 → 4.0.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 (102) hide show
  1. package/README.md +27 -61
  2. package/lib/cleanup.js +29 -0
  3. package/lib/commands/agents.js +8 -7
  4. package/lib/commands/skills.js +118 -23
  5. package/lib/config.js +13 -15
  6. package/lib/installer.js +5 -3
  7. package/lib/utils.js +36 -0
  8. package/package.json +1 -1
  9. package/skills/alloy-guides/SKILL.md +188 -0
  10. package/skills/alloy-guides/references/CLI_TASKS.md +233 -0
  11. package/skills/alloy-guides/references/CONCEPTS.md +171 -0
  12. package/skills/alloy-guides/references/CONTROLLERS.md +279 -0
  13. package/skills/alloy-guides/references/MODELS.md +742 -0
  14. package/skills/alloy-guides/references/MODELS_ADVANCED.md +482 -0
  15. package/skills/alloy-guides/references/PURGETSS.md +57 -0
  16. package/skills/alloy-guides/references/VIEWS_DYNAMIC.md +235 -0
  17. package/skills/alloy-guides/references/VIEWS_STYLES.md +375 -0
  18. package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +102 -0
  19. package/skills/alloy-guides/references/VIEWS_XML.md +581 -0
  20. package/skills/alloy-guides/references/WIDGETS.md +160 -0
  21. package/skills/alloy-howtos/SKILL.md +179 -0
  22. package/skills/alloy-howtos/references/best_practices.md +121 -0
  23. package/skills/alloy-howtos/references/cli_reference.md +230 -0
  24. package/skills/alloy-howtos/references/config_files.md +158 -0
  25. package/skills/alloy-howtos/references/custom_tags.md +148 -0
  26. package/skills/alloy-howtos/references/debugging_troubleshooting.md +78 -0
  27. package/skills/alloy-howtos/references/samples.md +156 -0
  28. package/skills/purgetss/SKILL.md +184 -181
  29. package/skills/purgetss/references/EXAMPLES.md +8 -6
  30. package/skills/purgetss/references/app-branding.md +5 -0
  31. package/skills/purgetss/references/apply-directive.md +1 -1
  32. package/skills/purgetss/references/class-categories.md +1 -1
  33. package/skills/purgetss/references/class-index-properties.md +618 -0
  34. package/skills/purgetss/references/class-index.md +4 -610
  35. package/skills/purgetss/references/cli-commands.md +41 -410
  36. package/skills/purgetss/references/custom-fonts.md +292 -0
  37. package/skills/purgetss/references/custom-rules.md +1 -1
  38. package/skills/purgetss/references/customization-deep-dive.md +64 -1
  39. package/skills/purgetss/references/icon-fonts.md +208 -118
  40. package/skills/purgetss/references/installation-setup.md +4 -4
  41. package/skills/purgetss/references/migration-guide.md +53 -1
  42. package/skills/purgetss/references/multi-density-images.md +53 -2
  43. package/skills/purgetss/references/svg-pipeline.md +249 -0
  44. package/skills/purgetss/references/tikit-components.md +2 -2
  45. package/skills/purgetss/references/titanium-resets.md +2 -2
  46. package/skills/purgetss/references/ui-ux-design.md +7 -5
  47. package/skills/purgetss/references/version-history.md +71 -82
  48. package/skills/ti-api/SKILL.md +128 -0
  49. package/skills/ti-api/references/api-android.md +675 -0
  50. package/skills/ti-api/references/api-app-platform.md +636 -0
  51. package/skills/ti-api/references/api-core.md +764 -0
  52. package/skills/ti-api/references/api-data-network.md +641 -0
  53. package/skills/ti-api/references/api-media.md +655 -0
  54. package/skills/ti-api/references/api-modules-ble-bluetooth.md +657 -0
  55. package/skills/ti-api/references/api-modules-coremotion-urlsession.md +411 -0
  56. package/skills/ti-api/references/api-modules-map.md +632 -0
  57. package/skills/ti-api/references/api-modules-nfc.md +725 -0
  58. package/skills/ti-api/references/api-modules-social-misc.md +526 -0
  59. package/skills/ti-api/references/api-services.md +700 -0
  60. package/skills/ti-api/references/api-ui-android.md +499 -0
  61. package/skills/ti-api/references/api-ui-extras.md +702 -0
  62. package/skills/ti-api/references/api-ui-ios-animator.md +378 -0
  63. package/skills/ti-api/references/api-ui-ios.md +756 -0
  64. package/skills/ti-api/references/api-ui-lists.md +581 -0
  65. package/skills/ti-api/references/api-ui-text-input.md +607 -0
  66. package/skills/ti-api/references/api-ui-views.md +572 -0
  67. package/skills/ti-api/references/api-ui-windows-navigation.md +676 -0
  68. package/skills/ti-api/references/api-xml-global.md +743 -0
  69. package/skills/ti-guides/SKILL.md +82 -0
  70. package/skills/ti-guides/references/advanced-data-and-images.md +155 -0
  71. package/skills/ti-guides/references/android-manifest.md +97 -0
  72. package/skills/ti-guides/references/app-distribution.md +373 -0
  73. package/skills/ti-guides/references/application-frameworks.md +366 -0
  74. package/skills/ti-guides/references/cli-reference.md +700 -0
  75. package/skills/ti-guides/references/coding-best-practices.md +150 -0
  76. package/skills/ti-guides/references/commonjs-advanced.md +279 -0
  77. package/skills/ti-guides/references/hello-world.md +99 -0
  78. package/skills/ti-guides/references/hyperloop-native-access.md +458 -0
  79. package/skills/ti-guides/references/javascript-primer.md +402 -0
  80. package/skills/ti-guides/references/reserved-words.md +36 -0
  81. package/skills/ti-guides/references/resources.md +172 -0
  82. package/skills/ti-guides/references/style-and-conventions.md +104 -0
  83. package/skills/ti-guides/references/tiapp-config.md +655 -0
  84. package/skills/ti-howtos/SKILL.md +131 -0
  85. package/skills/ti-howtos/references/android-platform-deep-dives.md +609 -0
  86. package/skills/ti-howtos/references/automation-fastlane-appium.md +96 -0
  87. package/skills/ti-howtos/references/buffer-codec-streams.md +162 -0
  88. package/skills/ti-howtos/references/cross-platform-development.md +358 -0
  89. package/skills/ti-howtos/references/debugging-profiling.md +473 -0
  90. package/skills/ti-howtos/references/extending-titanium.md +684 -0
  91. package/skills/ti-howtos/references/google-maps-v2.md +172 -0
  92. package/skills/ti-howtos/references/ios-map-kit.md +149 -0
  93. package/skills/ti-howtos/references/ios-platform-deep-dives.md +595 -0
  94. package/skills/ti-howtos/references/local-data-sources.md +310 -0
  95. package/skills/ti-howtos/references/location-and-maps.md +267 -0
  96. package/skills/ti-howtos/references/media-apis.md +268 -0
  97. package/skills/ti-howtos/references/notification-services.md +539 -0
  98. package/skills/ti-howtos/references/remote-data-sources.md +339 -0
  99. package/skills/ti-howtos/references/tutorials.md +552 -0
  100. package/skills/ti-howtos/references/using-modules.md +182 -0
  101. package/skills/ti-howtos/references/web-content-integration.md +288 -0
  102. package/skills/ti-howtos/references/webpack-build-pipeline.md +125 -0
@@ -0,0 +1,402 @@
1
+ # JavaScript development primer
2
+
3
+ Essential JavaScript concepts, resources, and best practices for Titanium development.
4
+
5
+ ## JavaScript overview
6
+
7
+ JavaScript is the language of Titanium. It is lightweight and dynamic, with object-oriented and functional features.
8
+
9
+ Why JavaScript for Titanium?
10
+ - Widely deployed (every web browser)
11
+ - Large community
12
+ - Dynamic typing with duck typing
13
+ - Functional programming support
14
+ - Convenient object literal notation
15
+ - Closures for encapsulation
16
+ - Small learning curve
17
+
18
+ JavaScript in Titanium:
19
+ - No DOM manipulation (that is web-specific)
20
+ - Access to native APIs via the Titanium namespace
21
+ - ECMAScript 5/6 compliant
22
+ - Same JavaScript you use on the web, but targeting mobile apps
23
+
24
+ ---
25
+
26
+ ## Learning resources
27
+
28
+ ### Online courses
29
+
30
+ - Codecademy: https://www.codecademy.com/learn/introduction-to-javascript
31
+ - Stanford CS101: http://www.stanford.edu/class/cs101/
32
+ - edX: https://www.edx.org/learn/javascript
33
+
34
+ ### Online books and references
35
+
36
+ - Eloquent JavaScript: https://eloquentjavascript.net/
37
+ - MDN JavaScript Guide: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide
38
+ - Douglas Crockford's resources: http://javascript.crockford.com/
39
+ - JavaScript in 10 Minutes: https://github.com/spencertipping/js-in-ten-minutes
40
+ - Google JavaScript Style Guide: https://google.github.io/styleguide/jsguide.html
41
+ - Learning Advanced JavaScript: http://ejohn.org/apps/learn/
42
+
43
+ ### Print books (recommended)
44
+
45
+ - JavaScript: The Good Parts (Douglas Crockford)
46
+ - JavaScript: The Definitive Guide (David Flanagan)
47
+ - JavaScript Patterns (Stoyan Stefanov)
48
+ - Eloquent JavaScript (Marijn Haverbeke)
49
+
50
+ ---
51
+
52
+ ## Best practices
53
+
54
+ ### Do not pollute the global scope
55
+
56
+ Bad: everything in global scope
57
+ ```javascript
58
+ const key = 'value';
59
+ const foo = 'bar';
60
+
61
+ function helper() {
62
+ // help out
63
+ }
64
+
65
+ function info(msg) {
66
+ helper(msg);
67
+ Ti.API.info(msg);
68
+ }
69
+ ```
70
+
71
+ Good: single namespace
72
+ ```javascript
73
+ const myapp = {}; // Only one global variable
74
+
75
+ myapp.key = 'value';
76
+
77
+ myapp.dosomething = (foo) => {
78
+ // do something
79
+ };
80
+
81
+ // Self-closing function for private members
82
+ (() => {
83
+ function helper() {
84
+ // Private - not accessible globally
85
+ }
86
+
87
+ myapp.info = (msg) => {
88
+ helper(msg);
89
+ Ti.API.info(msg);
90
+ };
91
+ })();
92
+
93
+ myapp.info('Hello World');
94
+ ```
95
+
96
+ ### Use strict equality
97
+
98
+ Bad: `==` converts types
99
+ ```javascript
100
+ const testme = '1';
101
+ if (testme == 1) {
102
+ // Executes! '1' is converted to integer
103
+ }
104
+ ```
105
+
106
+ Good: `===` checks both type and value
107
+ ```javascript
108
+ const testme = '1';
109
+ if (testme === 1) {
110
+ // Does NOT execute
111
+ }
112
+ ```
113
+
114
+ ### Efficient loops
115
+
116
+ Bad: checks `array.length` every iteration
117
+ ```javascript
118
+ const names = ['Jeff', 'Nolan', 'Marshall', 'Don'];
119
+ for (let i = 0; i < names.length; i++) {
120
+ process(names[i]);
121
+ }
122
+ ```
123
+
124
+ Good: cache length
125
+ ```javascript
126
+ const names = ['Jeff', 'Nolan', 'Marshall', 'Don'];
127
+ for (let i = 0, j = names.length; i < j; i++) {
128
+ process(names[i]);
129
+ }
130
+ ```
131
+
132
+ This is especially important with Titanium proxy objects, where checking length on each iteration has extra overhead.
133
+
134
+ Even better: ES6 `for...of`
135
+ ```javascript
136
+ for (const name of names) {
137
+ process(name);
138
+ }
139
+ ```
140
+
141
+ ### Prefer `const` and `let` over `var`
142
+
143
+ `var` is function-scoped and hoisted; `let` and `const` are block-scoped and clearer.
144
+
145
+ ```javascript
146
+ // Avoid: var (function-scoped, can be accidentally hoisted)
147
+ var x = 10;
148
+
149
+ // Prefer: const for values that do not change
150
+ const MAX_RETRIES = 3;
151
+ const config = { timeout: 5000 };
152
+
153
+ // Use let only when the binding must be reassigned
154
+ let retryCount = 0;
155
+ retryCount++;
156
+ ```
157
+
158
+ Rule of thumb: reach for `const` first; switch to `let` only when you need to reassign; never use `var` in new code.
159
+
160
+ ---
161
+
162
+ ## Common patterns
163
+
164
+ ### Ternary operator
165
+
166
+ Compact conditional assignment. Value after `?` is used if the condition is true; value after `:` if false.
167
+
168
+ ```javascript
169
+ // Instead of this:
170
+ let xyz;
171
+ if (somecondition === somevalue) {
172
+ xyz = 'abc';
173
+ } else {
174
+ xyz = '123';
175
+ }
176
+
177
+ // Use this:
178
+ const xyz = (somecondition === somevalue) ? 'abc' : '123';
179
+ ```
180
+
181
+ ### Multiple variable declarations
182
+
183
+ Use commas instead of multiple `var` statements:
184
+
185
+ ```javascript
186
+ // Instead of this:
187
+ const foo = true;
188
+ const me = 'awesome';
189
+ const great = 42;
190
+
191
+ // Use this:
192
+ const foo = true,
193
+ me = 'awesome',
194
+ great = 42;
195
+ ```
196
+
197
+ ### Self-calling functions (IIFE)
198
+
199
+ Encapsulate private variables and functions:
200
+
201
+ Ambiguous (not recommended):
202
+ ```javascript
203
+ const myValue = (() => {
204
+ return someValue;
205
+ })(); // Looks like assigning function, not result
206
+ ```
207
+
208
+ Clear (recommended):
209
+ ```javascript
210
+ const myValue = (() => {
211
+ // Private variables here
212
+ const privateVar = 'secret';
213
+
214
+ return someValue;
215
+ })(); // Clearly returns result, not function
216
+ ```
217
+
218
+ ### CommonJS modules
219
+
220
+ Use `require()` for modular code:
221
+
222
+ myModule.js:
223
+ ```javascript
224
+ // Private
225
+ const privateData = 'secret';
226
+
227
+ function privateHelper() {
228
+ // Private function
229
+ }
230
+
231
+ // Public API
232
+ exports.publicMethod = () => {
233
+ privateHelper();
234
+ return privateData;
235
+ };
236
+ ```
237
+
238
+ app.js:
239
+ ```javascript
240
+ const myModule = require('myModule');
241
+ myModule.publicMethod();
242
+ ```
243
+
244
+ ---
245
+
246
+ ## ES6+ features in Titanium
247
+
248
+ Titanium supports modern JavaScript (ES6/ES7+). Use these features.
249
+
250
+ Arrow functions:
251
+ ```javascript
252
+ // Old
253
+ const self = this;
254
+ someArray.forEach(function(item) {
255
+ self.process(item);
256
+ });
257
+
258
+ // New (arrow function preserves 'this')
259
+ someArray.forEach((item) => {
260
+ this.process(item);
261
+ });
262
+ ```
263
+
264
+ Template literals:
265
+ ```javascript
266
+ // Old
267
+ const message = 'Hello ' + name + ', you have ' + count + ' messages';
268
+
269
+ // New
270
+ const message = `Hello ${name}, you have ${count} messages`;
271
+ ```
272
+
273
+ Destructuring:
274
+ ```javascript
275
+ // Old
276
+ const width = e.source.size.width;
277
+ const height = e.source.size.height;
278
+
279
+ // New
280
+ const {width, height} = e.source.size;
281
+ ```
282
+
283
+ Spread operator:
284
+ ```javascript
285
+ // Old
286
+ const arr = [1, 2, 3];
287
+ const arr2 = arr.concat([4, 5]);
288
+
289
+ // New
290
+ const arr2 = [...arr, 4, 5];
291
+ ```
292
+
293
+ Classes:
294
+ ```javascript
295
+ class Person {
296
+ constructor(name) {
297
+ this.name = name;
298
+ }
299
+
300
+ greet() {
301
+ return `Hello, I'm ${this.name}`;
302
+ }
303
+ }
304
+ ```
305
+
306
+ ---
307
+
308
+ ## Gotchas to avoid
309
+
310
+ ### Variable hoisting
311
+
312
+ Problem: variables are hoisted to function scope.
313
+ ```javascript
314
+ function test() {
315
+ console.log(myVar); // undefined (not error)
316
+ var myVar = 'value';
317
+ }
318
+ ```
319
+
320
+ Solution: declare variables at the top of the function.
321
+ ```javascript
322
+ function test() {
323
+ let myVar; // Declare first
324
+ console.log(myVar);
325
+ myVar = 'value';
326
+ }
327
+ ```
328
+
329
+ ### Global variable accidents
330
+
331
+ Problem: forgetting `var` creates a global variable.
332
+ ```javascript
333
+ function test() {
334
+ myVar = 'value'; // Creates a global variable
335
+ }
336
+ ```
337
+
338
+ Solution: always use `var`, `let`, or `const`.
339
+ ```javascript
340
+ function test() {
341
+ const myVar = 'value';
342
+ }
343
+ ```
344
+
345
+ ### The `this` context
346
+
347
+ Problem: `this` changes in different contexts.
348
+ ```javascript
349
+ const obj = {
350
+ value: 42,
351
+ getValue: function() {
352
+ setTimeout(function() {
353
+ console.log(this.value); // undefined
354
+ }, 100);
355
+ }
356
+ };
357
+ ```
358
+
359
+ Solution 1: store `this`.
360
+ ```javascript
361
+ const obj = {
362
+ value: 42,
363
+ getValue: function() {
364
+ const self = this;
365
+ setTimeout(function() {
366
+ console.log(self.value); // Works
367
+ }, 100);
368
+ }
369
+ };
370
+ ```
371
+
372
+ Solution 2: arrow function (ES6).
373
+ ```javascript
374
+ const obj = {
375
+ value: 42,
376
+ getValue() {
377
+ setTimeout(() => {
378
+ console.log(this.value); // Works
379
+ }, 100);
380
+ }
381
+ };
382
+ ```
383
+
384
+ ### Semicolon insertion
385
+
386
+ JavaScript automatically inserts semicolons and can cause bugs.
387
+
388
+ Dangerous:
389
+ ```javascript
390
+ return
391
+ {
392
+ name: 'Test'
393
+ };
394
+ // Returns undefined
395
+ ```
396
+
397
+ Safe:
398
+ ```javascript
399
+ return {
400
+ name: 'Test'
401
+ };
402
+ ```
@@ -0,0 +1,36 @@
1
+ # Reserved words in Titanium
2
+
3
+ ## ECMAScript reserved keywords
4
+
5
+ These keywords cannot be used as variable, function, method, or object identifiers under the ECMAScript specification:
6
+
7
+ ```
8
+ abstract, boolean, break, byte, case, catch, char, class, const, continue,
9
+ debugger, default, delete, do, double, else, enum, export, extends, finally,
10
+ for, function, goto, if, implements, import, in, instanceof, int, interface,
11
+ let, long, native, new, package, private, protected, public, return, short,
12
+ static, super, switch, synchronized, this, throw, throws, transient, try,
13
+ typeof, var, void, volatile, while, with, yield
14
+ ```
15
+
16
+ ## iOS Objective-C reserved words
17
+
18
+ These keywords are exposed from Objective-C and should not be used as identifiers on iOS:
19
+
20
+ ```
21
+ _configure, _destroy, _initProperties, autorelease, deadlock, dealloc,
22
+ description, id, init, release, startup
23
+ ```
24
+
25
+ ## Alloy reserved words
26
+
27
+ Do not use double underscore prefixes on variables, properties, or function names (for example, `__foo`). These are reserved for Alloy's internal use.
28
+
29
+ ## Best practice
30
+
31
+ Avoid these reserved words when naming:
32
+ - Variables
33
+ - Functions
34
+ - Methods
35
+ - Object properties
36
+ - Module exports
@@ -0,0 +1,172 @@
1
+ # Titanium resources
2
+
3
+ Community resources, support channels, tools, and learning materials for Titanium developers.
4
+
5
+ ## Developer support
6
+
7
+ ### Official channels
8
+
9
+ - GitHub Discussions: https://github.com/tidev/titanium-sdk/discussions
10
+ - Slack: https://tidev.slack.com/
11
+ - Join at: https://tidev.slack.com/
12
+ - Channels for help, modules, announcements, and more
13
+
14
+ ### Module resources
15
+
16
+ - Module Search: https://modules.titaniumsdk.com/
17
+ - From Zero to App: https://fromzerotoapp.com/
18
+
19
+ ### Documentation
20
+
21
+ - Titanium SDK Docs: https://titaniumsdk.com/
22
+ - Alloy Framework Docs: https://titaniumsdk.com/guide/Alloy_Framework/
23
+ - This skill (`ti-guides`): `../SKILL.md`
24
+
25
+ ---
26
+
27
+ ## Example code
28
+
29
+ ### Official repositories
30
+
31
+ - tidev on GitHub: https://github.com/tidev
32
+ - titanium-mobile: https://github.com/tidev/titanium-mobile
33
+ - titanium-cli: https://github.com/tidev/titanium-cli
34
+ - titanium-code-processor: https://github.com/tidev/titanium-code-processor
35
+
36
+ ### Sample applications
37
+
38
+ - Ti.Map: https://github.com/tidev/ti.map
39
+ - KitchenSink: https://github.com/tidev/KitchenSink
40
+
41
+ ### Community projects
42
+
43
+ Search GitHub for "titanium" to find open source modules and apps.
44
+
45
+ ---
46
+
47
+ ## Community modules
48
+
49
+ ### Finding modules
50
+
51
+ 1. Module Search: https://modules.titaniumsdk.com/
52
+ 2. npm: https://www.npmjs.com/search?q=titanium
53
+ 3. GitHub search: https://github.com/search?q=titanium+module
54
+
55
+ ### Creating modules
56
+
57
+ See `hyperloop-native-access.md` for native module development:
58
+ - Android modules (Java/Kotlin)
59
+ - iOS modules (Objective-C/Swift)
60
+ - Module packaging and distribution
61
+
62
+ ### Popular modules
63
+
64
+ - ti.map: native maps (iOS and Android)
65
+ - ti.admob: AdMob ads
66
+ - ti.imagefactory: image processing
67
+ - ti.facebook: Facebook integration
68
+ - ti.media: extended media APIs
69
+
70
+ ---
71
+
72
+ ## Social media
73
+
74
+ ### Official accounts
75
+
76
+ - Bluesky: https://bsky.app/profile/titaniumsdk.com
77
+ - X (Twitter):
78
+ - https://x.com/tidevio
79
+ - https://x.com/TitaniumSDK
80
+
81
+ ### Community
82
+
83
+ - Reddit: https://www.reddit.com/r/titanium/
84
+ - Stack Overflow: https://stackoverflow.com/questions/tagged/titanium
85
+
86
+ ---
87
+
88
+ ## Learning resources
89
+
90
+ ### Getting started
91
+
92
+ 1. Hello World: see `hello-world.md` in this skill
93
+ 2. JavaScript Primer: see `javascript-primer.md` in this skill
94
+ 3. Alloy Framework: see the `alloy-guides` skill
95
+ 4. Sample apps: clone and study KitchenSink
96
+
97
+ ### Books and guides
98
+
99
+ - Titanium Up & Running
100
+ - Titanium Pocket Reference
101
+ - Alloy Guides (official Alloy framework documentation)
102
+
103
+ ### Video tutorials
104
+
105
+ - From Zero to App: https://fromzerotoapp.com/
106
+ - YouTube results: https://www.youtube.com/results?search_query=titanium+mobile
107
+
108
+ ---
109
+
110
+ ## Tools and IDEs
111
+
112
+ ### IDE support
113
+
114
+ - VS Code: https://code.visualstudio.com/ (with Titanium extensions)
115
+
116
+ ### CLI tools
117
+
118
+ ```bash
119
+ # Create new project
120
+ ti create
121
+
122
+ # Build for iOS
123
+ ti build -p ios
124
+
125
+ # Build for Android
126
+ ti build -p android
127
+
128
+ # Run on device
129
+ ti build -T device
130
+ ```
131
+
132
+ See `cli-reference.md` for complete CLI documentation.
133
+
134
+ ---
135
+
136
+ ## Contributing
137
+
138
+ ### Report bugs
139
+
140
+ - GitHub Issues: https://github.com/tidev/titanium-sdk/issues
141
+ - JIRA Archive: https://github.com/tidev/jira-archive
142
+
143
+ ### Contribute code
144
+
145
+ - Pull Request Guide: https://github.com/tidev/titanium-mobile/blob/master/CONTRIBUTING.md
146
+ - Follow coding standards in `style-and-conventions.md`
147
+
148
+ ---
149
+
150
+ ## Best practices for getting help
151
+
152
+ 1. Search first: check docs, GitHub issues, Stack Overflow.
153
+ 2. Be specific: include code, error messages, and platform info.
154
+ 3. Provide a minimal reproducible example.
155
+ 4. Use Slack for quick questions and GitHub Discussions for longer threads.
156
+ 5. Give back when you can.
157
+
158
+ ---
159
+
160
+ ## Resource checklist
161
+
162
+ For new Titanium developers:
163
+
164
+ - [ ] Install Titanium SDK and CLI
165
+ - [ ] Set up development environment (iOS/Android SDKs)
166
+ - [ ] Read `hello-world.md`
167
+ - [ ] Read `javascript-primer.md`
168
+ - [ ] Complete a sample project
169
+ - [ ] Join Slack community
170
+ - [ ] Explore Alloy framework
171
+ - [ ] Study sample apps on GitHub
172
+ - [ ] Contribute back to community
@@ -0,0 +1,104 @@
1
+ # Style and conventions reference
2
+
3
+ ## 1. Naming conventions
4
+
5
+ - Variables: `nounCategory` (for example, `personName`, `buttonSubmit`).
6
+ - Functions: `verbCategory` (for example, `getPersonName`, `doSync`).
7
+ - Classes/constructors: `PascalCase` (for example, `User`, `NetClient`).
8
+ - Factories: prefix with `create` (for example, `createWidget`).
9
+ - Namespaces: use capitalized words (for example, `App.UI.Widget`, `App.Network.Request`). Avoid lowercase for major namespaces (use `App.UI`, not `app.ui`).
10
+ - Hungarian notation: not supported by the Titanium SDK.
11
+
12
+ ## 2. Language rules
13
+
14
+ - Semicolons: official SDK guides require semicolons, but the `ti-expert` standard omits them and lets ASI handle it.
15
+ - `this` keyword: use with care. It may not refer to the object you expect.
16
+
17
+ ## 3. Formatting
18
+
19
+ - Indentation: both K&R/1TBS and Allman styles are acceptable. Consistency matters. Do not mix styles in the same project.
20
+ ```javascript
21
+ // K&R/1TBS style
22
+ if (x < 10) {
23
+ if (y > 10) {
24
+ // do this
25
+ }
26
+ } else {
27
+ // do this
28
+ }
29
+ ```
30
+ ```javascript
31
+ // Allman style
32
+ if (x < 10)
33
+ {
34
+ if (y > 10)
35
+ {
36
+ // do this
37
+ }
38
+ }
39
+ else
40
+ {
41
+ // do this
42
+ }
43
+ ```
44
+ - Operators: add a single space around operators.
45
+ ```javascript
46
+ const fullName = firstName + ' ' + lastName
47
+ ```
48
+
49
+ Return statement placement:
50
+ Do not put `return` on its own line followed by an object literal. JavaScript will insert a semicolon automatically and return `undefined`.
51
+ ```javascript
52
+ // Wrong
53
+ return
54
+ {
55
+ foo: 'bar'
56
+ }
57
+
58
+ // Correct
59
+ return {
60
+ foo: 'bar'
61
+ }
62
+ ```
63
+
64
+ ## 4. Control statements
65
+
66
+ Switch statements should have a single space before the opening parenthesis and a single space after the closing parenthesis. Switch content is indented with one tab; content in each case is indented one tab as well.
67
+ ```javascript
68
+ switch (someTest) {
69
+ case 1:
70
+ break;
71
+
72
+ case 2:
73
+ break;
74
+
75
+ default:
76
+ break;
77
+ }
78
+ ```
79
+
80
+ ## 5. Primitive types
81
+
82
+ - Avoid using primitive type object constructors (for example, `new String()`).
83
+ - Use template literals or single-space concatenation.
84
+
85
+ ## 6. Comments and documentation
86
+
87
+ - Single-line comments: required to reduce programmer error. Inline statement comments should be used at a minimum or not at all.
88
+ - JSDoc/block comments: required for documenting functions and classes.
89
+ ```javascript
90
+ // Calculate position using initial
91
+ // and offset x coordinates.
92
+ const finalPos = initPosX + offsetPosX;
93
+
94
+ /**
95
+ * @param {String} customerName Customer's full name.
96
+ */
97
+ function getCustomer(customerName) {}
98
+ ```
99
+
100
+ ## 7. References
101
+
102
+ - Douglas Crockford's JavaScript Code Conventions
103
+ - Google's JavaScript Style Guide: https://google.github.io/styleguide/jsguide.html
104
+ - TiDev ESLint Configuration (rules used for SDK-related npm packages and CLI code): https://github.com/tidev/eslint-config-axway