-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathmake.php
executable file
·102 lines (75 loc) · 1.66 KB
/
make.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/usr/bin/php
<?php
/**
* Make Helper
*/
use OpenTHC\Make;
define('APP_ROOT', __DIR__);
if ( ! is_file(APP_ROOT . '/vendor/autoload.php')) {
$cmd = [];
$cmd[] = 'composer';
$cmd[] = 'install';
$cmd[] = '--classmap-authoritative';
$cmd[] = '2>&1';
echo "Composer:\n";
passthru(implode(' ', $cmd), $ret);
var_dump($ret);
}
require_once(APP_ROOT . '/vendor/autoload.php');
chdir(APP_ROOT);
$doc = <<<DOC
OpenTHC Directory Make Helper
Usage:
make [options]
Commands:
install
Options:
--filter=<FILTER> Some Filter for PHPUnit
DOC;
// $cli_args
Make::composer();
Make::npm();
Make::install_bootstrap();
Make::install_fontawesome();
Make::install_jquery();
# lodash
$s = 'node_modules/lodash/lodash.min.js';
$t = 'webroot/vendor/lodash/lodash.min.js';
install_file($s, $t);
# qrcode
$s = 'node_modules/qrcodejs/qrcode.min.js';
$t = 'webroot/vendor/qrcodejs/qrcode.min.js';
install_file($s, $t);
# chart.js
$s = 'node_modules/chart.js/dist/chart.umd.js';
$t = 'webroot/vendor/chart.js/chart.umd.js';
install_file($s, $t);
// cp node_modules/chart.js/dist/chart.umd.js.map "$outpath/"
# echarts like from APP
#
# SASS
$cmd = [];
$cmd[] = './node_modules/.bin/sass';
$cmd[] = '--fatal-deprecation 1.65.0';
$cmd[] = '--no-charset';
$cmd[] = '--no-source-map';
$cmd[] = '--style=compressed';
$cmd[] = '--stop-on-error';
$cmd[] = 'sass/main.scss webroot/css/main.css';
$cmd[] = '2>&1';
$cmd = implode(' ', $cmd);
echo shell_exec($cmd);
echo "\n";
Make::create_homepage('pos');
function install_file(string $s, string $t) : bool
{
if ( ! is_file($s)) {
return false;
}
$p = dirname($t);
if ( ! is_dir($p)) {
mkdir($p, 0755, true);
}
copy($s, $t);
return true;
}