-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathpost-create-project.php
57 lines (48 loc) · 1.19 KB
/
post-create-project.php
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
46
47
48
49
50
51
52
53
54
55
56
57
<?php
// @codingStandardsIgnoreFile
// Create env file
touch('.env');
echo "- Created .env" . PHP_EOL;
// Remove Radar meta
array_map(
'unlink',
[
'CONTRIBUTING.md',
'LICENSE',
'CHANGELOG.md',
'README.md',
'src/.placeholder'
]
);
echo "- Removed Radar meta" . PHP_EOL;
// Remove Radar docs
array_map('unlink', glob('docs/*'));
rmdir('docs');
echo "- Removed Radar docs" . PHP_EOL;
// Keep composer.lock for projects
// http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
file_put_contents(
'.gitignore',
implode(PHP_EOL, [
'/.env',
'/vendor',
'',
])
);
echo "- Initialized .gitignore" . PHP_EOL;
// Cleanup composer.json
$composerJson = json_decode(file_get_contents('composer.json'), true);
unset(
$composerJson['name'],
$composerJson['description'],
$composerJson['license'],
$composerJson['scripts']
);
file_put_contents(
'composer.json',
json_encode($composerJson, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)
);
echo "- Cleaned composer.json" . PHP_EOL;
// Remove post install command
unlink('post-create-project.php');
echo "- Removed post-create-project.php command\n";