Uploaded image for project: 'Alloy'
  1. Alloy
  2. ALOY-1652

CLI: Improve handling of missing directories and files in alloy new

    Details

    • Sprint:
      2019 Sprint 7

      Description

      Description

      Currently if an expected directory or file doesn't exist the alloy new command doesn't handle this very well and will just throw an error directly from node.

      We should handle these errors properly and log errors informing a user what file is missing.

      For example (this is just one example, there are probably more)

      1. Create a titanium project using ti create or appc new --classic
      2. cd into that dir
      3. Call alloy new . ~/Documents

      fs.js:119
          throw err;
          ^
       
      Error: ENOENT: no such file or directory, lstat '/Users/eharris/Documents/app'
          at Object.lstatSync (fs.js:861:3)
          at /Users/eharris/Documents/git/alloy/node_modules/graceful-fs/polyfills.js:297:22
          at getStats (/Users/eharris/Documents/git/alloy/node_modules/fs-extra/lib/copy-sync/copy-sync.js:46:14)
          at startCopy (/Users/eharris/Documents/git/alloy/node_modules/fs-extra/lib/copy-sync/copy-sync.js:41:10)
          at Object.copySync (/Users/eharris/Documents/git/alloy/node_modules/fs-extra/lib/copy-sync/copy-sync.js:36:10)
          at module.exports (/Users/eharris/Documents/git/alloy/Alloy/commands/new/index.js:113:5)
          at Object.<anonymous> (/Users/eharris/Documents/git/alloy/Alloy/alloy.js:112:46)
          at Module._compile (internal/modules/cjs/loader.js:799:30)
          at Object.Module._extensions..js (internal/modules/cjs/loader.js:810:10)
          at Module.load (internal/modules/cjs/loader.js:666:32)
          at tryModuleLoad (internal/modules/cjs/loader.js:606:12)
          at Function.Module._load (internal/modules/cjs/loader.js:598:3)
          at Module.require (internal/modules/cjs/loader.js:705:19)
          at require (internal/modules/cjs/helpers.js:14:16)
          at Object.<anonymous> (/Users/eharris/Documents/git/alloy/bin/alloy:3:1)
          at Module._compile (internal/modules/cjs/loader.js:799:30)
          at Object.Module._extensions..js (internal/modules/cjs/loader.js:810:10)
          at Module.load (internal/modules/cjs/loader.js:666:32)
          at tryModuleLoad (internal/modules/cjs/loader.js:606:12)
          at Function.Module._load (internal/modules/cjs/loader.js:598:3)
          at Function.Module.runMain (internal/modules/cjs/loader.js:862:12)
          at internal/main/run_main_module.js:21:11
      

      That error should be handled correctly and we should log an error informing the user what is missing. We might wish to have a canned message on all messages saying something to the effect of "your template must have x, y and x".

      It would also be good to clear up the app directory created so that a user doesn't have to do this manually

        Attachments

          Activity

            People

            • Assignee:
              shaig Samuel Haig
              Reporter:
              eharris Ewan Harris
              Reviewer:
              Ewan Harris
              Tester:
              Samir Mohammed
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Source Code