Skip to content

A Yeoman generator for scaffolding Power Apps projects based on our tooling and best practices.

License

Notifications You must be signed in to change notification settings

Capgemini/powerapps-project-template

Repository files navigation

Power Apps Project Generator

Build Status npm (scoped)

A Yeoman based generator that scaffolds Power Platform Projects.

Power Apps Project Generator is an open-source tool designed to make it easier for developers working with Power Apps to quickly get up and running with new projects. It helps to ensure best practices are employed from the start, allowing developers to focus on the task at hand. The generator scaffolds source code for deployment, automated testing, build tasks, and more. In addition, it will configure an Azure DevOps repository, and associated build and release pipelines along with other Azure DevOps components. This allows developers to get up and running quickly and with confidence, and make their projects a success.

The generator scaffolds:

  • An Azure DevOps project (pipelines, releases, variable groups, service connections, etc.)
  • Build tasks
  • Solution metadata source code
  • Web resource project source code
  • Custom workflow activity/plug-in assembly project source code
  • Reference/configuration data migration project source code
  • Power BI project source code

Table of Contents

Prerequisites

You must have the following installed globally before you can use this generator:

If you already have Node installed, install Yeoman:

npm install -g yo

Installation

Install the generator package

Install the @capgeminiuk/generator-powerapps-project package globally:

npm install -g @capgeminiuk/generator-powerapps-project

Usage

Ensure that you have updated to the latest version of the generator and that your shell's current working directory is an empty folder (when running the generator for the first time) or your scaffolded repository (when using sub-generators).

Scaffold a project

A new project can be scaffolded using the main generator:

yo @capgeminiuk/powerapps-project

This generator requires you to enter some information about your project. The scaffolded artifacts include:

  • IDE configuration files
  • Boilerplate source code

Scaffold Azure DevOps

An Azure DevOps project can be scaffolded using the azuredevops sub-generator:

yo @capgeminiuk/powerapps-project:azuredevops

This generator requires you to enter some information about your project as well as an Azure DevOps personal access token and a tenant ID, application ID, and client secret of an Azure service principal. The scaffolded artifacts include:

  • Azure DevOps repository
  • Azure DevOps extensions
  • Azure DevOps variables
  • Azure DevOps service connections
  • Azure DevOps build pipelines
  • Azure DevOps release pipeline

You can easily generate the service principal using the script provided by Microsoft here. This will output the information required for the scaffolder.

Scaffold a solution

A new solution within the package can be scaffolded using the solution sub-generator:

yo @capgeminiuk/powerapps-project:solution

This sub-generator requires some information about your solution and generates the source code required to support the source control, build, and deployment of this solution.

This does not create a solution within the Common Data Service environment. The corresponding solution must be created manually and extracted after scaffolding.

Running this sub-generator:

  • Creates a corresponding folder within the src/solutions directory. This folder contains:
    • A MappingFile.xml file which is used when packing the solution with the solution packager
    • A spkl.json file which is used to contain spkl task runner configuration
    • An environment.json file which stores information regarding the development and staging (if applicable) environments for the solution
  • Updates the ImportConfig.xml file within the deployment project is updated to include the scaffolded solution in the deployment
  • Updates the .vscode/tasks.json file to allow for build tasks to be ran against the new solution

Scaffold a web resource project for a solution

This sub-generator generates the source code required to support the development of script web resources. A new web resource project can be generated within a solution using the scripts sub-generator:

yo @capgeminiuk/powerapps-project:scripts

Running this sub-generator:

  • Creates a WebResources/Scripts folder within the specified solution folder. This folder contains:
    • A tsconfig.json file for TypeScript configuration
    • A tslint.json file for TSLint configuration
    • A package.json file for managing npm dependencies
  • Updates the spkl.json file to include an empty webresource array which can be used to deploy the web resources with the spkl task runner
  • Updates the MappingFile.xml file to include a wildcard file mapping of all WebResources files. This will cause the Solution Packager to replace the web resources with the TypeScript compilation output when packing the solution

Scaffold a custom workflow activity/plug-in assembly for a solution

This sub-generator generates the source code required to support the development of custom workflow activities and plug-ins. A new custom workflow activity/plug-in project can be generated within a solution using the pluginassembly sub-generator:

yo @capgeminiuk/powerapps-project:pluginassembly

Running this sub-generator:

  • Creates a C# class library project targeting .NET Framework 4.6.2 within the specified solution folder. This project is pre-configured with required packages and code analysers.
  • Updates the spkl.json file to include the assembly built by the newly created project. This allows the assembly to be deployed using the spkl task runner.
  • Updates the MappingFile.xml file to include a file mapping of the plug-in assembly .dll. This will cause the Solution Packager to replace the assembly with the class library project build output when packing the solution

Scaffold reference/configuration data migration for a solution

This sub-generator generates the source code required to support the migration of reference or configuration data. This can be done using the data sub-generator:

yo @capgeminiuk/powerapps-project:data

Creates a data folder which contains the DataExport.json, DataImport.json, and DataSchema.xml files for use with the Capgemini XRM Data Migrator tool. The ImportConfig.xml is also updated to include the import of the data.

Scaffold a Power BI assembly for a solution

This sub-generator generates the source code required to support the migration of Power BI components. A new powerbi project can be generated within a solution using the powerbi sub-generator:

yo @capgeminiuk/powerapps-project:powerbi

Running this sub-generator:

  • Creates a C# class library project targeting .NET Framework 4.6.2 within the specified solution folder. This project is pre-configured with required powershell module and scripts which enables to deploy powerbi reports, updates required parameters and connections.
  • Creates two folders under the C# project. One is for the pbix files and the other folder is for the powershell files.
  • Updates the include-build-stage.yml file to include the assembly built by the newly created project. This allows the reports and powershell files to be included in the build artifact so that release pipelines for reports can access the required files.
  • Details regarding scripts, prerequisites and setting up a release pipeline for a report can be found in README file under src/generators/powerbi folder.
  • This set up does not require Premium license and it is fully functioning with Pro license.

Contributing

Please refer to the Contributing guide.

License

The Power Apps Project Template is released under the MIT license.