Skip to content

Commit d4d300e

Browse files
committed
Updated readme and added screenshot to illustrate a successful connection, cleaned out unnecessary deps
1 parent 93660b8 commit d4d300e

File tree

4 files changed

+34
-13
lines changed

4 files changed

+34
-13
lines changed

desktop-helper-sample/README.md

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,87 @@
11
# Desktop Helper Example
2-
This sample has two components, a Ps plugin and an Electron application built in React.
2+
3+
This sample has two components, a UXP plugin and an Electron application built in React.
34

45
For developers who have used `create-react-app` before, the folder structure and tools used in the Electron application will be familiar.
56

67
Both components must be running for the example to work correctly.
78

89
# Configuration
10+
911
The following steps will help you load the plugin into Photoshop and get the Electron app up and running.
1012

1113
## UXP Plugin
1214

1315
### 1. Install Node.js dependencies
16+
1417
```
1518
$ cd uxp
1619
$ yarn install # or npm install
1720
```
1821

19-
### 2. Run plugin in watch or build mode
22+
### 2. Run plugin in watch or build mode
23+
2024
```
21-
$ cd uxp
25+
$ cd uxp
2226
$ yarn watch # or npm run watch
2327
2428
# OR
2529
2630
$ yarn build # or npm run build
2731
```
2832

29-
* `yarn watch` or `npm run watch` will build a development version of the plugin, and recompile everytime you make a change to the source files. The result is placed in `uxp/dist`.
30-
* `yarn build` or `npm run build` will build a production version of the plugin and place it in `uxp/dist`. It will not update every time you make a change to the source files.
33+
- `yarn watch` or `npm run watch` will build a development version of the plugin, and recompile everytime you make a change to the source files. The result is placed in `uxp/dist`.
34+
- `yarn build` or `npm run build` will build a production version of the plugin and place it in `uxp/dist`. It will not update every time you make a change to the source files.
3135

3236
> You **must** run either `watch` or `build` prior to trying to use within Photoshop!
3337
3438
## Electron Helper
3539

36-
### 1. Install Node.js dependencies
40+
### 1. Install Node.js dependencies
41+
3742
```
38-
$ cd helper
43+
$ cd helper
3944
$ yarn install # or npm install
4045
```
4146

4247
### 2. Run helper app
48+
4349
```
4450
$ cd helper
4551
$ yarn start
4652
```
4753

48-
### 3. (Optional) Build the helper app
54+
### 3. (Optional) Build the helper app
55+
4956
```
5057
$ cd helper
5158
$ yarn build
5259
```
5360

5461
**Warning:** This command will take quite some time to execute.
5562

56-
In Electron, production builds compile JavaScript into a binary executable on the target platform for distribution or personal use. It is recommended that you build for production when you finish development.
63+
In Electron, production builds compile JavaScript into a binary executable on the target platform for distribution or personal use. It is recommended that you build for production when you finish development.
5764

58-
Once built, navigate to the `helper/dist` folder and double click the `UXP Helper App Setup 1.0.0` installer. Upon installation, the helper app can be run locally. Please note, the Electron project will have to be rebuilt and reinstalled for any future changes to take effect in production.
65+
Once built, navigate to the `helper/dist` folder and double click the `UXP Helper App Setup 1.0.0` installer. Upon installation, the helper app can be run locally. Please note, the Electron project will have to be rebuilt and reinstalled for any future changes to take effect in production.
5966

6067
# Load the Plugin
68+
6169
You can use the UXP Developer Tools to load the plugin into Photoshop.
6270

6371
If the plugin hasn't already been added to your workspace in the UXP Developer Tools, you can add it by clicking "Add Plugin..." and selecting `uxp/dist/manifest.json`. **DO NOT** select the `manifest.json` file inside the `uxp/plugin` folder.
6472

65-
Once added, you can load it into Photoshop by clicking the ••• button on the corresponding row, and clicking "Load". Switch to Photoshop and you should see the sample panel.
73+
Once added, you can load it into Photoshop by clicking the ••• button on the corresponding row, and clicking "Load". Switch to Photoshop and you should see the sample panel.
74+
75+
# Using the Plugin
76+
77+
This plugin uses an embedded websocket server to communicate between the Electron helper app and UXP.
78+
79+
Files for the server and electron configuration are located in the `helper/public` folder and are served as entrypoints for Electron on build.
80+
81+
Once both components are launched, you should be greeted with `'Connected'` status' on both components. If one component disconnects, the other will automatically recognize this disconnect as well, and the changes should be reflected with a `'Disconnected'` status.
82+
83+
![Plugin Screenshot](./images/connection.png)
84+
85+
Since it's an embedded server, its worth noting that this only runs on `localhost` and only administers communication between a single instance of the helper app and the UXP plugin. By default, the websocket server runs on port `4040` and the Electron helper app is served from port `3000`.
86+
87+
Other than connecting with one another, the two components can also pass strings of text which get reflected in their `Received data from the helper` and `Received data from UXP` sections.

desktop-helper-sample/helper/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
},
1717
"devDependencies": {
1818
"@adobe/react-spectrum": "^3.11.2",
19-
"@spectrum-icons/workflow": "^3.2.0",
2019
"concurrently": "^6.2.0",
2120
"cross-env": "^7.0.3",
2221
"electron": "^13.1.6",

desktop-helper-sample/helper/yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5424,7 +5424,7 @@ [email protected], core-util-is@~1.0.0:
54245424
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
54255425
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=
54265426

5427-
cors@^2.8.5, cors@~2.8.5:
5427+
cors@~2.8.5:
54285428
version "2.8.5"
54295429
resolved "https://registry.yarnpkg.com/cors/-/cors-2.8.5.tgz#eac11da51592dd86b9f06f6e7ac293b3df875d29"
54305430
integrity sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==
19 KB
Loading

0 commit comments

Comments
 (0)