npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-checkmate

v0.2.0

Published

Pre-build validation for tool versions, programs, environment, node, yarn, Android, iOS, and custom files.

Downloads

18

Readme

checkmate-logo

Checkmate for React Native

Checkmate is a environment validation tool for React Native projects. Increase your build success rate among multiple collaborators and CI servers. Catch build configuration errors at the start of the build, instead of 95% through.

  • Run checkmate as a standalone command. checkmate in your React Native project root directory.

checkmate-success

  • Run checkmate as part of your Fastfile. Use the yarn plugin as follows:
  yarn(
    command: 'checkmate',
    package_path: './package.json'
  )

Install

yarn -D add react-native-checkmate

Configure

Add a checkmate key and configuration object to your package.json file.

package.json example

{
  "checkmate": {
    "verbose": false,
    "shellPath": "/bin/zsh",
    "silentShell": true,
    "programs": ["fastlane", "gem", "pod", "react-native", "badge"],
    "versions": {
      "macOS": "10.12.6",
      "node": "v8.11.3",
      "ruby": "2.3.1p112",
      "xcode": "9.2",
      "yarn": "1.7.0",
      "npm": "5.6.0"
    },
    "envVars": ["ANDROID_SDK", "ANDROID_SDK_TOOLS", "ANDROID_PLATFORM_TOOLS"],
    "env": {
      "dir": "env",
      "buildTypes": ["dev", "staging", "release"]
    },
    "node": {
      "yarnIntegrity": true,
      "dirs": ["node_modules"],
      "files": ["yarn.lock"]
    },
    "android": {
      "nodePath": true,
      "gradle": true,
      "dirs": ["android"],
      "files": ["my-release-key.keystore"]
    },
    "ios": {
      "nodePath": true,
      "nodePathDir": "env",
      "nodePathFilename": "node_binary",
      "pods": true,
      "dirs": ["ios"],
      "files": []
    },
    "other": {
      "dirs": [],
      "files": []
    }
  },
}

Error example

failed-checkmate

Options Reference

Configuration

verbose (boolean)

console.log checkmate configuration object + all shell output

shellPath (string)

checkmate expects a bash or similar shell (bash, zsh, etc.). shelljs by default uses /bin/sh. String path to bash or zsh executable.

silentShell (boolean)

show / hide shell output

Challenges

programs (string array)

"programs": ["fastlane", "gem", "pod", "react-native", "badge"],

executable program names as strings

versions (object)

"versions": {
  "macOS": "10.13.6",
  "node": "v8.11.3",
  "ruby": "2.3.1p112",
  "xcode": "9.4.1",
  "yarn": "1.7.0",
  "npm": "6.1.0"
},

Supported software & expected format for version string:

  • macOS: "10.13.6"
  • node: "v8.11.3"
  • ruby: "2.3.1p112"
  • xcode: "9.4.1"
  • yarn: "1.7.0"
  • npm: "6.1.0"

Commands

  • macOS sw_vers | grep "ProductVersion" | awk '{print $2}'
  • node node --version
  • ruby ruby --version | awk '{print $2}'
  • xcode xcodebuild -version | grep 'Xcode' | awk '{print $2}'
  • yarn yarn --version
  • npm npm --version

envVars (string array)

"envVars": ["ANDROID_SDK", "ANDROID_SDK_TOOLS", "ANDROID_PLATFORM_TOOLS"],

Validates exported environment variables, i.e. 'ANDROID_SDK_TOOLS'. Performs directory validation on env var values.

env

"env": {
  "dir": "env",
  "buildTypes": ["dev", "staging", "release"]
},

Validates environment files stored in $PROJECT_ROOT/$dir/env.[...buildTypes]

  • dir (string) Environment files directory relative to $PROJECT_ROOT

  • buildTypes (string array) Array of build types, i.e. ['dev', 'staging', 'release'].Maps to ->$PROJECT_ROOT/$dir/env.dev$PROJECT_ROOT/$dir/env.staging$PROJECT_ROOT/$dir/env.release

node

"node": {
  "yarnIntegrity": true,
  "dirs": ["node_modules"],
  "files": ["yarn.lock"]
},

Validates yarn integrity, and custom dirs / files related to node / npm / yarn.

  • yarnIntegrity (boolean) Perform a yarn integrity check on node_modules folder vs yarn.lock
  • dirs (string array) Verify presence of directories, relative to $PROJECT_ROOT
  • files (string array) Verify presence of files, relative to $PROJECT_ROOT

android

"android": {
  "nodePath": true,
  "gradle": true,
  "dirs": ["android"],
  "files": ["my-release-key.keystore"]
},

Validates custom node path parameter, gradle tasks, and custom dirs / files related to Android.

  • nodePath (boolean) Enables presence check of NODE_BINARY variable in ~/.gradle/settings.gradle. Used with NVM + project build.gradle.
  • gradle (boolean) Verifies all gradle tasks are runnable. Downloads missing dependencies if necessary.
  • dirs (string array) Verify presence of directories, relative to $PROJECT_ROOT/android
  • files (string array) Verify presence of files, relative to $PROJECT_ROOT/android

ios

"ios": {
  "nodePath": true,
  "nodePathDir": "env",
  "nodePathFilename": "node_binary",
  "pods": true,
  "dirs": ["ios"],
  "files": []
}

Validates custom node path parameter, gradle tasks, and custom dirs / files related to iOS.

  • nodePath (boolean) Enables presence check of NODE_BINARY variable in $PROJECT_ROOT/$nodePathDir/$nodePathFilename. NODE_BINARY is sourced in Xcode build phases to use NVM node binary.
  • nodePathDir (string) Set path to find $nodePathFilename, relative to $PROJECT_ROOT
  • nodePathFilename (string) Set filename for custom node path variable.
  • pods (boolean) Ensures podfile.lock and Pods/manifest.lock are equivalent
  • dirs (string array) Verify presence of directories, relative to $PROJECT_ROOT/ios
  • files (string array) Verify presence of files, relative to $PROJECT_ROOT/ios

other

"other": {
  "relative": true,
  "dirs": ["foo"],
  "files": ["foo/bar.txt", "bam/baz.conf"]
}
  • relative (boolean) Set other validators to use relative ($PROJECT_ROOT) or absolute paths.
  • dirs (string array) Verify presence of directories, relative to $PROJECT_ROOT
  • files (string array) Verify presence of files, relative to $PROJECT_ROOT

Module Usage

Checkmate also exposes all validators in the root module. Import any of the sub-modules individually for custom validators. See ./src/[module name].js for usage information.

module.exports = {
  general: {
    dirCheck,
    dirsCheck,
    fileCheck,
    filesCheck,
    programCheck,
    programsCheck
  },
  versions: {
    versionsCheck
  },
  node: {
    yarnIntegrityCheck,
    nodePathCheck
  },
  ios: {
    iosPodCheck
  },
  android: {
    gradleTasksCheck
  },
  env: {
    envVarsCheck
  }
};