Skip to content

Commit 8efb12a

Browse files
author
Deborah Barnard
committed
now live eek
1 parent 1c3e975 commit 8efb12a

File tree

4 files changed

+61
-48
lines changed

4 files changed

+61
-48
lines changed

.eslintrc.prepublish.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
extends: "./.eslintrc.js",
3+
overrides: [
4+
{
5+
files: ['package.json'],
6+
plugins: ['eslint-plugin-n8n-nodes-base'],
7+
rules: {
8+
'n8n-nodes-base/community-package-json-name-still-default': 'error',
9+
},
10+
},
11+
],
12+
};

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ n8n provides an Execute Command node, which allows you to execute scripts on you
1111
1. Make sure you have PowerShell installed on the same machine as n8n. The node gives you the option to use either your default PowerShell installation, or your default PowerShell Core installation. You can't choose between multiple PowerShell (or PowerShell Core) versions.
1212
2. Follow the n8n documentation to [install community nodes](https://docs.n8n.io/integrations/community-nodes/installation/).
1313

14-
## Usage
15-
16-
17-
1814
## Limitations
1915

2016
### Not available on Cloud or Desktop
@@ -23,7 +19,13 @@ Like the Execute Command node, the PowerShell node won't work on n8n Cloud.
2319

2420
Community nodes are currently unavailable on n8n Desktop.
2521

26-
###
22+
### Requires PowerShell
23+
24+
You must have PowerShell installed on the same machine as n8n.
25+
26+
### Limited PowerShell selection
27+
28+
You can choose either PowerShell or PowerShell Core to run your script. The node uses the default installation. This means if you have PowerShell 3.x, 4.x, and 5.x installed, it will automatically use the default. You can't use the node to select an alternative installation. This shouldn't be a problem with PowerShell, as the latest version has good backwards compatibility, but you may need to be aware of differences between the main PowerShell Core versions.
2729

2830
## Technical background
2931

nodes/PowerShell/PowerShell.node.ts

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,20 @@ function execPromise(command: string, shellChoice: string): Promise<IExecReturnD
4747
}
4848

4949
export class PowerShell implements INodeType {
50-
description: INodeTypeDescription = {
51-
displayName: 'PowerShell',
52-
name: 'PowerShell',
53-
icon: 'file:powershell.svg',
54-
group: [],
55-
version: 1,
50+
description: INodeTypeDescription = {
51+
displayName: 'PowerShell',
52+
name: 'PowerShell',
53+
icon: 'file:powershell.svg',
54+
group: [],
55+
version: 1,
5656
subtitle: '',
57-
description: 'Run PowerShell commands from n8n',
58-
defaults: {
59-
name: 'PowerShell'
60-
},
61-
inputs: ['main'],
62-
outputs: ['main'],
63-
properties: [
57+
description: 'Run PowerShell commands from n8n',
58+
defaults: {
59+
name: 'PowerShell',
60+
},
61+
inputs: ['main'],
62+
outputs: ['main'],
63+
properties: [
6464
{
6565
displayName: 'Choose PowerShell Type',
6666
name: 'shellChoice',
@@ -75,44 +75,43 @@ export class PowerShell implements INodeType {
7575
{
7676
name: 'PowerShell Core',
7777
value: 'pwsh.exe',
78-
}
79-
]
80-
78+
},
79+
],
80+
},
81+
{
82+
displayName: 'Command',
83+
name: 'command',
84+
type: 'string',
85+
default: '',
86+
typeOptions: {
87+
rows: 10,
88+
},
89+
placeholder: 'Write-Output "Hello World"',
90+
description: 'Write a command to execute',
8191
},
82-
{
83-
displayName: 'Command',
84-
name: 'command',
85-
type: 'string',
86-
default: '',
87-
typeOptions: {
88-
rows: 10,
89-
},
90-
placeholder: 'Write-Output "Hello World"',
91-
description: 'Write a command to execute',
92-
},
93-
{
92+
{
9493
displayName: 'Execute Once',
9594
name: 'executeOnce',
9695
type: 'boolean',
9796
default: true,
9897
description: 'Whether to execute only once (enabled) instead of once for each entry (disabled)',
9998
},
100-
],
101-
};
99+
],
100+
};
102101

103102

104103

105104

106-
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
107-
let items = this.getInputData();
105+
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
106+
let items = this.getInputData();
108107
let command: string;
109108
let shellChoice: string;
110-
const executeOnce = this.getNodeParameter('executeOnce', 0) as boolean;
109+
const executeOnce = this.getNodeParameter('executeOnce', 0) as boolean;
111110

112111
if (executeOnce === true) {
113112
items = [items[0]];
114113
}
115-
const returnItems: INodeExecutionData[] = [];
114+
const returnItems: INodeExecutionData[] = [];
116115
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
117116
try {
118117
command = this.getNodeParameter('command', itemIndex) as string;
@@ -151,6 +150,6 @@ export class PowerShell implements INodeType {
151150
}
152151

153152
return this.prepareOutputData(returnItems);
154-
}
153+
}
155154

156155
}

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "n8n-nodes-powershell",
3-
"version": "0.1.0",
4-
"description": "",
2+
"name": "@starfallprojects/n8n-nodes-powershell",
3+
"version": "1.0.0",
4+
"description": "Run PowerShell scripts within an n8n workflow.",
55
"keywords": [
66
"n8n-community-node-package", "powershell"
77
],
@@ -19,10 +19,10 @@
1919
"scripts": {
2020
"build": "tsc && gulp build:icons",
2121
"dev": "tsc --watch",
22-
"format": "prettier nodes credentials --write",
23-
"lint": "tslint -p tsconfig.json -c tslint.json && eslint nodes credentials package.json",
24-
"lintfix": "tslint --fix -p tsconfig.json -c tslint.json && eslint nodes credentials package.json --fix",
25-
"prepublishOnly": "npm run build && npm run lint -c .eslintrc.prepublish.js nodes credentials package.json"
22+
"format": "prettier nodes --write",
23+
"lint": "tslint -p tsconfig.json -c tslint.json && eslint nodes package.json",
24+
"lintfix": "tslint --fix -p tsconfig.json -c tslint.json && eslint nodes package.json --fix",
25+
"prepublishOnly": "npm run build && npm run lint -c .eslintrc.prepublish.js nodes package.json"
2626
},
2727
"files": [
2828
"dist"
@@ -45,4 +45,4 @@
4545
"tslint": "^6.1.2",
4646
"typescript": "~4.6.0"
4747
}
48-
}
48+
}

0 commit comments

Comments
 (0)