0.1.92 • Published 8 months ago
@itkyk/ftp-controller v0.1.92
FTP Controller
How to use this module.
Npm module install
$ npm i -D @itkyk/ftp-controllerAdd scripts in
package.json"script": { "ftp:init": "ftpController --init", "deploy:prev": "ftpController --deploy preview", "deploy:stg": "ftpController --deploy staging" }Run npm init command
$ npm run ftp:initThis command is added template file of
.env.
We recommend that you rewrite file name of that template.
ex).env.template→.env.previewdeploy
- CLI
- Run npm deploy command
$ npm run deploy:prev
- Run npm deploy command
- API
- Import this module
import deploy from "@itkyk/ftp-controller"; deploy({ key: "preview", // required list: false // not required. default is `false`. })
- Import this module
- CLI
finished
- When complete,
/ftp/ftp-upload.logwill be output.
Options
| option | value | description |
|---|---|---|
| --init, -i | - | Create template file of .envfileThis option can't be used with other options. |
| --deploy, -d < value > | string | FTP deploy option.You give extension of .env file.(ex) .env.preview → --deploy preview |
| --list, -l | boolean | if true and when finish uploading, push log by console |
Options of env
| option | value | default(指定しなかった場合) | description |
|---|---|---|---|
| user | String | - | FTP ID |
| password | String | - | FTP pass word |
| host | String | - | FTP URL |
| port | Number | - | FTP access PORT |
| localRoot | String | /dist/ | File upload destination path |
| remoteRoot | String | /htdocs/ | Directory target to upload |
| include | Array | "*", "**/*" | Specify the file to upload. In the .env file, write as follows.include: "*, **/*" |
| exclude | Array | - | Specify the file that will not be uploaded. In the .env file, write as follows.include: "*, **/*" |
| deleteRemote | Boolean | false | Specifies whether to delete all existing files at the destination before uploading. |
| forcePasv | Boolean | false | Specifies whether passive mode enforces. |
| sftp | Boolean | false | Specifies whether to use SFTP. |
| privateKey | string | - | If you are using an SFTP connection and still need a pem key, enter the path to the pem key in this key. |
使い方
npmをインストール
$ npm i -D @itkyk/ftp-controllerpackage.jsonへスクリプトを追加"script": { "ftp:init": "ftpController --init", "deploy:prev": "ftpController --deploy preview", "deploy:stg": "ftpController --deploy staging" }
- 追加した
initコマンドを叩く
プロジェクトのルートディレクトリに$ npm run ftp:init/ftp/.env.templateが作成されます。 この作られたテンプレートの.envファイルを編集して設定ファイルを作成。
例).env.template→.env.preview
- deployする
- CLI
deployコマンドを叩く$ npm run deploy:prev
- API
- importして使う
1.
import deploy from "@itkyk/ftp-controller"; deploy({ key: "preview", // required list: false // not required. default is `false`. })
- importして使う
1.
- CLI
完了
- 完了すると、
/ftp/ftp-upload.logが出力されます。
- 完了すると、
Options
| option | value | description |
|---|---|---|
| --init, -i | - | .envファイルのテンプレート作成他optionとpの併用不可 |
| --deploy, -d < value > | String | FTPアップ時のコマンドです。.env後ろの拡張子をvalueとして与えてください。(ex) .env.preview → --deploy preview |
| --list, -l | Boolean | trueにするとFTPアップ時にconsoleにアップしたファイルが表示されます。 |
envファイル設定
| option | value | default(指定しなかった場合) | description |
|---|---|---|---|
| user | String | - | FTP ID |
| password | String | - | FTP pass word |
| host | String | - | FTP URL |
| port | Number | - | FTP access PORT |
| localRoot | String | /dist/ | ファイルアップ先のパス |
| remoteRoot | String | /htdocs/ | アップ先のディレクトリターゲット |
| include | Array | "*", "**/*" | アップするファイルを指定。.envファイルでは以下のように記述してください。include: "*, **/*" |
| exclude | Array | - | アップしないファイルを指定。.envファイルでは以下のように記述してください。include: "*, **/*" |
| deleteRemote | Boolean | false | アップロードする前に宛先にある既存のファイルをすべて削除するかどうか指定します。 |
| forcePasv | Boolean | false | パッシブモードが強制するかどうか指定します。 |
| sftp | Boolean | false | SFTPを使用するかどうか指定します。 |
| privateKey | string | - | SFTP接続でなおかつpemキーが必要な場合、このキーにpemキーまでのパスを記入してください。 |
1.0.0-snapshot.7
8 months ago
1.0.0-snapshot.6
8 months ago
1.0.0-beta.0.5
2 years ago
1.0.0-beta.0.2
2 years ago
1.0.0-beta.0.3
2 years ago
1.0.0-beta.0.1
2 years ago
1.0.0-beta.0.4
2 years ago
0.1.92
3 years ago
0.1.91
3 years ago
0.1.9
3 years ago
0.1.8
4 years ago
0.1.7
4 years ago
0.1.6
4 years ago
0.1.5
4 years ago
0.1.2
4 years ago
0.1.1
4 years ago
0.1.4
4 years ago
0.1.3
4 years ago
0.1.0
4 years ago
0.0.9
4 years ago
0.0.8
4 years ago
0.0.7
4 years ago
0.0.6
4 years ago
0.0.5
4 years ago
0.0.4
4 years ago
0.0.3
4 years ago
0.0.2
4 years ago
0.0.1
4 years ago