Create a New PCF Component

Developing a PCF Component

Question

You create a new PCF component.

Please select the three commands that you need to issue before you develop the component.

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D. E. F.

Correct Answers: B, D and F

The Components are reusable blocks that you can use for Power Apps applications.

Power Apps provides out-of-the-box standard controls (components) for creating applications, like HTML Text, Vertical Gallery, or Edit Form.

If your Power Platform solution requires more than standard controls, Power Apps also provides tools to create and reuse the custom components.

Power Apps Component Framework (PCF) helps you to create these components.

You can import and export components from other applications or store them in the Components Library.

Before you develop your component, you need to initialize a Microsoft PCF component template.

First, you create a directory for your component project.

You can use the mkdir command, like (Number 1) mkdir NewComponent.

Then you can create a new component from the template that Microsoft provides, like the following command (Number 2): pac pcf init --namespace NewComponentNamespace --name NewComponent --template field The pac is the Power Apps CLI (pac) command for the initialization of the pcf component.

After pac creates a set of files and directories, you can call (Number 3) npm install to install all dependencies that you need to run your component.

© cmd (Admin) = o x

Microsoft Windows [Version 10.0.19042.867]

, c:\Users\ \Dev\Power Platform\PCF
$ mkdir NewComponent @
angesiaes c:\Users\ \Dev\Power Platform\PCF

i$ cd NewComponent

| c:\Users\ \Dev\Power Platform\PCF\NewComponent
48 pac pcf init --namespace NewComponentNamespace --name NewComponent --template field @
The PowerApps component framework project was successfully created in ‘c:\Users\ \Dev\Power Platform\PCF\NewComponent’ .

Be sure to run ‘npm install* in this directory to install project dependencies.

> « 1 c:\Users\ \Dev\Power Platform\PCF\NewComponent

I$ npm install ®

jnpm deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.

npm |) deprecated opn@6.0.0: The package has been renamed to “open

Inpm deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
Inpm deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated

Inpm deprecated urix@@.1.0: Please see https://github.com/lydell/urix#deprecated

Inpm notice created a lockfile as package-lock.json. You should commit this file.

npm WAM optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.1 (node_modules\chokidar\node_modules\fsevents):

Inpm WAG) notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","“arch":"any"} (current: {"os":"win32", "arch": "xé
4"})

Inpm BEG) optional SKIPPING OPTIONAL DEPENDENCY: fsevents@*1.2.7 (node_modules\watchpack-chokidar2\node_modules\chokidar\node modules\fsevents):

npm QAGu) notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"»
64"})

npm ANN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@41.2.7 (node_modules\live-server\node_modules\chokidar\node_modules\fsevents) :

Inpm BEG) notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x
64"})

npm ANN) pcf-project@1.0@.@ No repository field.

Inpm BEGi) pcf-project@1.0.0 No license field.

ladded 689 packages from 434 contributors and audited 692 packages in 46.766s

36 packages are looking for funding
run “npm fund” for details

found @ vulnerabilities

| c:\Users\ \Dev\Power Platform\PCF\NewComponent

cmd.exe*[*64]:1112 « 171109[64] 1/1 [+] NUM PRIt 157x45  (3,43)25V 20528 100% /

Before you run pac and npm commands, you need to install Npm or Node.js.

It is required to run Microsoft Power Apps CLI.

And then, you can install Microsoft Power Apps CLI.

All other options are incorrect.

For more information about creating Power Apps Component Framework (PCF) component, please visit the below URLs:

To develop a new PCF (PowerApps Component Framework) component, you need to issue three commands to get started. These commands are necessary for setting up the development environment and generating the necessary files for the project. The correct commands are:

  1. pac pcf init: This command initializes a new PCF project, creating the necessary file structure and configuration files. It sets up a new project with the default settings.

  2. pac pcf new: This command generates the necessary files for a new PCF control. It creates a new control project in the specified directory.

  3. npm install: This command installs the necessary dependencies and packages required to develop a PCF control. It installs the required packages listed in the package.json file.

So, the correct answers are A, B, and F:

A. npm run build: This command builds the project for production. It compiles and optimizes the code for deployment.

B. pac pcf init: This command initializes a new PCF project.

F. npm install: This command installs the necessary dependencies and packages.

Note that command C (npm start) is used to start the development server and preview the project, but it is not necessary for setting up the project. Command D (mkdir) is not required as pac pcf init command creates the necessary directories.