Runtime adapters
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
Línea de trabajo
Empieza por separar los runtimes y las preocupaciones indicados: caché, llamadas de red, procesos secundarios, progreso, sistemas de archivos y montajes. Lee los issues enlazados 46 y WordPress Playground issue 1026; el payload no menciona archivos de implementación ni pruebas, por lo que el primer hito es acordar el alcance y los límites del runtime antes de definir qué significa que esté terminado.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Blueprints should support at least the following runtimes:
- wp-cli
- Docker
- wp-now
- Playground
- Native PHP CLI
- VS Code extension
Runtime-specific features
Caching the downloads
Blueprints shouldn't download the same 10MB WordPress.zip twice. Let's make sure we cache the downloads and invalidate the entries as new versions of Core and Plugins are released.
- In native PHP CLI, we can cache in the filesystem, e.g.
~/.wp/. Ideally, this would take HTTP headers into consideration. - In Playground, we can rely on HTTP cache built into
fetch(). In addition, we could cache at the service worker level. - In VS Code, there's a caching API AFAIR.
- In Docker, we could use the docker build layers for caching.
Network calls
- In native PHP CLI, we can use
libcurlorfopen("https://") - In Playground, we can only rely on
fetch(). We can't open raw TCP sockets sofopen("https://")andlibcurlcannot be easily used. - In VS Code, we can open raw TCP sockets so
fopen("https://"), butlibcurlisn't since Playground doesn't support it yet.
Spawning child processes
Blueprint steps, wp-cli, phpunit, and other tools will often spawn child processes.
- In wp-now PHP and native PHP, we can rely on
proc_open - In Playground, we need a custom spawn handler implemented in JavaScript
Reporting progress
- In any CLI, we should display an ASCII progress bar.
- With Docker as a backend, we should report the build progress somehow.
- In Playground, progress bar is a
<div>that needs to change itswidthsandinnerText
Filesystem interactions
I'd love to avoid abstract the filesystem and just use the regular PHP functions like copy() and fread()
Local mounts
It may useful to support mounting directories
- In the browser, we would either bale out (with a warning?) or mount an OPFS directory, whether that's page-specific or a local directory handle
- In wp-now and Docker, we can mount directories in the runtime without changing anything on the disk
- In Native PHP we could use symlinks
Technical implementation
Dependency injection
Let's explore the dependency injection pattern. Pimple is a tiny service container we can use to plug-in runtime-specific implementations:
$container = new Container();
switch ( $runtime ) {
case self::RUNTIME_NATIVE:
$container['downloads_cache'] = function ( $c ) {
return new FileCache();
};
$container['http_client'] = function ( $c ) {
return HttpClient::create();
};
$container['progress_reporter'] = function ( $c ) {
return function ( ProgressEvent $event ) {
echo $event->url . ' ' . $event->downloadedBytes . '/' . $event->totalBytes . " \r";
};
};
break;
case self::RUNTIME_PLAYGROUND:
$container['downloads_cache'] = function ( $c ) {
// @TODO
};
$container['http_client'] = function ( $c ) {
// @TODO
};
$container['progress_reporter'] = function ( $c ) {
// @TODO
// post_message_to_js();
};
break;
Other ideas
What are other viable solutions to this problem?
- Lenguaje dominante
- PHP
- Estrellas
- 61
- Forks
- 23
- Merge medio
- 20 h 9 min
- PR fusionados (30 d)
- 7
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de WordPress/php-toolkit
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
WordPress/php-toolkit#313 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 58/100
WordPress/php-toolkit#306 ·
Los mantenedores suelen responder en 1 día
-
WPCS complianceAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
WordPress/php-toolkit#157 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
WordPress/php-toolkit#138 · 7 comentarios · 2 reacciones ·
Los mantenedores suelen responder en 1 día
-
[Blueprints v2] Constraint the Blueprint bundle formatPosiblemente ocupada @JanJakes la tomó hace 438 días. AbiertoBlueprints enhancement
WordPress/php-toolkit#132 · 4 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de WordPress/php-toolkit
Issues similares
-
sync-en
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
sync-en
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 4 días
-
Combination form: image thumbnails collapse to 0×0 when a stylesheet sets `img { max-width: 100% }`Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
PrestaShop/PrestaShop#43200 ·
Los mantenedores suelen responder en 1 día
-
[Type] Enhancement Help Wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
codeigniter4/CodeIgniter4#10616 ·
Los mantenedores suelen responder en 1 día