Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

85
Visualizações
Order of fields in package.json?

Recently I made a PR to a repo to add a typings field in package.json, and the maintainer proposed the following change:

-   "typings": "./src/index.d.ts",
-   "main": "./src/index.js",
-   "exports": "./src/index.js",
+   "main": "./src/index.js",
+   "exports": "./src/index.js",
+   "types": "./src/index.d.ts",

I wonder if there is a recommended rule or convention of orders of entries in package.json.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It could be that the maintainer has a formating tool enabled like prettier that automatically sorts the package.json file. Or maybe they just like ordering their scripts in order of execution. Either way it's a json object so ultimately the order of the fields does not matter, just the nesting.

Another thought is they could be using a special batch or shell script that hand cranks the package.json during CD, converting the scripts object to an array that gets run in order of execution. Without seeing the github I can't be sure though.

https://www.npmjs.com/package/prettier-package-json

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda