Skip to content

Commit 3d18e42

Browse files
committed
chore: set up alchemy
1 parent c770a3f commit 3d18e42

33 files changed

+967
-840
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ phpunit.xml
55
.idea
66
test
77
.DS_Store
8+
9+
# Alchemy
10+
.alchemy

alchemy.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
app:
2+
- bin
3+
- src
4+
5+
lint:
6+
preset: PSR12
7+
rules:
8+
single_quote: true
9+
phpdoc_scalar: true
10+
no_unused_imports: true
11+
unary_operator_spaces: true
12+
binary_operator_spaces: true
13+
phpdoc_var_without_name: true
14+
trailing_comma_in_multiline: true
15+
phpdoc_single_line_var_spacing: true
16+
single_trait_insert_per_statement: true
17+
not_operator_with_successor_space: false
18+
array_syntax:
19+
syntax: short
20+
ordered_imports:
21+
sort_algorithm: alpha
22+
method_argument_space:
23+
on_multiline: ensure_fully_multiline
24+
keep_multiple_spaces_after_comma: true
25+
blank_line_before_statement:
26+
statements:
27+
- try
28+
- break
29+
- throw
30+
- return
31+
- declare
32+
- continue
33+
34+
actions:
35+
run:
36+
- lint
37+
os:
38+
- ubuntu-latest
39+
php:
40+
versions:
41+
- '8.3'
42+
events:
43+
- push
44+
- pull_request

bin/leaf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<?php
33

44
if (file_exists(dirname(__DIR__, 3) . "/autoload.php")) {
5-
require dirname(__DIR__, 3) . "/autoload.php";
5+
require dirname(__DIR__, 3) . "/autoload.php";
66
} else {
7-
require dirname(__DIR__) . "/vendor/autoload.php";
7+
require dirname(__DIR__) . "/vendor/autoload.php";
88
}
99

1010
$leafCli = json_decode(file_get_contents(dirname(__DIR__) . "/composer.json"));

composer.json

Lines changed: 54 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,56 @@
11
{
2-
"name": "leafs/cli",
3-
"description": "A simple command line tool for installing and interacting with your leaf apps",
4-
"homepage": "https://cli.leafphp.dev",
5-
"version": "v2.13.1",
6-
"keywords": [
7-
"leaf",
8-
"php",
9-
"installer",
10-
"deploy",
11-
"server",
12-
"database"
13-
],
14-
"license": "MIT",
15-
"authors": [
16-
{
17-
"name": "Michael Darko",
18-
"email": "[email protected]",
19-
"homepage": "https://mychi.netlify.app",
20-
"role": "Developer"
21-
}
22-
],
23-
"require": {
24-
"ext-json": "*",
25-
"leafs/fs": "^1.0",
26-
"psy/psysh": "*",
27-
"symfony/console": "^5.0|^6.0",
28-
"symfony/process": "^5.0|^6.0"
29-
},
30-
"bin": [
31-
"bin/leaf"
32-
],
33-
"autoload": {
34-
"psr-4": {
35-
"Leaf\\Console\\": "src/"
36-
}
37-
},
38-
"config": {
39-
"sort-packages": true
40-
},
41-
"minimum-stability": "dev",
42-
"prefer-stable": true
2+
"name": "leafs/cli",
3+
"description": "A simple command line tool for installing and interacting with your leaf apps",
4+
"homepage": "https://cli.leafphp.dev",
5+
"version": "v2.13.1",
6+
"keywords": [
7+
"leaf",
8+
"php",
9+
"installer",
10+
"deploy",
11+
"server",
12+
"database"
13+
],
14+
"license": "MIT",
15+
"authors": [
16+
{
17+
"name": "Michael Darko",
18+
"email": "[email protected]",
19+
"homepage": "https://mychi.netlify.app",
20+
"role": "Developer"
21+
}
22+
],
23+
"require": {
24+
"ext-json": "*",
25+
"leafs/fs": "^1.0",
26+
"psy/psysh": "*",
27+
"symfony/console": "^5.0|^6.0",
28+
"symfony/process": "^5.0|^6.0"
29+
},
30+
"bin": [
31+
"bin/leaf"
32+
],
33+
"autoload": {
34+
"psr-4": {
35+
"Leaf\\Console\\": "src/"
36+
}
37+
},
38+
"config": {
39+
"sort-packages": true,
40+
"allow-plugins": {
41+
"pestphp/pest-plugin": true
42+
}
43+
},
44+
"minimum-stability": "dev",
45+
"prefer-stable": true,
46+
"require-dev": {
47+
"friendsofphp/php-cs-fixer": "^3.66",
48+
"leafs/alchemy": "^2.0"
49+
},
50+
"scripts": {
51+
"alchemy": "./vendor/bin/alchemy setup",
52+
"test": "./vendor/bin/alchemy setup --test",
53+
"lint": "./vendor/bin/alchemy setup --lint",
54+
"actions": "./vendor/bin/alchemy setup --actions"
55+
}
4356
}

src/CreateCommand.php

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class CreateCommand extends Command
3030
'CSRF protection' => 'leafs/csrf',
3131
'CORS support' => 'leafs/cors',
3232
'Leaf Date' => 'leafs/date',
33-
'Leaf Fetch' => 'leafs/fetch'
33+
'Leaf Fetch' => 'leafs/fetch',
3434
];
3535

3636
/**
@@ -101,9 +101,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
101101

102102
$output->writeln(
103103
"\n⚙️ Creating \""
104-
. basename($directory) . "\" in <info>./"
105-
. basename(dirname($directory)) .
106-
"</info> using <info>$preset@v3</info>."
104+
. basename($directory) . '" in <info>./'
105+
. basename(dirname($directory)) .
106+
"</info> using <info>$preset@v3</info>."
107107
);
108108

109109
if ($preset === 'leaf') {
@@ -190,15 +190,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int
190190
if ($preset === 'mvc' || $preset === 'api') {
191191
$dockerThemeFolder = __DIR__ . '/themes/mvc/docker';
192192
}
193-
193+
194194
FS::superCopy($dockerThemeFolder, $directory);
195195
$output->write("\n🚀 Docker environment scaffolded successfully");
196196
}
197197

198-
$output->writeln("\n🚀 Successfully created project <info>" . basename($directory) . "</info>");
199-
$output->writeln("👉 Get started with the following commands:");
198+
$output->writeln("\n🚀 Successfully created project <info>" . basename($directory) . '</info>');
199+
$output->writeln('👉 Get started with the following commands:');
200200
$output->writeln("\n <info>cd</info> " . basename($directory));
201-
$output->writeln(" <info>leaf serve</info>");
201+
$output->writeln(' <info>leaf serve</info>');
202202

203203
if ($testing) {
204204
$output->writeln("\n👉 You can run tests with:");
@@ -216,7 +216,7 @@ protected function buildLeafApp($input, $output, $directory): int
216216
FS::superCopy(__DIR__ . '/themes/leaf3', $directory);
217217

218218
$composer = Utils\Core::findComposer();
219-
$output->writeln('⚡️ ' . basename($directory) . " scaffolded successfully");
219+
$output->writeln('⚡️ ' . basename($directory) . ' scaffolded successfully');
220220

221221
$commands = [
222222
"$composer install",
@@ -271,10 +271,10 @@ protected function buildLeafApp($input, $output, $directory): int
271271
});
272272

273273
if ($process->isSuccessful()) {
274-
$output->writeln("\n🚀 Successfully created project <info>" . basename($directory) . "</info>");
275-
$output->writeln("👉 Get started with the following commands:");
274+
$output->writeln("\n🚀 Successfully created project <info>" . basename($directory) . '</info>');
275+
$output->writeln('👉 Get started with the following commands:');
276276
$output->writeln("\n <info>cd</info> " . basename($directory));
277-
$output->writeln(" <info>leaf serve</info>");
277+
$output->writeln(' <info>leaf serve</info>');
278278

279279
if ($testing) {
280280
$output->writeln("\n👉 You can run tests with:");
@@ -389,7 +389,7 @@ protected function getAppPreset(InputInterface $input, $output): string
389389
if ($preset === 'leaf mvc') {
390390
return 'mvc';
391391
}
392-
392+
393393
return 'leaf';
394394
}
395395

@@ -414,6 +414,7 @@ protected function getAppTestPreset($input, $output)
414414

415415
if ($testing === 'none') {
416416
$output->writeln("\n💪 No tests, hope you know what you're doing");
417+
417418
return false;
418419
}
419420

0 commit comments

Comments
 (0)