|
1 | 1 | # Desktop Helper Example |
2 | 2 | This sample has two components, a Ps plugin and an Electron application built in React. |
| 3 | + |
3 | 4 | For developers who have used `create-react-app` before, the folder structure and tools used in the Electron application will be familiar. |
4 | 5 |
|
5 | 6 | Both components must be running for the example to work correctly. |
6 | 7 |
|
7 | 8 | # Configuration |
8 | 9 | The following steps will help you load the plugin into Photoshop and get the Electron app up and running. |
9 | 10 |
|
| 11 | +## UXP Plugin |
| 12 | + |
| 13 | +### 1. Install Node.js dependencies |
| 14 | +``` |
| 15 | +$ cd uxp |
| 16 | +$ yarn install # or npm install |
| 17 | +``` |
| 18 | + |
| 19 | +### 2. Run plugin in watch or build mode |
| 20 | +``` |
| 21 | +$ cd uxp |
| 22 | +$ yarn watch # or npm run watch |
| 23 | +
|
| 24 | +# OR |
| 25 | +
|
| 26 | +$ yarn build # or npm run build |
| 27 | +``` |
| 28 | + |
| 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. |
| 31 | + |
| 32 | +> You **must** run either `watch` or `build` prior to trying to use within Photoshop! |
| 33 | +
|
| 34 | +## Electron Helper |
| 35 | + |
10 | 36 | ### 1. Install Node.js dependencies |
11 | 37 | ``` |
12 | 38 | $ cd helper |
13 | 39 | $ yarn install # or npm install |
14 | 40 | ``` |
15 | 41 |
|
16 | | -### 2. Run Helper App |
| 42 | +### 2. Run helper app |
17 | 43 | ``` |
18 | 44 | $ cd helper |
19 | 45 | $ yarn start |
20 | 46 | ``` |
21 | 47 |
|
| 48 | +### 3. (Optional) Build the helper app |
| 49 | +``` |
| 50 | +$ cd helper |
| 51 | +$ yarn build |
| 52 | +``` |
| 53 | + |
| 54 | +**Warning:** This command will take quite some time to execute. |
| 55 | + |
| 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. |
| 57 | + |
| 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. |
| 59 | + |
22 | 60 | # Load the Plugin |
23 | | -The plugin requires no dependencies and can be run by using the UXP Developer Tools. Click "Add Plugin..." in the UXP Developer Tools and select `plugin/manifest.json`, then click the ••• button and select "Load...". |
| 61 | +You can use the UXP Developer Tools to load the plugin into Photoshop. |
| 62 | + |
| 63 | +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. |
| 64 | + |
| 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. |
0 commit comments