diff --git a/docs/en-US/handbook/workflow-javascript/index.md b/docs/en-US/handbook/workflow-javascript/index.md index 3f231789e8..1c51a9e138 100644 --- a/docs/en-US/handbook/workflow-javascript/index.md +++ b/docs/en-US/handbook/workflow-javascript/index.md @@ -62,6 +62,26 @@ WORKFLOW_SCRIPT_MODULES=crypto,timers,lodash,dayjs Modules not declared in `WORKFLOW_SCRIPT_MODULES`, including native Node.js modules or installed `node_modules`, **cannot** be used in scripts. This strategy allows administrators to control the modules accessible to users, reducing the risk of excessive script permissions. ::: +When in a non-source-deployed environment, if a module is not installed in `node_modules`, you can manually install the required package into the `storage` directory. For example, to use the `exceljs` package, you can perform the following steps: + +```shell +cd storage +npm i --no-save --no-package-lock --prefix . exceljs +``` + +Then add the package's relative (or absolute) path based on the application's CWD (current working directory) to the environment variable `WORKFLOW_SCRIPT_MODULES`: + +```ini +WORKFLOW_SCRIPT_MODULES=./storage/node_modules/exceljs +``` + +You can then use the `exceljs` package in your script: + +```js +const ExcelJS = require('exceljs'); +// ... +``` + ### Global Variables Global variables such as `global`, `process`, `__dirname`, and `__filename` are **not supported**. diff --git a/docs/fr-FR/handbook/workflow-javascript/index.md b/docs/fr-FR/handbook/workflow-javascript/index.md index b46f7859e1..20e4e342e2 100644 --- a/docs/fr-FR/handbook/workflow-javascript/index.md +++ b/docs/fr-FR/handbook/workflow-javascript/index.md @@ -52,7 +52,29 @@ Les modules disponibles dans le flux de travail peuvent être utilisés dans le WORKFLOW_SCRIPT_MODULES=crypto,timers,lodash,dayjs ``` -> **Remarque** : Les modules non déclarés dans `WORKFLOW_SCRIPT_MODULES` ne peuvent pas être utilisés. Cela permet aux administrateurs de contrôler les modules accessibles, réduisant ainsi le risque de permissions excessives. +:::info{title="Note"} +Les modules non déclarés dans `WORKFLOW_SCRIPT_MODULES` ne peuvent pas être utilisés. Cela permet aux administrateurs de contrôler les modules accessibles, réduisant ainsi le risque de permissions excessives. +::: + +When in a non-source-deployed environment, if a module is not installed in `node_modules`, you can manually install the required package into the `storage` directory. For example, to use the `exceljs` package, you can perform the following steps: + +```shell +cd storage +npm i --no-save --no-package-lock --prefix . exceljs +``` + +Then add the package's relative (or absolute) path based on the application's CWD (current working directory) to the environment variable `WORKFLOW_SCRIPT_MODULES`: + +```ini +WORKFLOW_SCRIPT_MODULES=./storage/node_modules/exceljs +``` + +You can then use the `exceljs` package in your script: + +```js +const ExcelJS = require('exceljs'); +// ... +``` ### Variables globales diff --git a/docs/ja-JP/handbook/workflow-javascript/index.md b/docs/ja-JP/handbook/workflow-javascript/index.md index d2c87b240d..cfa09e7063 100644 --- a/docs/ja-JP/handbook/workflow-javascript/index.md +++ b/docs/ja-JP/handbook/workflow-javascript/index.md @@ -62,6 +62,26 @@ WORKFLOW_SCRIPT_MODULES=crypto,timers,lodash,dayjs `WORKFLOW_SCRIPT_MODULES` に宣言されていないモジュールは、Node.js ネイティブモジュールやインストール済みモジュールであってもスクリプトで使用することはできません。このポリシーは、運用レベルでユーザーが使用可能なモジュールリストを制御し、スクリプト権限が過剰になるのを防ぐためのものです。 ::: +When in a non-source-deployed environment, if a module is not installed in `node_modules`, you can manually install the required package into the `storage` directory. For example, to use the `exceljs` package, you can perform the following steps: + +```shell +cd storage +npm i --no-save --no-package-lock --prefix . exceljs +``` + +Then add the package's relative (or absolute) path based on the application's CWD (current working directory) to the environment variable `WORKFLOW_SCRIPT_MODULES`: + +```ini +WORKFLOW_SCRIPT_MODULES=./storage/node_modules/exceljs +``` + +You can then use the `exceljs` package in your script: + +```js +const ExcelJS = require('exceljs'); +// ... +``` + ### グローバル変数 `global`、`process`、`__dirname`、`__filename` などのグローバル変数は**サポートされていません**。 diff --git a/docs/ru-RU/handbook/workflow-javascript/index.md b/docs/ru-RU/handbook/workflow-javascript/index.md index ce15a5f0c0..c8797aa823 100644 --- a/docs/ru-RU/handbook/workflow-javascript/index.md +++ b/docs/ru-RU/handbook/workflow-javascript/index.md @@ -62,6 +62,26 @@ WORKFLOW_SCRIPT_MODULES=crypto,timers,lodash,dayjs Модули, не объявленные в `WORKFLOW_SCRIPT_MODULES`, включая собственные модули Node.js или установленные `node_modules`, **не могут** использоваться в скриптах. Эта стратегия позволяет администраторам контролировать модули, доступные пользователям, что снижает риск чрезмерных разрешений скрипта. ::: +When in a non-source-deployed environment, if a module is not installed in `node_modules`, you can manually install the required package into the `storage` directory. For example, to use the `exceljs` package, you can perform the following steps: + +```shell +cd storage +npm i --no-save --no-package-lock --prefix . exceljs +``` + +Then add the package's relative (or absolute) path based on the application's CWD (current working directory) to the environment variable `WORKFLOW_SCRIPT_MODULES`: + +```ini +WORKFLOW_SCRIPT_MODULES=./storage/node_modules/exceljs +``` + +You can then use the `exceljs` package in your script: + +```js +const ExcelJS = require('exceljs'); +// ... +``` + ### Глобальные переменные Глобальные переменные, такие как `global`, `process`, `__dirname` и `__filename` **не поддерживаются**. diff --git a/docs/zh-CN/handbook/workflow-javascript/index.md b/docs/zh-CN/handbook/workflow-javascript/index.md index 3728af3d50..25751a32a9 100644 --- a/docs/zh-CN/handbook/workflow-javascript/index.md +++ b/docs/zh-CN/handbook/workflow-javascript/index.md @@ -62,6 +62,26 @@ WORKFLOW_SCRIPT_MODULES=crypto,timers,lodash,dayjs 在环境变量 `WORKFLOW_SCRIPT_MODULES` 中未声明的模块,即使是 Node.js 原生的或 `node_modules` 中已安装的,也**不能**在脚本中使用。该策略可以用于在运维层管控用户可使用的模块列表,在一些场景下避免脚本权限过高。 ::: +在非源码部署的环境下,如果某个模块未在 node_modules 中安装,可以将需要的包手动安装到 storage 目录中。例如需要使用 `exceljs` 包时,可以执行如下操作: + +```shell +cd storage +npm i --no-save --no-package-lock --prefix . exceljs +``` + +然后将该包基于应用 CWD(当前工作目录)的相对(或绝对路径)添加到环境变量 `WORKFLOW_SCRIPT_MODULES` 中: + +```ini +WORKFLOW_SCRIPT_MODULES=./storage/node_modules/exceljs +``` + +即可在脚本中使用 `exceljs` 包: + +```js +const ExcelJS = require('exceljs'); +// ... +``` + ### 全局变量 **不支持** `global`、`process`、`__dirname` 和 `__filename` 等全局变量。