Skip to content

Xepack

Build and deploy.

Installation

  1. The tool can be installed globally to use it within the command line.

    npm install @xeditor/tool-xepack --global --registry https://npm.xeditor.com:4873

  2. The tool can also be used inside your packages. Therefore, you can add it as an devDependeny.

    npm install @xeditor/tool-xepack --save-dev --registry https://npm.xeditor.com:4873

Configuration

Xepack can be configured using an javascript file with exports the configuration using module.exports. It will use the given confiuration file (Using the --config argument) or searchs for an `xepack.config.js` file inside the execution directory.


module.exports = [{

  /* Flags to enable/disable features */
  flags: {
    uglify: boolean, /* Enables/Disables the uglification/minimization*/
    closure: boolean, /* Enables/Disables the Google Closure Compiler. Therefor Java is required! */
    sourceMap: boolean, /* Enables/Disables the creation of Source Maps */
    loader: boolean, /* Enables/Disables the creation of the `xeditor.loader.js` script */
    clean: boolean, /* Enables/Disable the clean of the output directory */
    deepCopy: boolean /* Enables/Disables the copying of all dependencies */
  },

  /* Entries to build */
  entry: string | Object,

  /* Output configuration. */
  output: {
    path: string, /* Output direcotry. Default: `./dist` */
    filename: string /* Output filename. The varaible `[name]` can be used here i.e. `js/[name].js`.  Default: `js/[name].js` and with `flags.uglify` it is `js/[name].min.js` */
  } | string, /* Output direcotry. Default: `./dist` */

  /* Configuration */
  config: {

    /* Configuration for environment variable within the source code (v1.1.0 and above) */
    env: Object,

    /* Configuration for libraries */
    library: {
      name: string, /* Name of the library */
      target: string /* Target of the library. Default: `this` */
    } | string, /* Name of the library */

    /* Configuration for deep copy */
    deepCopy: {
      ignore: string[], /* Files to ignore */
      dependencies: string[] /* Dependencies to copy. Default: `package.json:dependencies` */
    },

    /* Configuration for the file loader - `xeditor.loader.js`*/
    loader: {
      ignore: string[], /* Files to ignore */
      loadAfter: string[] /* Files to load after all other files. By default the entries will be loaded at asynchronous */
    }
  },

  /* Array of all static files*/
  statics: Array<{
    from: string, /* Location of the static file/files */
    to: string /* Location of the destination */
  }> | string /* Location of the static files. Default: `./static` */
}];

Usage

The tool offers the following options:


Usage: xepack [args]

Config options:
  --config, -c  Path to the config file                                 [string]

Basic options:
  --watch, -w       Watch the filesystem for changes                   [boolean]
  --production, -p  Predefined switch for production.                  [boolean]
  --develop, -d     Predefined switch for develop.                     [boolean]
  --deep-copy, -C   Copies all xeditor dependencies                    [boolean]
  --clean           Cleans the project                                 [boolean]
  --quiet, -q       Prevents output                                    [boolean]

Advanced options:
  --source-map        Enables the soure map for this project           [boolean]
  --closure-compiler  Enables the closure compiler                     [boolean]
  --uglify            Enables the uglification.                        [boolean]

Developer options:
  --serve, -S  Serves the files for developing. On v1.1.0 and above you can also pass a port number
               to start it to an specific port, otherwise the port 7070 will be
               used.
  --open, -O   Opens the dev server in the default browser             [boolean]

Options:
  --help, -h     Show help                                             [boolean]
  --version, -v  Show version number                                   [boolean]