-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomposer.json
executable file
·135 lines (135 loc) · 13.2 KB
/
composer.json
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
{
"name": "dark-kitt/wordpress-boilerplate",
"description": "A small WordPress boilerplate",
"type": "project",
"license": "CC-BY-4.0",
"authors": [
{
"name": "dark-kitt"
}
],
"repositories": {
"wpackagist": {
"type": "composer",
"url": "https://wpackagist.org"
},
"advanced-custom-fields/advanced-custom-fields-pro": {
"type": "package",
"package": {
"name": "advanced-custom-fields/advanced-custom-fields-pro",
"version": "6.2.7",
"type": "wordpress-plugin",
"dist": {
"type": "zip",
"url": "https://connect.advancedcustomfields.com/index.php?a=download&p=pro&k=<<ACF_KEY>>&t=6.2.7"
}
}
}
},
"require": {
"advanced-custom-fields/advanced-custom-fields-pro": "^6.2.7",
"dark-kitt/wordpress-theme-configuration": "^1.0",
"dark-kitt/wordpress-theme-vue": "^1.0",
"roots/wordpress": "^6.4",
"roots/wp-password-bcrypt": "^1.0.0",
"vlucas/phpdotenv": "^5.3",
"wpackagist-plugin/acf-extended": "^0.8.5",
"wpackagist-plugin/acf-rgba-color-picker": "^1.2",
"wpackagist-plugin/jwt-authentication-for-wp-rest-api": "^1.2.6"
},
"extra": {
"installer-paths": {
"web/app/mu-plugins/{$name}/": [
"type:wordpress-muplugin"
],
"web/app/plugins/{$name}/": [
"type:wordpress-plugin"
],
"web/app/themes/{$name}/": [
"type:wordpress-theme"
]
},
"wordpress-install-dir": "web/wp"
},
"config": {
"optimize-autoloader": true,
"preferred-install": {
"dark-kitt/*": "source",
"*": "dist"
},
"sort-packages": true,
"allow-plugins": {
"roots/wordpress-core-installer": true,
"composer/installers": true
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-install-cmd": [
"composer run-script set-up-project;"
],
"post-update-cmd": [
"composer run-script set-up-project;"
],
"set-up-project": [
"if [ ! -d ./web/app/themes ]; then mkdir -p ./web/app/themes; fi",
"if [[ $( composer show | grep dark-kitt/wordpress-theme-vue ) && ! -d ./web/app/themes/$(basename $PWD) ]]; then composer run-script default-base-theme-files && composer run-script clear-base-theme; fi",
"if [[ $( composer show | grep dark-kitt/wordpress-theme-vue ) && -d ./web/app/themes/$(basename $PWD) ]]; then rm -rf ./web/app/themes/wordpress-theme-vue; fi",
"if [[ $( composer show | grep dark-kitt/wordpress-theme-configuration ) ]]; then composer run-script clear-theme-configuration; fi",
"if [[ $( composer show | grep dark-kitt/wordpress-mu-plugin-autoloader ) ]]; then mv ./web/app/mu-plugins/wordpress-mu-plugin-autoloader/mu-plugin-autoloader.php ./web/app/mu-plugins/mu-plugin-autoloader.php && composer run-script clear-mu-autoloader; fi",
"if [ ! -f .env ]; then composer run-script default-env-file; fi",
"if [ ! -f ./web/index.php ]; then composer run-script default-index-file; fi",
"if [ ! -f ./web/wp-config.php ]; then composer run-script default-wp-config-file; fi",
"if [ ! -f ./web/.htaccess ]; then composer run-script default-htaccess-file; fi",
"if [ ! -d ./web/media ]; then mkdir ./web/media; chmod 755 ./web/media; echo '' > ./web/media/.gitkeep; fi",
"if [ ! -d ./web/storage ]; then mkdir ./web/storage; chmod 755 ./web/storage; fi",
"if [ ! -d ./web/storage/cache ]; then mkdir ./web/storage/cache; chmod 755 ./web/storage/cache; echo '' > ./web/storage/cache/.gitkeep; fi",
"if [ ! -d ./web/storage/logs ]; then mkdir ./web/storage/logs; chmod 755 ./web/storage/logs; echo '' > ./web/storage/logs/.gitkeep; fi",
"if [ ! -d ./web/storage/lang ]; then mkdir ./web/storage/lang; chmod 755 ./web/storage/lang; echo '' > ./web/storage/lang/.gitkeep; fi"
],
"default-env-file": [
"echo 'DB_HOST=\"localhost\"\nDB_PORT=\"3306\"\nDB_NAME=\"database_name\"\nDB_USER=\"database_user\"\nDB_PASSWORD=\"database_password\"\nDB_PREFIX=\"wp_\"\nDB_CHARSET=\"utf8mb4\"\nDB_COLLATE=\"utf8mb4_unicode_ci\"\n\n# Optionally, you can use a data source name (DSN)\n# DATABASE_URL=\"mysql://database_user:database_password@database_host:database_port/database_name\"\n\nWP_HOME=\"http://example.com\"\nENV_SITEURL=\"http://api.example.com\"\nWP_SITEURL=\"${ENV_SITEURL}/wp\"\n\nWP_CONTENT_DIR=\"/app\"\nWP_CONTENT_URL=\"${ENV_SITEURL}/app\"\nWP_UPLOAD_DIR=\"/media\"\nWP_UPLOAD_URL=\"${ENV_SITEURL}/media\"\nWP_PLUGIN_URL=\"${ENV_SITEURL}/app/plugins\"\nWP_PLUGIN_DIR=\"/app/plugins\"\nWPMU_PLUGIN_URL=\"${ENV_SITEURL}/app/mu-plugins\"\nWPMU_PLUGIN_DIR=\"/app/mu-plugins\"\nWP_STORAGE_DIR=\"/storage\"\nWP_LANG_DIR=\"${WP_STORAGE_DIR}/lang\"\nWP_CACHE=true\nWP_CACHE_DIR=\"${WP_STORAGE_DIR}/cache\"\nWP_LOG_DIR=\"${WP_STORAGE_DIR}/logs\"\n\nCOMPRESS_CSS=true\nCOMPRESS_SCRIPTS=true\n\nWP_ENV=\"development\"\nWP_DEBUG=true\nWP_DEBUG_LOG=\"/storage/logs/wp_error.log\"\nWP_DEBUG_DISPLAY=false\nWP_DISABLE_FATAL_ERROR_HANDLER=false\nSCRIPT_DEBUG=false\n\nSMTP_HOST=\"smtp.domain.com\"\nSMTP_AUTH=true\nSMTP_PORT=587\nSMTP_SECURE=\"tls\"\nSMTP_USERNAME=\"[email protected]\"\nSMTP_PASSWORD=\"password\"\nSMTP_FROM=\"[email protected]\"\nSMTP_FROMNAME=\"WordPress\"\n\nAUTOMATIC_UPDATER_DISABLED=true\nDISABLE_WP_CRON=false\nDISALLOW_FILE_EDIT=true\nDISALLOW_FILE_MODS=true\nWP_POST_REVISIONS=true\n\nREST_USER=\"REST_USER\"\nREST_PASSWORD=\"admin\"\n' > .env; curl -s https://api.wordpress.org/secret-key/1.1/salt | sed \"s/^define('\\(.*\\)',\\ *'\\(.*\\)');$/\\1='\\2'/g\" >> .env; echo '\nJWT_AUTH_SECRET_KEY=\"'$(openssl rand -base64 48)'\"\nJWT_AUTH_CORS_ENABLE=false' >> .env;"
],
"default-index-file": [
"echo '<?php\n\ndefine(\"WP_USE_THEMES\", true);\nrequire __DIR__ . \"/wp/wp-blog-header.php\";\n' > ./web/index.php;"
],
"default-wp-config-file": [
"echo '<?php\n\n$root_dir = dirname(__DIR__);\nif (!defined(\"ABSPATH\")) define(\"ABSPATH\", $root_dir . \"/web/wp/\");\n\nrequire_once $root_dir . \"/vendor/autoload.php\";\n\n/**\n * Use Dotenv to set required environment variables and load .env file in root\n */\n$dotenv = Dotenv\\Dotenv::createUnsafeImmutable($root_dir);\nif (file_exists($root_dir . \"/.env\")) {\n $all_env = $dotenv->load();\n $dotenv->required([\"WP_HOME\", \"WP_SITEURL\", \"DB_HOST\", \"DB_NAME\", \"DB_USER\", \"DB_PASSWORD\"])->notEmpty();\n\n foreach ($all_env as $env_key => $env_value) {\n if ($env_key === \"DB_PREFIX\") {\n $table_prefix = $env_value;\n continue;\n }\n if (preg_match(\"/_DIR$|_LOG$/\", $env_key)) {\n define($env_key, $root_dir . \"/web\" . $env_value);\n continue;\n }\n if ($env_value === \"true\") {\n define($env_key, true);\n continue;\n }\n if ($env_value === \"false\") {\n define($env_key, false);\n continue;\n }\n define($env_key, $env_value);\n }\n}\n\n/** define WordPress default theme */\ndefine(\"WP_DEFAULT_THEME\", basename($root_dir));\n\n/**\n * If DATABASE_URL is set replace database requirements\n */\nif (defined(\"DATABASE_URL\")) {\n $dsn = (object) parse_url(getenv(\"DATABASE_URL\"));\n\n define(\"DB_NAME\", substr($dsn->path, 1));\n define(\"DB_USER\", $dsn->user);\n define(\"DB_PASSWORD\", isset($dsn->pass) ? $dsn->pass : null);\n define(\"DB_HOST\", isset($dsn->port) ? \"{$dsn->host}:{$dsn->port}\" : $dsn->host);\n}\n\n/**\n * Create project database, if it does not exists\n */\n$db_host = constant(\"DB_HOST\");\n$db_port = constant(\"DB_PORT\");\n$db_name = constant(\"DB_NAME\");\n$db_user = constant(\"DB_USER\");\n$db_passwd = constant(\"DB_PASSWORD\");\n$db_charset = constant(\"DB_CHARSET\");\n$db_collate = constant(\"DB_COLLATE\");\n\n/**\n * Before you start to install WordPress\n * set the database privileges for DB_USER\n */\ntry {\n $sql_connect = new mysqli($db_host, $db_user, $db_passwd, $db_name, $db_port);\n $sql_connect->close();\n} catch (\\Throwable $th) {\n $sql_connect = new mysqli($db_host, $db_user, $db_passwd);\n $sql = \"CREATE DATABASE IF NOT EXISTS `{$db_name}` CHARACTER SET $db_charset COLLATE $db_collate\";\n\n if ($sql_connect->query($sql) === false) {\n die(\"Error creating database: \" . $sql_connect->connect_error);\n }\n}\n\n/**\n * Allow WordPress to detect HTTPS when used behind a reverse proxy or a load balancer\n * See https://codex.wordpress.org/Function_Reference/is_ssl#Notes\n */\nif (isset($_SERVER[\"HTTP_X_FORWARDED_PROTO\"]) && $_SERVER[\"HTTP_X_FORWARDED_PROTO\"] === \"https\") {\n $_SERVER[\"HTTPS\"] = \"on\";\n}\n\n/**\n * Include WordPress settings\n */\nrequire_once ABSPATH . \"wp-settings.php\";\n' > ./web/wp-config.php;"
],
"default-htaccess-file": [
"echo 'SetEnvIf Host ^ KITT_TLD=.dev\nSetEnvIf Host ^ KITT_SLD=domain-name\n\nphp_value upload_max_filesize 64M\nphp_value post_max_size 128M\nphp_value memory_limit 256M\nphp_value max_execution_time 300\nphp_value max_input_time 300\n\nErrorDocument 403 http://%{ENV:KITT_SLD}%{ENV:KITT_TLD}/403\nErrorDocument 404 http://%{ENV:KITT_SLD}%{ENV:KITT_TLD}/404\nErrorDocument 500 http://%{ENV:KITT_SLD}%{ENV:KITT_TLD}/500\n\n<IfModule mod_rewrite.c>\n\n\tRewriteEngine On\n\tRewriteBase /\n\n\t# authorization for JWT\n\tRewriteCond %{HTTP:Authorization} ^(.*)\n\tRewriteRule (.*) - [E=HTTP_AUTHORIZATION:%1]\n\n\t# redirect backend\n\tRewriteRule ^(|wp|wp/|wp-admin|wp-admin/)$ wp/wp-login.php [L,R=301]\n\n\t# redirect to REST API\n\tRewriteRule ^(wp-json/.*)$ index.php/$1 [L,QSA]\n\n</IfModule>\n' > ./web/.htaccess;"
],
"default-base-theme-files": [
"name=$(basename $PWD); if [[ -d ./web/app/themes/wordpress-theme-vue && ! -d ./web/app/themes/$name ]]; then cp -r ./web/app/themes/wordpress-theme-vue ./web/app/themes/$name && rm -rf ./web/app/themes/wordpress-theme-vue; fi",
"name=$(basename $PWD); if [ ! -f ./web/app/themes/$name/style.css ]; then echo \"/**\n * Theme Name: ${name}\n * Author: dark-kitt\n * Author URI: https://www.kitt.digital\n */\" > ./web/app/themes/$name/style.css; fi",
"name=$(basename $PWD); if [ ! -f ./web/app/themes/$name/header.php ]; then echo \"<!DOCTYPE html>\n<html lang=\\\"en\\\">\n\n<head>\n <meta charset=\\\"UTF-8\\\" />\n <meta name=\\\"viewport\\\" content=\\\"width=device-width, initial-scale=1.0\\\" />\n <title>WordPress Theme</title>\n <?php wp_head(); ?>\n</head>\n\n<body>\n <header></header>\" > ./web/app/themes/$name/header.php; fi",
"name=$(basename $PWD); if [ ! -f ./web/app/themes/$name/index.php ]; then echo \"<?php\n/** Reload WordPress for access of internal functions */\nrequire_once('../../../wp/wp-load.php');\n\nget_header();\n?>\n\n<main id=\\\"theme\\\">WordPress index.php</main>\n\n<?php get_footer(); ?>\" > ./web/app/themes/$name/index.php; fi",
"name=$(basename $PWD); if [ ! -f ./web/app/themes/$name/footer.php ]; then echo \" <footer></footer>\n <?php wp_footer(); ?>\n\n</body>\n\n</html>\" > ./web/app/themes/$name/footer.php; fi",
"name=$(basename $PWD); if [ ! -f ./web/app/themes/$name/functions.php ]; then cp ./web/app/mu-plugins/wordpress-theme-configuration/example.functions.php ./web/app/themes/$name/example.functions.php && echo '<?php\n/**\n * customize your theme here\n * take a look in the example.functions.php file\n * copy paste useful stuff or just for tryouts\n */' > ./web/app/themes/$name/functions.php; fi"
],
"clear-theme-configuration": [
"if [ -f ./web/app/mu-plugins/wordpress-theme-configuration/.gitignore ]; then rm -f ./web/app/mu-plugins/wordpress-theme-configuration/.gitignore; fi",
"if [ -d ./web/app/mu-plugins/wordpress-theme-configuration/.git ]; then rm -rf ./web/app/mu-plugins/wordpress-theme-configuration/.git; fi",
"if [ -f ./web/app/mu-plugins/wordpress-theme-configuration/composer.json ]; then rm -f ./web/app/mu-plugins/wordpress-theme-configuration/composer.json; fi"
],
"clear-mu-autoloader": [
"if [[ -d ./web/app/mu-plugins/wordpress-mu-plugin-autoloader && -f ./web/app/mu-plugins/mu-plugin-autoloader.php ]]; then rm -rf ./web/app/mu-plugins/wordpress-mu-plugin-autoloader; fi"
],
"clear-base-theme": [
"name=$(basename $PWD); if [ -f ./web/app/themes/$name/.gitignore ]; then rm -f ./web/app/themes/$name/.gitignore; fi",
"name=$(basename $PWD); if [ -d ./web/app/themes/$name/.git ]; then rm -rf ./web/app/themes/$name/.git; fi",
"name=$(basename $PWD); if [ -f ./web/app/themes/$name/composer.json ]; then rm -f ./web/app/themes/$name/composer.json; fi"
],
"htpasswd-web": [
"@putenv HT_HEADER=\n\nAuthType Basic\nAuthName \"restricted area\"",
"@putenv HT_FOOTER=require valid-user",
"if [ ! -f ./web/.htpasswd ]; then htpasswd -b -c ./web/.htpasswd user password; chmod 644 ./web/.htpasswd; printenv HT_HEADER >> ./web/.htaccess; echo \"AuthUserFile ${PWD}/web/.htpasswd\" >> ./web/.htaccess; printenv HT_FOOTER >> ./web/.htaccess; fi"
],
"htpasswd-www": [
"@putenv HT_HEADER=\n\nAuthType Basic\nAuthName \"restricted area\"",
"@putenv HT_FOOTER=require valid-user",
"name=$(basename $PWD); path=./web/app/themes/$name/www; if [ ! -f $path/.htpasswd ]; then htpasswd -b -c $path/.htpasswd user password; chmod 644 $path/.htpasswd; printenv HT_HEADER >> $path/.htaccess; echo \"AuthUserFile ${PWD}/web/app/themes/$name/www/.htpasswd\" >> $path/.htaccess; printenv HT_FOOTER >> $path/.htaccess; fi"
]
}
}