infinitered / ignite

Infinite Red's battle-tested React Native project boilerplate, along with a CLI, component/model generators, and more! 9 years of continuous development and counting.
MIT License
17.7k stars 1.4k forks source link

Plugin Removing itself fails #1513

Closed adrienthiery closed 4 years ago

adrienthiery commented 4 years ago

šŸ‘‹


What's going on?

Ignite plugins seems to fail removing themselves (when using yarn, anyway).

$ ignite remove code-push --debug
šŸ”Ž    Verifying Plugin
    āœ”ļøŽ uninstalling react-native-code-push
    āœ”ļøŽ removing
Removing dev module
  TypeError: Cannot read property 'exec' of undefined

  - remove.js:65 removeDependency
    [global]/[ignite-cli]/build/commands/remove.js:65:27

  - remove.js:144 Command.<anonymous>
    [global]/[ignite-cli]/build/commands/remove.js:144:25

  - remove.js:32 step
    [global]/[ignite-cli]/build/commands/remove.js:32:23

  - remove.js:13 Object.next
    [global]/[ignite-cli]/build/commands/remove.js:13:53

  - remove.js:4 fulfilled
    [global]/[ignite-cli]/build/commands/remove.js:4:58

/Users/osedea/.config/yarn/global/node_modules/gluegun/build/index.js:13
    throw up;
    ^

TypeError: Cannot read property 'exec' of undefined
    at removeDependency (/Users/osedea/.config/yarn/global/node_modules/ignite-cli/build/commands/remove.js:65:27)
    at Command.<anonymous> (/Users/osedea/.config/yarn/global/node_modules/ignite-cli/build/commands/remove.js:144:25)
    at step (/Users/osedea/.config/yarn/global/node_modules/ignite-cli/build/commands/remove.js:32:23)
    at Object.next (/Users/osedea/.config/yarn/global/node_modules/ignite-cli/build/commands/remove.js:13:53)
    at fulfilled (/Users/osedea/.config/yarn/global/node_modules/ignite-cli/build/commands/remove.js:4:58)

remove.js relevant part:

38 var shelljs_1 = require("shelljs");
...
59 var removeDependency = function (moduleName) {
 60     console.warn('Removing dev module');
 61     if (useYarn) {
 62         shelljs_1.default.exec("yarn remove " + moduleName, { silent: true });
 63     }
 64     else {
              // shelljs_1.default does not seem to exist?
 65         shelljs_1.default.exec("npm rm " + moduleName + " --save-dev", { silent: true });
 66     }
 67 };

This is very strange because shelljs_1 is defined with all the methods on. Just shelljs1.default is missing.


Steps to reproduce

// Create a new project from `react-native init`
react-native init MyTest
ignite attach
ignite add intl
ignite remove intl

ignite doctor results:

System
  platform           darwin
  arch               x64
  cpu                4 cores      Intel(R) Core(TM) i5-6360U CPU @ 2.00GHz
  directory          MyTest       /Users/osedea/Projects/OSEDEA/Test/MyTest

JavaScript
  node               12.13.0      /Users/osedea/.nvm/versions/node/v12.13.0/bin/node
  npm                6.12.0       /Users/osedea/.nvm/versions/node/v12.13.0/bin/npm
  yarn               1.19.2       /usr/local/bin/yarn

Ignite
  ignite-cli           3.3.1        /usr/local/bin/ignite
  ignite src           build        /Users/osedea/.config/yarn/global/node_modules/ignite-cli/build
  createdWith          3.3.1
  boilerplate          empty
  boilerplateVersion   -
  generators           {}

Android
  java               1.8.0_222    /usr/bin/java
  android home       -            /Users/osedea/Library/Android/sdk

iOS
  xcode              11.2.1
  cocoapods          1.7.5        /Users/osedea/.rbenv/shims/pod
jamonholmgren commented 4 years ago

Submitted PR @adrienthiery.

infinitered-circleci commented 4 years ago

:tada: This issue has been resolved in version 3.3.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: