You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2018/11/30 13:08:46 UTC

[GitHub] brodybits commented on a change in pull request #221: Improvements to src/main.js

brodybits commented on a change in pull request #221: Improvements to src/main.js
URL: https://github.com/apache/cordova-coho/pull/221#discussion_r237854326
 
 

 ##########
 File path: src/main.js
 ##########
 @@ -17,27 +17,16 @@ specific language governing permissions and limitations
 under the License.
 */
 
-try {
-    // Ensure npm install has been run.
-    Object.keys(require('../package').dependencies).forEach(require);
-} catch (e) {
-    console.log('Please run "npm install" from this directory:\n\t' + __dirname); // eslint-disable-line no-path-concat
-    process.exit(2);
-}
+// Verify that npm install was run before importing anything else
+require('./check-npm-install-util');
 
 const co = require('co');
 const optimist = require('optimist');
 
 const executil = require('./executil');
 const apputil = require('./apputil');
 
-function * lazyRequire (name, opt_prop) {
-    if (opt_prop) {
-        yield require(name)[opt_prop];
-    } else {
-        yield require(name);
-    }
-}
+const lazyRequire = require('./lazy-require-util.js');
 
 Review comment:
   I just removed `.js` for the sake of consistency with the rest of the code. (I remember reading that it is better to require with `.js` at the end, but don't think it is worth breaking the consistency in this case.)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org