az-upload

1.3.4 • Public • Published

az-upload

A tool for quickly packaging and uploading your code to the server

Installation

npm install az-upload --save -dev

or

yarn add az-upload --dev

Usage

Create file "upload.config.js/upload.config.json/.uploadrc" in the project root directory.

Add scripts like this:

// 'env' will be 'production'
"upload": "az-upload"

or

// 'env' will be 'stage'
"upload:stage": "az-upload stage"

configuration

"upload.config.js" example:

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:

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:

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

Readme

Keywords

Package Sidebar

Install

npm i az-upload

Weekly Downloads

0

Version

1.3.4

License

MIT

Unpacked Size

8.6 kB

Total Files

4

Last publish

Collaborators

  • azed