diff --git a/de/guide/migrating-5.md b/de/guide/migrating-5.md index 2b2e8f03..35dd65e8 100644 --- a/de/guide/migrating-5.md +++ b/de/guide/migrating-5.md @@ -28,16 +28,16 @@ To help you migrate your express server, we have created a set of codemods that Run the following command for run all the codemods available: ```sh -npx @expressjs/codemod upgrade +npx codemod@latest @expressjs/v5-migration-recipe ``` If you want to run a specific codemod, you can run the following command: ```sh -npx @expressjs/codemod name-of-the-codemod +npx codemod@latest @expressjs/name-of-the-codemod ``` -You can find the list of available codemods [here](https://github.com/expressjs/codemod?tab=readme-ov-file#available-codemods). +You can find the list of available codemods [here](https://codemod.link/express).

Änderungen in Express 5

@@ -96,16 +96,16 @@ Express 5 unterstützt die Funktion `app.del()` nicht mehr. Wenn Sie diese Funkt Anfänglich wurde `del` statt `delete` verwendet, weil `delete` in JavaScript ein reserviertes Schlüsselwort ist. Ab ECMAScript 6 jedoch können `delete` und andere reservierte Schlüsselwörter legal als Eigenschaftsnamen verwendet werden. -{% capture codemod-deprecated-signatures %} +{% capture codemod-route-del-to-delete %} You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod v4-deprecated-signatures +npx codemod@latest @expressjs/route-del-to-delete ``` {% endcapture %} -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-route-del-to-delete %} ```js // v4 @@ -137,7 +137,7 @@ Die folgenden Methodennamen wurden pluralisiert. In Express 4 wurde bei Verwendu You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod pluralized-methods +npx codemod@latest @expressjs/pluralize-method-names ``` {% endcapture %} @@ -178,7 +178,7 @@ Dieses potenziell verwirrende und durchaus riskante Verfahren des Abrufens von F You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod req-param +npx codemod@latest @expressjs/explicit-request-params ``` {% endcapture %} @@ -209,7 +209,16 @@ app.post('/user', (req, res) => { Express 5 unterstützt die Signatur `res.json(obj, status)` nicht mehr. Stattdessen müssen Sie den Status festlegen und diesen dann mit `res.json()`-Methoden wie dieser verketten: `res.status(status).json(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-status-send-order %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/status-send-order +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -227,7 +236,7 @@ app.post('/user', (req, res) => { Express 5 unterstützt die Signatur `res.jsonp(obj, status)` nicht mehr. Stattdessen müssen Sie den Status festlegen und diesen dann mit `res.jsonp()`-Methoden wie dieser verketten: `res.status(status).jsonp(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -245,7 +254,16 @@ app.post('/user', (req, res) => { Express 5 unterstützt die Signatur `res.send(obj, status)` nicht mehr. Stattdessen müssen Sie den Status festlegen und diesen dann mit `res.send()`-Methoden wie dieser verketten: `res.status(status).send(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-redirect-arg-order %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/redirect-arg-order +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-redirect-arg-order %} ```js // v4 @@ -263,16 +281,16 @@ app.get('/user', (req, res) => { Express 5 no longer supports the magic string `back` in the `res.redirect()` and `res.location()` methods. Instead, use the `req.get('Referrer') || '/'` value to redirect back to the previous page. In Express 4, the `res.redirect('back')` and `res.location('back')` methods were deprecated. -{% capture codemod-magic-redirect %} +{% capture codemod-back-redirect-deprecated %} You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod magic-redirect +npx codemod@latest @expressjs/back-redirect-deprecated ``` {% endcapture %} -{% include admonitions/note.html content=codemod-magic-redirect %} +{% include admonitions/note.html content=codemod-back-redirect-deprecated %} ```js // v4 @@ -290,7 +308,7 @@ app.get('/user', (req, res) => { Express 5 no longer supports the signature `res.send(obj, status)`. Instead, set the status and then chain it to the `res.send()` method like this: `res.status(status).send(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -309,7 +327,7 @@ app.get('/user', (req, res) => { Express 5 unterstützt die Signatur res.send(status), nicht mehr, wobei _`status`_ für eine Zahl steht. Verwenden Sie stattdessen die Funktion `res.sendStatus(statusCode)`, mit der der Statuscode für den HTTP-Antwort-Header festgelegt und die Textversion des Codes gesendet wird: "Not Found" (Nicht gefunden), "Internal Server Error" (Interner Serverfehler) usw. Wenn Sie eine Zahl senden und hierfür die Funktion `res.send()` verwenden müssen, müssen Sie die Zahl in Anführungszeichen setzen, um diese in eine Zeichenfolge zu konvertieren. Dadurch interpretiert Express diese Zahl nicht als Versuch, die nicht mehr unterstützte alte Signatur zu verwenden. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -336,7 +354,16 @@ Die Funktion `res.sendfile()` wurde durch eine Version in Camel-Schreibweise von - Font files (.woff): now "font/woff" instead of "application/font-woff" - SVG files (.svg): now "image/svg+xml" instead of "application/svg+xml" -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-camelcase-sendfile %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/camelcase-sendfile +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-camelcase-sendfile %} ```js // v4 diff --git a/es/guide/migrating-5.md b/es/guide/migrating-5.md index 889c0a18..00ff6760 100644 --- a/es/guide/migrating-5.md +++ b/es/guide/migrating-5.md @@ -28,16 +28,16 @@ To help you migrate your express server, we have created a set of codemods that Run the following command for run all the codemods available: ```sh -npx @expressjs/codemod upgrade +npx codemod@latest @expressjs/v5-migration-recipe ``` If you want to run a specific codemod, you can run the following command: ```sh -npx @expressjs/codemod name-of-the-codemod +npx codemod@latest @expressjs/name-of-the-codemod ``` -You can find the list of available codemods [here](https://github.com/expressjs/codemod?tab=readme-ov-file#available-codemods). +You can find the list of available codemods [here](https://codemod.link/express).

Changes in Express 5

@@ -96,16 +96,16 @@ Express 5 ya no da soporte a la función `app.del()`. Si utiliza esta función, Inicialmente, se utilizaba `del` en lugar de `delete`, porque `delete` es una palabra clave reservada en JavaScript. No obstante, a partir de ECMAScript 6, `delete` y otras palabras clave reservadas pueden utilizarse correctamente como nombres de propiedad. -{% capture codemod-deprecated-signatures %} +{% capture codemod-route-del-to-delete %} You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod v4-deprecated-signatures +npx codemod@latest @expressjs/route-del-to-delete ``` {% endcapture %} -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-route-del-to-delete %} ```js // v4 @@ -137,7 +137,7 @@ Los siguientes nombres de métodos se han pluralizado. En Express 4, el uso de l You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod pluralized-methods +npx codemod@latest @expressjs/pluralize-method-names ``` {% endcapture %} @@ -178,7 +178,7 @@ Este método potencialmente confuso y peligroso de recuperar datos de formulario You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod req-param +npx codemod@latest @expressjs/explicit-request-params ``` {% endcapture %} @@ -209,7 +209,16 @@ app.post('/user', (req, res) => { Express 5 ya no da soporte a la firma `res.json(obj, status)`. En su lugar, establezca el estado y encadénelo al método `res.json()` de la siguiente manera: `res.status(status).json(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-status-send-order %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/status-send-order +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -227,7 +236,7 @@ app.post('/user', (req, res) => { Express 5 ya no da soporte a la firma `res.jsonp(obj, status)`. En su lugar, establezca el estado y encadénelo al método `res.jsonp()` de la siguiente manera: `res.status(status).jsonp(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -245,7 +254,16 @@ app.post('/user', (req, res) => { Express 5 ya no da soporte a la firma `res.send(obj, status)`. En su lugar, establezca el estado y encadénelo al método `res.send()` de la siguiente manera: `res.status(status).send(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-redirect-arg-order %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/redirect-arg-order +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-redirect-arg-order %} ```js // v4 @@ -263,16 +281,16 @@ app.get('/user', (req, res) => { Express 5 no longer supports the magic string `back` in the `res.redirect()` and `res.location()` methods. Instead, use the `req.get('Referrer') || '/'` value to redirect back to the previous page. In Express 4, the `res.redirect('back')` and `res.location('back')` methods were deprecated. -{% capture codemod-magic-redirect %} +{% capture codemod-back-redirect-deprecated %} You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod magic-redirect +npx codemod@latest @expressjs/back-redirect-deprecated ``` {% endcapture %} -{% include admonitions/note.html content=codemod-magic-redirect %} +{% include admonitions/note.html content=codemod-back-redirect-deprecated %} ```js // v4 @@ -290,7 +308,7 @@ app.get('/user', (req, res) => { Express 5 no longer supports the signature `res.send(obj, status)`. Instead, set the status and then chain it to the `res.send()` method like this: `res.status(status).send(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -309,7 +327,7 @@ app.get('/user', (req, res) => { Express 5 ya no da soporte a la firma res.send(status), donde _`status`_ es un número. En su lugar, utilice la función `res.sendStatus(statusCode)`, que establece el código de estado de la cabecera de respuesta HTTP y envía la versión de texto del código: "Not Found", "Internal Server Error", etc. Si necesita enviar un número utilizando la función `res.send()`, escríbalo entre comillas para convertirlo en una serie, para que Express no lo interprete como un intento de utilizar la firma antigua no soportada. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -336,7 +354,16 @@ La función `res.sendfile()` se ha sustituido por una versión de la función `r - Font files (.woff): now "font/woff" instead of "application/font-woff" - SVG files (.svg): now "image/svg+xml" instead of "application/svg+xml" -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-camelcase-sendfile %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/camelcase-sendfile +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-camelcase-sendfile %} ```js // v4 diff --git a/fr/guide/migrating-5.md b/fr/guide/migrating-5.md index 67db811e..9cb36583 100644 --- a/fr/guide/migrating-5.md +++ b/fr/guide/migrating-5.md @@ -36,16 +36,16 @@ To help you migrate your express server, we have created a set of codemods that Run the following command for run all the codemods available: ```sh -npx @expressjs/codemod upgrade +npx codemod@latest @expressjs/v5-migration-recipe ``` If you want to run a specific codemod, you can run the following command: ```sh -npx @expressjs/codemod name-of-the-codemod +npx codemod@latest @expressjs/name-of-the-codemod ``` -You can find the list of available codemods [here](https://github.com/expressjs/codemod?tab=readme-ov-file#available-codemods). +You can find the list of available codemods [here](https://codemod.link/express).

Modifications dans Express 5

@@ -114,16 +114,16 @@ clé réservé dans JavaScript. Cependant, à partir d'ECMAScript 6, `delete` et les autres mots clés réservés peuvent être utilisés en toute légalité comme noms de propriété. -{% capture codemod-deprecated-signatures %} +{% capture codemod-route-del-to-delete %} You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod v4-deprecated-signatures +npx codemod@latest @expressjs/route-del-to-delete ``` {% endcapture %} -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-route-del-to-delete %} ```js // v4 @@ -162,7 +162,7 @@ d'obsolescence. Express 5 ne les prend plus du tout en charge : You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod pluralized-methods +npx codemod@latest @expressjs/pluralize-method-names ``` {% endcapture %} @@ -213,7 +213,7 @@ l'objet `req.params`, `req.body` ou `req.query`. You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod req-param +npx codemod@latest @expressjs/explicit-request-params ``` {% endcapture %} @@ -248,7 +248,16 @@ statut et enchaînez-le à la méthode `res.json()` comme suit : `res.status(status).json(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-status-send-order %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/status-send-order +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -269,7 +278,7 @@ Express 5 ne prend plus en charge la signature statut et enchaînez-le à la méthode `res.jsonp()` comme suit : `res.status(status).jsonp(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -290,7 +299,16 @@ Express 5 ne prend plus en charge la signature statut et enchaînez-le à la méthode `res.send()` comme suit : `res.status(status).send(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-redirect-arg-order %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/redirect-arg-order +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-redirect-arg-order %} ```js // v4 @@ -308,16 +326,16 @@ app.get('/user', (req, res) => { Express 5 no longer supports the magic string `back` in the `res.redirect()` and `res.location()` methods. Instead, use the `req.get('Referrer') || '/'` value to redirect back to the previous page. In Express 4, the `res.redirect('back')` and `res.location('back')` methods were deprecated. -{% capture codemod-magic-redirect %} +{% capture codemod-back-redirect-deprecated %} You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod magic-redirect +npx codemod@latest @expressjs/back-redirect-deprecated ``` {% endcapture %} -{% include admonitions/note.html content=codemod-magic-redirect %} +{% include admonitions/note.html content=codemod-back-redirect-deprecated %} ```js // v4 @@ -335,7 +353,7 @@ app.get('/user', (req, res) => { Express 5 no longer supports the signature `res.send(obj, status)`. Instead, set the status and then chain it to the `res.send()` method like this: `res.status(status).send(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -360,7 +378,7 @@ Si vous devez envoyer un nombre à l'aide de la fonction `res.send()`, mettez ce nombre entre guillemets pour qu'Express ne l'interprète pas comme une tentative d'utilisation de l'ancienne signature non prise en charge. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -389,7 +407,16 @@ version CamelCase `res.sendFile()` dans Express 5. - Font files (.woff): now "font/woff" instead of "application/font-woff" - SVG files (.svg): now "image/svg+xml" instead of "application/svg+xml" -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-camelcase-sendfile %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/camelcase-sendfile +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-camelcase-sendfile %} ```js // v4 diff --git a/it/guide/migrating-5.md b/it/guide/migrating-5.md index 40d09e37..5d58dec5 100644 --- a/it/guide/migrating-5.md +++ b/it/guide/migrating-5.md @@ -28,16 +28,16 @@ To help you migrate your express server, we have created a set of codemods that Run the following command for run all the codemods available: ```sh -npx @expressjs/codemod upgrade +npx codemod@latest @expressjs/v5-migration-recipe ``` If you want to run a specific codemod, you can run the following command: ```sh -npx @expressjs/codemod name-of-the-codemod +npx codemod@latest @expressjs/name-of-the-codemod ``` -You can find the list of available codemods [here](https://github.com/expressjs/codemod?tab=readme-ov-file#available-codemods). +You can find the list of available codemods [here](https://codemod.link/express).

Modifiche in Express 5

@@ -96,16 +96,16 @@ Express 5 non supporta più la funzione `app.del()`. Se si utilizza questa funzi Inizialmente era stato utilizzato il comando `del` al posto di `delete`, perché `delete` è una parola chiave riservata in JavaScript. Tuttavia, a partire da ECMAScript 6, `delete` e altre parole chiave riservate possono essere utilizzate liberamente come nomi di proprietà. -{% capture codemod-deprecated-signatures %} +{% capture codemod-route-del-to-delete %} You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod v4-deprecated-signatures +npx codemod@latest @expressjs/route-del-to-delete ``` {% endcapture %} -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-route-del-to-delete %} ```js // v4 @@ -137,7 +137,7 @@ I seguenti nomi di metodi sono stati messi al plurale. In Express 4, l'utilizzo You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod pluralized-methods +npx codemod@latest @expressjs/pluralize-method-names ``` {% endcapture %} @@ -178,7 +178,7 @@ Questo metodo poco chiaro e molto pericoloso che si utilizzava per richiamare i You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod req-param +npx codemod@latest @expressjs/explicit-request-params ``` {% endcapture %} @@ -209,7 +209,16 @@ app.post('/user', (req, res) => { Express 5 non supporta più la firma `res.json(obj, status)`. Al contrario, impostare lo stato e successivamente associarlo al metodo `res.json()` come segue: `res.status(status).json(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-status-send-order %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/status-send-order +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -227,7 +236,7 @@ app.post('/user', (req, res) => { Express 5 non supporta più la firma `res.jsonp(obj, status)`. Al contrario, impostare lo stato e successivamente associarlo al metodo `res.jsonp()` come segue: `res.status(status).jsonp(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -245,7 +254,16 @@ app.post('/user', (req, res) => { Express 5 non supporta più la firma `res.send(obj, status)`. Al contrario, impostare lo stato e successivamente associarlo al metodo `res.send()` come segue: `res.status(status).send(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-redirect-arg-order %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/redirect-arg-order +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-redirect-arg-order %} ```js // v4 @@ -263,16 +281,16 @@ app.get('/user', (req, res) => { Express 5 no longer supports the magic string `back` in the `res.redirect()` and `res.location()` methods. Instead, use the `req.get('Referrer') || '/'` value to redirect back to the previous page. In Express 4, the `res.redirect('back')` and `res.location('back')` methods were deprecated. -{% capture codemod-magic-redirect %} +{% capture codemod-back-redirect-deprecated %} You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod magic-redirect +npx codemod@latest @expressjs/back-redirect-deprecated ``` {% endcapture %} -{% include admonitions/note.html content=codemod-magic-redirect %} +{% include admonitions/note.html content=codemod-back-redirect-deprecated %} ```js // v4 @@ -290,7 +308,7 @@ app.get('/user', (req, res) => { Express 5 no longer supports the signature `res.send(obj, status)`. Instead, set the status and then chain it to the `res.send()` method like this: `res.status(status).send(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -309,7 +327,7 @@ app.get('/user', (req, res) => { Express 5 non supporta più la firma res.send(status), dove _`status`_ è un numero. Al contrario, utilizzare la funzione `res.sendStatus(statusCode)`, la quale imposta il codice di stato dell'intestazione della risposta HTTP e invia la versione di testo del codice: "Non trovato", "Errore interno del server" e così via. Se è necessario inviare un numero utilizzando la funzione `res.send()`, citare il numero per convertirlo in una stringa, in modo tale che Express non lo interpreti come un tentativo di utilizzo di una firma vecchia non supportata. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -336,7 +354,16 @@ La funzione `res.sendfile()` è stata sostituita da una versione in cui ogni fra - Font files (.woff): now "font/woff" instead of "application/font-woff" - SVG files (.svg): now "image/svg+xml" instead of "application/svg+xml" -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-camelcase-sendfile %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/camelcase-sendfile +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-camelcase-sendfile %} ```js // v4 diff --git a/ja/guide/migrating-5.md b/ja/guide/migrating-5.md index 21b7e81b..44f494b5 100644 --- a/ja/guide/migrating-5.md +++ b/ja/guide/migrating-5.md @@ -28,16 +28,16 @@ To help you migrate your express server, we have created a set of codemods that Run the following command for run all the codemods available: ```sh -npx @expressjs/codemod upgrade +npx codemod@latest @expressjs/v5-migration-recipe ``` If you want to run a specific codemod, you can run the following command: ```sh -npx @expressjs/codemod name-of-the-codemod +npx codemod@latest @expressjs/name-of-the-codemod ``` -You can find the list of available codemods [here](https://github.com/expressjs/codemod?tab=readme-ov-file#available-codemods). +You can find the list of available codemods [here](https://codemod.link/express).

Express 5 における変更点

@@ -96,16 +96,16 @@ Express 5 は、`app.del()` 関数をサポートしなくなりました。こ 最初は `del` が `delete` の代わりに使用されていました。`delete` は、JavaScript で予約されているキーワードであるためです。しかし、ECMAScript 6 以降では、`delete` およびその他の予約済みキーワードを正式にプロパティー名として使用できます。ここで、`app.del` 関数の非推奨につながった議論を読むことができます。 However, as of ECMAScript 6, `delete` and other reserved keywords can legally be used as property names. -{% capture codemod-deprecated-signatures %} +{% capture codemod-route-del-to-delete %} You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod v4-deprecated-signatures +npx codemod@latest @expressjs/route-del-to-delete ``` {% endcapture %} -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-route-del-to-delete %} ```js // v4 @@ -137,7 +137,7 @@ The following method names have been pluralized. In Express 4, using the old met You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod pluralized-methods +npx codemod@latest @expressjs/pluralize-method-names ``` {% endcapture %} @@ -178,7 +178,7 @@ This potentially confusing and dangerous method of retrieving form data has been You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod req-param +npx codemod@latest @expressjs/explicit-request-params ``` {% endcapture %} @@ -209,7 +209,16 @@ app.post('/user', (req, res) => { Express 5 は、シグニチャー `res.json(obj, status)` をサポートしなくなりました。代わりに、状況を設定してから、`res.status(status).json(obj)` のように `res.json()` メソッドにチェーニングします。 Instead, set the status and then chain it to the `res.json()` method like this: `res.status(status).json(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-status-send-order %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/status-send-order +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -227,7 +236,7 @@ app.post('/user', (req, res) => { Express 5 は、シグニチャー `res.jsonp(obj, status)` をサポートしなくなりました。代わりに、状況を設定してから、`res.status(status).jsonp(obj)` のように `res.jsonp()` メソッドにチェーニングします。 Instead, set the status and then chain it to the `res.jsonp()` method like this: `res.status(status).jsonp(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -245,7 +254,16 @@ app.post('/user', (req, res) => { Express 5 no longer supports the signature `res.redirect(url, status)`. Instead, use the following signature: `res.redirect(status, url)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-redirect-arg-order %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/redirect-arg-order +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-redirect-arg-order %} ```js // v4 @@ -263,16 +281,16 @@ app.get('/user', (req, res) => { Express 5 no longer supports the magic string `back` in the `res.redirect()` and `res.location()` methods. Instead, use the `req.get('Referrer') || '/'` value to redirect back to the previous page. In Express 4, the `res.redirect('back')` and `res.location('back')` methods were deprecated. -{% capture codemod-magic-redirect %} +{% capture codemod-back-redirect-deprecated %} You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod magic-redirect +npx codemod@latest @expressjs/back-redirect-deprecated ``` {% endcapture %} -{% include admonitions/note.html content=codemod-magic-redirect %} +{% include admonitions/note.html content=codemod-back-redirect-deprecated %} ```js // v4 @@ -290,7 +308,7 @@ app.get('/user', (req, res) => { Express 5 は、シグニチャー `res.send(obj, status)` をサポートしなくなりました。代わりに、状況を設定してから、`res.status(status).send(obj)` のように `res.send()` メソッドにチェーニングします。 Instead, set the status and then chain it to the `res.send()` method like this: `res.status(status).send(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -309,7 +327,7 @@ app.get('/user', (req, res) => { Express 5 no longer supports the signature `res.send(status)`, where `status` is a number. Instead, use the `res.sendStatus(statusCode)` function, which sets the HTTP response header status code and sends the text version of the code: "Not Found", "Internal Server Error", and so on. If you need to send a number by using the `res.send()` function, quote the number to convert it to a string, so that Express does not interpret it as an attempt to use the unsupported old signature. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -336,7 +354,16 @@ app.get('/user', (req, res) => { - Font files (.woff): now "font/woff" instead of "application/font-woff" - SVG files (.svg): now "image/svg+xml" instead of "application/svg+xml" -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-camelcase-sendfile %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/camelcase-sendfile +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-camelcase-sendfile %} ```js // v4 diff --git a/ko/guide/migrating-5.md b/ko/guide/migrating-5.md index fedcfe82..57fbcff9 100644 --- a/ko/guide/migrating-5.md +++ b/ko/guide/migrating-5.md @@ -28,16 +28,16 @@ To help you migrate your express server, we have created a set of codemods that Run the following command for run all the codemods available: ```sh -npx @expressjs/codemod upgrade +npx codemod@latest @expressjs/v5-migration-recipe ``` If you want to run a specific codemod, you can run the following command: ```sh -npx @expressjs/codemod name-of-the-codemod +npx codemod@latest @expressjs/name-of-the-codemod ``` -You can find the list of available codemods [here](https://github.com/expressjs/codemod?tab=readme-ov-file#available-codemods). +You can find the list of available codemods [here](https://codemod.link/express).

Express 5에서의 변경사항

@@ -96,16 +96,16 @@ Express 5는 `app.del()` 함수를 더 이상 지원하지 않습니다. 이 함 `delete`는 JavaScript의 예약된 키워드이므로, 처음에는 `delete` 대신 `del`이 사용되었습니다. 그러나, ECMAScript 6을 기준으로, `delete` 및 다른 예약된 키워드를 정식 특성 이름으로 사용할 수 있게 되었습니다. -{% capture codemod-deprecated-signatures %} +{% capture codemod-route-del-to-delete %} You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod v4-deprecated-signatures +npx codemod@latest @expressjs/route-del-to-delete ``` {% endcapture %} -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-route-del-to-delete %} ```js // v4 @@ -137,7 +137,7 @@ app.delete('/user/:id', (req, res) => { You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod pluralized-methods +npx codemod@latest @expressjs/pluralize-method-names ``` {% endcapture %} @@ -178,7 +178,7 @@ app.all('/', (req, res) => { You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod req-param +npx codemod@latest @expressjs/explicit-request-params ``` {% endcapture %} @@ -209,7 +209,16 @@ app.post('/user', (req, res) => { Express 5는 `res.json(obj, status)` 시그니처를 더 이상 지원하지 않습니다. 대신, 상태를 설정한 후 이를 `res.status(status).json(obj)`과 같은 `res.json()` 메소드에 체인해야 합니다. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-status-send-order %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/status-send-order +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -227,7 +236,7 @@ app.post('/user', (req, res) => { Express 5는 `res.jsonp(obj, status)` 시그니처를 더 이상 지원하지 않습니다. 대신, 상태를 설정한 후 이를 `res.status(status).jsonp(obj)`와 같은 `res.jsonp()` 메소드에 체인해야 합니다. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -245,7 +254,16 @@ app.post('/user', (req, res) => { Express 5는 `res.send(obj, status)` 시그니처를 더 이상 지원하지 않습니다. 대신, 상태를 설정한 후 이를 `res.status(status).send(obj)`와 같은 `res.send()` 메소드에 체인해야 합니다. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-redirect-arg-order %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/redirect-arg-order +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-redirect-arg-order %} ```js // v4 @@ -263,16 +281,16 @@ app.get('/user', (req, res) => { Express 5 no longer supports the magic string `back` in the `res.redirect()` and `res.location()` methods. Instead, use the `req.get('Referrer') || '/'` value to redirect back to the previous page. In Express 4, the `res.redirect('back')` and `res.location('back')` methods were deprecated. -{% capture codemod-magic-redirect %} +{% capture codemod-back-redirect-deprecated %} You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod magic-redirect +npx codemod@latest @expressjs/back-redirect-deprecated ``` {% endcapture %} -{% include admonitions/note.html content=codemod-magic-redirect %} +{% include admonitions/note.html content=codemod-back-redirect-deprecated %} ```js // v4 @@ -290,7 +308,7 @@ app.get('/user', (req, res) => { Express 5 no longer supports the signature `res.send(obj, status)`. Instead, set the status and then chain it to the `res.send()` method like this: `res.status(status).send(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -309,7 +327,7 @@ app.get('/user', (req, res) => { Express 5는 \*`status`\*가 숫자인 res.send(status) 시그니처를 더 이상 지원하지 않습니다. 대신, HTTP 응답 헤더 상태 코드를 설정하고 해당 코드의 텍스트 버전("Not Found", "Internal Server Error" 등)을 전송하는 `res.sendStatus(statusCode)` 함수를 사용해야 합니다. `res.send()` 함수를 이용해 숫자를 전송해야 하는 경우, Express가 그 숫자를 지원되지 않는 구버전 시그니처 사용 시도로 해석하지 않도록 숫자의 앞뒤에 따옴표를 추가하여 숫자를 문자열로 변환하십시오. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -336,7 +354,16 @@ Express 5에서 `res.sendfile()` 함수는 낙타 대문자(camel-cased) 버전 - Font files (.woff): now "font/woff" instead of "application/font-woff" - SVG files (.svg): now "image/svg+xml" instead of "application/svg+xml" -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-camelcase-sendfile %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/camelcase-sendfile +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-camelcase-sendfile %} ```js // v4 diff --git a/pt-br/guide/migrating-5.md b/pt-br/guide/migrating-5.md index 32794931..1796ab58 100644 --- a/pt-br/guide/migrating-5.md +++ b/pt-br/guide/migrating-5.md @@ -37,16 +37,16 @@ To help you migrate your express server, we have created a set of codemods that Run the following command for run all the codemods available: ```sh -npx @expressjs/codemod upgrade +npx codemod@latest @expressjs/v5-migration-recipe ``` If you want to run a specific codemod, you can run the following command: ```sh -npx @expressjs/codemod name-of-the-codemod +npx codemod@latest @expressjs/name-of-the-codemod ``` -You can find the list of available codemods [here](https://github.com/expressjs/codemod?tab=readme-ov-file#available-codemods). +You can find the list of available codemods [here](https://codemod.link/express).

Mudanças no Express 5

@@ -112,16 +112,16 @@ palavra-chave reservada no JavaScript. Entretanto, a partir do ECMAScript 6, `delete` e outras palavras-chave reservadas podem legalmente ser usadas como nomes de propriedades. -{% capture codemod-deprecated-signatures %} -Você pode substituir as assinaturas obsoletas pelo seguinte comando: +{% capture codemod-route-del-to-delete %} +You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod v4-deprecated-signatures +npx codemod@latest @expressjs/route-del-to-delete ``` {% endcapture %} -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-route-del-to-delete %} ```js // v4 @@ -157,7 +157,7 @@ descontinuação. O Express 5 não os suporta mais de forma nenhuma: Express 5 You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod pluralized-methods +npx codemod@latest @expressjs/pluralize-method-names ``` {% endcapture %} @@ -206,7 +206,7 @@ Este é um método potencialmente confuso e perigoso de recuperação de dados d You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod req-param +npx codemod@latest @expressjs/explicit-request-params ``` {% endcapture %} @@ -239,7 +239,16 @@ O Express 5 não suporta mais a assinatura `res.json(obj, status)`. Ao invés disso, configure o status e então encadeie-o ao método `res.json()` assim: `res.status(status).json(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-status-send-order %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/status-send-order +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -258,7 +267,7 @@ app.post('/user', (req, res) => { O Express 5 não suporta mais a assinatura `res.jsonp(obj, status)`. Ao invés disso, configure o status e então encadeie-o ao método `res.jsonp()` assim: `res.status(status).jsonp(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -277,7 +286,16 @@ app.post('/user', (req, res) => { O Express 5 não suporta mais a assinatura `res.send(obj, status)`. Ao invés disso, configure o status e então encadeie-o ao método `res.send()` assim: `res.status(status).send(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-redirect-arg-order %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/redirect-arg-order +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-redirect-arg-order %} ```js // v4 @@ -295,16 +313,16 @@ app.get('/user', (req, res) => { Express 5 no longer supports the magic string `back` in the `res.redirect()` and `res.location()` methods. Instead, use the `req.get('Referrer') || '/'` value to redirect back to the previous page. In Express 4, the `res.redirect('back')` and `res.location('back')` methods were deprecated. -{% capture codemod-magic-redirect %} +{% capture codemod-back-redirect-deprecated %} You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod magic-redirect +npx codemod@latest @expressjs/back-redirect-deprecated ``` {% endcapture %} -{% include admonitions/note.html content=codemod-magic-redirect %} +{% include admonitions/note.html content=codemod-back-redirect-deprecated %} ```js // v4 @@ -322,7 +340,7 @@ app.get('/user', (req, res) => { Express 5 no longer supports the signature `res.send(obj, status)`. Instead, set the status and then chain it to the `res.send()` method like this: `res.status(status).send(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -350,7 +368,7 @@ converte-lo para um sequência de caracteres, para que o Express não o interprete como uma tentativa de usar a assinatura antiga não suportada. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -379,7 +397,16 @@ Express 5. - Font files (.woff): now "font/woff" instead of "application/font-woff" - SVG files (.svg): now "image/svg+xml" instead of "application/svg+xml" -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-camelcase-sendfile %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/camelcase-sendfile +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-camelcase-sendfile %} ```js // v4 diff --git a/zh-cn/guide/migrating-5.md b/zh-cn/guide/migrating-5.md index 02d36227..cf86a537 100644 --- a/zh-cn/guide/migrating-5.md +++ b/zh-cn/guide/migrating-5.md @@ -28,16 +28,16 @@ To help you migrate your express server, we have created a set of codemods that Run the following command for run all the codemods available: ```sh -npx @expressjs/codemod upgrade +npx codemod@latest @expressjs/v5-migration-recipe ``` If you want to run a specific codemod, you can run the following command: ```sh -npx @expressjs/codemod name-of-the-codemod +npx codemod@latest @expressjs/name-of-the-codemod ``` -You can find the list of available codemods [here](https://github.com/expressjs/codemod?tab=readme-ov-file#available-codemods). +You can find the list of available codemods [here](https://codemod.link/express).

Express 5 中的更改

@@ -96,16 +96,16 @@ Express 5 不再支持 `app.del()` 函数。如果使用此函数,将抛出错 最初之所以使用 `del` 而不是 `delete`,是因为 `delete` 是 JavaScript 中的保留关键字。但在 ECMAScript 6 时,`delete` 和其他保留关键字可以合法地用作属性名称。您可以在此阅读该讨论,这导致我们在此不推荐使用 `app.del` 函数。 However, as of ECMAScript 6, `delete` and other reserved keywords can legally be used as property names. -{% capture codemod-deprecated-signatures %} +{% capture codemod-route-del-to-delete %} You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod v4-deprecated-signatures +npx codemod@latest @expressjs/route-del-to-delete ``` {% endcapture %} -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-route-del-to-delete %} ```js // v4 @@ -137,7 +137,7 @@ The following method names have been pluralized. In Express 4, using the old met You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod pluralized-methods +npx codemod@latest @expressjs/pluralize-method-names ``` {% endcapture %} @@ -178,7 +178,7 @@ This potentially confusing and dangerous method of retrieving form data has been You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod req-param +npx codemod@latest @expressjs/explicit-request-params ``` {% endcapture %} @@ -209,7 +209,16 @@ app.post('/user', (req, res) => { Express 5 不再支持特征符 `res.json(obj, status)`。而是设置状态,然后将其链接到 `res.json()` 方法,如下所示:`res.status(status).json(obj)`。 Instead, set the status and then chain it to the `res.json()` method like this: `res.status(status).json(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-status-send-order %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/status-send-order +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -227,7 +236,7 @@ app.post('/user', (req, res) => { Express 5 不再支持特征符 `res.jsonp(obj, status)`。而是设置状态,然后将其链接到 `res.jsonp()` 方法,如下所示:`res.status(status).jsonp(obj)`。 Instead, set the status and then chain it to the `res.jsonp()` method like this: `res.status(status).jsonp(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -245,7 +254,16 @@ app.post('/user', (req, res) => { Express 5 no longer supports the signature `res.redirect(url, status)`. Instead, use the following signature: `res.redirect(status, url)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-redirect-arg-order %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/redirect-arg-order +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-redirect-arg-order %} ```js // v4 @@ -263,16 +281,16 @@ app.get('/user', (req, res) => { Express 5 no longer supports the magic string `back` in the `res.redirect()` and `res.location()` methods. Instead, use the `req.get('Referrer') || '/'` value to redirect back to the previous page. In Express 4, the `res.redirect('back')` and `res.location('back')` methods were deprecated. -{% capture codemod-magic-redirect %} +{% capture codemod-back-redirect-deprecated %} You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod magic-redirect +npx codemod@latest @expressjs/back-redirect-deprecated ``` {% endcapture %} -{% include admonitions/note.html content=codemod-magic-redirect %} +{% include admonitions/note.html content=codemod-back-redirect-deprecated %} ```js // v4 @@ -290,7 +308,7 @@ app.get('/user', (req, res) => { Express 5 不再支持特征符 `res.send(obj, status)`。而是设置状态,然后将其链接到 `res.send()` 方法,如下所示:`res.status(status).send(obj)`。 Instead, set the status and then chain it to the `res.send()` method like this: `res.status(status).send(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -309,7 +327,7 @@ app.get('/user', (req, res) => { Express 5 no longer supports the signature `res.send(status)`, where `status` is a number. Instead, use the `res.sendStatus(statusCode)` function, which sets the HTTP response header status code and sends the text version of the code: "Not Found", "Internal Server Error", and so on. If you need to send a number by using the `res.send()` function, quote the number to convert it to a string, so that Express does not interpret it as an attempt to use the unsupported old signature. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -336,7 +354,16 @@ app.get('/user', (req, res) => { - Font files (.woff): now "font/woff" instead of "application/font-woff" - SVG files (.svg): now "image/svg+xml" instead of "application/svg+xml" -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-camelcase-sendfile %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/camelcase-sendfile +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-camelcase-sendfile %} ```js // v4 diff --git a/zh-tw/guide/migrating-5.md b/zh-tw/guide/migrating-5.md index a85c65ab..809ebdb9 100644 --- a/zh-tw/guide/migrating-5.md +++ b/zh-tw/guide/migrating-5.md @@ -28,16 +28,16 @@ To help you migrate your express server, we have created a set of codemods that Run the following command for run all the codemods available: ```sh -npx @expressjs/codemod upgrade +npx codemod@latest @expressjs/v5-migration-recipe ``` If you want to run a specific codemod, you can run the following command: ```sh -npx @expressjs/codemod name-of-the-codemod +npx codemod@latest @expressjs/name-of-the-codemod ``` -You can find the list of available codemods [here](https://github.com/expressjs/codemod?tab=readme-ov-file#available-codemods). +You can find the list of available codemods [here](https://codemod.link/express).

Express 5 中的變更

@@ -96,16 +96,16 @@ Express 5 no longer supports the `app.del()` function. If you use this function, 最初是使用 `del` 而非 `delete`,因為 `delete` 是 JavaScript 中的保留關鍵字。不過,從 ECMAScript 6 起,`delete` 和其他保留關鍵字可以合法作為內容名稱。您可以在這裡閱讀導致淘汰 `app.del` 函數的相關討論。 However, as of ECMAScript 6, `delete` and other reserved keywords can legally be used as property names. -{% capture codemod-deprecated-signatures %} +{% capture codemod-route-del-to-delete %} You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod v4-deprecated-signatures +npx codemod@latest @expressjs/route-del-to-delete ``` {% endcapture %} -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-route-del-to-delete %} ```js // v4 @@ -137,7 +137,7 @@ The following method names have been pluralized. In Express 4, using the old met You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod pluralized-methods +npx codemod@latest @expressjs/pluralize-method-names ``` {% endcapture %} @@ -178,7 +178,7 @@ This potentially confusing and dangerous method of retrieving form data has been You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod req-param +npx codemod@latest @expressjs/explicit-request-params ``` {% endcapture %} @@ -209,7 +209,16 @@ app.post('/user', (req, res) => { Express 5 不再支援 `res.json(obj, status)` 簽章。請改以設定狀態,然後與 `res.json()` 方法鏈接,如下所示:`res.status(status).json(obj)`。 Instead, set the status and then chain it to the `res.json()` method like this: `res.status(status).json(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-status-send-order %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/status-send-order +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -227,7 +236,7 @@ app.post('/user', (req, res) => { Express 5 不再支援 `res.jsonp(obj, status)` 簽章。請改以設定狀態,然後與 `res.jsonp()` 方法鏈接,如下所示:`res.status(status).jsonp(obj)`。 Instead, set the status and then chain it to the `res.jsonp()` method like this: `res.status(status).jsonp(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -245,7 +254,16 @@ app.post('/user', (req, res) => { Express 5 no longer supports the signature `res.redirect(url, status)`. Instead, use the following signature: `res.redirect(status, url)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-redirect-arg-order %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/redirect-arg-order +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-redirect-arg-order %} ```js // v4 @@ -263,16 +281,16 @@ app.get('/user', (req, res) => { Express 5 no longer supports the magic string `back` in the `res.redirect()` and `res.location()` methods. Instead, use the `req.get('Referrer') || '/'` value to redirect back to the previous page. In Express 4, the `res.redirect('back')` and `res.location('back')` methods were deprecated. -{% capture codemod-magic-redirect %} +{% capture codemod-back-redirect-deprecated %} You can replace the deprecated signatures with the following command: ```plain-text -npx @expressjs/codemod magic-redirect +npx codemod@latest @expressjs/back-redirect-deprecated ``` {% endcapture %} -{% include admonitions/note.html content=codemod-magic-redirect %} +{% include admonitions/note.html content=codemod-back-redirect-deprecated %} ```js // v4 @@ -290,7 +308,7 @@ app.get('/user', (req, res) => { Express 5 不再支援 `res.send(obj, status)` 簽章。請改以設定狀態,然後與 `res.send()` 方法鏈接,如下所示:`res.status(status).send(obj)`。 Instead, set the status and then chain it to the `res.send()` method like this: `res.status(status).send(obj)`. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -310,7 +328,7 @@ Express 5 不再支援 res.send(status) 簽章,其中 _` 如果您需要使用 `res.send()` 函數來傳送數字,請將數字括上引號來轉換成字串,這樣 Express 就不會解譯它以試圖使用不支援的舊簽章。 Instead, use the `res.sendStatus(statusCode)` function, which sets the HTTP response header status code and sends the text version of the code: "Not Found", "Internal Server Error", and so on. If you need to send a number by using the `res.send()` function, quote the number to convert it to a string, so that Express does not interpret it as an attempt to use the unsupported old signature. -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% include admonitions/note.html content=codemod-status-send-order %} ```js // v4 @@ -337,7 +355,16 @@ app.get('/user', (req, res) => { - Font files (.woff): now "font/woff" instead of "application/font-woff" - SVG files (.svg): now "image/svg+xml" instead of "application/svg+xml" -{% include admonitions/note.html content=codemod-deprecated-signatures %} +{% capture codemod-camelcase-sendfile %} +You can replace the deprecated signatures with the following command: + +```plain-text +npx codemod@latest @expressjs/camelcase-sendfile +``` + +{% endcapture %} + +{% include admonitions/note.html content=codemod-camelcase-sendfile %} ```js // v4