Wolfram Research

Function Repository Resource:

CloudDeployReactProject (1.0.0) current version: 1.2.0 »

Source Notebook

Build and deploy a React project to the Wolfram Cloud

Contributed by: Kareem Ahmed, Jon McLoone

ResourceFunction["CloudDeployReactProject"][sourceDirectory,endpoint]

builds the React project found in sourceDirectory to a CloudObject specified by endpoint.

ResourceFunction["CloudDeployReactProject"][sourceDirectory,{targetDirectory,endPoint}]

builds the React project found in sourceDirectory to a CloudObject specified by endpoint in the cloud directory targetDirectory.

Details and Options

React is a JavaScript library for building user interfaces. A typical application might use React for the user interface and Wolfram Language APIFunction deployments for the computational logic.
This function automates the process of building a React project and deploying it to the Wolfram Cloud
PathAutomaticpath on which npm can be found
"ProgressMessages"Nonewhether to print progress messages
Permissions$Permissionsthe Cloud Permissions for deployed files

Node.js and npm must be installed for this function to work. See instructions here»

Examples

Basic Examples (2) 

Create a new React app, for example using npx create-react-appmy-react-app then deploy it using:

In[1]:=
ResourceFunction["CloudDeployReactProject", ResourceVersion->"1.0.0"]["/Users/jonm/temp/my-react-app", "myReactApp"]
Out[1]=

A React deployment consists of many files. A directory called React is created to store these, and the endpoint is also placed in this directory. You can also specify the name of this directory:

In[2]:=
ResourceFunction["CloudDeployReactProject", ResourceVersion->"1.0.0"]["/Users/jonm/temp/my-react-app", {"mydirectory", "myReactApp"}]
Out[2]=

Options (2) 

You can view progress messages with "ProgressMessages" True for basic messages, or "ProgressMessages" All for all actions:

In[3]:=
ResourceFunction["CloudDeployReactProject", ResourceVersion->"1.0.0"]["/Users/jonm/temp/my-react-app", "myReactApp", "ProgressMessages" -> True]
Out[3]=

If you need to specify the path for npm that can be done with the option Path:

In[4]:=
ResourceFunction["CloudDeployReactProject", ResourceVersion->"1.0.0"]["/Users/jonm/temp/my-react-app", "myReactApp", Path -> "/opt/homebrew/bin"]
Out[4]=

Publisher

Jon McLoone

Version History

  • 1.2.0 – 13 March 2024
  • 1.1.0 – 13 November 2023
  • 1.0.2 – 14 June 2023
  • 1.0.1 – 26 April 2023
  • 1.0.0 – 08 December 2022

Related Resources

License Information