-
-
Notifications
You must be signed in to change notification settings - Fork 355
/
Copy pathux-toolkit-kit-create
executable file
·45 lines (37 loc) · 1.15 KB
/
ux-toolkit-kit-create
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env php
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
if ('cli' !== \PHP_SAPI) {
throw new Exception('This script must be run from the command line.');
}
use Symfony\Component\Console\Application;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\UX\Toolkit\Command\CreateKitCommand;
function includeIfExists(string $file): bool
{
return file_exists($file) && include $file;
}
if (
!includeIfExists(__DIR__ . '/../../../autoload.php') &&
!includeIfExists(__DIR__ . '/../vendor/autoload.php')
) {
fwrite(STDERR, 'Install dependencies using Composer.'.PHP_EOL);
exit(1);
}
if (!class_exists(Application::class)) {
fwrite(STDERR, 'You need the "symfony/console" component in order to run the UX Toolkit kit linter.'.PHP_EOL);
exit(1);
}
$filesystem = new Filesystem();
(new Application())->add($command = new CreateKitCommand($filesystem))
->getApplication()
->setDefaultCommand($command->getName(), true)
->run()
;