pcf-limitations — правило для GitHub Copilot: как настроить
Напоминает GitHub Copilot об ограничениях Power Apps Component Framework в коде компонентов. Помогает вовремя учесть запреты Canvas Apps и правила бандлинга.
.github/instructions/pcf-limitations.instructions.mdЧто делает pcf-limitations
Правило задаёт рамки для разработки компонентов интерфейса Power Apps и Power Pages. Инструкция применяется к файлам **/*.{ts,tsx,js,json,xml,pcfproj,csproj}. Ассистент не предложит вызвать WebAPI Dataverse в Canvas Apps, потому что эти методы там не работают.
Файл фиксирует требования к архитектуре сборки и безопасности. Внешние библиотеки придётся упаковать в основной бандл компонента или заменить библиотеками платформы. Доступ к window.localStorage и window.sessionStorage исключается: данные в браузере хранить нельзя из-за проблем с безопасностью и надёжностью.
Для авторизации в Canvas Apps правило предписывает использовать стандартные коннекторы, так как собственный auth механизм платформа не поддерживает. Игнорирование этого ограничения приведёт к нерабочему компоненту ещё на этапе развёртывания.
Какие задачи решает
- предотвратить вызовы Dataverse WebAPI в Canvas Apps
- исключить небезопасное хранение данных в local storage
- настроить бандлинг внешних библиотек в код компонента
- заменить кастомную авторизацию на коннекторы Power Apps
Примеры запросов агенту
- Напиши компонент PCF для отображения списка, совместимый с Canvas Apps
- Как сохранить состояние формы без использования local storage?
- Добавь стороннюю библиотеку в проект pcfproj с учётом бандлинга
Как установить pcf-limitations
Вручную: положить файлы
.github/instructions/pcf-limitations.instructions.mdПоле applyTo задаёт, к каким файлам применять
Вручную: положить файлы
.claude/rules/pcf-limitations.mdПоле paths во frontmatter ограничивает файлы: applyTo из источника → paths
AGENTS.md
Codex читает AGENTS.md: вставьте текст правила туда
Вручную: положить файлы
.cursor/rules/pcf-limitations.mdcВо frontmatter: description, globs, alwaysApply. applyTo из источника → globs, иначе правило само не подключится
Вручную: положить файлы
.devin/rules/pcf-limitations.mdВручную: положить файлы
.clinerules/pcf-limitations.mdПо шагам, с командами для каждой платформы: AGENTS.md и CLAUDE.md: что это, кто читает и какой выбрать
Вопросы о pcf-limitations
Как установить pcf-limitations в GitHub Copilot?
Сохраните файл правила по пути .github/instructions/pcf-limitations.instructions.md в корне вашего репозитория.
Что делает правило pcf-limitations?
Оно инструктирует ассистента учитывать ограничения Power Apps Component Framework, включая запрет на WebAPI в Canvas Apps и отказ от веб-хранилищ браузера.
Можно ли использовать window.localStorage в компонентах PCF?
Правило запрещает обращение к window.localStorage и window.sessionStorage, так как браузерное хранилище не гарантирует безопасность и надёжную доступность данных.
Исходный текст
pcf-limitations.instructions.md · MIT
---
description: 'Limitations and restrictions of Power Apps Component Framework'
applyTo: '**/*.{ts,tsx,js,json,xml,pcfproj,csproj}'
---
# Limitations
With Power Apps component framework, you can create your own code components to improve the user experience in Power Apps and Power Pages. Even though you can create your own components, there are some limitations that restrict developers implementing some features in the code components. Below are some of the limitations:
## 1. Dataverse Dependent APIs Not Available for Canvas Apps
Microsoft Dataverse dependent APIs, including WebAPI, are not available for Power Apps canvas applications yet. For individual API availability, see [Power Apps component framework API reference](https://learn.microsoft.com/en-us/power-apps/developer/component-framework/reference/).
## 2. Bundle External Libraries or Use Platform Libraries
Code components should either use [React controls & platform libraries](https://learn.microsoft.com/en-us/power-apps/developer/component-framework/react-controls-platform-libraries) or bundle all the code including external library content into the primary code bundle.
To see an example of how the Power Apps command line interface can help with bundling your external library content into a component-specific bundle, see [Angular flip component](https://learn.microsoft.com/en-us/power-apps/developer/component-framework/sample-controls/angular-flip-control) example.
## 3. Do Not Use HTML Web Storage Objects
Code components should not use the HTML web storage objects, like `window.localStorage` and `window.sessionStorage`, to store data. Data stored locally on the user's browser or mobile client is not secure and not guaranteed to be available reliably.
## 4. Custom Auth Not Supported in Canvas Apps
Custom auth in code components is not supported in Power Apps canvas applications. Use connectors to get data and take actions instead.
## Related Topics
- [Power Apps component framework API reference](https://learn.microsoft.com/en-us/power-apps/developer/component-framework/reference/)
- [Power Apps component framework overview](https://learn.microsoft.com/en-us/power-apps/developer/component-framework/overview)
© github · MIT · github/awesome-copilot