Common Package

The rsx-common package provides a set of core libraries and utility functions for use in any plugins.

Libraries:

npmlog

chalk

Functions

Path

isFile(path)

Checks whether path is a file and returns true if it is, false otherwise.

isDirectory(path)

Checks whether path is a directory and returns true if it is, false otherwise.

makeDirectory(path)

Creates a directory at path if it doesn’t already exist.

getProjectFolderName(path)

Returns the last folder name from path.

Process

run(cliCommand, callback)

Runs cliCommand as an external process on the command line. Upon successful execution, callback is executed.

Project

getPackageJson(path)

Returns the package.json file as a JSON object from path.

Validate

inProject()

Returns true if the current working directory is a React Native project, false otherwise.

isPackageName(name)

Returns true if the package name is valid, false otherwise.

isPlugin(name)

Returns true if the plugin is a valid React Native plugin, false otherwise.