overherz / cscartsdk
为CS-Cart & Multi-Vendor开发者提供的命令行工具
Requires
- ext-mbstring: *
- overherz/upgrade-builder: ^1.2
- symfony/console: ^5.2
- symfony/filesystem: ~4.0
- symfony/twig-bridge: ~4.0
README
为开发者骄傲的CS-Cart & Multivendor命令行工具。
目的
我们希望为CS-Cart & Multi-Vendor提供便利的开发者工具。此SDK旨在处理与插件和主题开发相关的复杂和常规任务。
使用方法
安装
您需要在系统中安装Composer。如果您之前没有安装过,请查看其安装指南。
当Composer安装完成后,只需在您的控制台中执行以下命令
$ composer global require "cscart/sdk:*"
执行命令
$ cscart-sdk command:name
命令列表
addon:symlink
在CS-Cart安装目录中创建插件文件的符号链接,允许您在单独的Git仓库中开发和存储插件文件。
$ cscart-sdk addon:symlink --help
Usage:
addon:symlink [options] [--] <name> <addon-directory> <cart-directory>
Arguments:
name Add-on ID (name)
addon-directory Path to directory with add-on files
cart-directory Path to CS-Cart installation directory
Options:
-r, --relative Created symlinks will have a relative path to the target file. By default the created symlinks have an absolute path to target.
--templates-to-design Whether to take the add-on templates from "var/themes_repository" path at the add-on directory and put them at "design/themes" path in the CS-Cart installation directory . When this option is not specified, the templates are being taken from "var/themes_repository" and also put into "var/themes_repository" directory.
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
Creates symlinks for add-on files at the CS-Cart installation directory, allowing you to develop and store add-on files in a separate Git repository.
addon:export
将所有插件文件复制或移动到单独的目录,保留目录结构。
$ cscart-sdk addon:export --help
Usage:
addon:export [options] [--] <name> <addon-directory> <cart-directory>
Arguments:
name Add-on ID (name)
addon-directory Path to directory where files should be moved to
cart-directory Path to CS-Cart installation directory
Options:
-d, --delete Files and directories will be moved instead of being copied.
--templates-from-design Whether to take the add-on templates from "design/themes" path at CS-Cart installation directory and put them at "var/themes_repository" path in the add-on files directory. When this option is not specified, the templates are being taken from "var/themes_repository" and also put into "var/themes_repository" directory.
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
Copies or moves all add-on files to the separate directory, preserving the structure of directories.
addon:sync
同步CS-Cart安装目录和存储所有插件文件的单独目录之间的插件文件。调用此命令的效果与同时调用"addon:export"和"addon:symlink"命令的效果相同。
$ cscart-sdk addon:sync --help
Usage:
addon:sync [options] [--] <name> <addon-directory> <cart-directory>
Arguments:
name Add-on ID (name)
addon-directory Path to directory where files should be moved to
cart-directory Path to CS-Cart installation directory
Options:
-r, --relative Created symlinks will have a relative path to the target file. By default the created symlinks have an absolute path to target.
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
Synchronizes add-on files between CS-Cart installation directory and the separate directory storing all add-on files. Calling this command has the same effect as calling the "addon:export" and "addon:symlink" commands simultaneously.
addon:build_upgrade
在插件版本之间创建升级包
$ php bin/cscart-sdk addon:build_upgrade --help
Usage:
addon:build_upgrade <old_addon_version_archive_path> <new_addon_version_archive_path> <result_dir_path>
Arguments:
old_addon_version_archive_path Old add-on version archive path
new_addon_version_archive_path New add-on version archive path
result_dir_path Path to a directory where the built upgrade package will be placed
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
Creates upgrade package between add-on versions
贡献
要为此项目做出贡献,您需要了解如何使用Git和GitHub。
您需要GitHub账户来提交问题或拉取请求。
提交问题
在您提交问题之前,请先进行搜索,以确保它之前没有被提交。这样我们就可以更快地处理问题。
如果问题似乎是一个错误,并且尚未报告,请创建一个新的问题: 切换到“问题”标签,按“新建问题”按钮并填写表单。您需要登录到您的GitHub账户。
提交问题时,请提供以下信息,以便我们能够快速修复它
-
问题的简短摘要 - 这有助于我们保持事情的整洁。
-
为什么这对您来说是一个问题? - 并非所有问题都是错误。如果您有关于如何改进SDK的建议,请告诉我们这种改进将如何使项目受益。
-
浏览器和操作系统 - 如果我们知道问题仅出现在特定的浏览器或某些操作系统上,我们将能够更快地重现它。
-
重现问题的步骤 - 我们需要亲自看到问题以确认和修复它。
-
建议的修复方法 - 如果您知道可能导致错误的原因,请告诉我们。
提交拉取请求
GitHub允许您创建SDK的完整副本并在其中单独工作。一旦您做了些修改,您就可以向我们发送拉取请求,以便我们将您的更改包含到主仓库中。
为SDK开发做出贡献,请执行以下步骤:
- 在GitHub上注册账户,如果您还没有注册——您需要这个账户来完成以下步骤。
- Fork SDK——获取主SDK仓库的副本以进行工作和实验。
- 克隆您的Fork到本地机器——本地仓库是所有工作的地方。
- 在本地克隆中创建一个分支——为不同的任务拥有独立的分支有助于保持事情的组织。
- 在此分支中工作SDK。请确保遵循PSR编码标准。
- 将您的更改分支推送到您的GitHub账户的Fork中——您在本地所做的更改将出现在您的在线仓库中。
- 创建一个pull request——将您的更改提交给我们。
就这些!我们的专家将审查更改,并可能将其拉入仓库。
准备本地开发环境
在克隆了Fork的仓库之后,您将想要能够运行 cscart-sdk
命令以在本地测试事情。为此,您需要从本地路径安装Composer包。
将以下行添加到您位于 ~/.composer/composer.json
路径的全局Composer配置文件中
{ "minimum-stability": "dev", "repositories": [ { "type": "path", "url": "/path/to/cloned/repository/directory" } ], "require": { "cscart/sdk": "*" } }
不要忘记指定克隆仓库Fork的正确目录路径。
然后,执行此命令
$ composer global require "cscart/sdk:*"
您只需要这样做一次;每次您在代码中做出更改时,无需重新安装本地包。Fork仓库的目录将被符号链接到您的全局Composer包目录。
现在,您可以通过执行全局可用的 cscart-sdk
命令来测试您的更改。
版权和许可
代码在 MIT许可证 下发布。