BuildCommands
extends AbstractCommands
in package
Provides commands to build a site for development and a production artifact.
Table of Contents
- buildAssets() : Result|int
- Build theme assets (Css and Js).
- buildDev() : CollectionBuilder
- Build site for local development.
- buildDevReset() : CollectionBuilder
- Build site for local development from scratch with a clean git.
- buildDist() : CollectionBuilder
- Build the distribution package.
- getConfigurationFile() : string
- Path to YAML configuration file containing command defaults.
- getWorkingDir() : string
- Returns the current working directory.
- initializeRuntimeConfiguration() : mixed
- Command initialization.
- getBin() : string
- Validate and return the path to given bin.
- getBinPath() : string
- Return the path to given bin.
- getConfigValue() : mixed
- {@inheritdoc}
- getGitCommitHash() : string
- Returns the current Git commit hash.
- getGitTag() : string
- Returns the current Git tag.
- getNodeBin() : string
- Validate and return the path to given bin from node packages.
- getNodeBinPath() : string
- Return the path to given bin from node packages.
- isSimulating() : bool
- Check if current command is being executed with option simulate.
- taskExecute() : mixed
- Execute a command.
- taskProcess() : Process|CollectionBuilder
- Process the file.
- taskReplaceBlock() : ReplaceBlock|CollectionBuilder
- Replace block in a file.
Methods
buildAssets()
Build theme assets (Css and Js).
public
buildAssets(ConsoleIO $io[, array<string|int, mixed> $options = ['default-theme' => InputOption::VALUE_OPTIONAL, 'custom-code-folder' => InputOption::VALUE_REQUIRED, 'build-npm-packages' => InputOption::VALUE_REQUIRED, 'validate' => InputOption::VALUE_REQUIRED, 'theme-task-runner' => InputOption::VALUE_REQUIRED] ]) : Result|int
Parameters
- $io : ConsoleIO
- $options : array<string|int, mixed> = ['default-theme' => InputOption::VALUE_OPTIONAL, 'custom-code-folder' => InputOption::VALUE_REQUIRED, 'build-npm-packages' => InputOption::VALUE_REQUIRED, 'validate' => InputOption::VALUE_REQUIRED, 'theme-task-runner' => InputOption::VALUE_REQUIRED]
-
Additional options for the command.
Tags
Return values
Result|int —The collection builder.
buildDev()
Build site for local development.
public
buildDev([array<string|int, mixed> $options = ['root' => InputOption::VALUE_REQUIRED] ]) : CollectionBuilder
Parameters
- $options : array<string|int, mixed> = ['root' => InputOption::VALUE_REQUIRED]
-
Command options.
Tags
Return values
CollectionBuilder —Collection builder.
buildDevReset()
Build site for local development from scratch with a clean git.
public
buildDevReset([array<string|int, mixed> $options = ['root' => InputOption::VALUE_REQUIRED, 'yes' => InputOption::VALUE_OPTIONAL] ]) : CollectionBuilder
Parameters
- $options : array<string|int, mixed> = ['root' => InputOption::VALUE_REQUIRED, 'yes' => InputOption::VALUE_OPTIONAL]
-
Command options.
Tags
Return values
CollectionBuilder —Collection builder.
buildDist()
Build the distribution package.
public
buildDist([array<string|int, mixed> $options = ['root' => InputOption::VALUE_REQUIRED, 'dist-root' => InputOption::VALUE_REQUIRED, 'keep' => InputOption::VALUE_REQUIRED, 'remove' => InputOption::VALUE_REQUIRED, 'tag' => InputOption::VALUE_OPTIONAL, 'sha' => InputOption::VALUE_OPTIONAL] ]) : CollectionBuilder
This will create the distribution package intended to be deployed. The folder structure will match the following:
- ./dist
- ./dist/composer.json
- ./dist/composer.lock
- ./dist/manifest.json
- ./dist/config
- ./dist/vendor
- ./dist/web
- ./dist/web/VERSION.txt
Parameters
- $options : array<string|int, mixed> = ['root' => InputOption::VALUE_REQUIRED, 'dist-root' => InputOption::VALUE_REQUIRED, 'keep' => InputOption::VALUE_REQUIRED, 'remove' => InputOption::VALUE_REQUIRED, 'tag' => InputOption::VALUE_OPTIONAL, 'sha' => InputOption::VALUE_OPTIONAL]
-
Command options.
Tags
Return values
CollectionBuilder —Collection builder.
getConfigurationFile()
Path to YAML configuration file containing command defaults.
public
getConfigurationFile() : string
Return values
string —getWorkingDir()
Returns the current working directory.
public
getWorkingDir() : string
Return values
string —The current working directory.
initializeRuntimeConfiguration()
Command initialization.
public
initializeRuntimeConfiguration() : mixed
Tags
Return values
mixed —getBin()
Validate and return the path to given bin.
protected
getBin(string $name) : string
Parameters
- $name : string
-
The bin to look for.
Tags
Return values
string —The bin path.
getBinPath()
Return the path to given bin.
protected
getBinPath(string $name) : string
Parameters
- $name : string
Return values
string —The path to given binary.
getConfigValue()
{@inheritdoc}
protected
getConfigValue(mixed $key[, mixed $default = null ]) : mixed
Parameters
- $key : mixed
- $default : mixed = null
Return values
mixed —getGitCommitHash()
Returns the current Git commit hash.
protected
getGitCommitHash() : string
Return values
string —Current Git hash.
getGitTag()
Returns the current Git tag.
protected
getGitTag() : string
Return values
string —Current Git tag.
getNodeBin()
Validate and return the path to given bin from node packages.
protected
getNodeBin(string $name) : string
Parameters
- $name : string
-
The bin to look for.
Tags
Return values
string —The bin path.
getNodeBinPath()
Return the path to given bin from node packages.
protected
getNodeBinPath(string $name) : string
Parameters
- $name : string
Return values
string —The path to given binary.
isSimulating()
Check if current command is being executed with option simulate.
protected
isSimulating() : bool
Return values
bool —True if using --simulate, false otherwise.
taskExecute()
Execute a command.
protected
taskExecute(array<string|int, mixed> $tasks) : mixed
Parameters
- $tasks : array<string|int, mixed>
-
An array with tasks to execute.
Return values
mixed —taskProcess()
Process the file.
protected
taskProcess(string $source[, string $destination = '' ]) : Process|CollectionBuilder
Parameters
- $source : string
-
The source file to process.
- $destination : string = ''
-
The destination file.
Return values
Process|CollectionBuilder —taskReplaceBlock()
Replace block in a file.
protected
taskReplaceBlock([string $filename = '' ]) : ReplaceBlock|CollectionBuilder
Parameters
- $filename : string = ''
-
The file to process.