as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support

Set Up Yarn Workspaces

Yarn Workspaces allows you to manage multiple packages or "workspaces" within a single repository. This page describe the process of setting up and using Yarn Workspaces for CLI-based builds React Native for Vega app and turbo module projects.

The key steps involve:

  • Install Yarn
  • Configure workspaces
  • Integrate npm-run all
  • Organize packages
  • Build the project
  • Use Yarn commands

Install Yarn

Install Yarn, version 3.8.1 or later. For installation instructions, see Yarn installation documentation.

Configure workspaces

Create .yarnrc.yml file in your project’s root folder (example,keplerworkspaceapp/), and add this configuration:

Copied to clipboard.

   nodeLinker: node-modules
   nmSelfReferences: false

Integrate npm-run-all dependency

Complete the following steps:

  1. Use the NPM_EXECPATH to set the path to Yarn.
  2. Set the NPM_EXECPATH environment variable in your .bashrc or .zshrc file:

    export NPM_EXECPATH=$(which yarn)
    

    You can use NPM_EXECPATH directly at the command prompt when running with Yarn.

    NPM_EXECPATH=$(which yarn) yarn
    

Organize packages

If you have the project setup with React Native for Vega apps and turbo modules, skip to Build the project.

To organize packages, complete the following steps:

  1. In your project’s root folder, create a packages/ folder.
  2. When you create a React Native for Vega app and a turbo module sub-projects in this workspace project, generate these projects in their own folders under packages/ folder using kepler project generate commands. The project structure looks like this:

      ├── keplerworkspaceapp/
      │   ├── package.json
      │   ├── packages/
      │   │   ├── turbo-module/
      │   │   │   ├── package.json
      │   │   │   ├── ...
      │   │   ├── application/
      │   │   │   ├── package.json
      │   │   │   ├── ...
      │   │   ├── ...
      │   ├── ...
    

Build the project

  1. Add scripts to the project’s root package.json.

    Copied to clipboard.

    {
      "name": "@amazon-devices/kepler-workspace-app",
      "version": "0.0.1",
     " workspaces": {
        "packages": [
          "packages/*"
        ]
      },
      "scripts": {
        "build:tm": "yarn workspace '@amazon-devices/<tm-project>' run pack",
        "build:app": "yarn workspace '@amazon-devices/<app-project>' run build:app",
        "build": "npm-run-all build:tm build:app"
      }
    }
    
  2. Add more packages to the project as required. Follow the steps in Organize packages.

Use Yarn commands

To install dependencies and build, use the applicable Yarn commands:


Copied to clipboard.

yarn install

Copied to clipboard.

yarn build:app

Copied to clipboard.

yarn install

Copied to clipboard.

yarn build:app

Copied to clipboard.

yarn install

Copied to clipboard.

yarn pack

For details on using Yarn workspaces, visit Yarn workspaces documentation.


Last updated: Sep 30, 2025