-d, --project-dir <value> the directory containing the project [default: .]
When running
ti build -d
the output in the console is:
[ERROR] TypeError: Arguments to path.join must be strings
at path.js:360:15
at Array.filter (native)
at exports.join (path.js:358:36)
at conf.options.appc.util.mix.project-dir.callback (/Users/oromero/Library/Application Support/Titanium/mobilesdk/osx/3.3.0.v20140626144112/cli/commands/build.js:101:52)
at Context.<anonymous> (/usr/local/lib/node_modules/titanium/lib/context.js:597:31)
at Array.forEach (native)
at Context.setArg (/usr/local/lib/node_modules/titanium/lib/context.js:576:35)
at Context.<anonymous> (/usr/local/lib/node_modules/titanium/lib/context.js:675:9)
at Context.parse (/usr/local/lib/node_modules/titanium/lib/context.js:772:6)
at processConf (/usr/local/lib/node_modules/titanium/lib/context.js:364:21)
---------------------------------------------
at run (/Users/oromero/Library/Application Support/Titanium/mobilesdk/osx/3.3.0.v20140626144112/node_modules/node-appc/lib/subprocess.js:59:8)
at /Users/oromero/Library/Application Support/Titanium/mobilesdk/osx/3.3.0.v20140626144112/iphone/cli/lib/detect.js:415:9
at /Users/oromero/Library/Application Support/Titanium/mobilesdk/osx/3.3.0.v20140626144112/node_modules/async/lib/async.js:511:21
at /Users/oromero/Library/Application Support/Titanium/mobilesdk/osx/3.3.0.v20140626144112/node_modules/async/lib/async.js:227:13
at /Users/oromero/Library/Application Support/Titanium/mobilesdk/osx/3.3.0.v20140626144112/node_modules/async/lib/async.js:111:13
at Array.forEach (native)
at _each (/Users/oromero/Library/Application Support/Titanium/mobilesdk/osx/3.3.0.v20140626144112/node_modules/async/lib/async.js:32:24)
at async.each (/Users/oromero/Library/Application Support/Titanium/mobilesdk/osx/3.3.0.v20140626144112/node_modules/async/lib/async.js:110:9)
[~fmiao] You are correct,
\-d
should display the same error as\-\-project\-dir
. The problem stems fromcontext.js
, but that's because of a feature, not a bug. The CLI supports flags and options. Flags are in the format\-\-flag\-name
and when encountered, the CLI treats this as\-\-flag\-name true
. Options are in the format\-\-option\-name somevalue
. Because the CLI parser doesn't know of something is a flag or option, it treats them as flags. That means if you specify\-\-option\-name
without a subsequent value, it will set the option value totrue
. This herein lies the problem. This is by design. So, while this isn't great, we have a solution. For every option, we simply need to check if the value is a boolean. All option values should be strings even if it is a number or boolean string. So, "hello world", "123", "true" are all valid option values. The option callbacks and validators will need to properly parse the values from the string format. As an example, here's what you need to do:For a real world example, look at the options in the iOS build script: https://github.com/appcelerator/titanium_mobile/blame/master/iphone/cli/commands/_build.js#L349-L351. You can see I added a bunch of them in this commit: https://github.com/appcelerator/titanium_mobile/commit/5ed0879a77d98cfcce35404a6be098d378224fd3. You just need to find the remaining options that are missing this, add them, and test.
[~fmiao] On a Mac, if you do
\-\-
, it automatically turns it into an "mdash". Since an mdash is not a dash, and probably is accidental, we treat\-\-
and mdashes the same.PR Master: https://github.com/appcelerator/titanium_mobile/pull/5983 Functional Test: 1. Create an app:
2. Build the app:
Following error message should be shown:
3. Build the app again by passing a value to the option
The build process should run without error.
Verified fix on: Mac OSX 10.9.4 Appcelerator Studio, build: 3.4.0.201408291834 Titanium SDK build: 3.4.0.v20140829184521 Titanium CLI, build: 3.4.0-dev Alloy: 1.5.0-dev Created a new app and attempted to build using the ti build -project-dir command, after asking for the platform to target it showed the error as expected. I then built and passed in a value and the build process ran without error. The same is shown with the ti build -d command