Created
May 7, 2019 21:08
-
-
Save nullvariable/437a1a5c84cf8645256c419435379b35 to your computer and use it in GitHub Desktop.
Use typerocket with root composer.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"require": { | |
"typerocket/core": "4.0.*" | |
}, | |
"scripts": { | |
"typerocket-migrate": [ | |
"php ./wp-content/mu-plugins/typerocket/galaxy migrate up" | |
] | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ** /wp-content/mu-plugins/typerocket/init.php | |
define( 'TR_APP_NAMESPACE', 'App' ); | |
define( 'TR_PATH', __DIR__ ); | |
new \TypeRocket\Core\Config( __DIR__ . '/config' ); | |
if ( defined( 'WPINC' ) ) { | |
( new \TypeRocket\Core\Launcher() )->initCore(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ** /wp-content/mu-plugins/loader.php | |
/** | |
* MU Loader | |
* | |
* Plugin Name: TypeRocket MU Loader | |
* Description: Load TypeRocket | |
* Version: 2.0.0 | |
* License: GPL2 | |
* | |
* @package mu-loader | |
*/ | |
// Load TypeRocket and TypeRocket centric code. | |
if ( ! defined( 'TR_APP_NAMESPACE' ) ) { | |
require WP_CONTENT_DIR . '/vendor/autoload.php'; | |
require 'typerocket/init.php'; | |
add_action( | |
'typerocket_loaded', | |
function() { | |
// Any custom code you need to run after TR is loaded | |
} | |
); | |
// In some hosting environments we can't run the galaxy command. This adds galaxy as a WP CLI command. | |
if ( defined( 'WP_CLI' ) && WP_CLI ) { | |
WP_CLI::add_command( | |
'galaxy', | |
function () { | |
$count = count( $_SERVER['argv'] ); | |
for ( $i = 0; $i < $count; $i++ ) { | |
// strip any preceeding arguments so galaxy isn't confused. | |
$arg = array_shift( $_SERVER['argv'] ); | |
if ( 'galaxy' == $arg ) { | |
array_unshift( $_SERVER['argv'], 'galaxy' ); | |
break; | |
} | |
} | |
new \TypeRocket\Console\Launcher(); | |
} | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment