edge-react-gui icon indicating copy to clipboard operation
edge-react-gui copied to clipboard

Move devDependencies that required to compile the app to dependencies

Open emanuelb opened this issue 3 years ago • 6 comments

Ensure all dependencies used to compile the android & ios version are in dependencies, and compilation work when NODE_ENV="production" environment variable is used.

as currently the steps in compiling android app fails when node production mode is used: command: yarn postinstall

Error: /bin/sh: patch-package: not found

cause patch-package is in devDependencies instead of dependencies https://github.com/EdgeApp/edge-react-gui/blob/9d93d01b691be2219a003fbf14ed600b58f8adbf/package.json#L223

Command: yarn prepare

Error: Cannot find module '/home/appuser/app/edge/edge-react-gui/node_modules/.bin/rollup'

https://github.com/EdgeApp/edge-react-gui/blob/9d93d01b691be2219a003fbf14ed600b58f8adbf/package.json#L226 cause rollup is in devDependencies instead of dependencies

emanuelb avatar May 15 '21 15:05 emanuelb

devDependencies are installed just like dependencies when cloning the full application. This has not been a problem for anyone else building the application.

paullinator avatar May 16 '21 01:05 paullinator

devDependencies are installed only if node running in development mode, when it's run in production mode either by NODE_ENV="production" environment variable or when --production argument is added or when npm ci is used. The npm ci will install exact packages from lockfile in production mode, and is needed for reproducible-builds.

emanuelb avatar May 16 '21 01:05 emanuelb

Ok understood. @thehobbit85 can you task this to someone

paullinator avatar May 16 '21 02:05 paullinator

Another such dependency that should be moved to dependencies is jetifier until issue #2613 is fixed (to remove this dependency) https://github.com/EdgeApp/edge-react-gui/blob/9d93d01b691be2219a003fbf14ed600b58f8adbf/package.json#L220

emanuelb avatar May 16 '21 03:05 emanuelb

More such devDeps to move to deps are: rollup-plugin-node-resolve webpack-cli babel-loader edge-plugin-bity edge-plugin-simplex edge-plugin-wyre

Details below: https://github.com/EdgeApp/edge-react-gui/blob/9b2345528928b560e6e328aea7b8053eed64d82e/package.json#L228

Otherwise error like:

$ ./prepare-assets.sh
[!] Error: Cannot find module 'rollup-plugin-node-resolve'
Require stack:
- /home/appuser/app/edge/edge-react-gui-2.0.10/rollup.config.js
- /home/appuser/app/edge/edge-react-gui-2.0.10/node_modules/rollup/dist/shared/loadConfigFile.js
- /home/appuser/app/edge/edge-react-gui-2.0.10/node_modules/rollup/dist/bin/rollup
Error: Cannot find module 'rollup-plugin-node-resolve'
Require stack:
- /home/appuser/app/edge/edge-react-gui-2.0.10/rollup.config.js
- /home/appuser/app/edge/edge-react-gui-2.0.10/node_modules/rollup/dist/shared/loadConfigFile.js
- /home/appuser/app/edge/edge-react-gui-2.0.10/node_modules/rollup/dist/bin/rollup
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/home/appuser/app/edge/edge-react-gui-2.0.10/rollup.config.js:5:15)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.require.extensions.<computed> [as .js] (/home/appuser/app/edge/edge-react-gui-2.0.10/node_modules/rollup/dist/shared/loadConfigFile.js:530:20)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)

https://github.com/EdgeApp/edge-react-gui/blob/9b2345528928b560e6e328aea7b8053eed64d82e/package.json#L201-L203 Move this lines of "edge-plugin-bity" "edge-plugin-simplex" "edge-plugin-wyre"

Otherwise errors like:

./src/util/bridge/bridge.js → ./src/util/bridge/rolledUp.js...
created ./src/util/bridge/rolledUp.js in 176ms
internal/modules/cjs/loader.js:883
  throw err;
  ^

Error: Cannot find module './node_modules/edge-plugin-simplex/manifest.json'
Require stack:
- /home/appuser/app/edge/edge-react-gui-2.0.10/copy-plugin.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at copyAssets (/home/appuser/app/edge/edge-react-gui-2.0.10/copy-plugin.js:19:20)
    at /home/appuser/app/edge/edge-react-gui-2.0.10/copy-plugin.js:32:5
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/home/appuser/app/edge/edge-react-gui-2.0.10/copy-plugin.js:31:11)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/home/appuser/app/edge/edge-react-gui-2.0.10/copy-plugin.js' ]
}

https://github.com/EdgeApp/edge-react-gui/blob/9b2345528928b560e6e328aea7b8053eed64d82e/package.json#L232

Otherwise error like:

./src/util/bridge/bridge.js → ./src/util/bridge/rolledUp.js...
created ./src/util/bridge/rolledUp.js in 154ms
internal/modules/cjs/loader.js:883
  throw err;
  ^

Error: Cannot find module '/home/appuser/app/edge/edge-react-gui-2.0.10/node_modules/.bin/webpack'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

https://github.com/EdgeApp/edge-react-gui/blob/9b2345528928b560e6e328aea7b8053eed64d82e/package.json#L199

Otherwise error like:

./src/util/bridge/bridge.js → ./src/util/bridge/rolledUp.js...
created ./src/util/bridge/rolledUp.js in 148ms

Insufficient number of arguments or no entry found.
Alternatively, run 'webpack(-cli) --help' for usage info.

ERROR in Entry module not found: Error: Can't resolve 'babel-loader' in '/home/appuser/app/edge/edge-react-gui-2.0.10'
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

emanuelb avatar May 16 '21 04:05 emanuelb

If you want reproducible builds, try using the command yarn install --frozen-lockfile --production=false to get the devDependencies, even if you have NODE_ENV=production in your environment. If you are building the app, you need the build tools, and the build tools are devDependencies. Even the react native template project puts build-time dependencies like metro-react-native-babel-preset in the devDependencies.

swansontec avatar Jun 10 '21 18:06 swansontec