1.1.0 • Published 8 months ago
@missthee/simple-deploy v1.1.0
simple-deploy
A simple NodeJS tool for packaging, copying to linux server, and cleaning up
Install
npm i @missthee/simple-deploy -DUse
- Initialization
or# Initialize the configuration file. simple-deploy init
Generate configuration file# chinese simple-deploy init -l zh-CNsimple-deploy.config.jsonafter option.
- Deployment
Execution log example# Packaging, Copying to linux server, Cleaning up simple-deploy -e [environmentKey]
Deployment process√ Check Configuration T:\deployFileTest\simple-deploy.config.json ? Confirm · deploy-cli · dev: 11.22.33.44 sure to deploy dev ? Yes i Current Environment dev √ Build Code echo √ Create Local Tmp Dir T:\deployFileTest\.deployTmp_1611289911528\ √ Zip Local File T:\deployFileTest\dist to T:\deployFileTest\.deployTmp_1611289911528\dist_deploy.zip √ Zip Local File T:\deployFileTest\dist1\index.html to T:\deployFileTest\.deployTmp_1611289911528\index.html_deploy.zip √ SSH Connect 11.22.33.44 √ Upload File T:\deployFileTest\.deployTmp_1611289911528\dist_deploy.zip to \www\wwwroot\default\aaa\dist_deploy.zip √ Upload File T:\deployFileTest\.deployTmp_1611289911528\index.html_deploy.zip to \www\wwwroot\default\bbb\index.html_deploy.zip √ Unzip And Delete Remote File \www\wwwroot\default\aaa\dist_deploy.zip √ Unzip And Delete Remote File \www\wwwroot\default\bbb\index.html_deploy.zip √ Rename Remote File \www\wwwroot\default\bbb\index.html to \www\wwwroot\default\bbb\ondex.html √ SSH Disconnect √ Clean Local Tmp Dir T:\deployFileTest\.deployTmp_1611289911528 ALL DONECheck ConfigurationCheck file attributes and contentBuild CodeExecute the set instructionsCreate Local TmpCreate a temporary folder to store the zip fileZip Local FileArchive local filesSSH ConnectEstablish ssh linkUpload FileUpload archived filesUnzip And Delete Remote FileUnzip and delete the uploaded archived fileRename Remote FileIf it is a single file, and the uploaded file name is specified in the fileMap, the file will be renamedSSH DisconnectDisconnect ssh linkClean Local Tmp DirClean up temporary folder
Configuration File
simple-deploy.config.jsonexample:{ "local": { "projectName": "deploy-cli", "sshPrivateKeyPath": "~/.ssh/id_rsa", "sshPassphrase": "" }, "env": { "dev": { "project": { "projectBuildScript": "npm build" }, "server": { "serverHost": "11.22.33.44", "serverPort": 22, "serverUsername": "root", "serverPassword": "root" }, "fileMap": { "dist": "/www/wwwroot/default/aaa", "dist1/index.html": "/www/wwwroot/default/bbb/rename.html" }, "other": { "needRebuildWhenBuildScriptSameWithPreviousEnv": false, "isClearLocalDistFileBeforeBuild": false, "isClearServerPathBeforeDeploy": false, "isClearLocalDistFileAfterDeploy": false } }, "prod": { "project": { "projectBuildScript": "npm build" }, "server": { "serverHost": "55.66.77.88", "serverPort": 22, "serverUsername": "root", "serverPassword": "root" }, "fileMap": { "dist": "/www/wwwroot/default/aaa", "dist1/index.html": "/www/wwwroot/default/bbb/rename.html" }, "other": { "needRebuildWhenBuildScriptSameWithPreviousEnv": false, "isClearLocalDistFileBeforeBuild": false, "isClearServerPathBeforeDeploy": false, "isClearLocalDistFileAfterDeploy": false } } } }otheroptionneedRebuildWhenHasSameBuildScriptWithPreviousEnvif buildScript in current env was same as previous env:falseskip build;truerun build script.isClearLocalDistFileBeforeBuildUse the key offileMap, and use the project root directory as the starting path to clean up files before build.isClearServerPathBeforeDeployUse the value offileMap, and use the project root directory as the starting path to clean up files before deployment.isClearLocalDistFileAfterDeployUse the key offileMap, and use the project root directory as the starting path to clean up files after deployment.
NOTE
Only for linux server with unzip,rm,mv command
1.1.0
8 months ago
1.0.18
3 years ago
1.0.17
3 years ago
1.0.16
3 years ago
1.0.15
3 years ago
1.0.14
3 years ago
1.0.13
4 years ago
1.0.11
4 years ago
1.0.12
4 years ago
1.0.10
4 years ago
1.0.9
4 years ago
1.0.8
4 years ago
1.0.7
4 years ago
1.0.6
4 years ago
1.0.5
5 years ago
1.0.4
5 years ago
1.0.3
5 years ago
1.0.2
5 years ago
1.0.1
5 years ago
1.0.0
5 years ago
0.0.2
5 years ago
0.0.1
5 years ago
0.0.1-beta
5 years ago