Skip to content

Commit

Permalink
Merge pull request #1820 from n8n-io/linting
Browse files Browse the repository at this point in the history
Linting
  • Loading branch information
Deborah authored Jan 25, 2024
2 parents e00963a + c1b3c42 commit b709986
Show file tree
Hide file tree
Showing 628 changed files with 1,145 additions and 5,338 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Run Vale
on: [pull_request]

jobs:
vale:
name: runner / vale
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: errata-ai/vale-action@reviewdog
with:
files: '["docs", "_snippets"]'
7 changes: 4 additions & 3 deletions .vale.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ StylesPath = "styles"
MinAlertLevel = warning
Vocab = default
[*.md]
BasedOnStyles = alex, write-good, Microsoft, n8n-styles, Vale
alex.Profanity = NO
TokenIgnores = (\-\-8\<\-\- \".*\")
BasedOnStyles = from-alex, from-write-good, n8n-styles, from-microsoft, Vale
Vale.Terms = NO
from-alex.Profanity = NO
TokenIgnores = (\-\-8\<\-\- \".*\"), (-only), (\*\*.*\*\*), (\*\*Release date:\*\*.*), (\[\[\%.*\%\]\]), (\[.*\]\(.*\)\{:target=_blank .external-link\}), (\[\[.*\]\]), (Rocket\.Chat), (\(https.*\))
2 changes: 1 addition & 1 deletion _snippets/data/data-mapping/item-linking-code-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ To control item linking, set `pairedItem` when returning data. For example, to l
```


### pairedItem usage example
### `pairedItem` usage example

Take this input data:

Expand Down
6 changes: 3 additions & 3 deletions _snippets/flow-logic/subworkflow-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ If there are errors in the sub-workflow, the parent workflow can't trigger it.
/// note | Load data into sub-workflow before building
This requires the ability to [load data from previous executions](/workflows/executions/debug/), which is available to Pro and Enterprise users.

If you want to load data into your subworkflow to use while building it:
If you want to load data into your sub-workflow to use while building it:

1. Create the subworkflow and add the **Execute Workflow Trigger**.
1. In the subworkflow [settings](/workflows/settings/), set **Save successful production executions** to **Save**.
1. Create the sub-workflow and add the **Execute Workflow Trigger**.
1. In the sub-workflow [settings](/workflows/settings/), set **Save successful production executions** to **Save**.
1. Skip ahead to setting up the parent workflow, and run it.
1. Follow the steps to [load data from previous executions](/workflows/executions/debug/).
You'll now have example data pinned in the trigger node, which allows you to work with real data when configuring the rest of the workflow.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

Vector Store nodes in n8n have three modes: **Get Many**, **Insert Documents** and **Retrieve Documents**. The mode you select determines the operations you can perform with the node and what inputs and outputs are available.

<!-- vale off -->
#### Get Many

In this mode, you can retrieve multiple documents from your vector database by providing a prompt. The prompt will be embedded and used for similarity search. The node will return the documents that are most similar to the prompt with their similarity score. This is useful if you want to retrieve a list of similar documents and pass them to a chain as additional context.

<!-- vale on -->
#### Insert Documents

Use insert documents mode to insert new documents into your vector database.
Expand Down
4 changes: 2 additions & 2 deletions _snippets/integrations/builtin/core-nodes/code-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This page gives usage information about the Code node. For more guidance on codi
///

/// note | Function and Function Item nodes
The Code node replaces the Function and Function Item nodes from version 0.198.0 onwards. If you're using an older version of n8n, you can still view the [Function node documentation](https://github.com/n8n-io/n8n-docs/blob/67935ad2528e2e30d7984ea917e4af2910a096ec/docs/integrations/builtin/core-nodes/n8n-nodes-base.function.md){:target=_blank .external-link} and [Function Item node documentation](https://github.com/n8n-io/n8n-docs/blob/67935ad2528e2e30d7984ea917e4af2910a096ec/docs/integrations/builtin/core-nodes/n8n-nodes-base.functionItem.md){:target=_blank .external-link}.
The Code node replaces the Function and Function Item nodes from version 0.198.0. If you're using an older version of n8n, you can still view the [Function node documentation](https://github.com/n8n-io/n8n-docs/blob/67935ad2528e2e30d7984ea917e4af2910a096ec/docs/integrations/builtin/core-nodes/n8n-nodes-base.function.md){:target=_blank .external-link} and [Function Item node documentation](https://github.com/n8n-io/n8n-docs/blob/67935ad2528e2e30d7984ea917e4af2910a096ec/docs/integrations/builtin/core-nodes/n8n-nodes-base.functionItem.md){:target=_blank .external-link}.
///
## Usage

Expand Down Expand Up @@ -49,7 +49,7 @@ The syntax to use the built-in methods and variables is `$variableName` or `$met
n8n added Python support in version 1.0. It doesn't include a Python executable. Instead, n8n provides Python support using [Pyodide](https://pyodide.org/en/stable/){:target=_blank .external-link}, which is a port of CPython to WebAssembly. This limits the available Python packages to the [Packages included with Pyodide](https://pyodide.org/en/stable/usage/packages-in-pyodide.html#packages-in-pyodide){:target=_blank .external-link}. n8n downloads the package automatically the first time you use it.

/// note | Slower than JavaScript
The Code node takes longer to process Python than JavaScript. This is due to the additional compilation steps.
The Code node takes longer to process Python than JavaScript. This is due to the extra compilation steps.
///
### Built-in methods and variables

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ All information is always present, except:
- `execution.url`: requires the execution to be saved in the database. Not present if the error is in the trigger node of the main workflow, as the workflow doesn't execute.
- `execution.retryOf`: only present when the execution is a retry of a failed execution.

If the error is caused by the trigger node of the main workflow, rather than a later stage, the data sent to the error workflow is different. There is less information in `execution{}` and more in `trigger{}`:
If the error is caused by the trigger node of the main workflow, rather than a later stage, the data sent to the error workflow is different. There's less information in `execution{}` and more in `trigger{}`:

```json
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ The Merge node is triggered by one branch, then goes and executes the other bran

For example, in the screenshot below there's a workflow containing a Edit Fields node, If node, and Merge node. The standard If node behavior is to execute one branch (in the screenshot, this is the **true** output). However, due to the Merge node, both branches execute, despite the If node not sending any data down the **false** branch.

![Screenshot of a simple workflow. The workflow has an Edit Fields node, followed by an If node. It ends with a Merge node.](/_images/integrations/builtin/core-nodes/merge/if-merge-node.png)
![Screenshot of a workflow. The workflow has an Edit Fields node, followed by an If node. It ends with a Merge node.](/_images/integrations/builtin/core-nodes/merge/if-merge-node.png)

<!-- TODO: remove once v1 is mature -->
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
1. Access your [Google Cloud Console - Library](https://console.cloud.google.com/apis/library){:target=_blank .external-link}. Make sure you're in the correct project.
1. Search for and select the API(s) you want to enable. For example, for the Gmail node, search for and enable the Gmail API.

<!-- vale off -->
/// note | Some integrations need additional APIs
<!-- vale on -->
The following integrations require the Google Drive API, as well as their own API:

* Google Docs
Expand Down
2 changes: 1 addition & 1 deletion _snippets/integrations/creating-nodes/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ You can test your node as you build it by running it in a local n8n instance.

### Troubleshooting

- There is no `custom` directory in `~/.n8n` local installation.
- There's no `custom` directory in `~/.n8n` local installation.

You have to create `custom` directory manually and run `npm init`
```shell
Expand Down
2 changes: 1 addition & 1 deletion _snippets/privacy-security/gdpr-self-hosted.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
If you self-host n8n, you are responsible for deleting user data. If you need to delete data on behalf of one of your users, you can delete the respective execution. n8n recommends configuring n8n to prune execution data automatically after few days to avoid effortful GDPR request handling as much as possible. Configure this using the `EXECUTIONS_DATA_MAX_AGE` environment variable. Refer to [Environment variables](/hosting/environment-variables/environment-variables/) for more information.
If you self-host n8n, you are responsible for deleting user data. If you need to delete data on behalf of one of your users, you can delete the respective execution. n8n recommends configuring n8n to prune execution data automatically every few days to avoid effortful GDPR request handling as much as possible. Configure this using the `EXECUTIONS_DATA_MAX_AGE` environment variable. Refer to [Environment variables](/hosting/environment-variables/environment-variables/) for more information.
4 changes: 2 additions & 2 deletions _snippets/self-hosting/installation/tunnel.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## n8n with tunnel

/// danger
This is only meant for local development and testing. Do not use it in production.
Use this for local development and testing. It isn't safe to use it in production.
///

To be able to use webhooks for trigger nodes of external services like GitHub, n8n has to be reachable from the web. To make that easy, n8n has a special [tunnel service](https://github.com/localtunnel/localtunnel) which redirects requests from our servers to your local n8n instance.
To be able to use webhooks for trigger nodes of external services like GitHub, n8n has to be reachable from the web. n8n has a [tunnel service](https://github.com/localtunnel/localtunnel) which redirects requests from n8n's servers to your local n8n instance.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ The advantage of this pattern is that work is instantly available to other envir

The disadvantages are:

* If you push by mistake, there is a risk the work will make it into your production instance. If you [use a GitHub Action to automate pulls](#optional-use-a-github-action-to-automate-pulls) to production, you must either use the multi-instance, multi-branch pattern, or be very careful to never push work that you don't want in production.
* If you push by mistake, there is a risk the work will make it into your production instance. If you [use a GitHub Action to automate pulls](#optional-use-a-github-action-to-automate-pulls) to production, you must either use the multi-instance, multi-branch pattern, or be careful to never push work that you don't want in production.
* Pushing and pulling to the same instance can cause data loss as changes are overridden when performing these actions. You should set up processes to ensure content flows in one direction.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Since n8n's repository already has a Autopilot Trigger node, we will name this n
3. Within the Autofriend folder, create a file called `AutofriendTrigger.node.ts` (YourNodeNameTrigger.node.ts).
4. Download and add the Autofriend [icon](https://github.com/n8n-io/n8n/blob/master/packages/nodes-base/nodes/Autopilot/autopilot.svg) to the folder. Name it `autopilot.svg`.
- The icon property has to be either a 60x60 pixels PNG or an SVG and must exist in the node's folder.
- An SVG is preferable. In case you have to use a PNG, make sure that it is compressed. A good tool for that is [tinypng](https://tinypng.com).
- An SVG is preferable. In case you have to use a PNG, make sure that it's compressed. A good tool for that's [tinypng](https://tinypng.com).
- A good place to find company icons is [gilbarbara/logos](https://github.com/gilbarbara/logos/tree/master/logos).
5. Paste the following code in the `AutofriendTrigger.node.ts` file.

Expand Down Expand Up @@ -77,7 +77,7 @@ export class AutofriendTrigger implements INodeType {
group: ['trigger'],
version: 1,
subtitle: '={{$parameter["event"]}}',
description: 'Handle Autofriend events via webhooks',
description: 'Handle Autofriend events using webhooks',
defaults: {
name: 'Autofriend Trigger',
color: '#6ad7b9',
Expand Down Expand Up @@ -140,7 +140,7 @@ npm run dev

- On startup, n8n will load all the nodes and credentials (more about credentials later) that are registered in `/packages/nodes-base/package.json`.
- The property `description.name` uses camelCase.
- The property `description.color` is the company's branding color in hexadecimal. In case the website does not include this information, there are other websites that help you get a company's branding colors. For example, [brandpalettes.com](https://brandpalettes.com/).
- The property `description.color` is the company's branding color in hexadecimal. In case the website doesn'tinclude this information, there are other websites that help you get a company's branding colors. For example, [brandpalettes.com](https://brandpalettes.com/).


## Creating the UI for the node
Expand Down Expand Up @@ -218,7 +218,7 @@ The node should now look like in the following image.

Most REST APIs use some sort of authentication mechanism. Autofriend's REST API uses API Keys. The API Key informs them about who is making the request to their system and gives you access to all the functionality that the API provides. Given all the things it can do, this has to be treated as a sensitive piece of information and should be kept private.

n8n gives you the ability to ask for sensitive information using credentials. In the credentials, you can use all the generally available UI elements. Additionally, the data that is stored using the credentials would be encrypted before being saved to the database. In order to do that, n8n uses an encryption key.
n8n gives you the ability to ask for sensitive information using credentials. In the credentials, you can use all the generally available UI elements. Additionally, the data that's stored using the credentials would be encrypted before being saved to the database. In order to do that, n8n uses an encryption key.

With that in mind, let's create the UI to ask for the user's Autofriend API Key. The process of creating and registering credentials is similar to that of creating and registering the node:

Expand Down Expand Up @@ -319,8 +319,8 @@ The life cycle methods allow us to create, delete, and check if the webhook exis

**Methods**

- `checkExist`: This is the first method that gets called. It checks if the webhook with the current path is already registered in the external system or not. If the webhook is already registered, n8n persists the webhook ID. If the webhook is not registered with the external system, the `create` method gets executed.
- `create`: This method gets called if the `checkExist` method returns false (if the webhook with the current path does not exist in the external system). This method registers the webhook in the external system and stores the webhook ID in n8n.
- `checkExist`: This is the first method that gets called. It checks if the webhook with the current path is already registered in the external system or not. If the webhook is already registered, n8n persists the webhook ID. If the webhook isn't registered with the external system, the `create` method gets executed.
- `create`: This method gets called if the `checkExist` method returns false (if the webhook with the current path doesn'texist in the external system). This method registers the webhook in the external system and stores the webhook ID in n8n.
- `delete`: This method gets called when the trigger is either stopped manually or when the workflow is deactivated. It uses the ID previously persisted by either the create or the checkExist method to delete the webhook from the external system.

![Lifecycle flowchart](/_images/integrations/creating-nodes/lifecycle.png)
Expand Down Expand Up @@ -459,7 +459,7 @@ The trigger node is now receiving events. Sometimes it might take a bit longer f
You probably noticed that this time we did not run the project using `npm run dev`, but instead using `./packages/cli/bin/n8n start --tunnel`.
Since our server is running locally, we need a tool that lets us proxy all requests to our local machine so that n8n receives and handles the events from the external service (Autopilot). This gets achieved using a tunnel. The details on how a tunnel works are out of the scope of this tutorial. If you want to know about it, you can check this [link](http://localtunnel.github.io/www/). Keep in mind that the tunnel is meant for development purposes only and should not be used in production.
Since our server is running locally, we need a tool that lets us proxy all requests to our local machine so that n8n receives and handles the events from the external service (Autopilot). This gets achieved using a tunnel. The details on how a tunnel works are out of the scope of this tutorial. If you want to know about it, you can check this [link](http://localtunnel.github.io/www/). Keep in mind that the tunnel is meant for development purposes only and shouldn't be used in production.
## Test your node
Expand Down
4 changes: 2 additions & 2 deletions docs/1-0-migration-checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The release of n8n 1.0 marks a milestone in n8n's journey to make n8n available

This release introduces [semantic versioning](https://semver.org/){:target=_blank .external link}. This allows n8n to signal backwards-incompatible changes directly in the version number, making it easier to update n8n safely.

From n8n 1.0 onwards, releases will follow the pattern MAJOR.MINOR.PATCH. Version numbers increment as follows:
From n8n 1.0 on, releases will follow the pattern MAJOR.MINOR.PATCH. Version numbers increment as follows:

- MAJOR version when making incompatible changes which potentially require user action
- MINOR version when adding functionality in a backward-compatible manner
Expand Down Expand Up @@ -72,7 +72,7 @@ docker run --rm -it --user root -v ~/.n8n:/home/node/.n8n --entrypoint chown n8n

#### Image removal

We have removed the Debian and RHEL images. If you were using these you need to change the image you use. This shouldn't result in any errors unless you were making a custom image based on one of those images.
We've removed the Debian and RHEL images. If you were using these you need to change the image you use. This shouldn't result in any errors unless you were making a custom image based on one of those images.

#### Entrypoint change

Expand Down
Loading

0 comments on commit b709986

Please sign in to comment.