Skip to content

Commit 33388c4

Browse files
committed
fix: ensure alchemy dir is present and ignored
1 parent b09624b commit 33388c4

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ A `phpstan-baseline.neon` at your project root is included automatically, and **
174174

175175
(`alchemy setup` is a deprecated alias for `alchemy all`.)
176176

177+
Coming from Alchemy 4? See the [upgrade guide](https://leafphp.dev/docs/utils/testing#upgrading-from-alchemy-4) — v4 scripts keep working, and the guide covers what changed.
178+
177179
Every tool is installed lazily: requiring alchemy adds nothing to your dependency tree until you actually run a command that needs an engine — pest arrives on your first `composer run test`, phpstan on your first `composer run analyse`, never before.
178180

179181
Alchemy also never takes over a setup you didn't hand it. When `init` finds an existing tool config it asks: **port it** into `alchemy.yml` (phpunit.xml and php-cs-fixer configs map fully; phpstan neon files port through the `analyse` passthrough; `rector.php` is read directly from the rector config itself) — or **keep it**, recorded in `alchemy.yml` as a pinned file:

‎src/Commands/InitCommand.php‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,7 @@ protected function resolveExistingConfig(array $config, string $tool, array $can
118118
*/
119119
protected function parkPortedConfig(string $file): void
120120
{
121-
if (!is_dir(getcwd() . '/.alchemy')) {
122-
mkdir(getcwd() . '/.alchemy', 0777, true);
123-
}
121+
Core::ensureAlchemyDir();
124122

125123
if (@rename(getcwd() . "/$file", getcwd() . "/.alchemy/$file.bak")) {
126124
$this->writeln("<info>Imported $file into alchemy.yml — original parked at .alchemy/$file.bak.</info>");

‎src/Commands/SetupCommand.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ protected function loadAlchemyConfig()
113113
Core::set(Yaml::parseFile(dirname(__DIR__) . '/setup/alchemy.yml'));
114114
}
115115

116-
\Leaf\FS\Directory::create(getcwd() . '/.alchemy');
116+
Core::ensureAlchemyDir();
117117
}
118118

119119
/**

‎src/Commands/SwitchCommand.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ protected function switchCiProvider(string $target, array $config, string $confi
6262
$this->writeln('<comment>Note: alchemy.yml was rewritten, so any comments in it were dropped.</comment>');
6363

6464
Core::set($config);
65-
\Leaf\FS\Directory::create(getcwd() . '/.alchemy');
65+
Core::ensureAlchemyDir();
6666
$this->generateActions();
6767

6868
$leftoverFiles = [];

0 commit comments

Comments
 (0)