Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@adobe-fixed-uxp/uxp-devtools-cli
Advanced tools
Command line interface for rapid UXP plugin development
Table of contents
(Devtools helper uses N-API v4. Node version and N-API compatibility matrix is available here.)
PowerShell
or Command Prompt
.Install yarn
via npm
on the command line:
npm install -g yarn
You need to add the yarn global bin
path to the PATH
environment variable to access the uxp
command directly from the command line. See just below for instructions for your OS.
Mac
You can run this command on terminal to add yarn global bin
to the PATH
.
export PATH="$(yarn global bin):$PATH"
Windows
You can add yarn global bin path to system variables by following the steps given here.
Mac Apple Silicon
Currently, arm package for electron is not available. Hence ,installation is not supported for node installed for Apple silicon(arm
)
(Check node processor using node -p "process.arch"
)
Note: Installation will work on node running in Intel emulation mode (x64
).
cd
into the resulting uxp-developer-tools
directoryyarn install
npm install @adobe/uxp-devtools-cli
or
yarn add @adobe/uxp-devtools-cli
First, make sure the target application is running.
Then you can start working with the UXP CLI. Be sure you are cd
'd into your plugin project. (If you don't have a plugin project yet, check out the Plugin initiatialization section for how to boostrap a plugin from the command line.)
Here is one quick way to get started, which will result in 3 tabs (or command line instances) in your terminal:
uxp service start
uxp devtools enable && uxp plugin load && uxp plugin debug
For tab 3, here are some options:
uxp plugin reload
when you want to reload changesnpx nodemon --exec "uxp plugin reload" -e js,jsx,html
[Note: if you have nodemon globally installed, you can omit npx
from this command]To get help on the command line, you can run the following commands:
$ uxp help
// prints details of all the commands available in the cli.
$ uxp <command> help
// prints details of specific command.
apps
Get details for apps that support UXP:
$ uxp apps list
Output:
┌─────────┬──────┬──────────┬───────────────────┐
│ (index) │ ID │ Version │ Name │
├─────────┼──────┼──────────┼───────────────────┤
│ 0 │ 'PS' │ '21.0.3' │ 'Adobe Photoshop' │
├─────────┼──────┼──────────┼───────────────────┤
│ 1 │ 'XD' │ '28.0.12'│ 'Adobe XD' │
└─────────┴──────┴──────────┴───────────────────┘
The ID column contains the app ID that you will use in other CLI commands. This ID string is the same as the app ID you will specify in the plugin's manifest.json
file under host -> app.
If you have more than one version of the same app installed (say, standard & pre-release version), each version will be listed in the output with its own version number. Example:
┌─────────┬──────┬──────────┬───────────────────┐
│ (index) │ ID │ Version │ Name │
├─────────┼──────┼──────────┼───────────────────┤
│ 0 │ 'PS' │ '21.0.3' │ 'Adobe Photoshop' │
├─────────┼──────┼──────────┼───────────────────┤
│ 1 │ 'PS' │ '21.1.0' │ 'Adobe Photoshop' │ <- this is pre-release.
├─────────┼──────┼──────────┼───────────────────┤
│ 2 │ 'XD' │ '28.0.12'│ 'Adobe XD' │
└─────────┴──────┴──────────┴───────────────────┘
enable
Before you run any UXP developer commands to load or debug your plugin, you must enable UXP DevTools. To do that, run the following command:
uxp devtools enable
Note: This command will prompt you with an OS credentials dialog. This is done so that random external scripts can't issue plugin load commands to the apps to load unauthorized plugins without user knowledge.
Once you are done with the tooling you can disable UXP DevTools by running the following command:
$ uxp devtools disable
service
The UXP CLI and Adobe apps communicate with each other using a WebSocket connection. For this to happen, you must start the CLI service from the command line. This runs a server at an optionally specified port.
Start the service:
$ uxp service start [--port <port>]
Options:
--port: The port is where the service will run, defaults to 14001
As seen in the Quick Start above, now that the CLI service is running, you need to open a separate command line instance to run the actual developer tool commands.
You can use the new terminal instance to run other project commands for loading/reloading plugins, debugging, and more.
plugin
You can initialize or bootstrap a directory as a UXP plugin by running these commands:
$ uxp plugin init
- On prompt provide plugin details such as plugin name, plugin version, id
- Select host app (based on host app, default template for corresponding host app will be selected)
- If both host apps are selected(XD,PS), common template for host apps is selected
On initialisation, plugin directory structure is created in current working directory which comprises of manifest.json and plugin src files
User template:
$ uxp plugin init [--template <template-source>]
--template: The template source for the plugin. If a template is not provided, the CLI will prompt you to enter plugin details.
A template can be one of:
- the default template provided with the CLI called 'ps-starter'
- a local path relative to the current working directory (e.g. ../my-custom-template)
You can load a plugin into a host app like this:
$ uxp plugin load [--manifest <path>] [--apps <appId ...>] [--breakOnStart]
--manifest
The path to the plugin's manifest.json file. If the final plugin code is generated in a sub-folder (say, a "build" or "dist" folder), then you need to provide the path to this folder.
--apps
A list of apps that you want to load the plugin into. If you don't provide this argument the CLI will look into the host entry details in your manifest.json
file and load the plugin into all supported apps that are currently connected to the CLI service.
If more than one version of the app is running, you can limit this app to a specific version by appending the version string to the app ID. Let's look at an example:
$ uxp apps list
┌─────────┬──────┬──────────┬───────────────────┐
│ (index) │ ID │ Version │ Name │
├─────────┼──────┼──────────┼───────────────────┤
│ 0 │ 'PS' │ '21.0.3' │ 'Adobe Photoshop' │
├─────────┼──────┼──────────┼───────────────────┤
│ 1 │ 'PS' │ '21.1.0' │ 'Adobe Photoshop' │
└─────────┴──────┴──────────┴───────────────────┘
Load the plugin into both versions of Photoshop:
$ uxp plugin load
Limit the load to only one version:
$ uxp plugin load --apps PS@21.1.0
--breakOnStart Blocks the plugin until a debugger attaches.If specified, attach is assumed, and a debugger will immediately be spawned.Defaults to false.
After you have loaded your plugin once with uxp plugin load
, you can reload the plugin into the host application using this command:
$ uxp plugin reload [--apps <appId ...>]
--apps
A list of apps that you want to reload the plugin into. If you don't provide this argument, the CLI will look into the host entry details in your manifest.json
file and reload the plugin into all supported apps that are currently connected to the CLI service.
If more than one version of the app is running, you can limit this app to a specific version by appending the version string to the app ID.
For eg, to limit the reload to only one version:
$ uxp plugin unload --apps PS@21.1.0
Note: This will reload all changes done in the plugin except for manifest changes. To reload your manifest, you will need to run uxp plugin load
.
After you have loaded your plugin once with uxp plugin load
, you can debug the plugin using this command:
$ uxp plugin debug [--apps <appId ...>]
--apps
If your plugin is loaded in multiple apps, you can use this option to choose the app in which you want to limit the debugging to.
By default you will able to debug all connected apps specified in your manifest.json
.
You can unload a plugin from a host app like this:
$ uxp plugin unload [--apps <appId ...>]
--apps
A list of apps that you want to unload the plugin from. If you don't provide this argument, the CLI will look into the host entry details in your manifest.json
file and unload the plugin from all supported apps that are currently connected to the CLI service.
If more than one version of the app is running, you can limit this app to a specific version by appending the version string to the app ID.
For eg, to unload the plugin from all supported apps:
$ uxp plugin unload
To limit the unload to only one version:
$ uxp plugin unload --apps PS@21.1.0
You can watch a plugin like this:
$ uxp plugin watch [--path <relative path>] [--apps <appId ...>]
--path Relative path to plugin's source folder. Defaults to the current working directory.
--apps
A list of apps that you want to watch the plugin for and reload contents on change. If you don't provide this argument, the CLI will look into the host entry details in your manifest.json
file, watch the plugin directory and reload plugin into all supported apps that are currently connected to the CLI service when changes are saved.
If more than one version of the app is running, you can limit this app to a specific version by appending the version string to the app ID.
For eg, to limit the watch and reload to only one version:
$ uxp plugin watch --apps PS@21.1.0
After you have loaded your plugin once with uxp plugin load
, you can view plugin logs using this command.
This command launches a plugin console window where logs can be viewed
$ uxp plugin logs
You can now execute execute plugin's functional tests in UXP CLI v1.3 and above. This support is available for Adobe Applications integrated with UXP 5.0 and above. The following CLI commands can be used to get you started with writing and executing tests for your plugin.
The intial automation setup can be done using this command:
$ uxp plugin test --setup
The default project uses WebDriverIO framework
This command will create a folder named "uxp-plugin-tests" and install the required dependencies to execute the testsuite.
You can automate your plugin's UI by adding more tests in the folder location "uxp-plugin-tests". (sub-folders are configurable. Eg. specs )
You can refer sample scripts available with the plugin init templates
After you have loaded the plugin using uxp plugin load
, you can execute the plugin tests with:
$ uxp plugin test [--port <testService Port>] [--appId <appId>]
Once tests are executed, the test reports can be seen on the console. Note: The test reports, depend on the reporting module that you choose with the automation framework(WDIO).
Note: The plugin should be loaded to execute the tests. Currently, on uxp plugin load
, Ps loads the plugin UI and XD adds to the plugin panel. To execute tests on XD open the plugin manually and then run the command.
Client can choose any javascript automation framework of their choice.
Create a folder uxp-plugin-tests inside plugin folder
$ mkdir uxp-plugin-tests $ cd uxp-plugin-tests
Add framework files to the folder "uxp-plugin-tests" and run yarn install
to install the needed dependencies.
Arguments such as driverPort, servicePort & app-id are needed to create a connection between plugin and UXP CLI. Ref. wdio.conf.js
The command to execute the testSuite should be mentioned at "uxp-plugin-tests" in package.json of the automation project.
--port Port at which the UXP testService starts. Default value: 4797
$ uxp plugin test --port 4789
--appId
Single App ID into which the plugin's test should be executed.The supported app IDs can be retrieved using uxp apps list
. The default action is to execute test on the first host app specified in the plugin's manifest.
$ uxp plugin test --appId XD
_After you have created your plugin , you can package your plugin using this command.
$ uxp plugin package
--manifest
The path to the plugin's manifest.json file. If the final plugin code is generated in a sub-folder (say, a "build" or "dist" folder), then you need to provide the path to this folder.
--apps
A list of apps for which you want to package the plugin. If you don't provide this argument, the CLI will look into the host entry details in your manifest.json
and will generate the separate packages for all the host application.
$ uxp plugin package --apps PS
--outputPath Output directory path where plugin will be packaged. Defaults to current working directory.
$uxp plugin package --outputPath <path>
Contributions are welcome! Read the Contributing Guide for more information.
This project is licensed under the Apache V2 License. See LICENSE for more information.
FAQs
Command line interface for rapid UXP plugin development
We found that @adobe-fixed-uxp/uxp-devtools-cli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.