Search by

baxtian / merak-env

baxtian

Manager for Merak themes and plugins

Package info

bitbucket.org/baxtian/merak-env

Type:merak-env

pkg:composer/baxtian/merak-env

Statistics

Installs: 771

Dependents: 2

Suggesters: 0

0.7.15 2026-10-08 14:18 UTC

This package is auto-updated.

Last update: 2026-10-08 14:18:36 UTC


README

Environment to maintain a Merak component. Static classes that merak-cli (flags) and the composer.json of each Merak plugin or theme (scripts) call from the project root.

Scripts

Every script that changes files accepts -- --dry-run when it runs from composer (composer run update_composer -- --dry-run): it reports what it would change and writes nothing.

Composer scriptClassWhat it does
versionMerakEnv\Version::updatePropagates the Version: of the main file to README.md, package.json, composer.json and phpunit.xml.
version (chained)MerakEnv\Header::copyrightScriptCopyright year range: first commit year to the current year. Runs together with the version bump.
update_headerMerakEnv\Header::wordpressScriptWordPress compatibility, only when the user asks: Requires at least (added when missing, never changed), Tested up to (installed WordPress version) and the README. Needs wp-cli.
update_copyrightMerakEnv\Header::copyrightScriptThe copyright step alone. Needs git.
update_composerMerakEnv\Composer::updateScriptLeaves what the framework owns in composer.json equal to the reference: archive > exclude, the scripts above and the baxtian/merak-env constraint.
"scripts": {
    "version": [
        "MerakEnv\\Version::update",
        "MerakEnv\\Header::copyrightScript"
    ],
    "update_header": "MerakEnv\\Header::wordpressScript",
    "update_copyright": "MerakEnv\\Header::copyrightScript",
    "update_composer": "MerakEnv\\Composer::updateScript"
}

Other classes: Libs, Blocks, Src (regenerate lib.json, entry points and Instances.php), SilenceIsGold, Dist (zip), Svn.

composer.json

MerakEnv\Composer::update() brings three things to the reference and rewrites only those parts, so the rest of the file keeps its format. It is the way to reach a project that does not have the scripts yet (merak --update_composer works without them).

  • archive > exclude (Composer::EXCLUDE): all entries start with /, so they are resolved from the project root and never touch the files of the dependencies in vendor/. It replaces the old patterns (composer.* → /composer.*, the webpack.* ones → /webpack.* and /vendor/baxtian/merak/config/, merak-env → /vendor/baxtian/merak-env/), adds what is missing and keeps the project's own entries at the end.
  • scripts (Composer::SCRIPTS): version, update_header, update_copyright and update_composer are added when missing and replaced when different. The other scripts of the project are not touched.
  • baxtian/merak-env: a ^0.7.x constraint below ^0.7.14 is raised to it; run composer update baxtian/merak-env afterwards.

Header

MerakEnv\Header has three entry points: wordpress(), copyright() and update() (both). They return ['changes' => [...], 'warnings' => [...]]; a missing wp-cli or git adds a warning and skips the step that needs it.

Messages and translation

The library writes its messages in English and does not translate them. A caller that wants to translate (merak-cli does) uses the codes: the fixed entries of warnings are keyed by a code (no_wp_cli, wp_version, no_git, no_git_history in Header; no_archive, no_scripts, no_merak_env, run_update, exclude_not_rewritten, invalid_json, invalid_result in Composer), and errors are MerakEnvException with a code (MerakEnvException::NO_*) and getContext() for the values of the message.