0.1.92 • Published 4 months ago
@itkyk/ftp-controller v0.1.92
FTP Controller
How to use this module.
Npm module install
$ npm i -D @itkyk/ftp-controller
Add 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:init
This command is added template file of
.env
.
We recommend that you rewrite file name of that template.
ex).env.template
→.env.preview
deploy
- 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.log
will be output.
Options
option | value | description |
---|---|---|
--init, -i | - | Create template file of .env fileThis 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-controller
package.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-beta.0.5
4 months ago
1.0.0-beta.0.2
4 months ago
1.0.0-beta.0.3
4 months ago
1.0.0-beta.0.1
4 months ago
1.0.0-beta.0.4
4 months ago
0.1.92
10 months ago
0.1.91
1 year ago
0.1.9
1 year ago
0.1.8
2 years ago
0.1.7
2 years ago
0.1.6
2 years ago
0.1.5
2 years ago
0.1.2
2 years ago
0.1.1
2 years ago
0.1.4
2 years ago
0.1.3
2 years ago
0.1.0
2 years ago
0.0.9
2 years ago
0.0.8
2 years ago
0.0.7
2 years ago
0.0.6
2 years ago
0.0.5
2 years ago
0.0.4
2 years ago
0.0.3
2 years ago
0.0.2
2 years ago
0.0.1
2 years ago