Problem description
If no config.json file is present, creating a new Widget returns an error.
Steps
1. Create a new Alloy project
2. Delete config.json file in the root project folder
3. From Appcelerator Studio, left click and create a new Widget
Result: a problem occurred creating a new widget.
Widget folder is created but config.json file is not found and an error is thrown.
fs.js:427
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT, no such file or directory '/usr/local/lib/node_modules/alloy/Alloy/template/config.json'
at Object.fs.openSync (fs.js:427:18)
at Object.fs.readFileSync (fs.js:284:15)
at module.exports (/usr/local/lib/node_modules/alloy/Alloy/commands/generate/targets/widget.js:50:19)
at generate (/usr/local/lib/node_modules/alloy/Alloy/commands/generate/index.js:37:34)
at Object.<anonymous> (/usr/local/lib/node_modules/alloy/Alloy/alloy.js:100:46)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/local/lib/node_modules/alloy/bin/alloy:3:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
Ideal result would probably be to automatically create a default config.json file and add in there the informations regarding the new created Widget.
If config.json file is removed, then, in order to create a new Widget, the user has to re-create manually a new config.json file just including :
{}
Note
Not a regression.
PR: https://github.com/appcelerator/alloy/pull/582 Functional test: 1. Create a new alloy project 2. Delete the app/config.json file 3. At the command line, from the project's directory, enter
alloy generate widget foo
. The widget should be generated without errors 4. Confirm that config.json has been created, and the widget dependency added to itPR merged.
Verified fixed. TiSDK 3.4.1.v20141007094537 Appcelerator Studio 3.4.1.201409191405 CLI 3.4.0.GA Alloy 1.6.0-dev Closing.
Backport to 1_6_X https://github.com/appcelerator/alloy/pull/656