|
| 1 | +--- |
| 2 | +slug: /contributing/code |
| 3 | +title: Contributi al codice |
| 4 | +description: Una guida per i contributi al codice, che copre come fare il fork del repository, configurare un ambiente locale e inviare una pull request. |
| 5 | +--- |
| 6 | + |
| 7 | +<!-- |
| 8 | +# Code contributions |
| 9 | +--> |
| 10 | + |
| 11 | +# Contributi al codice |
| 12 | + |
| 13 | +<!-- |
| 14 | +Like all WordPress projects, Playground uses GitHub to manage code and track issues. The main repository is at [https://github.com/WordPress/wordpress-playground](https://github.com/WordPress/wordpress-playground) and the Playground Tools repository is at [https://github.com/WordPress/playground-tools/](https://github.com/WordPress/playground-tools/). |
| 15 | +
|
| 16 | +:::info Contribute to Playground Tools |
| 17 | +
|
| 18 | +This guide includes links to the main repository, but all the steps and options apply for both. If you're interested in the plugins or [local development](/developers/local-development/) tools—start there. |
| 19 | +
|
| 20 | +::: |
| 21 | +
|
| 22 | +Browse [the list of open issues](https://github.com/wordpress/wordpress-playground/issues) to find what to work on. The [`Good First Issue`](https://github.com/wordpress/wordpress-playground/issues?q=is%3Aopen+is%3Aissue+label%3A%22Good+First+Issue%22) label is a recommended starting point for first-time contributors. |
| 23 | +
|
| 24 | +Be sure to review the following resources before you begin: |
| 25 | +
|
| 26 | +- [Coding principles](/contributing/coding-standards) |
| 27 | +- [Architecture](/developers/architecture) |
| 28 | +- [Vision and Philosophy](https://github.com/WordPress/wordpress-playground/issues/472) |
| 29 | +- [WordPress Playground Roadmap](https://github.com/WordPress/wordpress-playground/issues/525) |
| 30 | +--> |
| 31 | + |
| 32 | +Come tutti i progetti WordPress, Playground usa GitHub per gestire il codice e tracciare le issue. Il repository principale è su [https://github.com/WordPress/wordpress-playground](https://github.com/WordPress/wordpress-playground) e il repository Playground Tools è su [https://github.com/WordPress/playground-tools/](https://github.com/WordPress/playground-tools/). |
| 33 | + |
| 34 | +:::info Contribuire a Playground Tools |
| 35 | + |
| 36 | +Questa guida include link al repository principale, ma tutti i passaggi e le opzioni si applicano ad entrambi. Se sei interessato ai plugin o agli strumenti di [sviluppo locale](/developers/local-development/)—inizia da lì. |
| 37 | + |
| 38 | +::: |
| 39 | + |
| 40 | +Sfoglia [l'elenco delle issue aperte](https://github.com/wordpress/wordpress-playground/issues) per trovare su cosa lavorare. L'etichetta [`Good First Issue`](https://github.com/wordpress/wordpress-playground/issues?q=is%3Aopen+is%3Aissue+label%3A%22Good+First+Issue%22) è un punto di partenza consigliato per i contributori alle prime armi. |
| 41 | + |
| 42 | +Assicurati di rivedere le seguenti risorse prima di iniziare: |
| 43 | + |
| 44 | +- [Principi di codifica](/contributing/coding-standards) |
| 45 | +- [Architettura](/developers/architecture) |
| 46 | +- [Visione e Filosofia](https://github.com/WordPress/wordpress-playground/issues/472) |
| 47 | +- [Roadmap di WordPress Playground](https://github.com/WordPress/wordpress-playground/issues/525) |
| 48 | + |
| 49 | +<!-- |
| 50 | +## Contribute Pull Requests |
| 51 | +
|
| 52 | +[Fork the Playground repository](https://github.com/WordPress/wordpress-playground/fork) and clone it to your local machine. To do that, copy and paste these commands into your terminal: |
| 53 | +
|
| 54 | +```bash |
| 55 | +git clone -b trunk --single-branch --depth 1 --recurse-submodules |
| 56 | +
|
| 57 | +# replace `YOUR-GITHUB-USERNAME` with your GitHub username: |
| 58 | +git@github.com:YOUR-GITHUB-USERNAME/wordpress-playground.git |
| 59 | +cd wordpress-playground |
| 60 | +npm install |
| 61 | +``` |
| 62 | +
|
| 63 | +Create a branch, make changes, and test it locally by running the following command: |
| 64 | +
|
| 65 | +```bash |
| 66 | +npm run dev |
| 67 | +``` |
| 68 | +
|
| 69 | +Playground will open in a new browser tab and refresh automatically with each change. |
| 70 | +
|
| 71 | +When your'e ready, commit the changes and submit a Pull Request. |
| 72 | +
|
| 73 | +:::info Formatting |
| 74 | +
|
| 75 | +We handle code formatting and linting automatically. Relax, type away, and let the machines do the work. |
| 76 | +
|
| 77 | +::: |
| 78 | +--> |
| 79 | + |
| 80 | +## Contribuire con Pull Request |
| 81 | + |
| 82 | +[Fai il fork del repository Playground](https://github.com/WordPress/wordpress-playground/fork) e clonalo sulla tua macchina locale. Per farlo, copia e incolla questi comandi nel tuo terminale: |
| 83 | + |
| 84 | +```bash |
| 85 | +git clone -b trunk --single-branch --depth 1 --recurse-submodules |
| 86 | + |
| 87 | +# sostituisci `YOUR-GITHUB-USERNAME` con il tuo username GitHub: |
| 88 | +git@github.com:YOUR-GITHUB-USERNAME/wordpress-playground.git |
| 89 | +cd wordpress-playground |
| 90 | +npm install |
| 91 | +``` |
| 92 | + |
| 93 | +Crea un branch, fai le modifiche e testalo localmente eseguendo il seguente comando: |
| 94 | + |
| 95 | +```bash |
| 96 | +npm run dev |
| 97 | +``` |
| 98 | + |
| 99 | +Playground si aprirà in una nuova scheda del browser e si aggiornerà automaticamente ad ogni modifica. |
| 100 | + |
| 101 | +Quando sei pronto, committa le modifiche e invia una Pull Request. |
| 102 | + |
| 103 | +:::info Formattazione |
| 104 | + |
| 105 | +Gestiamo automaticamente la formattazione del codice e il linting. Rilassati, scrivi e lascia che le macchine facciano il lavoro. |
| 106 | + |
| 107 | +::: |
| 108 | + |
| 109 | +<!-- |
| 110 | +### Running a local Multisite |
| 111 | +
|
| 112 | +WordPress Multisite has a few [restrictions when run locally](https://developer.wordpress.org/advanced-administration/multisite/prepare-network/#restrictions). If you plan to test a Multisite network using Playground's `enableMultisite` step, make sure you either change `wp-now`'s default port or set a local test domain running via HTTPS. |
| 113 | +
|
| 114 | +To change `wp-now`'s default port to the one supported by WordPress Multisite, run it using the `--port=80` flag: |
| 115 | +
|
| 116 | +```bash |
| 117 | +npx @wp-now/wp-now start --port=80 |
| 118 | +``` |
| 119 | +
|
| 120 | +There are a few ways to set up a local test domain, including editing your `hosts` file. If you're unsure how to do that, we suggest installing [Laravel Valet](https://laravel.com/docs/11.x/valet) and then running the following command: |
| 121 | +
|
| 122 | +```bash |
| 123 | +valet proxy playground.test http://127.0.0.1:5400 --secure |
| 124 | +``` |
| 125 | +
|
| 126 | +Your dev server is now available on https://playground.test. |
| 127 | +--> |
| 128 | + |
| 129 | +### Eseguire un Multisite locale |
| 130 | + |
| 131 | +WordPress Multisite ha alcune [restrizioni quando viene eseguito localmente](https://developer.wordpress.org/advanced-administration/multisite/prepare-network/#restrictions). Se prevedi di testare una rete Multisite usando il passo `enableMultisite` di Playground, assicurati di cambiare la porta predefinita di `wp-now` o di impostare un dominio di test locale in esecuzione tramite HTTPS. |
| 132 | + |
| 133 | +Per cambiare la porta predefinita di `wp-now` a quella supportata da WordPress Multisite, eseguilo usando il flag `--port=80`: |
| 134 | + |
| 135 | +```bash |
| 136 | +npx @wp-now/wp-now start --port=80 |
| 137 | +``` |
| 138 | + |
| 139 | +Ci sono diversi modi per impostare un dominio di test locale, incluso modificare il tuo file `hosts`. Se non sei sicuro di come farlo, suggeriamo di installare [Laravel Valet](https://laravel.com/docs/11.x/valet) e poi eseguire il seguente comando: |
| 140 | + |
| 141 | +```bash |
| 142 | +valet proxy playground.test http://127.0.0.1:5400 --secure |
| 143 | +``` |
| 144 | + |
| 145 | +Il tuo server di sviluppo è ora disponibile su https://playground.test. |
| 146 | + |
| 147 | +<!-- |
| 148 | +## Debugging |
| 149 | +
|
| 150 | +### Use VS Code and Chrome |
| 151 | +
|
| 152 | +If you're using VS Code and have Chrome installed, you can debug Playground in the code editor: |
| 153 | +
|
| 154 | +- Open the project folder in VS Code. |
| 155 | +- Select Run > Start Debugging from the main menu or press `F5`/`fn`+`F5`. |
| 156 | +
|
| 157 | +### Debugging PHP |
| 158 | +
|
| 159 | +Playground logs PHP errors in the browser console after every PHP request. |
| 160 | +--> |
| 161 | + |
| 162 | +## Debug |
| 163 | + |
| 164 | +### Usa VS Code e Chrome |
| 165 | + |
| 166 | +Se stai usando VS Code e hai Chrome installato, puoi fare il debug di Playground nell'editor di codice: |
| 167 | + |
| 168 | +- Apri la cartella del progetto in VS Code. |
| 169 | +- Seleziona Esegui > Avvia debug dal menu principale o premi `F5`/`fn`+`F5`. |
| 170 | + |
| 171 | +### Debug di PHP |
| 172 | + |
| 173 | +Playground registra gli errori PHP nella console del browser dopo ogni richiesta PHP. |
0 commit comments