Skip to content

Commit d54b6f7

Browse files
Merge pull request #59 from Root16/dev/plugins
Plugin Update Support
2 parents 782342c + 18ac85c commit d54b6f7

File tree

10 files changed

+341
-22
lines changed

10 files changed

+341
-22
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,7 @@
4747

4848
## [0.3.3]
4949
- Load / error messages controlled via verbosity setting
50-
- Update internal fspath handling
50+
- Update internal fspath handling
51+
52+
## [0.3.4]
53+
- Support for updating Plugin Packages

README.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Bamboo is a simple, friendly, and ⚡*blazingly*⚡ fast customization manager, designed to speed up development time on the [Microsoft Power Platform](https://powerplatform.microsoft.com/en-us/). 🚀
44

5-
Currently supporting [web resources](https://learn.microsoft.com/en-us/power-apps/developer/model-driven-apps/web-resources) and [custom controls](https://learn.microsoft.com/en-us/power-apps/developer/component-framework/create-custom-controls-using-pcf), Bamboo provides a seamless experience for developers to edit and manage these solution components - all from within VS Code.
5+
Currently supporting [web resources](https://learn.microsoft.com/en-us/power-apps/developer/model-driven-apps/web-resources), [custom controls](https://learn.microsoft.com/en-us/power-apps/developer/component-framework/create-custom-controls-using-pcf), and [plugin packages](https://learn.microsoft.com/en-us/power-apps/developer/data-platform/build-and-package), Bamboo provides a seamless experience for developers to edit and manage these solution components - all from within VS Code.
66

77
## Features
88
Bamboo provides the following features inside VS Code:
@@ -12,21 +12,23 @@ Bamboo provides the following features inside VS Code:
1212
- Add web resources to a solution automatically.
1313
- Manage custom controls (PCF components) through the import + publish of solutions.
1414
- List all web resources and custom controls in a given solution in a VS Code tree view.
15+
- Update plugin packages
1516

1617

1718
#### Component Tree
1819
![Component Tree](./images/component_tree.png)
1920

2021
#### Commands
21-
![Command Palette](./images/command_palette.png)
22+
![Command Palette](./images/command_palette2.png)
2223

2324
## Getting Started
2425

2526
1. Install the extension [here](https://marketplace.visualstudio.com/publishers/root16).
26-
2. Add a `bamboo.conf.json` at the **root** of your VS Code workspace.
27-
- ![Example Project Strucutre](./images/project_structure.png)
28-
- **Do not check `bamboo.conf.json` into source control.**
29-
3. Populate the json file with the following data:
27+
2. Add the files: `bamboo.conf.json` and `.bamboo_tokens/tokenCache.json` at the **root** of your VS Code workspace.
28+
- A suggested structure is:
29+
- ![Example Project Structure](./images/project_structure.png)
30+
- **Do not check `bamboo.conf.json` or `.bamboo_tokens` into source control.**
31+
3. Populate `bamboo.conf.json` with the following data:
3032

3133
```json
3234
{
@@ -61,6 +63,13 @@ Bamboo provides the following features inside VS Code:
6163
"solutionName": "ControlTwoSolution"
6264
},
6365
...
66+
],
67+
"pluginPackages": [
68+
{
69+
"pluginPackageName": "new_NEW.Plugins",
70+
"relativePathOnDiskToNugetPackage": "path/to/NEW.Plugins.1.0.0.nupkg"
71+
},
72+
...
6473
]
6574
}
6675
```
@@ -81,13 +90,14 @@ Bamboo provides the following features inside VS Code:
8190
- `baseUrl` must *not* end with a `/`.
8291
- The [app registration](https://learn.microsoft.com/en-us/power-apps/developer/data-platform/walkthrough-register-app-azure-active-directory#confidential-client-app-registration) specified must have:
8392
- Access to the specified Dataverse environment
84-
- The appropiate Security Role necessary to:
93+
- The appropriate Security Role necessary to:
8594
- Upload solutions
8695
- Publish solutions
8796
- Upload web resources
8897
- Publish web resources
98+
- Upload plugin packages
8999
- Add components to solutions
90-
- `relativePathOnDisk` and `relativePathOnDiskToSolution` must *not* start with a `/`.
100+
- `relativePathOnDisk`, `relativePathOnDiskToSolution` and `relativePathOnDiskToNugetPackage` must *not* start with a `/`.
91101
- For web resources, `dataverseName` and `relativePathOnDisk` don't *need* to be similar (as shown in the example), this is just encouraged for ease of development
92102

93103
## Usage
@@ -97,14 +107,11 @@ Bamboo provides the following features inside VS Code:
97107
| `bamboo.syncCurrentFile` | Sync current file. (Must be present on conf.) |
98108
| `bamboo.syncAllFiles` | Sync all files. (Each file present in the conf.) |
99109
| `bamboo.syncCustomControl` | Sync a Custom Control. (Opens up a choice dropdown for each control specified in the conf.) |
110+
| `bamboo.syncPluginPackage` | Sync a Plugin Package. (Opens up a choice dropdown for each package specified in the conf.) |
100111

101112
- All command can be run in the command palette.
102113

103114

104-
## Token Refresh + Cache
105-
- Bamboo can use the previously cached token to speed up initial load times.
106-
- Add the file: `<vscode-workspace>/bamboo_tokens/tokenCache.json` and then restart VS Code.
107-
108115
## Extension Settings
109116

110117
| Property | Type | Default | Description |
@@ -125,7 +132,9 @@ Bamboo provides the following features inside VS Code:
125132
- [] Automatically add custom controls to solution
126133
- [] Manage upload / sync from context of tree view
127134
- [] Sync data from Power Apps to local files
128-
- [] Plugin support
135+
- [] Create a Plugin Package or Plugin Assembly
136+
- [] Update / sync a *Plugin Package*
137+
- [] Update / sync a *Plugin Assembly*
129138

130139
## License
131140
Distributed under the MIT License. See [`LICENSE`](LICENSE) for more information.

images/command_palette.png

-7.96 KB
Binary file not shown.

images/command_palette2.png

13.6 KB
Loading

package-lock.json

Lines changed: 64 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"url": "https://github.com/Root16/bamboo"
77
},
88
"description": "Enables users to create, update, and publish Web Resources and Custom Controls for Microsoft Power Platform — directly from VS Code.",
9-
"version": "0.3.3",
9+
"version": "0.3.4",
1010
"icon": "resources/bamboo-green.png",
1111
"engines": {
1212
"vscode": "^1.73.0"
@@ -80,6 +80,11 @@
8080
"light": "resources/light/refresh.svg",
8181
"dark": "resources/dark/refresh.svg"
8282
}
83+
},
84+
{
85+
"command": "bamboo.syncPluginPackage",
86+
"title": "Sync a Plugin Package.",
87+
"category": "Bamboo"
8388
}
8489
],
8590
"menus": {
@@ -103,11 +108,13 @@
103108
"package": "vsce package"
104109
},
105110
"devDependencies": {
111+
"@types/adm-zip": "^0.5.7",
106112
"@types/glob": "^7.1.4",
107113
"@types/jsonwebtoken": "^9.0.9",
108114
"@types/mocha": "^9.0.0",
109115
"@types/node": "14.x",
110116
"@types/vscode": "^1.73.0",
117+
"@types/xml2js": "^0.4.14",
111118
"@typescript-eslint/eslint-plugin": "^4.31.1",
112119
"@typescript-eslint/parser": "^4.31.1",
113120
"@vscode/test-electron": "^2.4.1",
@@ -118,7 +125,9 @@
118125
},
119126
"dependencies": {
120127
"@azure/msal-node": "^3.2.3",
128+
"adm-zip": "^0.5.16",
121129
"jsonwebtoken": "^9.0.2",
122-
"open": "^10.1.0"
130+
"open": "^10.1.0",
131+
"xml2js": "^0.6.2"
123132
}
124133
}

src/classes/syncer/BambooConfig.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export interface BambooConfig {
44
credential: Credential;
55
webResources: WebResourceMapping[];
66
customControls: CustomControlMapping[];
7+
pluginPackages: PluginPackageMapping[];
78
}
89

910
export enum CredentialType {
@@ -28,3 +29,8 @@ export interface CustomControlMapping {
2829
relativePathOnDiskToSolution: string;
2930
solutionName: string;
3031
}
32+
33+
export interface PluginPackageMapping {
34+
pluginPackageName: string;
35+
relativePathOnDiskToNugetPackage: string;
36+
}

src/classes/syncer/BambooManager.ts

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as vscode from 'vscode';
2-
import { BambooConfig, CredentialType, CustomControlMapping } from './BambooConfig';
3-
import path from 'path';
2+
import { BambooConfig, CredentialType, CustomControlMapping, PluginPackageMapping } from './BambooConfig';
3+
import path, { relative } from 'path';
44
import { IWebResource } from '../../dataverse/IWebResource';
55
import { logErrorMessage, logMessage, logMessageWithProgress, logTemporaryMessage, VerboseSetting } from '../../log/message';
66
import { DataverseClient } from '../../dataverse/DataverseClient';
@@ -113,6 +113,7 @@ export class BambooManager {
113113
solutionUniqueName: rawData.solutionUniqueName,
114114
webResources: rawData.webResources,
115115
customControls: rawData.customControls,
116+
pluginPackages: rawData.pluginPackages,
116117
credential: {
117118
...rawData.credential,
118119
type: credentialTypeMap[rawData.credential.type] ?? CredentialType.ClientSecret,
@@ -341,4 +342,37 @@ export class BambooManager {
341342
}
342343
}
343344

345+
public async updatePluginPackage(
346+
currentWorkspace: vscode.WorkspaceFolder,
347+
pluginPackage: PluginPackageMapping
348+
): Promise<void> {
349+
const config = await this.getConfig();
350+
if (!config) {
351+
return;
352+
}
353+
354+
const token = await this.getToken();
355+
if (token === null) {
356+
return;
357+
}
358+
359+
const workspaceRoot = currentWorkspace.uri.fsPath;
360+
361+
const fullPath = path.join(workspaceRoot, pluginPackage.relativePathOnDiskToNugetPackage);
362+
363+
const normalizedPath = path.normalize(fullPath).replace(/\\/g, "/");
364+
365+
const [success, errorMessage] = await this.client.registerPluginPackage(
366+
pluginPackage.pluginPackageName,
367+
normalizedPath,
368+
token,
369+
);
370+
371+
if (success) {
372+
logTemporaryMessage(`Synced plugin package: ${pluginPackage.pluginPackageName}.`, VerboseSetting.Low);
373+
} else {
374+
logErrorMessage(errorMessage!, VerboseSetting.Low);
375+
}
376+
}
377+
344378
}

0 commit comments

Comments
 (0)