Skip to content

Commit bf19b47

Browse files
authored
docs: add manual for non installed modules (#436)
1 parent f779235 commit bf19b47

5 files changed

Lines changed: 103 additions & 1 deletion

File tree

  • docs
    • en-US/handbook/workflow-javascript
    • fr-FR/handbook/workflow-javascript
    • ja-JP/handbook/workflow-javascript
    • ru-RU/handbook/workflow-javascript
    • zh-CN/handbook/workflow-javascript

docs/en-US/handbook/workflow-javascript/index.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,26 @@ WORKFLOW_SCRIPT_MODULES=crypto,timers,lodash,dayjs
6262
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.
6363
:::
6464

65+
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:
66+
67+
```shell
68+
cd storage
69+
npm i --no-save --no-package-lock --prefix . exceljs
70+
```
71+
72+
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`:
73+
74+
```ini
75+
WORKFLOW_SCRIPT_MODULES=./storage/node_modules/exceljs
76+
```
77+
78+
You can then use the `exceljs` package in your script:
79+
80+
```js
81+
const ExcelJS = require('exceljs');
82+
// ...
83+
```
84+
6585
### Global Variables
6686

6787
Global variables such as `global`, `process`, `__dirname`, and `__filename` are **not supported**.

docs/fr-FR/handbook/workflow-javascript/index.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,29 @@ Les modules disponibles dans le flux de travail peuvent être utilisés dans le
5252
WORKFLOW_SCRIPT_MODULES=crypto,timers,lodash,dayjs
5353
```
5454

55-
> **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.
55+
:::info{title="Note"}
56+
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.
57+
:::
58+
59+
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:
60+
61+
```shell
62+
cd storage
63+
npm i --no-save --no-package-lock --prefix . exceljs
64+
```
65+
66+
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`:
67+
68+
```ini
69+
WORKFLOW_SCRIPT_MODULES=./storage/node_modules/exceljs
70+
```
71+
72+
You can then use the `exceljs` package in your script:
73+
74+
```js
75+
const ExcelJS = require('exceljs');
76+
// ...
77+
```
5678

5779
### Variables globales
5880

docs/ja-JP/handbook/workflow-javascript/index.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,26 @@ WORKFLOW_SCRIPT_MODULES=crypto,timers,lodash,dayjs
6262
`WORKFLOW_SCRIPT_MODULES` に宣言されていないモジュールは、Node.js ネイティブモジュールやインストール済みモジュールであってもスクリプトで使用することはできません。このポリシーは、運用レベルでユーザーが使用可能なモジュールリストを制御し、スクリプト権限が過剰になるのを防ぐためのものです。
6363
:::
6464

65+
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:
66+
67+
```shell
68+
cd storage
69+
npm i --no-save --no-package-lock --prefix . exceljs
70+
```
71+
72+
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`:
73+
74+
```ini
75+
WORKFLOW_SCRIPT_MODULES=./storage/node_modules/exceljs
76+
```
77+
78+
You can then use the `exceljs` package in your script:
79+
80+
```js
81+
const ExcelJS = require('exceljs');
82+
// ...
83+
```
84+
6585
### グローバル変数
6686

6787
`global``process``__dirname``__filename` などのグローバル変数は**サポートされていません**

docs/ru-RU/handbook/workflow-javascript/index.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,26 @@ WORKFLOW_SCRIPT_MODULES=crypto,timers,lodash,dayjs
6262
Модули, не объявленные в `WORKFLOW_SCRIPT_MODULES`, включая собственные модули Node.js или установленные `node_modules`, **не могут** использоваться в скриптах. Эта стратегия позволяет администраторам контролировать модули, доступные пользователям, что снижает риск чрезмерных разрешений скрипта.
6363
:::
6464

65+
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:
66+
67+
```shell
68+
cd storage
69+
npm i --no-save --no-package-lock --prefix . exceljs
70+
```
71+
72+
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`:
73+
74+
```ini
75+
WORKFLOW_SCRIPT_MODULES=./storage/node_modules/exceljs
76+
```
77+
78+
You can then use the `exceljs` package in your script:
79+
80+
```js
81+
const ExcelJS = require('exceljs');
82+
// ...
83+
```
84+
6585
### Глобальные переменные
6686

6787
Глобальные переменные, такие как `global`, `process`, `__dirname` и `__filename` **не поддерживаются**.

docs/zh-CN/handbook/workflow-javascript/index.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,26 @@ WORKFLOW_SCRIPT_MODULES=crypto,timers,lodash,dayjs
6262
在环境变量 `WORKFLOW_SCRIPT_MODULES` 中未声明的模块,即使是 Node.js 原生的或 `node_modules` 中已安装的,也**不能**在脚本中使用。该策略可以用于在运维层管控用户可使用的模块列表,在一些场景下避免脚本权限过高。
6363
:::
6464

65+
在非源码部署的环境下,如果某个模块未在 node_modules 中安装,可以将需要的包手动安装到 storage 目录中。例如需要使用 `exceljs` 包时,可以执行如下操作:
66+
67+
```shell
68+
cd storage
69+
npm i --no-save --no-package-lock --prefix . exceljs
70+
```
71+
72+
然后将该包基于应用 CWD(当前工作目录)的相对(或绝对路径)添加到环境变量 `WORKFLOW_SCRIPT_MODULES` 中:
73+
74+
```ini
75+
WORKFLOW_SCRIPT_MODULES=./storage/node_modules/exceljs
76+
```
77+
78+
即可在脚本中使用 `exceljs` 包:
79+
80+
```js
81+
const ExcelJS = require('exceljs');
82+
// ...
83+
```
84+
6585
### 全局变量
6686

6787
**不支持** `global``process``__dirname``__filename` 等全局变量。

0 commit comments

Comments
 (0)