# az-upload **Repository Path**: AzedL/az-upload ## Basic Information - **Project Name**: az-upload - **Description**: az-upload,用于快速打包部署前端代码到服务器的npm包。 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2021-07-28 - **Last Updated**: 2022-04-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # az-upload #### A tool for quickly packaging and uploading your code to the server ## Installation ```javascript npm install az-upload --save -dev ``` or ```javascript yarn add az-upload --dev ``` ## Usage Create file "upload.config.js/upload.config.json/.uploadrc" in the project root directory. Add scripts like this: ```javascript // 'env' will be 'production' "upload": "az-upload" ``` or ```javascript // 'env' will be 'stage' "upload:stage": "az-upload stage" ``` ## configuration "upload.config.js" example: ```javascript module.exports = { uploadDir: 'build', packingCMD: (env) => { if (env === 'production') return 'npm run build' return `npm run build:${env}` }, confirm: ['production'], environment: { production: { ip: '', port: '', username: '', password: '', path: '', rmPath: '', }, stage: { ip: '', port: '', username: '', password: '', path: '', rmPath: '', }, }, } ``` #### uploadDir String Not required. Default: 'dist' The files you want to upload. Generally, it is the directory of the packaged code. #### packingCMD Function/Object/String Not required The script use to packaging your code. 'env' is from your script. Example: ```javascript module.exports = { // Function, default packingCMD: (env) => { if (env === 'production') return 'npm run build' return `npm run build:${env}` }, // Object packingCMD: { production: 'npm run build', stage: 'npm run build:stage', }, // String packingCMD: 'npm run build', } ``` #### confirm Boolean/Array/Function Not required Does command execution require confirmation? 'env' is from your script. Example: ```javascript module.exports = { // Array, default confirm: ['production'], // Boolean confirm: true, // Function confirm: (env) => { if (env === 'production') return true return false }, } ``` #### environment Object Required 'environment[env]' will be used for connecting the server. 'env' is from your script. ip: ip of server port: port of server username: username of server password: password of server path: the path to upload your code rmPath: the path cleaned before uploading