
Setting up your development environment
6 Tasks
30 mins
Advanced
Enterprise Application Development
Dev/Designer Studio
English
Scenario
You have recently joined the Sweet Life Pega Center of Excellence (COE) team. Because you have strong React development skills, Sweet Life wants you to focus on building reusable Constellation DX components for use across all Constellation applications. You must set up your local development environment to use Constellation DX Component Builder to achieve this outcome.
The following table provides the credentials you need to complete the challenge:
Role | User name | Password |
---|---|---|
Application Developer | Author@SL | pega123! |
Your Lead System Architect (LSA) has created a Ruleset and Ruleset version that he wants you to publish your components to, as shown in the following table:
Ruleset | Ruleset version |
---|---|
SLConstellationDXComponents | 01-01-01 |
Your LSA has also specified a library name, as shown in the following table:
Library | Organization |
---|---|
DXExtensions | SL |
Detailed Tasks
1 Install the prerequisites and validate your environment
- Install the prerequisites.
For more information, see Initializing a project. - In the terminal of choice, run the following commands:
Caution: The challenges in the Constellation DX Components mission were tested only against the stated node and npm versions. Before proceeding, you are strongly advised to get your development environment working with these versions. If you proceed with different versions (either lower or higher), you might experience difficulties running some commands in DX Component Builder.
- git --version
Use Git version 2.30 or later
- node --version
Use system node version 18.x.x or 20.x.x
- npm --version
Use version 8.x.x for Node 18 or 10.x.x for Node 20
- git --version
- Ensure that you have an Integrated Development Environment (IDE) for developing Javascript applications installed on your workstation
Tip: As a best practice, install Visual Studio Code for the exercises. See Visual Studio Code for instructions on how to download and install it for your environment.
- Launch your Pega Infinity instance for the challenge.
2 Install Constellation DX Component Builder
- In Visual Studio Code, open a new terminal.
- In your terminal, enter the following command: npx @pega/custom-dx-components@~24.2 init.
- If prompted, enter y to install the Custom DX Components npm package.
- Complete the required information to set up your DX Component Builder project:
- In the Enter Project name (required) line, enter sldxcomponents.
- In the Enter Organization name (required) line, enter SL.
- Press the Enter key to accept defaults for everything else.
After successful installation, the following information is displayed similar to the following figure:
3 Update your tasks.config.json
- Open Visual Studio Code.
- In Visual Studio Code navigate to and open the sldxcomponents project directory
- In Visual Studio Code open tasks.config.json
- Configure the server-config section:
- In the rulesetName line, enter SLConstellationDXComponents.
- In the rulesetVersion line, enter 01-01-01.
- In the components section, in the library line, enter DXExtensions.
Your tasks.config.json file should resemble the following figure: - Save your file.
4 Test your connectivity
- Wake up your Pega Academy instance, if necessary, and launch it.
- Open Visual Studio Code in your sldxcomponents project folder.
- Open a terminal in Visual Studio Code and execute the following command: npm run authenticate.
The first time you run this command, the system prompts you for the server name and authentication service name. - In the Enter pega server URL line, enter the academy instance URL, including the https and prweb portions.
For example, https://abcdeghi.pegacademy.net/prweb. - Accept the defaults for the other question by pressing the Enter key.
DX Component Builder launches a browser tab that shows the login screen of your Pega instance, as shown in the following figure: - Enter the credentials:
- In the User name field, enter author@sl
- In the Password field, enter pega123!
- After successfully authentication, close the browser tab.
A confirmation of successful authentication is also displayed in your terminal, as shown in the following figure:
5 Create, view, and publish a test component
- Open Visual Studio Code and navigate to your sldxcomponents project folder.
- In Visual Studio Code, open a terminal window.
- In the terminal window and the root of your project, enter the following command: npm run create.
- In the Enter type of component prompt, press the Enter key to select the Field option.
- In the Enter the subtype of the component prompt, press the Enter key to select the Text option.
- In the Enter component name (required) prompt, enter TestText.
- In the Enter component label for display (required) prompt, enter Test Text.
- Press the Enter key for all of the remaining questions to accept the default values.
The terminal displays an output similar to the following figure: - Enter the following command in your terminal to check that your component is available on the server: npm run list.
- Select 2 to select the Local option, and then press the Enter key.
Your local component is displayed in the list. This component has not yet been published to the Pega server. - In your terminal, run the following command: npm run startStorybook.
Storybook starts, and then creates a local web server to interact with the Storybook stories. After Storybook compiles the component stories, it automatically launches a new browser window, as shown in the following figure: - Close the browser window that contains Storybook.
- Go back to the terminal window where you ran the previous command, and then press CTRL-C to stop the Storybook process.
- Enter the following commands in your terminal:
- npm run authenticate
- npm run publish
Note: You only need to use npm run authenticate if your access token has expired. By default, this token is set to expire after 3600 seconds. - After running the publish command, select the only component in the list.
- Accept all of the defaults by pressing the Enter key for each component.
Your terminal output looks similar to the following figure:
When component bundling and packaging are complete, the component uploads to the Pega server and is added to the Ruleset and Ruleset version that you specified. The following figure shows the success message:
- Check that your component is available on the server by entering the following into your terminal: npm run list.
- Select 1 for Server.
You see output similar to the following figure:
You have successfully generated a new component from a sample DX Component Builder template and published it to the server, which validates that your environment is properly configured for building a Constellation DX component.
6 Clean up your test component
- In your terminal, run the following command: npm run delete.
- Select 2 for Local.
- Select 1 for SL_DXExtensions_TestText.
Your component is now deleted from your local development environment.
Available in the following mission:
If you are having problems with your training, please review the Pega Academy Support FAQs.
Want to help us improve this content?