Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1138] Error creating a new Widget from Studio if config.json is not present

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-10-07T01:32:11.000+0000
Affected Version/sAlloy 1.5.0, Alloy 1.4.1
Fix Version/sAlloy 1.6.0, Alloy 1.7.0
ComponentsAppcelerator Studio, Tooling
Labelsusability
ReporterFederico Casali
AssigneeTim Poulsen
Created2014-09-15T16:12:54.000+0000
Updated2015-01-13T14:42:15.000+0000

Description

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.

Comments

  1. Tim Poulsen 2014-10-01

    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 it
  2. Feon Sua Xin Miao 2014-10-07

    PR merged.
  3. Federico Casali 2014-10-07

    Verified fixed. TiSDK 3.4.1.v20141007094537 Appcelerator Studio 3.4.1.201409191405 CLI 3.4.0.GA Alloy 1.6.0-dev Closing.
  4. Tim Poulsen 2015-01-13

    Backport to 1_6_X https://github.com/appcelerator/alloy/pull/656

JSON Source