Repository navigation
Version 3 is a rebuild of mage.
Most commands of version 2 are back, the ones that are not are listed under Removed.
Anything mage does not know still runs bin/magento.
Added
- Magento root detection: Mage now works from any folder inside a Magento project, it moves to the root on its own.
mage createoptions:--edition,--versionand--envskip their questions, and-yuses the defaults for anything not given.mage addhandlers:mage addis now the central command for adding to a project, with handlers for themes, modules, patches, sample data, stores and more.
Without arguments it shows its own help page with every option.mage clean [OPTION]command: Replacesmage cleanup, with the optionsfiles,redis,varnish,opensearch,sample-files,logsandall.
Likemage addit is built from handlers, so new options are easy to add.
Without an option it cleans all, which options that runs can be set withMAGE_CLEAN_ALL.
mage purgestays as an alias formage clean.mage add [FILE].json: Applies a composer fragment, a json file with therepositories,config,auth,requireandrequire-devkeys of a composer.json.
Its repositories are appended after the existing ones, so thepackage-sourcepath repository keeps priority.
Credentials the global composer auth already has are kept and not asked again.
The first answer to a placeholder that is not a secret is saved as itsMAGE_VAR_<NAME>default.
{{NAME}}placeholders are asked, with defaults fromMAGE_VAR_<NAME>in the config, and credentials go to the global composer auth, so they never end up in the project.
Requires jq.
templates/composer-hyva.jsonis an example that adds Hyvä with a license.mage add themecommand: Replacesmage new theme.
The vendor, name and parent can be given as options, the parent defaults to Hyvä when it is installed, and a theme created inpackage-sourceis required right away.
Besidestheme.xmlandregistration.php, a theme now also gets acomposer.json,README.md,CHANGELOG.md,SECURITY.md,.editorconfigand.gitignore.mage add modulecommand: Replacesmage new module.
The vendor, name and Hyvä choice can be given as options, and a module created inpackage-sourceis required right away.
A module now also gets acomposer.json,README.md,CHANGELOG.md,SECURITY.md,.editorconfigand.gitignore, and a Hyvä module the observer,events.xmland tailwind sources that register it with the Hyvä config, following the hyva-module-template.mage show [OPTION]command: Shows information about the project, built from handlers likemage addandmage clean.
The options arestores,themes, which lists the themes of your direct dependencies andapp/designwith their parent,modules, which now only lists the modules of your direct dependencies andapp/code, with where each comes from and whether it is disabled,fpc, the full page cache in use, andlogs.mage open mail: Opens the mail catcher of the environment: the Warden Mailpit, the DDEV one, orMAGE_MAIL_URLon your machine.- Templates: Generated files, such as those of a new theme or module, and the bundled composer fragments come from the
templatesfolder of mage.
They are synced to~/.config/mage/templateson first use, and updated bymage self-update. .gitignorefor Magento:mage setupadds a Magento aware.gitignorewhen the project has none.mage backupcommand: Backs up the database, and optionallypub/media, tovar/backups, to set the project up on another device.
It usesdb:dumpof magerun2, leaving out the logs and sessions by default, and falls back tomysqldump.
Works on a server such as Hypernode too.mage restorecommand: Replaces the database with a backup, the latest by default, and unpacks its media.
Then moves every store to the domain of this device, sob2b.store.nlbecomesb2b.store.test, and makes each domain reachable likemage add store.
It also resets the cookie domain, admin url and search engine, sets the store config and developer mode, and reindexes.mage synccommand: Pullspub/mediafrom a server with rsync, and with--dbalso its latest backup, formage restore.
The host is required, the Magento root defaults to the one of Hypernode, and can be given or set withMAGE_SYNC_PATH.mage nuke --keep-files: Removes the database and environment, but keeps the project files.- Config file: The defaults, such as the admin user, database credentials, store config and default composer packages, can be overridden in
~/.config/mage/config.
Mage only loads it when it is owned by you and others can not change it. - DDEV support: Projects with a
.ddev/config.yamlrun their commands through DDEV.
mage createcan set up a new DDEV project, with the OpenSearch and Redis add-ons, andmage nukeremoves it withddev delete. - Tests and CI: A bats test suite, and a GitHub Action that runs it together with ShellCheck on every push and pull request to main.
Changed
- Source layout: The source is split into
core,envandcommands, withsrc/mage.shas the entrypoint.
It runs unbuilt during development, and the build inlines its source lines into the singlemagescript.
The version now comes from this changelog. - Environments: Warden, Valet and local are separate environments with their own setup and nuke steps.
Warden is only used when thewardencommand is installed, so mage inside the container runs as local. mage create: Adds the Siteation Debug Bar as a dev package, enabled bymage setup.
No longer requiresmage-os/theme-adminhtml-m137, Mage-OS installs its admin theme itself, matching its version.
Mage-OS is now the default edition, setMAGE_EDITION="community"in the config to change it.
Asks which environment to use, defaulting to the first one installed (Warden, DDEV, Valet, then local).mage setup: Asks for confirmation before reinstalling a project that is already installed, and now cleans the database as part of the install, so reinstalling also works in Warden and DDEV.
On Mage-OS it also disablesMageOS_ThemeOptimization, whose bfcache conflicts with the BFCache patches and does not work with Hyvä, see mage-os/module-theme-optimization#28.
The modules it disables can be set withMAGE_DISABLE_MODULES.mage nuke: Asks to type the folder name to confirm.
The database name and credentials are read fromapp/etc/env.php, and the local environment now also drops its database, not only Valet.mage add [GIT_URL]: A cloned repository is now required asdev-<branch> as <latest tag>, so packages that depend on a version of it still resolve.
Without tags it falls back to@dev.
An existing clone is reused, and thepackage-sourcepath repository is registered when a project does not have it yet.- Redis per project:
mage setupgives the cache and page cache a readable prefix (<db_name>_), like the OpenSearch indices already had.
mage nukeandmage clean redisnow only delete the Redis keys of that project, instead of flushing all of Redis, so other projects on the same Redis keep their cache.
For the same reasonreindex,set csp,add storeand the theme switch now runcache:cleaninstead ofcache:flush, which empties the whole Redis database. mage del [TERM]: Removing by term now lists the matching packages and asks before removing them,-yskips the question.
Terms match as plain text instead of a regex,require-devpackages are removed with--dev, and platform entries likephpnever match.
It reads the composer.json with jq instead of asking composer.mage upd [TERM]: Updating by term matches the same way asmage del, and passes options like-Won to composer.
mage updwithout arguments now runscomposer update.mage add patch: Now also replacesmage new patch, the input decides: a package alone creates a patch from your changes, a repository url adds its patches, and a package with a name and source adds that patch.
A created patch now includes new files, and a second one for the same package no longer overwrites the first.
patches.jsonis edited with jq instead of php, and a missingcweagans/composer-patchesstops with a hint.mage add hyva [--dev]: The packages and repositories now come from the bundledcomposer-hyva.jsonandcomposer-hyva-dev.json, so they can change without a new mage release.
--devreplaces the question for a production setup.
The license key goes to the global composer auth instead of theauth.jsonof the project.
It no longer asks for Checkout and Commerce, and no longer builds the theme styles.mage add storeinfo: Now reads its packages from the bundledcomposer-storeinfo.json, so the list can change without a new mage release, and runssetup:upgradeafterwards.mage outdated: The new--terminaloption shows the result instead of writingcomposer-outdated.json, further arguments go to composer, and the ignored packages can be set withMAGE_OUTDATED_IGNORE.mage add admin: The defaults come from theMAGE_ADMIN_*settings, and-ycreates the admin without asking.
mage add customerpasses its arguments to magerun.mage add i18n: The path is resolved from the folder you run mage in, and it now also works on Linux, it used the macOS onlysed -i ''.mage add store: Also accepts a prefix with dashes, asmy-storewith the codemy_store, and refuses an invalid store code.
DDEV and a local setup get a hint on how to reach the new domain.mage open: Gets the url from Magento in one call instead of magerun or several config lookups, so a base url on a website and a custom admin url now work too.
A store view is matched by its exact code instead of any part of the text, an unknown one lists the codes there are, and the url is printed when there is no open command.mage watch: The cache-clean of the project now runs in the environment, so in the container with Warden and DDEV.
Without any cache-clean it stops with an error and how to add it.mage set csp: No longer needs magerun, it writes the values toapp/etc/env.phpwith Magento's ownconfig:set --lock-env, and cleans the config cache.mage set fpc: Refuses an unknown cache instead of using the builtin one, and shows errors instead of hiding them.
The builtin cache is used when none is given, and can be namedbuiltinordefault.mage log: Also accepts the log name with.log.
mage log showis nowmage show logs, which also shows the size of each log, andmage log clearis nowmage clean logs.mage enableandmage disableby term: Read the modules fromapp/etc/config.phpinstead ofmodule:status, so only one Magento boot is left, and only match modules that can change.
The matches are listed and confirmed first,-yskips it, terms match as plain text, and options such as--clear-static-contentgo to Magento.mage info: Reads everything from Magento in one boot instead of about eight, so it is much faster.
It now also shows the Redis the caches and sessions use, with their databases and cache prefix.
The PHP version is now the one that runs Magento, also inside a container, the admin url counts a custom admin url, and the module count only counts enabled modules.mage add sample [magento|hyva]: Asks which sample data to add: the Luma sample data of Magento, or the new Koti sample data of Hyvä, which also works without a Hyvä license, such as for Hyvä from the GitLab or frompackage-source.
The Magento set now usessampledata:deploy, so it fits the installed version of every edition, Mage-OS included, and works in Warden and DDEV.
The old clones in~/.magento-sampledatacan be deleted.
The version argument is gone, the installed version is used.mage build: Now builds themes with their npm scripts, every theme inapp/designandpackage-sourcewithout a target, or what matches the target, and--watchwatches one.
It no longer runssetup:static-content:deploy, usemage setup:static-content:deployfor that.
mage build hyvastill builds the Hyvä theme invendor.
The script names can be set withMAGE_BUILD_SCRIPTandMAGE_WATCH_SCRIPT.- Scripts and agents: Without a terminal, a question now stops with an error instead of quietly taking a default.
-ytakes the defaults forcreate,setup,add theme,add module,add sample,add admin,del,enableanddisable, andMAGE_YES=1does the same for every command.
mage infoandmage show modules,themesandlogsprint json with--json.
Seedocs/automation.md. - Output: Errors go to stderr, and colors are left out when
NO_COLORis set or the output is not a terminal.
Removed
mage install: Usemage create, which installs and sets up the project in one go.mage start: No longer opens the editor, git client, store and admin at once.mage storesandmage modules: Usemage show storesandmage show modules.mage new theme,mage new module,mage new patch,mage new admin,mage new customer,mage new storeandmage new i18n: Usemage addwith the same name.mage add hyva checkoutandmage add hyva commerce: Add their repositories withmage add <url>.git.mage set themeandmage set mage-os: For the theme, usemage theme:change.mage browser-syncandmage get: Use their npm or composer commands directly.mage cleanup [TYPE]: Usemage clean [OPTION], wheresampleis nowsample-files.
Fixed
- Cloning a project created by mage:
package-sourcenow gets a.gitkeep, so the folder survives a clone.
Without itcomposer installaborted with "the url supplied for the path (package-source//) repository does not exist".
Thanks to @allrude, see #52. - Stale static files with Valet: Valet serves static files without
Cache-Control, so browsers kept old JS and CSS in developer mode until a hard reload.
mage setupnow adds aLocalValetDriver.phpthat makes them revalidate, and the gitignore template ignores it.
See #55. mage add storewith Valet: The store is linked and added to.valet-env.phpby its site name, instead of the full domain, which Valet served with a second tld.- Module location: A module in
app/codeis now created asVendor/MyModule, the path Magento autoloads it from, instead ofVendor/my-module. mage createwith Warden: The project folder is now created before moving into it.
Full Changelog: 2.8.1...3.0.0