Skip to content

Commit

Permalink
Merge branch 'Dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
rendertom committed Jun 8, 2022
2 parents ca44bba + 3e7d366 commit a92a8b8
Show file tree
Hide file tree
Showing 19 changed files with 4,745 additions and 511 deletions.
33 changes: 11 additions & 22 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
{
"env": {
"browser": false,
"commonjs": true,
"es6": true,
"node": true
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"sourceType": "module"
},
"rules": {
"no-const-assign": "warn",
"no-this-before-super": "warn",
"no-undef": "warn",
"no-unreachable": "warn",
"no-unused-vars": "warn",
"constructor-super": "warn",
"valid-typeof": "warn",
"semi": "warn"
}
"env": {
"browser": false,
"commonjs": true,
"es6": true,
"node": true
},
"extends": ["eslint:recommended", "plugin:prettier/recommended"],
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "error"
}
}
28 changes: 28 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Install, lint and package
on:
# Triggers the workflow on push or pull-request events for the master and Dev branches
push:
branches: [master, Dev]
pull_request:
branches: [master, Dev]

jobs:
install-lint-package:
runs-on: ubuntu-latest
steps:
- name: Checkout Git repository
uses: actions/checkout@v3

- name: Install node
uses: actions/setup-node@v3
with:
node-version: 14

- name: Install dependencies
run: npm ci

- name: Lint codebase
run: npm run lint

- name: Create package
run: npm run package
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.node_modules

# Ignore all Markdown files:
*.md
11 changes: 11 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"arrowParens": "always",
"bracketSpacing": true,
"endOfLine": "auto",
"printWidth": 100,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false
}
10 changes: 4 additions & 6 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"dbaeumer.vscode-eslint"
]
}
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": ["dbaeumer.vscode-eslint"]
}
44 changes: 21 additions & 23 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,24 @@
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
]
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/test"
]
}
]
}
"version": "0.2.0",
"configurations": [
{
"name": "Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"]
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/test"
]
}
]
}
11 changes: 9 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
// Place your settings in this file to overwrite default and user settings.
{
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe"
}
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"editor.formatOnSave": true
},
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe"
}
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@ All notable changes to the Adobe Script Runner extension will be documented in t

---

## [0.6.0] 2022-06-08

### Added

- Support to execute scripts in `Adobe After Effects (Beta)`
- Support to execute scripts in `Adobe Illustrator (Beta)`
- Support to execute scripts in `Adobe Photoshop (Beta)`
- ESLint + Prettier for a consistent codebase

### Changed

- Updates default paths for After Effects, Illustrator, and Photoshop for Windows to 2022 application versions.

---

## [0.5.0] 2021-03-13

### Changed
Expand Down
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ Script runner for Adobe applications right from VSCode. Extension available for
## Supported applications

- Adobe After Effects
- Adobe After Effects (Beta)
- Adobe ExtendScript Toolkit
- Adobe Illustrator
- Adobe Illustrator (Beta)
- Adobe InCopy
- Adobe InDesign
- Adobe Photoshop
- Adobe Photoshop (Beta)

## Features

Expand All @@ -28,10 +31,12 @@ Adobe Script Runner executes script in the active viewer by default. However, wh
## Installation

- ### From VSCode application

- Open `Extensions` and type `Adobe Script Runner`.
- Click `Install` and then `Reload` button.

- ### From GitHub

- Download repository and unzip the package.
- Copy `VSCode-Adobe-Script-Runner-master` to `/Users/YOURUSER/.vscode/extensions` folder.

Expand All @@ -48,15 +53,15 @@ Keyboard shortcut `Cmd+R` is bind to `adobeScriptRunner.ae` command, which will
- Open Keyboard Shortcuts editor and click on the link `keybindings.json`.
- This will open the Default Keyboard Shortcuts on the left and your `keybindings.json` file where you can overwrite the default bindings on the right.
- With `keybindings.json` in focus click `Cmd+K` twice to open an interactive keybinding modal window (or whatever it’s called) and follow the on-screen instructions. This will create a new binding entry in the `keybindings.json` file.
- Edit the `command` property to `adobeScriptRunner.XX`, where XX is an abbreviation of the application. Check available abbreviations in `Extensions > Adobe Script Runner > Contributions` tab.
- Edit the `command` property to `adobeScriptRunner.XX`, where XX is an abbreviation of the application. Check available abbreviations in `Extensions > Adobe Script Runner > Contributions` tab.

The result should look something like this:

```json
{
"key": "cmd+r",
"command": "adobeScriptRunner.ae",
"when": "editorTextFocus"
"key": "cmd+r",
"command": "adobeScriptRunner.ae",
"when": "editorTextFocus"
},
```

Expand All @@ -68,8 +73,8 @@ Use token to execute a different file, rather than the one in the viewer. Add `A

```javascript
/*
Adobe-script-runner '../../index.js'
Executes file between quotes rather than the one in the active viewer.
Adobe-script-runner '../../index.js'
Executes file between quotes rather than the one in the active viewer.
*/

alert('Hello World'); // This line never gets executed, unless `index.js` is referencing the file in viewer.
Expand Down Expand Up @@ -100,12 +105,15 @@ Click `Cmd+,` on Mac or `Ctrl+,` on Windows to modify settings. Extension expose
**For Windows users only:**

- `adobeScriptRunner.winAfterEffectsExe`: path to Adobe After Effects executable (AfterFX.exe).
- `adobeScriptRunner.winAfterEffectsBetaExe`: path to Adobe After Effects (Beta) executable (AfterFX (Beta).exe).
- `adobeScriptRunner.winExtendscriptToolkitExe`: path to Adobe ExtendScript Toolkit executable (ExtendScript Toolkit.exe).
- `adobeScriptRunner.winIllustratorExe`: path to Adobe Illustrator executable (Illustrator.exe).
- `adobeScriptRunner.winIllustratorBetaExe`: path to Adobe Illustrator (Beta) executable (Illustrator.exe).
- `adobeScriptRunner.winPhotoshopExe`: path to Adobe Photoshop executable (Photoshop.exe).
- `adobeScriptRunner.winPhotoshopBetaExe`: path to Adobe Photoshop (Beta) executable (Photoshop.exe).

Executable paths for InCopy and InDesign for Windows are not exposed because they are handled differently than the rest of the Adobe apps. Go figure Adobe ¯\\\_(ツ)\_

## Known issues

- The host application does not get focus on script run.
- The host application does not get focus on script run.
42 changes: 21 additions & 21 deletions lib/buildCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ const ide = require('./ide.js');
* @param {Object} hostApp entry from hostApps[hostApp].
*/
function buildCommand(hostApp) {
try {
getScriptFile(function(scriptFile) {
getShellCommand(hostApp, scriptFile, function(command) {
console.log('Running shell command:', command);
cp.exec(command, (error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
return;
}
try {
getScriptFile(function (scriptFile) {
getShellCommand(hostApp, scriptFile, function (command) {
console.log('Running shell command:', command);
cp.exec(command, (error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
return;
}

console.log(stdout);
console.log(stderr);
});
ide.showInformationMessage(`Script sent to ${hostApp.appName}`);
});
});
} catch (error) {
if (typeof error !== 'undefined') {
console.log(error);
}
}
console.log(stdout);
console.log(stderr);
});
ide.showInformationMessage(`Script sent to ${hostApp.appName}`);
});
});
} catch (error) {
if (typeof error !== 'undefined') {
console.log(error);
}
}
}

module.exports = buildCommand;
module.exports = buildCommand;
14 changes: 6 additions & 8 deletions lib/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ const vscode = require('vscode');
/**
* @description Method is called when extension is activated.
* Extension is activated the very first time the command is executed.
* @param {any} context vscode.ExtensionContext
*/
function activate(context) {
hostApps.forEach(hostApp => {
vscode.commands.registerCommand(
`adobeScriptRunner.${hostApp.shortName}`,
() => buildCommand(hostApp)
);
});
function activate() {
hostApps.forEach((hostApp) => {
vscode.commands.registerCommand(`adobeScriptRunner.${hostApp.shortName}`, () =>
buildCommand(hostApp)
);
});
}

exports.activate = activate;
Loading

0 comments on commit a92a8b8

Please sign in to comment.