Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"label": "Contribuire"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
---
slug: /contributing/code
title: Contributi al codice
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.
---

<!--
# Code contributions
-->

# Contributi al codice

<!--
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/).

:::info Contribute to Playground Tools

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.

:::

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.

Be sure to review the following resources before you begin:

- [Coding principles](/contributing/coding-standards)
- [Architecture](/developers/architecture)
- [Vision and Philosophy](https://github.com/WordPress/wordpress-playground/issues/472)
- [WordPress Playground Roadmap](https://github.com/WordPress/wordpress-playground/issues/525)
-->

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/).

:::info Contribuire a Playground Tools

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ì.

:::

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.

Assicurati di rivedere le seguenti risorse prima di iniziare:

- [Principi di codifica](/contributing/coding-standards)
- [Architettura](/developers/architecture)
- [Visione e Filosofia](https://github.com/WordPress/wordpress-playground/issues/472)
- [Roadmap di WordPress Playground](https://github.com/WordPress/wordpress-playground/issues/525)

<!--
## Contribute Pull Requests

[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:

```bash
git clone -b trunk --single-branch --depth 1 --recurse-submodules

# replace `YOUR-GITHUB-USERNAME` with your GitHub username:
[email protected]:YOUR-GITHUB-USERNAME/wordpress-playground.git
cd wordpress-playground
npm install
```

Create a branch, make changes, and test it locally by running the following command:

```bash
npm run dev
```

Playground will open in a new browser tab and refresh automatically with each change.

When your'e ready, commit the changes and submit a Pull Request.

:::info Formatting

We handle code formatting and linting automatically. Relax, type away, and let the machines do the work.

:::
-->

## Contribuire con Pull Request

[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:

```bash
git clone -b trunk --single-branch --depth 1 --recurse-submodules

# sostituisci `YOUR-GITHUB-USERNAME` con il tuo username GitHub:
[email protected]:YOUR-GITHUB-USERNAME/wordpress-playground.git
cd wordpress-playground
npm install
```

Crea un branch, fai le modifiche e testalo localmente eseguendo il seguente comando:

```bash
npm run dev
```

Playground si aprirà in una nuova scheda del browser e si aggiornerà automaticamente ad ogni modifica.

Quando sei pronto, committa le modifiche e invia una Pull Request.

:::info Formattazione

Gestiamo automaticamente la formattazione del codice e il linting. Rilassati, scrivi e lascia che le macchine facciano il lavoro.

:::

<!--
### Running a local Multisite

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.

To change `wp-now`'s default port to the one supported by WordPress Multisite, run it using the `--port=80` flag:

```bash
npx @wp-now/wp-now start --port=80
```

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:

```bash
valet proxy playground.test http://127.0.0.1:5400 --secure
```

Your dev server is now available on https://playground.test.
-->

### Eseguire un Multisite locale

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.

Per cambiare la porta predefinita di `wp-now` a quella supportata da WordPress Multisite, eseguilo usando il flag `--port=80`:

```bash
npx @wp-now/wp-now start --port=80
```

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:

```bash
valet proxy playground.test http://127.0.0.1:5400 --secure
```

Il tuo server di sviluppo è ora disponibile su https://playground.test.

<!--
## Debugging

### Use VS Code and Chrome

If you're using VS Code and have Chrome installed, you can debug Playground in the code editor:

- Open the project folder in VS Code.
- Select Run > Start Debugging from the main menu or press `F5`/`fn`+`F5`.

### Debugging PHP

Playground logs PHP errors in the browser console after every PHP request.
-->

## Debug

### Usa VS Code e Chrome

Se stai usando VS Code e hai Chrome installato, puoi fare il debug di Playground nell'editor di codice:

- Apri la cartella del progetto in VS Code.
- Seleziona Esegui > Avvia debug dal menu principale o premi `F5`/`fn`+`F5`.

### Debug di PHP

Playground registra gli errori PHP nella console del browser dopo ogni richiesta PHP.
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
---
slug: /contributing/coding-standards
title: Principi di codifica
description: Dettaglia i principi di codifica per Playground, concentrandosi su messaggi di errore utili, un'API pubblica minimale e Blueprints.
---

<!--
# Coding principles
-->

# Principi di codifica

<!--
## Error messages

A good error message informs the user of the following steps to take. Any ambiguity in errors thrown by Playground [Public APIs](/developers/apis/) will prompt the developers to open issues.

Consider a network error, for example—can we infer the type of error and display a relevant message summarizing the next steps?

- **Network error**: "Your internet connection twitched. Try to reload the page.
- **404**: "Could not find the file".
- **403**: "The server blocked access to the file".
- **CORS**: clarify it's a browser security feature and add a link to a detailed explanation (on MDN or another reliable source). Suggest the user move their file somewhere else, like `raw.githubusercontent.com`, and link to a resource explaining how to set up CORS headers on their servers.

We handle code formatting and linting automatically. Relax, type away, and let the machines do the work.
-->

## Messaggi di errore

Un buon messaggio di errore informa l'utente sui passaggi successivi da seguire. Qualsiasi ambiguità negli errori generati dalle [API pubbliche](/developers/apis/) di Playground spingerà gli sviluppatori ad aprire issue.

Considera un errore di rete, per esempio—possiamo dedurre il tipo di errore e visualizzare un messaggio rilevante che riassuma i prossimi passaggi?

- **Errore di rete**: "La tua connessione internet ha avuto un problema. Prova a ricaricare la pagina."
- **404**: "Impossibile trovare il file".
- **403**: "Il server ha bloccato l'accesso al file".
- **CORS**: chiarisci che è una funzionalità di sicurezza del browser e aggiungi un link a una spiegazione dettagliata (su MDN o un'altra fonte affidabile). Suggerisci all'utente di spostare il proprio file altrove, come `raw.githubusercontent.com`, e linka a una risorsa che spiega come impostare gli header CORS sui loro server.

Gestiamo automaticamente la formattazione del codice e il linting. Rilassati, scrivi e lascia che le macchine facciano il lavoro.

<!--
## Public API

Playground aims to keep the narrowest possible API scope.

Public APIs are easy to add and hard to remove. It only takes one PR to introduce a new API, but it may take a thousand to remove it, especially if other projects have already consumed it.

- Don't expose unnecessary functions, classes, constants, or other components.
-->

## API pubblica

Playground mira a mantenere lo scope dell'API il più ristretto possibile.

Le API pubbliche sono facili da aggiungere e difficili da rimuovere. Serve solo una PR per introdurre una nuova API, ma potrebbero servire mille per rimuoverla, specialmente se altri progetti l'hanno già utilizzata.

- Non esporre funzioni, classi, costanti o altri componenti non necessari.

<!--
## Blueprints

[Blueprints](/blueprints/getting-started) are the primary way to interact with Playground. These JSON files describe a set of steps that Playground executes in order.

### Guidelines

Blueprint steps should be **concise and focused**. They should do one thing and do it well.

- If you need to create a new step, try refactoring an existing one first.
- If that's not enough, ensure the new step delivers a new capability. Don't replicate the functionality of existing steps.
- Assume the step would be called more than once.
- Assume it would run in a specific order.
- Add unit tests to verify that.

Blueprints should be **intuitive and straightforward**.

- Don't require arguments that can be optional.
- Use plain argument. For example, `slug` instead of `path`.
- Define constants in virtual JSON files—don't modify PHP files.
- Define a TypeScript type for the Blueprint. That's how Playground generates its JSON schema.
- Write a function to handle a Blueprint step. Accept the argument of the type you defined.
- Provide a usage example in the doc string. It's automatically reflected in the docs.
-->

## Blueprints

I [Blueprints](/blueprints/getting-started) sono il modo principale per interagire con Playground. Questi file JSON descrivono una serie di passaggi che Playground esegue in ordine.

### Linee guida

I passaggi dei Blueprints dovrebbero essere **concisi e mirati**. Dovrebbero fare una cosa e farla bene.

- Se devi creare un nuovo passaggio, prova prima a refactorizzare uno esistente.
- Se non è sufficiente, assicurati che il nuovo passaggio fornisca una nuova capacità. Non replicare la funzionalità dei passaggi esistenti.
- Assumi che il passaggio verrà chiamato più di una volta.
- Assumi che verrà eseguito in un ordine specifico.
- Aggiungi test unitari per verificarlo.

I Blueprints dovrebbero essere **intuitivi e diretti**.

- Non richiedere argomenti che possono essere opzionali.
- Usa argomenti semplici. Per esempio, `slug` invece di `path`.
- Definisci le costanti in file JSON virtuali—non modificare i file PHP.
- Definisci un tipo TypeScript per il Blueprint. È così che Playground genera il suo schema JSON.
- Scrivi una funzione per gestire un passaggio del Blueprint. Accetta l'argomento del tipo che hai definito.
- Fornisci un esempio di utilizzo nella stringa di documentazione. Viene automaticamente riflesso nella documentazione.
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
title: Badge Contributore WordPress Playground
slug: /contributing/contributor-badge
description: Scopri i criteri per il Badge Contributore WordPress Playground e come richiederlo per il tuo profilo WordPress.org.
---

<!--
# Playground Contributor Badge

This page provides detailed information on the Playground Contributor Badge and the process of requesting it on your [WordPress.org](https://wordpress.org) profile.

---
-->

# Badge Contributore Playground

Questa pagina fornisce informazioni dettagliate sul Badge Contributore Playground e sul processo per richiederlo sul tuo profilo [WordPress.org](https://wordpress.org).

---

<!--
## Getting Started

Any contribution to the WordPress Playground project is highly valued. The Playground team recognizes contributions across several key areas:

- **Playground Code:** Making code changes and reviewing the core project.
- **Playground UI:** Improving the user interface of the web experience.
- **Documentation:** Writing, updating, and reviewing documentation.
- **Translation:** Translating any part of the project.
- **Blueprints Gallery:** Creating new blueprints or improving existing ones.
-->

## Per iniziare

Ogni contributo al progetto WordPress Playground è molto apprezzato. Il team Playground riconosce i contributi in diverse aree chiave:

- **Codice Playground:** Fare modifiche al codice e rivedere il progetto principale.
- **Interfaccia Playground:** Migliorare l'interfaccia utente dell'esperienza web.
- **Documentazione:** Scrivere, aggiornare e rivedere la documentazione.
- **Traduzione:** Tradurre qualsiasi parte del progetto.
- **Galleria Blueprints:** Creare nuovi blueprints o migliorare quelli esistenti.

<!--
## Playground Contributor Badge

To get a Playground Contributor Badge, you must have made at least one eligible contribution from the list above. The team may choose to award the badge for other contributions or a combination of the above at the team's discretion.

![Playground Contributor Badge](@site/static/img/contributing/playground-contributor-badge.webp)
-->

## Badge Contributore Playground

Per ottenere un Badge Contributore Playground, devi aver fatto almeno un contributo idoneo dall'elenco sopra. Il team può scegliere di assegnare il badge per altri contributi o una combinazione di quelli sopra a discrezione del team.

![Badge Contributore Playground](@site/static/img/contributing/playground-contributor-badge.webp)

<!--
## Playground Team Badge

If you are currently a contributor and have been actively involved in the Playground project for the past **twelve months**, you are eligible for a **Playground Team Badge**.

![Playground Contributor Badge](@site/static/img/contributing/playground-team-badge.webp)
-->

## Badge Team Playground

Se sei attualmente un contributore e sei stato attivamente coinvolto nel progetto Playground negli ultimi **dodici mesi**, sei idoneo per un **Badge Team Playground**.

![Badge Team Playground](@site/static/img/contributing/playground-team-badge.webp)

<!--
## Requesting a Profile Badge

If you meet the criteria, you can request a badge. Please include links to resources (such as GitHub pull requests, issues, or translated strings) that show you have met the criteria. Send a request at the links bellow:

- [Contributor Badge](https://profiles.wordpress.org/associations/playground-contributor/)
- [Team Badge](https://profiles.wordpress.org/associations/playground-team/)

### Request form

![Playground Contributor Badge](@site/static/img/contributing/request-contributor-badge.webp)

To access the request, the user should be logged in with their WordPress.org account and open the Request Membership tab, after submitting the required information. A Playground Team Representative will confirm your contribution and assign the badge. The team will perform a weekly review of contributions and award badges at that time. Updates on new badges awarded will be posted during the Playground Team meeting.
-->

## Richiedere un Badge Profilo

Se soddisfi i criteri, puoi richiedere un badge. Per favore includi link a risorse (come pull request GitHub, issue o stringhe tradotte) che dimostrino che hai soddisfatto i criteri. Invia una richiesta ai link seguenti:

- [Badge Contributore](https://profiles.wordpress.org/associations/playground-contributor/)
- [Badge Team](https://profiles.wordpress.org/associations/playground-team/)

### Modulo di richiesta

![Badge Contributore Playground](@site/static/img/contributing/request-contributor-badge.webp)

Per accedere alla richiesta, l'utente dovrebbe essere loggato con il proprio account WordPress.org e aprire la scheda Richiedi Appartenenza, dopo aver inviato le informazioni richieste. Un Rappresentante del Team Playground confermerà il tuo contributo e assegnerà il badge. Il team eseguirà una revisione settimanale dei contributi e assegnerà i badge in quel momento. Gli aggiornamenti sui nuovi badge assegnati verranno pubblicati durante la riunione del Team Playground.
Loading