bx

command module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2025 License: MIT Imports: 6 Imported by: 0

README

BX

BX is a command-line tool for developers of 1C-Bitrix platform modules. The project is currently in active development, and its API may change without backward compatibility.

Features
  • Manage developer accounts
  • Maintain a module registry
  • Build and prepare a module bundle for publication in the 1C-Bitrix Marketplace
Installation
go install github.com/pixel365/bx@latest
Usage
Create module
# Enter a module name via standard input
bx create
# Create a new module (default config)
bx create --name my_module
# Help
bx create -h
Validate module configuration
# Choose a module via standard dialog
bx check
# Check the configuration of a module by name
bx check --name my_module
# Check the configuration of a module by file path
bx check --file module-path/config.yaml
# Help
bx check -h
Build module
# Choose a module via standard dialog
bx build
# Build a module by name
bx build --name my_module
# Build a module by file path
bx build --file config.yaml
# Override version
bx build --name my_module --version 1.2.3
# Help
bx build -h
Push module to Marketplace
# Choose a module via standard dialog
bx push
# Push a module by name
bx push --name my_module
# Push a module by file path
bx push --file config.yaml
# Override version
bx push --name my_module --version 1.2.3
# Help
bx push -h
Help
bx -h
Example of default module configuration
name: "test"
version: "1.0.0"
account: "test"
buildDirectory: "./dist/test"
logDirectory: "./logs/test"

variables:
  structPath: "./examples/structure"
  install: "install"
  bitrix: "{structPath}/bitrix"
  local: "{structPath}/local"
  
stages:
  - name: "components"
    to: "{install}/components"
    actionIfFileExists: "replace"
    from:
      - "{bitrix}/components"
      - "{local}/components"
  - name: "templates"
    to: "{install}/templates"
    actionIfFileExists: "replace"
    from:
      - "{bitrix}/templates"
      - "{local}/templates"
  - name: "rootFiles"
    to: .
    actionIfFileExists: "replace"
    from:
      - "{structPath}/simple-file.php"
  - name: "testFiles"
    to: "test"
    actionIfFileExists: "replace"
    from:
      - "{structPath}/simple-file.php"
  - name: "anotherTestFiles"
    to: "another-test"
    actionIfFileExists: "replace"
    from:
      - "./examples/structure/simple-file.php"
    convertTo1251: false

ignore:
  - "**/*.log"
Configuration Fields
  • name – The name of the module.

  • version – The version of the module.

  • account – The account associated with the module.

  • buildDirectory – Directory where the build artifacts will be output.

  • logDirectory – Directory where log files will be stored.

  • variables (optional) – A set of key-value pairs where both keys and values are strings. These variables can be used in the stages section for the name, to, and from fields. Placeholders in curly braces {} will be replaced with their corresponding values.

    Example:

    variables:
      structPath: "./examples/structure"
      install: "install"
      bitrix: "{structPath}/bitrix"
      local: "{structPath}/local"
    

    In this case, {bitrix} will expand to ./examples/structure/bitrix, and {install} will be replaced with install when used in stages.

Stages

The stages section defines the steps for copying files. Each stage consists of:

  • name – The name of the stage. Can use variables.
  • to – The location where files and directories will be copied, relative to the module's distribution root. Can use variables.
    • For example, if the module's root is /build/1.2.3, then setting to: {install}/components means files will be placed in /build/1.2.3/install/components.
  • from – The source paths from which files should be copied. Can use variables.
  • actionIfFileExists – Action to take if the file already exists:
    • replace – Overwrite the existing file.
    • skip – Skip copying if the file exists.
    • replace_if_newer – Overwrite only if the source file is newer.
  • convertTo1251 (optional) - Specifies whether to convert the file contents to windows-1251 encoding. Applies only to *.php files, as well as description.ru. Defaults to false.
Example Stages
  • components – Copies component files to {install}/components.
  • templates – Copies template files to {install}/templates.
  • rootFiles – Copies specific files to the root directory (.).
  • testFiles – Copies test files to test/.

The stage names provided in the examples are for reference only and can be customized as needed.

Ignored Files

The ignore section defines file patterns to be excluded from processing.
For example:

ignore:
  - "**/*.log"  # Exclude all log files.
Status

The project is under active development. The API is unstable and subject to change.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL