create-powerapp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/ISSUE_TEMPLATE/bug_report.md +36 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
- package/.github/workflows/ci.yml +103 -0
- package/CHANGELOG.md +26 -0
- package/CONTRIBUTING.md +130 -0
- package/LICENSE +21 -0
- package/README.md +137 -0
- package/docs/setup-guide.md +968 -0
- package/index.js +667 -0
- package/package.json +31 -0
|
@@ -0,0 +1,968 @@
|
|
|
1
|
+
# VS Code Setup Guide for Vibe Coding
|
|
2
|
+
### Using GitHub Copilot or Claude Code
|
|
3
|
+
|
|
4
|
+
> **Who is this for?** Anyone who wants to build Power Apps using AI — even if you have never written a line of code, never heard of VS Code, and have no idea what "the terminal" is. Follow this guide from top to bottom. Every unfamiliar word is explained. Take it one step at a time.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## ⚡ The Fast Way — One Command to Start Any Project
|
|
9
|
+
|
|
10
|
+
> **Already completed the VS Code setup below?** This is all you need to start a new project. Run one command, answer four questions, and your entire project is scaffolded and open in VS Code — ready for you to start prompting your AI.
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npx create-powerapp
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
That's it. The tool will ask you:
|
|
17
|
+
|
|
18
|
+
1. **What do you want to call your project?** (e.g. `employee-leave-app`)
|
|
19
|
+
2. **Which type of Power App?** (Canvas / Model-Driven / PCF / Power Pages / Code App)
|
|
20
|
+
3. **Which AI assistant?** (GitHub Copilot or Claude Code)
|
|
21
|
+
4. **Your Power Platform environment URL** (optional — you can add it later)
|
|
22
|
+
|
|
23
|
+
Then it automatically creates:
|
|
24
|
+
|
|
25
|
+
- ✅ Your project folder with the right structure for that app type
|
|
26
|
+
- ✅ `.gitignore` — so passwords and auto-generated files never get uploaded
|
|
27
|
+
- ✅ `.env` — a safe place to store your environment URL and secrets
|
|
28
|
+
- ✅ `README.md` — project overview with useful commands
|
|
29
|
+
- ✅ `instructions/` folder — AI context files that teach your AI how this app type works
|
|
30
|
+
- ✅ `prompts/starter.md` — ready-made prompts you can copy and paste to get your first screens built immediately
|
|
31
|
+
- ✅ `CLAUDE.md` or `.github/copilot-instructions.md` — the file your AI reads to understand your project
|
|
32
|
+
- ✅ Git initialised with a first commit
|
|
33
|
+
- ✅ Power Platform environment connected (if you provided the URL)
|
|
34
|
+
- ✅ VS Code opened automatically
|
|
35
|
+
|
|
36
|
+
**After the command finishes:**
|
|
37
|
+
1. VS Code opens with your project
|
|
38
|
+
2. Open `prompts/starter.md` — it has ready-made first prompts tailored to your app type
|
|
39
|
+
3. Open your AI assistant (Copilot Chat icon, or run `claude` in the terminal)
|
|
40
|
+
4. Copy a prompt from `prompts/starter.md`, paste it in, and start building
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
### Installing `create-powerapp` (one-time)
|
|
45
|
+
|
|
46
|
+
You need Node.js installed first (covered in Part 1, Step 2 below). Then you can either run it directly with `npx` (no install needed) or install it globally so it's always available:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Option 1 — run without installing (always uses the latest version)
|
|
50
|
+
npx create-powerapp
|
|
51
|
+
|
|
52
|
+
# Option 2 — install globally so you can run it anytime
|
|
53
|
+
npm install -g create-powerapp
|
|
54
|
+
create-powerapp
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 🗺️ Before You Start — Read This First
|
|
60
|
+
|
|
61
|
+
### What will I be doing?
|
|
62
|
+
|
|
63
|
+
By the end of this guide, you will have a laptop set up so you can **describe an app in plain English** and have an AI build it for you. You will not need to memorise code. You will not need a computer science degree. You just need to be able to type sentences.
|
|
64
|
+
|
|
65
|
+
### What is "Vibe Coding"?
|
|
66
|
+
|
|
67
|
+
Vibe coding means you describe what you want to build in plain English, and an AI assistant (GitHub Copilot or Claude Code) writes the code for you. You guide, review, and refine — the AI does the heavy lifting. Think of it as pair programming with a very fast AI colleague.
|
|
68
|
+
|
|
69
|
+
**Real example:** Instead of writing hundreds of lines of code yourself, you type something like:
|
|
70
|
+
|
|
71
|
+
> *"Create a form that lets employees submit time-off requests. It should have a date picker, a dropdown for the reason, and a submit button that saves to a SharePoint list."*
|
|
72
|
+
|
|
73
|
+
…and the AI writes all the code for you. Your job is to review it, test it, and ask for changes in plain English.
|
|
74
|
+
|
|
75
|
+
### What is VS Code?
|
|
76
|
+
|
|
77
|
+
VS Code (Visual Studio Code) is a free text editor made by Microsoft. Think of it like Microsoft Word, but instead of writing documents, you write instructions for computers (code). It also has a built-in terminal (a text-based command line) and can connect to AI assistants. You do not need to know how to code to use it — the AI inside it does that for you.
|
|
78
|
+
|
|
79
|
+
### What are Power Apps?
|
|
80
|
+
|
|
81
|
+
Power Apps is Microsoft's platform for building business apps — things like employee portals, approval workflows, data entry forms, customer-facing websites, and more. There are several types of Power Apps:
|
|
82
|
+
|
|
83
|
+
| App Type | Think of it as… |
|
|
84
|
+
|---|---|
|
|
85
|
+
| **Canvas App** | A blank canvas — you design every screen, like building a PowerPoint slide that works as an app |
|
|
86
|
+
| **Model-Driven App** | A database-first app — great for CRM-style tools where the data structure drives the layout |
|
|
87
|
+
| **Code Component (PCF)** | A custom control you embed inside another app — like a special interactive widget |
|
|
88
|
+
| **Power Pages** | A public-facing website connected to your business data |
|
|
89
|
+
| **Code App** | A modern web app (like a React website) that runs inside Power Platform |
|
|
90
|
+
|
|
91
|
+
You do not need to choose right now. This guide sets up your machine for all of them.
|
|
92
|
+
|
|
93
|
+
### How long will this take?
|
|
94
|
+
|
|
95
|
+
About **60–90 minutes** the first time, mostly waiting for software to download. Once set up, starting a new project takes about 5 minutes.
|
|
96
|
+
|
|
97
|
+
### What do I need?
|
|
98
|
+
|
|
99
|
+
- A Windows, macOS, or Linux computer
|
|
100
|
+
- An internet connection
|
|
101
|
+
- A Microsoft 365 / work account (for connecting to Power Apps)
|
|
102
|
+
- Either a GitHub Copilot subscription or an Anthropic API key (your organisation may provide one — ask your IT team or manager)
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## 🧩 Jargon Glossary
|
|
107
|
+
|
|
108
|
+
You will see these words throughout the guide. Here is what they mean in plain English:
|
|
109
|
+
|
|
110
|
+
| Word | Plain English meaning |
|
|
111
|
+
|---|---|
|
|
112
|
+
| **Terminal** | A text-based window where you type commands. Like a chat with your computer. |
|
|
113
|
+
| **Command** | A short instruction you type into the terminal and press Enter to run. |
|
|
114
|
+
| **Install** | Download and set up a program so it runs on your computer. |
|
|
115
|
+
| **npm** | A tool that downloads and manages coding libraries automatically. Comes with Node.js. |
|
|
116
|
+
| **Node.js** | A behind-the-scenes engine that runs JavaScript on your computer. Most tools need it. |
|
|
117
|
+
| **Git** | A save-and-history system for code. Like "Track Changes" in Word, but for entire projects. |
|
|
118
|
+
| **Repository / Repo** | A project folder tracked by Git. |
|
|
119
|
+
| **CLI** | Command Line Interface — a tool you use by typing commands instead of clicking buttons. |
|
|
120
|
+
| **Extension** | An add-on for VS Code, like a plugin. Gives VS Code new abilities. |
|
|
121
|
+
| **Environment** | A Power Platform workspace — like a separate sandbox where your apps live. |
|
|
122
|
+
| **Solution** | A bundle/container in Power Apps that holds your apps, data tables, and settings together. |
|
|
123
|
+
| **PAC CLI** | Microsoft's command-line tool for Power Apps — lets you manage apps from the terminal. |
|
|
124
|
+
| **YAML / XML** | Types of structured text files that store settings. The AI handles these — you rarely edit them directly. |
|
|
125
|
+
| **Push / Pull** | Uploading your local changes to the server (push), or downloading the server's latest version (pull). |
|
|
126
|
+
| **Package.json** | A file that lists what libraries a project needs. Like a recipe ingredient list. |
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Part 1 — Local Device Setup
|
|
131
|
+
|
|
132
|
+
These steps are done **once on your machine**. You only need to do this again if you get a new computer.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
### Step 1: Install VS Code
|
|
137
|
+
|
|
138
|
+
**What is this?** VS Code is the app where you will do all your work. Think of it as your coding workbench.
|
|
139
|
+
|
|
140
|
+
1. Go to [https://code.visualstudio.com](https://code.visualstudio.com)
|
|
141
|
+
2. Click **Download** — it will auto-detect your operating system (Windows / macOS / Linux)
|
|
142
|
+
3. Run the installer and follow the on-screen steps — click Next/Continue/Agree through all the defaults
|
|
143
|
+
4. Open VS Code once the install finishes
|
|
144
|
+
|
|
145
|
+
**What you should see:** A dark-themed window with a welcome tab, a sidebar on the left with icons, and a menu bar at the top. That is VS Code.
|
|
146
|
+
|
|
147
|
+
> **macOS tip:** After installing, drag VS Code into your Applications folder so you can find it easily.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
### Step 2: Install Node.js (Required for most projects)
|
|
152
|
+
|
|
153
|
+
**What is this?** Node.js is a behind-the-scenes engine that almost every modern coding tool depends on. You won't use it directly — it just needs to be there. Installing it also gives you **npm**, which is a tool for downloading other tools automatically.
|
|
154
|
+
|
|
155
|
+
1. Go to [https://nodejs.org](https://nodejs.org)
|
|
156
|
+
2. Download the **LTS** version (the one labeled "Recommended for most users")
|
|
157
|
+
3. Run the installer with all default settings — just keep clicking Next
|
|
158
|
+
|
|
159
|
+
**Now check it worked.** You need to open the terminal inside VS Code:
|
|
160
|
+
|
|
161
|
+
> **How to open the terminal in VS Code:** Press `` Ctrl+` `` (Windows/Linux) or `` Cmd+` `` (macOS). Alternatively, go to the top menu: **View → Terminal**. A panel will appear at the bottom of VS Code. That dark text area is your terminal.
|
|
162
|
+
|
|
163
|
+
Type these two commands one at a time, pressing **Enter** after each:
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
node --version
|
|
167
|
+
npm --version
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Both commands should print a version number (e.g. `v20.11.0`). If they do, Node.js is installed correctly.
|
|
171
|
+
|
|
172
|
+
> **If you see "command not found":** Close VS Code completely, re-open it, and try again. If still broken, re-run the Node.js installer.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
### Step 3: Install Git
|
|
177
|
+
|
|
178
|
+
**What is this?** Git is a save-and-history system for your code. Every time you finish a chunk of work, you "commit" it — this saves a snapshot you can go back to later. It also lets you share code with teammates. Think of it like "Track Changes" in Word, but for entire projects.
|
|
179
|
+
|
|
180
|
+
- **Windows:** Download from [https://git-scm.com](https://git-scm.com) and run the installer (keep all defaults — just click Next through everything)
|
|
181
|
+
- **macOS:** Run `git --version` in the terminal — macOS will automatically prompt you to install it. Click Install in the pop-up.
|
|
182
|
+
- **Linux:** Run `sudo apt install git` in your terminal and type Y when asked
|
|
183
|
+
|
|
184
|
+
**After installing, tell Git your name and email** (it stamps these on every save you make). In the terminal, run these two lines one at a time — replace the example values with your own:
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
git config --global user.name "Your Name"
|
|
188
|
+
git config --global user.email "you@example.com"
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
No output means it worked — that's normal for Git.
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
### Step 4: Install Power Platform CLI (PAC CLI)
|
|
196
|
+
|
|
197
|
+
**What is this?** The PAC CLI (Power Platform Command Line Interface) is Microsoft's official tool for connecting your VS Code to Power Apps. It lets you download apps to edit locally, push your changes back to the cloud, and manage your Power Apps environment — all from the terminal. Think of it as the bridge between your laptop and Power Apps.
|
|
198
|
+
|
|
199
|
+
It lets you pull, push, and manage Power Apps components (Model-Driven Apps, Canvas Apps, Code Components, Code Apps, Power Pages) directly from VS Code and your terminal — no browser needed for most tasks.
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
#### 4a — Install the PAC CLI
|
|
204
|
+
|
|
205
|
+
In the VS Code terminal, run one of these (Option 1 is recommended):
|
|
206
|
+
|
|
207
|
+
**Option 1 — Via npm (recommended, works on all OS):**
|
|
208
|
+
```
|
|
209
|
+
npm install -g pac
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**Option 2 — Via .NET tool** (if Option 1 fails):
|
|
213
|
+
```
|
|
214
|
+
dotnet tool install --global Microsoft.PowerApps.CLI.Tool
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
> The `-g` flag means "install globally" — so it works from any folder, not just one project.
|
|
218
|
+
|
|
219
|
+
**Check it installed:**
|
|
220
|
+
```
|
|
221
|
+
pac --version
|
|
222
|
+
```
|
|
223
|
+
You should see something like `Microsoft PowerApps CLI 1.x.x`. If you do, it worked.
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
#### 4b — Install the Power Platform VS Code Extension
|
|
228
|
+
|
|
229
|
+
**What is this?** Extensions add new abilities to VS Code. This one adds a Power Platform sidebar panel so you can manage your apps without leaving VS Code.
|
|
230
|
+
|
|
231
|
+
1. In VS Code, click the **Extensions icon** in the left sidebar (it looks like four squares, with one slightly separated)
|
|
232
|
+
— or press `Ctrl+Shift+X` (Windows/Linux) / `Cmd+Shift+X` (macOS)
|
|
233
|
+
2. In the search box at the top of the Extensions panel, type: **Power Platform Tools**
|
|
234
|
+
3. Find the result published by **Microsoft** and click **Install**
|
|
235
|
+
|
|
236
|
+
| Extension | Publisher | Purpose |
|
|
237
|
+
|---|---|---|
|
|
238
|
+
| **Power Platform Tools** | Microsoft | Full PAC CLI integration inside VS Code — manage environments, solutions, and apps from the sidebar |
|
|
239
|
+
|
|
240
|
+
**What you should see after installing:** A new icon that looks like a Power Platform logo appears in the VS Code left sidebar. Clicking it shows your Power Apps environments.
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
#### 4c — Authenticate PAC CLI with Your Environment
|
|
245
|
+
|
|
246
|
+
**What is this?** Before PAC CLI can talk to your organisation's Power Apps, you need to log in. This step connects the CLI to your Microsoft work account. You only do this once per environment.
|
|
247
|
+
|
|
248
|
+
**What is a Power Platform environment?** Think of it as a workspace — your organisation might have a "Development" environment for testing and a "Production" environment for the live apps. Ask your manager or IT team which URL to use.
|
|
249
|
+
|
|
250
|
+
Run this in the terminal (replace the URL with your organisation's):
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
pac auth create --url https://yourorg.crm.dynamics.com
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
> **How do I find my organisation's URL?** Log in to [make.powerapps.com](https://make.powerapps.com), click the settings gear → **Session details**, and look for "Instance url". It looks like `https://yourcompany.crm.dynamics.com`.
|
|
257
|
+
|
|
258
|
+
A browser window will open asking you to sign in with your Microsoft 365 / work account. Sign in as normal. After sign-in, the CLI stores your credentials locally — you won't need to do this again.
|
|
259
|
+
|
|
260
|
+
**Useful commands for managing your login:**
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
pac auth list # See all the environments you're logged into
|
|
264
|
+
pac auth select --index 1 # Switch to a different environment (use the number from pac auth list)
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
#### 4d — Power Apps Component Skill Files
|
|
270
|
+
|
|
271
|
+
**What is this?** Each type of Power App has its own code structure and conventions. This section sets up instruction files that teach your AI assistant how each app type works — so it gives you accurate, relevant suggestions instead of generic ones. Think of these as a briefing document you hand to a new colleague before they start work.
|
|
272
|
+
|
|
273
|
+
Set these up **once locally** so your AI assistant understands Power Platform patterns.
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
##### Model-Driven Apps (MDA)
|
|
278
|
+
|
|
279
|
+
**What is a Model-Driven App?** This is a database-first app — the structure of your data (tables, columns, relationships) drives how the app looks. Great for CRM tools, service management systems, or anything where you're managing lots of structured records. Power Apps generates most of the UI automatically from your data model.
|
|
280
|
+
|
|
281
|
+
**In plain English:** You define the data, Power Apps builds the screens. Less design work, more data work.
|
|
282
|
+
|
|
283
|
+
Use PAC CLI to work with them:
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
# Pull a solution containing MDA components
|
|
287
|
+
pac solution clone --name YourSolutionName --outputDirectory ./solutions/your-solution
|
|
288
|
+
|
|
289
|
+
# Typical local folder structure after clone:
|
|
290
|
+
solutions/
|
|
291
|
+
your-solution/
|
|
292
|
+
src/
|
|
293
|
+
Entities/ # Dataverse table definitions
|
|
294
|
+
Forms/ # Form XML layouts
|
|
295
|
+
Views/ # View definitions
|
|
296
|
+
SiteMaps/ # App navigation
|
|
297
|
+
solution.xml
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
**AI instructions file** — create a file called `instructions/mda-instructions.md` in your project folder and paste this inside it. This tells the AI how Model-Driven Apps work so it can help you correctly:
|
|
301
|
+
|
|
302
|
+
```markdown
|
|
303
|
+
# Model-Driven App Instructions
|
|
304
|
+
|
|
305
|
+
## Type: Model-Driven App (Power Apps / Dataverse)
|
|
306
|
+
- All entities map to Dataverse tables
|
|
307
|
+
- Forms are defined in XML — do not hand-edit GUIDs
|
|
308
|
+
- Business rules go in Dataverse, not client-side JS
|
|
309
|
+
- Use PAC CLI to push/pull: `pac solution push` / `pac solution clone`
|
|
310
|
+
- Plugin code goes in the Plugins/ folder, registered via Plugin Registration Tool
|
|
311
|
+
- JavaScript web resources live in WebResources/ and must be registered on forms
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
##### Canvas Apps
|
|
317
|
+
|
|
318
|
+
**What is a Canvas App?** This is a drag-and-drop app where you control every pixel of the design. Great for custom-branded employee tools, mobile apps, kiosks, and anything where the visual design matters. You build screens like PowerPoint slides, then connect them to data.
|
|
319
|
+
|
|
320
|
+
**In plain English:** You design exactly how it looks and behaves. More creative control, more work.
|
|
321
|
+
|
|
322
|
+
PAC CLI unpacks them into editable YAML files you can edit locally:
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
# Unpack a Canvas App from a solution for editing
|
|
326
|
+
pac canvas unpack --msapp ./CanvasApp.msapp --sources ./canvas-src
|
|
327
|
+
|
|
328
|
+
# Pack it back before pushing
|
|
329
|
+
pac canvas pack --msapp ./CanvasApp.msapp --sources ./canvas-src
|
|
330
|
+
|
|
331
|
+
# Typical unpacked folder structure:
|
|
332
|
+
canvas-src/
|
|
333
|
+
Src/
|
|
334
|
+
App.fx.yaml # App-level formulas and settings
|
|
335
|
+
Screens/ # One .fx.yaml file per screen
|
|
336
|
+
Assets/ # Images, icons, fonts
|
|
337
|
+
DataSources/ # Connected data source definitions
|
|
338
|
+
pkgs/ # Component libraries
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
**AI instructions file** — create `instructions/canvas-instructions.md`:
|
|
342
|
+
|
|
343
|
+
```markdown
|
|
344
|
+
# Canvas App Instructions
|
|
345
|
+
|
|
346
|
+
## Type: Canvas App (Power Apps)
|
|
347
|
+
- Screens and controls are defined in .fx.yaml files
|
|
348
|
+
- Formulas use Power Fx — similar to Excel syntax
|
|
349
|
+
- Use `With()`, `Collect()`, `Patch()` for data operations — never SQL
|
|
350
|
+
- Navigation: `Navigate(ScreenName, ScreenTransition.Fade)`
|
|
351
|
+
- Avoid nested galleries where possible — use collections instead
|
|
352
|
+
- PAC commands: `pac canvas unpack` / `pac canvas pack`
|
|
353
|
+
- Never edit .msapp binary directly — always unpack first
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
##### Code Components (PCF — Power Apps Component Framework)
|
|
359
|
+
|
|
360
|
+
**What is a Code Component?** A PCF component is a custom interactive control you build once and then embed inside Canvas or Model-Driven Apps. Think of it as a reusable widget — for example, a custom colour picker, a signature pad, an interactive chart, or a drag-and-drop list. Built with standard web technologies (React and TypeScript), they look and behave exactly how you design them.
|
|
361
|
+
|
|
362
|
+
**In plain English:** You're building a reusable UI lego brick that snaps into your other Power Apps.
|
|
363
|
+
|
|
364
|
+
```bash
|
|
365
|
+
# Create a new PCF project
|
|
366
|
+
pac pcf init --namespace YourNamespace --name YourComponentName --template field
|
|
367
|
+
|
|
368
|
+
# Install dependencies
|
|
369
|
+
npm install
|
|
370
|
+
|
|
371
|
+
# Run in local test harness (opens a preview in your browser)
|
|
372
|
+
npm start watch
|
|
373
|
+
|
|
374
|
+
# Build for deployment
|
|
375
|
+
npm run build
|
|
376
|
+
|
|
377
|
+
# Push to environment
|
|
378
|
+
pac pcf push --publisher-prefix yourprefix
|
|
379
|
+
|
|
380
|
+
# Typical folder structure:
|
|
381
|
+
YourComponentName/
|
|
382
|
+
YourComponentName/
|
|
383
|
+
index.ts # Main component logic
|
|
384
|
+
ControlManifest.xml # Component metadata and properties
|
|
385
|
+
__tests__/ # Unit tests
|
|
386
|
+
node_modules/
|
|
387
|
+
package.json
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
**AI instructions file** — create `instructions/pcf-instructions.md`:
|
|
391
|
+
|
|
392
|
+
```markdown
|
|
393
|
+
# PCF Code Component Instructions
|
|
394
|
+
|
|
395
|
+
## Type: Power Apps Component Framework (PCF)
|
|
396
|
+
- Entry point is always `index.ts` implementing `ComponentFramework.StandardControl`
|
|
397
|
+
- Properties are declared in `ControlManifest.Input.xml`
|
|
398
|
+
- Use `context.parameters` to read input properties
|
|
399
|
+
- Use `notifyOutputChanged()` to push values back to the app
|
|
400
|
+
- Styling: use CSS modules or inline styles — no Tailwind
|
|
401
|
+
- Testing: use `@testing-library/react` + Jest
|
|
402
|
+
- Build: `npm run build` then `pac pcf push`
|
|
403
|
+
- Never modify `.pcfproj` or `Solution.xml` by hand
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
##### Power Pages (Portals)
|
|
409
|
+
|
|
410
|
+
**What is Power Pages?** Power Pages are external-facing websites connected to your Dataverse data. Great for customer portals, partner sites, self-service forms, or any situation where people outside your organisation need to interact with your business data — without needing a Microsoft account.
|
|
411
|
+
|
|
412
|
+
**In plain English:** A public website that your customers or partners can visit, powered by your Power Apps data behind the scenes.
|
|
413
|
+
|
|
414
|
+
```bash
|
|
415
|
+
# Download a Power Pages site to edit locally
|
|
416
|
+
pac pages download --path ./powerpages-site --webSiteId your-website-id
|
|
417
|
+
|
|
418
|
+
# Upload changes back
|
|
419
|
+
pac pages upload --path ./powerpages-site
|
|
420
|
+
|
|
421
|
+
# Typical folder structure:
|
|
422
|
+
powerpages-site/
|
|
423
|
+
web-files/ # CSS, JS, image assets
|
|
424
|
+
web-pages/ # Page content in HTML/Liquid
|
|
425
|
+
web-templates/ # Reusable Liquid templates
|
|
426
|
+
content-snippets/ # Reusable text blocks
|
|
427
|
+
entity-forms/ # Dataverse-connected forms
|
|
428
|
+
web-roles/ # Access control roles
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
**AI instructions file** — create `instructions/powerpages-instructions.md`:
|
|
432
|
+
|
|
433
|
+
```markdown
|
|
434
|
+
# Power Pages Instructions
|
|
435
|
+
|
|
436
|
+
## Type: Power Pages (External Portal)
|
|
437
|
+
- Pages use Liquid templating language — similar to Jinja2
|
|
438
|
+
- Data access uses FetchXML or Liquid tags like `{% fetchxml %}`
|
|
439
|
+
- CSS and JS go in web-files/ — reference them in templates
|
|
440
|
+
- Authentication is managed by Power Pages — do not build custom auth
|
|
441
|
+
- Table permissions control data access — configure in Power Pages studio
|
|
442
|
+
- Use `pac pages download` / `pac pages upload` to sync changes
|
|
443
|
+
- Never hardcode environment URLs — use Liquid `{{ request.url }}` helpers
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
---
|
|
447
|
+
|
|
448
|
+
##### Code Apps
|
|
449
|
+
|
|
450
|
+
**What is a Code App?** Code Apps are the newest app type — they let you build a fully custom web app using standard web technologies (React, Vue, or any framework) and host it on Power Platform's managed infrastructure. You get full control over every pixel of the UI and every line of logic, while Power Platform handles authentication, security policies, deployment, and access to 1,500+ data connectors.
|
|
451
|
+
|
|
452
|
+
**In plain English:** Build a proper website or web app in VS Code the way a developer would — but Microsoft handles all the hosting, security, and login for you, and you can tap into all your existing Power Platform data and connectors.
|
|
453
|
+
|
|
454
|
+
> **Admin step required first:** Before you can use Code Apps, a Power Platform admin must turn the feature on. Ask your admin to go to: **Power Platform Admin Center → Manage → Environments → [your environment] → Settings → Product → Features → Enable code apps**. End users also need a **Power Apps Premium license**.
|
|
455
|
+
|
|
456
|
+
```bash
|
|
457
|
+
# Install the Power Apps client library (includes the npm-based CLI)
|
|
458
|
+
npm install @microsoft/power-apps
|
|
459
|
+
|
|
460
|
+
# Initialize a new code app project
|
|
461
|
+
pac code init --outputDirectory ./my-code-app
|
|
462
|
+
|
|
463
|
+
# Run locally during development (opens a preview in your browser)
|
|
464
|
+
npm start
|
|
465
|
+
|
|
466
|
+
# Publish to your Power Platform environment
|
|
467
|
+
pac code push
|
|
468
|
+
|
|
469
|
+
# Typical folder structure:
|
|
470
|
+
my-code-app/
|
|
471
|
+
src/
|
|
472
|
+
index.ts # App entry point
|
|
473
|
+
App.tsx # Root component (if using React)
|
|
474
|
+
components/ # UI components
|
|
475
|
+
public/ # Static assets
|
|
476
|
+
package.json
|
|
477
|
+
tsconfig.json
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
> **Note:** Starting with `@microsoft/power-apps` v1.0.4+, a new npm-based CLI is included and will eventually replace `pac code` commands. Check the [npm package](https://www.npmjs.com/package/@microsoft/power-apps) for the latest CLI usage.
|
|
481
|
+
|
|
482
|
+
**AI instructions file** — create `instructions/codeapp-instructions.md`:
|
|
483
|
+
|
|
484
|
+
```markdown
|
|
485
|
+
# Code App Instructions
|
|
486
|
+
|
|
487
|
+
## Type: Power Apps Code App (Code-first web app)
|
|
488
|
+
- Standard web app (React/Vue/TypeScript) hosted on Power Platform
|
|
489
|
+
- Use `@microsoft/power-apps` npm package to access connectors and platform APIs
|
|
490
|
+
- Authentication is handled by Microsoft Entra — do not build custom auth
|
|
491
|
+
- Call Power Platform connectors directly from JavaScript via the client library
|
|
492
|
+
- Publish with `pac code push` — no manual deployment pipeline needed
|
|
493
|
+
- Follows canvas app sharing limits and DLP policies set by admins
|
|
494
|
+
- Not supported in Power Apps mobile app or Power Apps for Windows
|
|
495
|
+
- Use `npm start` for local dev; the platform manages hosting in production
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
---
|
|
499
|
+
|
|
500
|
+
#### 4e — Useful PAC CLI Commands Cheat Sheet
|
|
501
|
+
|
|
502
|
+
**What is this?** A quick-reference card for the most common commands. Bookmark this page — you'll come back to it often. Run these in the VS Code terminal.
|
|
503
|
+
|
|
504
|
+
```bash
|
|
505
|
+
# Auth
|
|
506
|
+
pac auth create --url https://yourorg.crm.dynamics.com # Connect to environment
|
|
507
|
+
pac auth list # List saved profiles
|
|
508
|
+
pac auth clear # Remove all profiles
|
|
509
|
+
|
|
510
|
+
# Solutions
|
|
511
|
+
pac solution list # List solutions in environment
|
|
512
|
+
pac solution clone --name SolutionName --outputDirectory ./solutions
|
|
513
|
+
pac solution push # Push local changes to environment
|
|
514
|
+
pac solution export --name SolutionName --path ./exports # Export as .zip
|
|
515
|
+
|
|
516
|
+
# Canvas Apps
|
|
517
|
+
pac canvas unpack --msapp App.msapp --sources ./src
|
|
518
|
+
pac canvas pack --msapp App.msapp --sources ./src
|
|
519
|
+
|
|
520
|
+
# PCF Components
|
|
521
|
+
pac pcf init --namespace NS --name MyControl --template field
|
|
522
|
+
pac pcf push --publisher-prefix prefix
|
|
523
|
+
|
|
524
|
+
# Power Pages
|
|
525
|
+
pac pages download --path ./site --webSiteId <id>
|
|
526
|
+
pac pages upload --path ./site
|
|
527
|
+
|
|
528
|
+
# Code Apps
|
|
529
|
+
pac code init --outputDirectory ./my-code-app
|
|
530
|
+
pac code push
|
|
531
|
+
|
|
532
|
+
# Environment info
|
|
533
|
+
pac env list # List all environments
|
|
534
|
+
pac env who # Show current environment details
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
---
|
|
538
|
+
|
|
539
|
+
### Step 5: Install Essential VS Code Extensions
|
|
540
|
+
|
|
541
|
+
**What is this?** Extensions are add-ons that make VS Code smarter. These are the ones that every developer uses — they catch mistakes as you type, keep your code tidy, and make Git easier to use.
|
|
542
|
+
|
|
543
|
+
Open VS Code, then open the Extensions panel with `Ctrl+Shift+X` (Windows/Linux) or `Cmd+Shift+X` (macOS). In the search box, type the name of each extension below and click **Install** on the result from the correct publisher.
|
|
544
|
+
|
|
545
|
+
#### General Development Extensions
|
|
546
|
+
|
|
547
|
+
| Extension | Purpose |
|
|
548
|
+
|---|---|
|
|
549
|
+
| **ESLint** | Catches code errors as you type — like spell-check but for code |
|
|
550
|
+
| **Prettier - Code formatter** | Automatically formats your code to look clean and consistent when you save |
|
|
551
|
+
| **GitLens** | Shows who changed what and when, directly inside your files. Makes Git much easier to understand |
|
|
552
|
+
| **Error Lens** | Shows error messages directly on the line where the problem is — no hunting around |
|
|
553
|
+
| **Path Intellisense** | Auto-completes file paths as you type them, so you don't have to remember exact folder names |
|
|
554
|
+
|
|
555
|
+
---
|
|
556
|
+
|
|
557
|
+
#### GitHub Copilot Prompt-Writing Extensions
|
|
558
|
+
|
|
559
|
+
**What is this?** These extensions supercharge how you write prompts and interact with Copilot inside VS Code. Install all of them — they work together. If you're using Claude Code instead of Copilot, skip this table but still read the prompting tips below.
|
|
560
|
+
|
|
561
|
+
| Extension | Publisher | Purpose |
|
|
562
|
+
|---|---|---|
|
|
563
|
+
| **GitHub Copilot** | GitHub | Core AI code completion — shows suggested code in grey as you type; press Tab to accept |
|
|
564
|
+
| **GitHub Copilot Chat** | GitHub | Chat panel for writing prompts in plain English to generate code, explain errors, and refactor |
|
|
565
|
+
| **GitHub Copilot Labs** | GitHub | Experimental extras: translate code between languages, explain code step-by-step, fix bugs with one click |
|
|
566
|
+
| **Prompt Engine** | Microsoft | Helps write, save, and reuse structured prompts directly inside VS Code files |
|
|
567
|
+
| **AI Toolkit for VS Code** | Microsoft | Test and compare prompts against different AI models; useful for fine-tuning how you phrase instructions to Copilot |
|
|
568
|
+
|
|
569
|
+
**Tips for writing better prompts in Copilot Chat:**
|
|
570
|
+
|
|
571
|
+
The quality of what the AI builds depends directly on how clearly you describe it. Here is how to get better results:
|
|
572
|
+
|
|
573
|
+
- **Be specific about the app type and what you want**
|
|
574
|
+
> ✅ "Create a Canvas App Power Fx formula that filters a gallery by the current user's email"
|
|
575
|
+
> ❌ "Filter this gallery"
|
|
576
|
+
|
|
577
|
+
- **Tell the AI what you already have**
|
|
578
|
+
> "I have a PCF component with an index.ts file. Add a `getValue()` method that returns the current text input value."
|
|
579
|
+
|
|
580
|
+
- **Ask for step-by-step explanations** — especially useful when learning
|
|
581
|
+
> "Explain this PAC CLI command step by step: `pac solution clone --name MySolution --outputDirectory ./solutions`"
|
|
582
|
+
|
|
583
|
+
- **Use `#file` to reference a specific file in your project**
|
|
584
|
+
> In Copilot Chat, type `#file:canvas-src/Screens/HomeScreen.fx.yaml` to give Copilot context from that exact file before asking your question.
|
|
585
|
+
|
|
586
|
+
- **Use `/fix`, `/explain`, `/tests` slash commands**
|
|
587
|
+
> Highlight broken code → open Copilot Chat → type `/fix` → Copilot explains what's wrong and rewrites it.
|
|
588
|
+
|
|
589
|
+
- **Save your best prompts** — use the Prompt Engine extension to store reusable prompt templates in a `prompts/` folder in your project so the whole team benefits.
|
|
590
|
+
|
|
591
|
+
---
|
|
592
|
+
|
|
593
|
+
### Step 6: Choose Your AI Assistant
|
|
594
|
+
|
|
595
|
+
**What is this?** This is the AI that will actually write the code for you when you describe what you want. You only need **one** of the two options below. Pick the one your team has access to — if you're not sure, ask your manager.
|
|
596
|
+
|
|
597
|
+
| | GitHub Copilot | Claude Code |
|
|
598
|
+
|---|---|---|
|
|
599
|
+
| **Made by** | GitHub / Microsoft | Anthropic |
|
|
600
|
+
| **Best for** | Teams already on GitHub | Teams using Anthropic's Claude |
|
|
601
|
+
| **What you need** | GitHub account + Copilot subscription | Anthropic API key |
|
|
602
|
+
|
|
603
|
+
---
|
|
604
|
+
|
|
605
|
+
#### Option A — GitHub Copilot
|
|
606
|
+
|
|
607
|
+
**What you need:** A GitHub account with a Copilot subscription (or your organisation's license).
|
|
608
|
+
|
|
609
|
+
1. In VS Code Extensions (`Ctrl+Shift+X`), search for **GitHub Copilot** and install it
|
|
610
|
+
2. Also install **GitHub Copilot Chat**
|
|
611
|
+
3. Click the **Accounts icon** at the bottom-left of VS Code (it looks like a person silhouette) → **Sign in with GitHub**
|
|
612
|
+
4. A browser window will open — log in to your GitHub account and click **Authorize**
|
|
613
|
+
5. Once signed in, you'll see a chat icon (💬) in the left sidebar — that's Copilot Chat
|
|
614
|
+
|
|
615
|
+
**How to use it:**
|
|
616
|
+
- **Inline suggestions:** Just start typing code or a comment — Copilot will suggest the rest in grey text. Press `Tab` to accept, or keep typing to ignore it.
|
|
617
|
+
- **Chat panel:** Click the chat icon and type what you want to build in plain English.
|
|
618
|
+
- **Quick ask:** Highlight any code, right-click → **Copilot → Explain This** or **Fix This**.
|
|
619
|
+
|
|
620
|
+
---
|
|
621
|
+
|
|
622
|
+
#### Option B — Claude Code
|
|
623
|
+
|
|
624
|
+
**What you need:** An Anthropic account and API key, or your organisation's Claude Code license.
|
|
625
|
+
|
|
626
|
+
**Install Claude Code (CLI)** — in the VS Code terminal, run:
|
|
627
|
+
```
|
|
628
|
+
npm install -g @anthropic-ai/claude-code
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
**Check it installed:**
|
|
632
|
+
```
|
|
633
|
+
claude --version
|
|
634
|
+
```
|
|
635
|
+
|
|
636
|
+
**Set your API key** (get it from [https://console.anthropic.com](https://console.anthropic.com)):
|
|
637
|
+
```
|
|
638
|
+
export ANTHROPIC_API_KEY="your-api-key-here"
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
> **Make it permanent** so you don't have to re-run this every time:
|
|
642
|
+
> - **macOS/Linux:** Add the line above to your `~/.zshrc` or `~/.bashrc` file, then run `source ~/.zshrc`
|
|
643
|
+
> - **Windows:** Search for "Environment Variables" in the Start menu → Add a new User variable called `ANTHROPIC_API_KEY` with your key as the value
|
|
644
|
+
|
|
645
|
+
**Install the VS Code extension:**
|
|
646
|
+
In VS Code Extensions, search for **Claude Code** and install it.
|
|
647
|
+
|
|
648
|
+
**How to use it:**
|
|
649
|
+
- Open a terminal in your project folder and run: `claude`
|
|
650
|
+
- Or use the Claude Code panel in the VS Code sidebar
|
|
651
|
+
- Type what you want to build in plain English — Claude will read your project files and write code directly
|
|
652
|
+
|
|
653
|
+
---
|
|
654
|
+
|
|
655
|
+
### Step 7: Configure VS Code Settings (Recommended)
|
|
656
|
+
|
|
657
|
+
**What is this?** These settings make VS Code easier and more pleasant to use — auto-save, auto-format, sensible font sizes, and so on. This is a one-time setup.
|
|
658
|
+
|
|
659
|
+
Go to **File → Preferences → Settings** (or `Ctrl+,` / `Cmd+,`) and apply these settings for a better experience. You can also paste this directly into your `settings.json` file — press `Ctrl+Shift+P` (or `Cmd+Shift+P` on Mac), type **Open User Settings JSON**, and press Enter. Replace everything in the file with this:
|
|
660
|
+
|
|
661
|
+
```json
|
|
662
|
+
{
|
|
663
|
+
"editor.formatOnSave": true,
|
|
664
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
665
|
+
"editor.tabSize": 2,
|
|
666
|
+
"editor.fontSize": 14,
|
|
667
|
+
"editor.wordWrap": "on",
|
|
668
|
+
"editor.minimap.enabled": false,
|
|
669
|
+
"terminal.integrated.fontSize": 13,
|
|
670
|
+
"files.autoSave": "onFocusChange",
|
|
671
|
+
"explorer.confirmDelete": false,
|
|
672
|
+
"editor.inlineSuggest.enabled": true,
|
|
673
|
+
"github.copilot.enable": {
|
|
674
|
+
"*": true
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
> Remove the `"github.copilot.enable"` block if you're using Claude Code instead of Copilot.
|
|
680
|
+
|
|
681
|
+
---
|
|
682
|
+
|
|
683
|
+
## ✅ Part 1 Checklist
|
|
684
|
+
|
|
685
|
+
Before moving on, confirm you have all of these:
|
|
686
|
+
|
|
687
|
+
- [ ] VS Code is installed and opens without errors
|
|
688
|
+
- [ ] `node --version` prints a version number in the terminal
|
|
689
|
+
- [ ] `npm --version` prints a version number in the terminal
|
|
690
|
+
- [ ] `git --version` prints a version number in the terminal
|
|
691
|
+
- [ ] `pac --version` prints a version number in the terminal
|
|
692
|
+
- [ ] Power Platform Tools extension is installed in VS Code
|
|
693
|
+
- [ ] `pac auth list` shows your work account logged in
|
|
694
|
+
- [ ] General extensions (ESLint, Prettier, GitLens, Error Lens, Path Intellisense) are installed
|
|
695
|
+
- [ ] GitHub Copilot OR Claude Code is installed and signed in
|
|
696
|
+
|
|
697
|
+
If any box is unchecked, go back to that step before continuing.
|
|
698
|
+
|
|
699
|
+
---
|
|
700
|
+
|
|
701
|
+
## Part 2 — Project Directory Setup
|
|
702
|
+
|
|
703
|
+
**What is this?** Every time you start working on a new app (or pick up an existing one), you set up a project folder. This section walks you through exactly that. It takes about 5 minutes once you've done it a couple of times.
|
|
704
|
+
|
|
705
|
+
Do these steps **every time you start a new project** or clone an existing one.
|
|
706
|
+
|
|
707
|
+
---
|
|
708
|
+
|
|
709
|
+
### Step 1: Create or Clone Your Project
|
|
710
|
+
|
|
711
|
+
**What does this mean?** You need a folder on your computer where all your project files will live. You either create a brand-new empty one, or "clone" (download) an existing project from GitHub.
|
|
712
|
+
|
|
713
|
+
**Starting a new project** — in the VS Code terminal:
|
|
714
|
+
```
|
|
715
|
+
mkdir my-project-name
|
|
716
|
+
cd my-project-name
|
|
717
|
+
```
|
|
718
|
+
|
|
719
|
+
> `mkdir` creates the folder. `cd` means "change directory" — it moves the terminal into that folder. Replace `my-project-name` with whatever you want to call your project (no spaces — use hyphens instead).
|
|
720
|
+
|
|
721
|
+
**Cloning an existing project from GitHub** (if someone has already started the project):
|
|
722
|
+
```
|
|
723
|
+
git clone https://github.com/your-org/your-repo.git
|
|
724
|
+
cd your-repo
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
> Your team lead or IT team will give you the GitHub URL to use.
|
|
728
|
+
|
|
729
|
+
Then open the folder in VS Code:
|
|
730
|
+
```
|
|
731
|
+
code .
|
|
732
|
+
```
|
|
733
|
+
|
|
734
|
+
> The `.` means "this folder". This command opens the current folder as a VS Code workspace.
|
|
735
|
+
|
|
736
|
+
---
|
|
737
|
+
|
|
738
|
+
### Step 2: Initialize Git (new projects only)
|
|
739
|
+
|
|
740
|
+
**What is this?** If you created a brand new folder (not cloned), you need to turn on Git's tracking for that folder. This only takes one command.
|
|
741
|
+
|
|
742
|
+
```
|
|
743
|
+
git init
|
|
744
|
+
```
|
|
745
|
+
|
|
746
|
+
You should see: `Initialized empty Git repository in .../your-folder/.git/`
|
|
747
|
+
|
|
748
|
+
---
|
|
749
|
+
|
|
750
|
+
### Step 3: Create a `.gitignore` File
|
|
751
|
+
|
|
752
|
+
**What is this?** Some files should never be uploaded to GitHub — passwords, large auto-generated folders, and personal settings. A `.gitignore` file tells Git to skip these automatically.
|
|
753
|
+
|
|
754
|
+
In VS Code, create a new file in your project folder called `.gitignore` (exactly that name, including the dot at the start). Paste this content inside it:
|
|
755
|
+
|
|
756
|
+
```
|
|
757
|
+
# Dependencies
|
|
758
|
+
node_modules/
|
|
759
|
+
.pnp
|
|
760
|
+
.pnp.js
|
|
761
|
+
|
|
762
|
+
# Environment variables (NEVER commit these)
|
|
763
|
+
.env
|
|
764
|
+
.env.local
|
|
765
|
+
.env.*.local
|
|
766
|
+
|
|
767
|
+
# Build outputs
|
|
768
|
+
dist/
|
|
769
|
+
build/
|
|
770
|
+
out/
|
|
771
|
+
.next/
|
|
772
|
+
|
|
773
|
+
# Editor files
|
|
774
|
+
.vscode/
|
|
775
|
+
.idea/
|
|
776
|
+
*.swp
|
|
777
|
+
|
|
778
|
+
# OS files
|
|
779
|
+
.DS_Store
|
|
780
|
+
Thumbs.db
|
|
781
|
+
|
|
782
|
+
# Logs
|
|
783
|
+
*.log
|
|
784
|
+
npm-debug.log*
|
|
785
|
+
```
|
|
786
|
+
|
|
787
|
+
> **How to create a new file in VS Code:** In the left sidebar (Explorer panel), hover over your project folder name and click the "New File" icon (it looks like a page with a +). Type the filename and press Enter.
|
|
788
|
+
|
|
789
|
+
---
|
|
790
|
+
|
|
791
|
+
### Step 4: Create a `.env` File (for secrets and config)
|
|
792
|
+
|
|
793
|
+
**What is this?** A `.env` file stores sensitive values like passwords, API keys, and database URLs. Keeping them here — instead of hardcoding them in your code — means they never accidentally get shared or published. This is a standard security practice.
|
|
794
|
+
|
|
795
|
+
Create a new file in your project folder called `.env` and paste this as a starting template:
|
|
796
|
+
|
|
797
|
+
```
|
|
798
|
+
# .env — DO NOT commit this file to Git
|
|
799
|
+
DATABASE_URL=your-database-url-here
|
|
800
|
+
API_KEY=your-api-key-here
|
|
801
|
+
APP_PORT=3000
|
|
802
|
+
```
|
|
803
|
+
|
|
804
|
+
Replace the placeholder values with your real ones as your project grows. The `.gitignore` file from Step 3 already prevents `.env` from being uploaded to GitHub — this is intentional.
|
|
805
|
+
|
|
806
|
+
---
|
|
807
|
+
|
|
808
|
+
### Step 5: Install Project Dependencies
|
|
809
|
+
|
|
810
|
+
**What is this?** Most projects rely on a set of pre-built libraries (other people's code) to function. These are listed in a file called `package.json`. This one command reads that file and downloads everything the project needs.
|
|
811
|
+
|
|
812
|
+
If the project has a `package.json` file (most JavaScript/TypeScript projects do), run:
|
|
813
|
+
```
|
|
814
|
+
npm install
|
|
815
|
+
```
|
|
816
|
+
|
|
817
|
+
This creates a `node_modules/` folder — that is normal. It is large, but your `.gitignore` already excludes it from Git, so it won't be uploaded.
|
|
818
|
+
|
|
819
|
+
> **Nothing happened?** If there's no `package.json` yet (brand new project), that's fine — skip this step and come back when the AI generates one for you.
|
|
820
|
+
|
|
821
|
+
---
|
|
822
|
+
|
|
823
|
+
### Step 6: Add an AI Context File (Highly Recommended)
|
|
824
|
+
|
|
825
|
+
**What is this?** This file tells your AI assistant about your project — what it does, what technology it uses, and what coding style to follow. Without this, the AI gives generic answers. With it, every suggestion is tailored to your exact project. This is one of the most important things you can do to get better AI output.
|
|
826
|
+
|
|
827
|
+
**For GitHub Copilot** — create the folder and file:
|
|
828
|
+
```
|
|
829
|
+
mkdir -p .github
|
|
830
|
+
```
|
|
831
|
+
|
|
832
|
+
Then in VS Code, create `.github/copilot-instructions.md` with content like this:
|
|
833
|
+
|
|
834
|
+
```markdown
|
|
835
|
+
# Project: [Your Project Name]
|
|
836
|
+
|
|
837
|
+
## What this project does
|
|
838
|
+
[One paragraph describing what the app does]
|
|
839
|
+
|
|
840
|
+
## Tech stack
|
|
841
|
+
- Framework: React / Next.js / Vue / etc.
|
|
842
|
+
- Language: TypeScript / JavaScript
|
|
843
|
+
- Styling: Tailwind CSS / CSS Modules / etc.
|
|
844
|
+
- Database: PostgreSQL / MongoDB / etc.
|
|
845
|
+
|
|
846
|
+
## Coding conventions
|
|
847
|
+
- Use functional components (no class components)
|
|
848
|
+
- Use async/await (not .then() chains)
|
|
849
|
+
- All functions must have TypeScript types
|
|
850
|
+
- File names use kebab-case (e.g. user-profile.tsx)
|
|
851
|
+
|
|
852
|
+
## Folder structure
|
|
853
|
+
src/
|
|
854
|
+
components/ # Reusable UI components
|
|
855
|
+
pages/ # Page-level components
|
|
856
|
+
utils/ # Helper functions
|
|
857
|
+
types/ # TypeScript type definitions
|
|
858
|
+
```
|
|
859
|
+
|
|
860
|
+
**For Claude Code** — create `CLAUDE.md` in your project root with the same kind of content. Claude Code reads this file automatically every time you start a session.
|
|
861
|
+
|
|
862
|
+
> **Tip:** Ask your AI assistant to help you write these files! Type: *"Based on this project's files, write a CLAUDE.md that describes what this project does, its tech stack, and coding conventions."*
|
|
863
|
+
|
|
864
|
+
---
|
|
865
|
+
|
|
866
|
+
### Step 7: Verify Everything Works
|
|
867
|
+
|
|
868
|
+
**What is this?** A final sanity check before you start building. Run these commands in the terminal and confirm each one gives a sensible response.
|
|
869
|
+
|
|
870
|
+
```bash
|
|
871
|
+
# Check Node is available
|
|
872
|
+
node --version
|
|
873
|
+
|
|
874
|
+
# Check npm is available
|
|
875
|
+
npm --version
|
|
876
|
+
|
|
877
|
+
# Check Git is set up
|
|
878
|
+
git status
|
|
879
|
+
|
|
880
|
+
# Start the development server (if applicable)
|
|
881
|
+
npm run dev
|
|
882
|
+
```
|
|
883
|
+
|
|
884
|
+
If `npm run dev` works and you see your app in the browser — you're ready to build! 🎉
|
|
885
|
+
|
|
886
|
+
> **`git status` says "not a git repository"?** Run `git init` first (see Step 2 above).
|
|
887
|
+
> **`npm run dev` gives an error?** Run `npm install` first (see Step 5), then try again.
|
|
888
|
+
|
|
889
|
+
---
|
|
890
|
+
|
|
891
|
+
## 🚀 Your First Vibe Coding Session — A Walkthrough
|
|
892
|
+
|
|
893
|
+
**You're set up. Now what?** Here is exactly what your first session looks like, step by step.
|
|
894
|
+
|
|
895
|
+
1. **Create your project** by running `npx create-powerapp` in the terminal and answering the four questions. VS Code will open automatically when it's done.
|
|
896
|
+
2. **Open the terminal** in VS Code (`Ctrl+` `` ` `` or `Cmd+` `` ` ``)
|
|
897
|
+
3. **Open `prompts/starter.md`** in VS Code — this file has ready-made prompts for your app type. You can use these directly or write your own.
|
|
898
|
+
4. **Open your AI assistant** — click the Copilot Chat icon (💬) or run `claude` in the terminal
|
|
899
|
+
5. **Describe what you want to build** — either copy a prompt from `prompts/starter.md` or write your own. Be specific. For example:
|
|
900
|
+
|
|
901
|
+
> *"I'm building a Canvas App for employee time-off requests. Create a screen with a date range picker, a dropdown for leave type (Annual, Sick, Personal), a text box for notes, and a Submit button. When submitted, save the record to a Dataverse table called cr123_LeaveRequests."*
|
|
902
|
+
|
|
903
|
+
6. **Review what the AI writes.** You don't need to understand every line — just check it looks roughly right and run it to see if it works
|
|
904
|
+
7. **Test it.** If something looks wrong, describe the problem to the AI: *"The submit button isn't doing anything when I click it. Can you fix it?"*
|
|
905
|
+
8. **Save your work** when you're happy with a chunk:
|
|
906
|
+
|
|
907
|
+
```
|
|
908
|
+
git add .
|
|
909
|
+
git commit -m "Added leave request submission form"
|
|
910
|
+
git push
|
|
911
|
+
```
|
|
912
|
+
|
|
913
|
+
That's it. Repeat steps 5–8 for every feature you want to add.
|
|
914
|
+
|
|
915
|
+
---
|
|
916
|
+
|
|
917
|
+
## Quick Reference — Daily Workflow
|
|
918
|
+
|
|
919
|
+
Once everything is set up, your typical day looks like this:
|
|
920
|
+
|
|
921
|
+
```
|
|
922
|
+
1. Open VS Code → open your project folder
|
|
923
|
+
2. Open the terminal (Ctrl+` or Cmd+`)
|
|
924
|
+
3. Start the dev server: npm run dev
|
|
925
|
+
4. Open Copilot Chat or Claude Code
|
|
926
|
+
5. Describe what you want to build → review the AI's code → accept or adjust
|
|
927
|
+
6. Save your work: git add . → git commit -m "describe what you did" → git push
|
|
928
|
+
```
|
|
929
|
+
|
|
930
|
+
---
|
|
931
|
+
|
|
932
|
+
## Troubleshooting
|
|
933
|
+
|
|
934
|
+
**Don't panic when things go wrong — errors are normal, even for experienced developers.** The AI assistant can help you fix them. Copy the error message and paste it into the chat with: *"I got this error — what does it mean and how do I fix it?"*
|
|
935
|
+
|
|
936
|
+
| Problem | Fix |
|
|
937
|
+
|---|---|
|
|
938
|
+
| `npm: command not found` | Re-install Node.js from nodejs.org, then restart VS Code |
|
|
939
|
+
| `git: command not found` | Install Git (see Part 1, Step 3) |
|
|
940
|
+
| `pac: command not found` | Run `npm install -g pac` or restart VS Code after install |
|
|
941
|
+
| `pac auth create` browser doesn't open | Run `pac auth create --url <url> --deviceCode` for device-code login instead |
|
|
942
|
+
| Canvas App changes not showing after push | Run `pac solution push --force-overwrite` |
|
|
943
|
+
| PCF component won't build | Delete `node_modules/` and re-run `npm install` |
|
|
944
|
+
| Copilot not suggesting anything | Check you're signed into GitHub in VS Code (bottom-left Accounts icon) |
|
|
945
|
+
| Copilot Chat `#file` not working | Make sure the file is inside the currently open VS Code workspace folder |
|
|
946
|
+
| `ANTHROPIC_API_KEY` not found | Re-run the export command or add to shell config (see Step 6, Option B) |
|
|
947
|
+
| `node_modules` missing | Run `npm install` in the project folder |
|
|
948
|
+
| Port already in use | Run `npm run dev -- --port 3001` to use a different port |
|
|
949
|
+
| "I have no idea what this error means" | Copy the full error text → paste into Copilot Chat or Claude → ask "what does this mean and how do I fix it?" |
|
|
950
|
+
|
|
951
|
+
---
|
|
952
|
+
|
|
953
|
+
## Getting Help
|
|
954
|
+
|
|
955
|
+
- **GitHub Copilot docs:** https://docs.github.com/en/copilot
|
|
956
|
+
- **Claude Code docs:** https://docs.anthropic.com/en/docs/claude-code
|
|
957
|
+
- **PAC CLI reference:** https://learn.microsoft.com/en-us/power-platform/developer/cli/reference
|
|
958
|
+
- **Power Platform Tools extension:** https://marketplace.visualstudio.com/items?itemName=microsoft-IsvExpTools.powerplatform-vscode
|
|
959
|
+
- **PCF (Code Components) docs:** https://learn.microsoft.com/en-us/power-apps/developer/component-framework/overview
|
|
960
|
+
- **Code Apps docs:** https://learn.microsoft.com/en-us/power-apps/developer/code-apps/overview
|
|
961
|
+
- **Canvas App Power Fx reference:** https://learn.microsoft.com/en-us/power-platform/power-fx/formula-reference
|
|
962
|
+
- **Power Pages docs:** https://learn.microsoft.com/en-us/power-pages/
|
|
963
|
+
- **VS Code keyboard shortcuts:** Press `Ctrl+K Ctrl+S` (or `Cmd+K Cmd+S`) inside VS Code
|
|
964
|
+
- **Ask your AI assistant directly** — type "explain this error" or "how do I…" in the chat panel
|
|
965
|
+
|
|
966
|
+
---
|
|
967
|
+
|
|
968
|
+
*Last updated: May 2026*
|