XEpack (Tool)
What it does
Tool for building and deploying xeditor packages.
Installation
The tool can be installed globally to use it within the command line.
# npm install --global @xeditor/tool-xepack --registry https://npm.xeditor.com:4873
The tool can be also be used inside the packages using the scripts. Therefor you can add it as an devDependency:
$ npm install --save-dev @xeditor/tool-xepack --registry https://npm.xeditor.com:4873
Usage
xepack 1.5.0
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] |
--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. 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] |
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 */
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` */
}];