Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Debugging the Scariest Development Environments...

Debugging the Scariest Development Environments: End the nightmares with tools like envinfo and Solidarity

In a world where perpetually confused developers can’t quite get their environments working, new libraries emerge from the ashes of lost productivity: envinfo and Solidarity. Escape the complexity and witness the rise of projects embracing change to save their projects from themselves.

Avatar for Trevor Brindle

Trevor Brindle

January 24, 2019

More Decks by Trevor Brindle

Other Decks in Programming

Transcript

  1. The Problems • command not found • works on my

    computer • what version do you have? • what SDK version do I need? • every issue template ever…
  2. THE WORST QUIZ EVER • What version of Bash was

    Globstar (**) added? • When was async/await added to Node? • When did Ruby add safe navigation (&.) ? • When did `npm install` start updating package-lock.json? • When was overflowchanged removed from Chrome?
  3. Story Time • cmd -v until you (╯°□°)╯︵ ┻━┻ •

    PR to React Native • Read the whole story on medium: • envinfo: An OSS Story
 goo.gl/zeqZcQ • $ `react-native info`
  4. System: OS: Linux 4.9 Debian GNU/Linux 8 (jessie) CPU: x64

    Intel(R) Core(TM) i7-4870HQ [email protected] Memory: 327.91 MB / 1.991 GB Container: Yes Shell: 4.3.30 - /bin/bash Binaries: Node: 9.7.1 - /usr/local/bin/node Yarn: 1.5.1 - /usr/local/bin/yarn npm: 5.6.0 - /usr/local/bin/npm Languages: Bash: 4.3.30 - /bin/bash Python: 2.7.9 - /usr/bin/python
  5. CLI Programmatic $ npm install envinfo $ yarn add envinfo

    $ npm install -g envinfo $ yarn global add envinfo Getting Started
  6. $ npx envinfo@latest $ npm install envinfo && envinfo (pre

    npm 5.2) $ ./envinfo-macos (look ma, no node dependency!) $ curl -L getenv.info | bash
  7. import { helpers } from 'envinfo'; const os = await

    helpers.getOSInfo(); const docker = await helpers.getDockerInfo(); console.log({ os, docker }); import { run } from ‘envinfo'; const info = await run({…}); 
 console.log({ info });
  8. defaults: { System: ['OS', 'CPU', 'Memory', 'Container', 'Shell'], Binaries: ['Node',

    'Yarn', 'npm', 'Watchman'], Virtualization: ['Docker', 'Parallels', 'VirtualBox', 'VMware'], SDKs: ['iOS SDK', 'Android SDK'], IDEs: ['Android Studio', 'Atom', 'VSCode', 'Sublime Text', 'Xcode'], Languages: ['Bash', 'Go', 'Elixir', 'PHP', 'Python', 'Ruby'], Browsers: [ 'Chrome', 'Chrome Canary’, 'Firefox', 'Safari', 'Safari Technology Preview', ], npmPackages: true, npmGlobalPackages: true, },
  9. So?

  10. CLI help & Issue Templates $ react-native info $ create-react-app

    --info $ exp diagnostics $ webpack-cli info $ gatbsy info
  11. HALP • 184 stars on GitHub • ~80,000 per day

    • ~2 million per month • ~550,000 per week
  12. { // I’m JSON5 - comment me! $schema: “http://json.schemastore.org/solidaritySchema", requirements:

    { Yarn: [ { rule: "cli", binary: "yarn", semver: "~1.5.1", error: "Yarn: You have {{installedVersion}}, and need {{wantedVersion}}. Update with `npm install -g yarn@{{wantedVersion}}` or `curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version {{wantedVersion}}`" } ] } }
  13. Neat Tricks • npm “pre” hooks • unterminated escape codes

    • git config user.email • inject wantedVersion
  14. $ docker run -it --rm node:8 /bin/bash -c "npx envinfo@latest"

    $ envinfo --helper Docker // [ 'Docker', '18.03.0', '/usr/local/bin/docker' ] $ docker run -v $PWD:/src -w /src -u node -it --rm node /bin/bash alias dockerhere=‘…’
  15. $ vagrant init ubuntu/xenial64 $ vagrant up $ vagrant ssh

    -c "npx envinfo@latest" $ vagrant ssh $ vagrant halt