mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
This commit is contained in:
@@ -1,14 +1,8 @@
|
||||
import { ITriggerFunctions } from 'n8n-core';
|
||||
import {
|
||||
IDataObject,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
ITriggerResponse,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, INodeType, INodeTypeDescription, ITriggerResponse } from 'n8n-workflow';
|
||||
|
||||
import { watch } from 'chokidar';
|
||||
|
||||
|
||||
export class LocalFileTrigger implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Local File Trigger',
|
||||
@@ -49,9 +43,7 @@ export class LocalFileTrigger implements INodeType {
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
triggerOn: [
|
||||
'file',
|
||||
],
|
||||
triggerOn: ['file'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -63,9 +55,7 @@ export class LocalFileTrigger implements INodeType {
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
triggerOn: [
|
||||
'folder',
|
||||
],
|
||||
triggerOn: ['folder'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -77,9 +67,7 @@ export class LocalFileTrigger implements INodeType {
|
||||
type: 'multiOptions',
|
||||
displayOptions: {
|
||||
show: {
|
||||
triggerOn: [
|
||||
'folder',
|
||||
],
|
||||
triggerOn: ['folder'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -126,7 +114,8 @@ export class LocalFileTrigger implements INodeType {
|
||||
name: 'followSymlinks',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description: 'Whether linked files/folders will also be watched (this includes symlinks, aliases on MacOS and shortcuts on Windows). Otherwise only the links themselves will be monitored).',
|
||||
description:
|
||||
'Whether linked files/folders will also be watched (this includes symlinks, aliases on MacOS and shortcuts on Windows). Otherwise only the links themselves will be monitored).',
|
||||
},
|
||||
{
|
||||
displayName: 'Ignore',
|
||||
@@ -134,7 +123,8 @@ export class LocalFileTrigger implements INodeType {
|
||||
type: 'string',
|
||||
default: '',
|
||||
placeholder: '**/*.txt',
|
||||
description: 'Files or paths to ignore. The whole path is tested, not just the filename. Supports <a href="https://github.com/micromatch/anymatch">Anymatch</a>- syntax.',
|
||||
description:
|
||||
'Files or paths to ignore. The whole path is tested, not just the filename. Supports <a href="https://github.com/micromatch/anymatch">Anymatch</a>- syntax.',
|
||||
},
|
||||
// eslint-disable-next-line n8n-nodes-base/node-param-default-missing
|
||||
{
|
||||
@@ -176,11 +166,9 @@ export class LocalFileTrigger implements INodeType {
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
async trigger(this: ITriggerFunctions): Promise<ITriggerResponse> {
|
||||
const triggerOn = this.getNodeParameter('triggerOn') as string;
|
||||
const path = this.getNodeParameter('path') as string;
|
||||
@@ -188,7 +176,7 @@ export class LocalFileTrigger implements INodeType {
|
||||
|
||||
let events: string[];
|
||||
if (triggerOn === 'file') {
|
||||
events = [ 'change' ];
|
||||
events = ['change'];
|
||||
} else {
|
||||
events = this.getNodeParameter('events', []) as string[];
|
||||
}
|
||||
@@ -197,16 +185,19 @@ export class LocalFileTrigger implements INodeType {
|
||||
ignored: options.ignored,
|
||||
persistent: true,
|
||||
ignoreInitial: true,
|
||||
followSymlinks: options.followSymlinks === undefined ? true : options.followSymlinks as boolean,
|
||||
depth: [-1, undefined].includes(options.depth as number) ? undefined : options.depth as number,
|
||||
followSymlinks:
|
||||
options.followSymlinks === undefined ? true : (options.followSymlinks as boolean),
|
||||
depth: [-1, undefined].includes(options.depth as number)
|
||||
? undefined
|
||||
: (options.depth as number),
|
||||
});
|
||||
|
||||
const executeTrigger = (event: string, path: string) => {
|
||||
this.emit([this.helpers.returnJsonArray([{ event,path }])]);
|
||||
this.emit([this.helpers.returnJsonArray([{ event, path }])]);
|
||||
};
|
||||
|
||||
for (const eventName of events) {
|
||||
watcher.on(eventName, path => executeTrigger(eventName, path));
|
||||
watcher.on(eventName, (path) => executeTrigger(eventName, path));
|
||||
}
|
||||
|
||||
function closeFunction() {
|
||||
@@ -216,6 +207,5 @@ export class LocalFileTrigger implements INodeType {
|
||||
return {
|
||||
closeFunction,
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user