CodeSampleX

Ejemplo

search and load configuration file using cosmiconfig

sha256:26b7509992f940548573383616ac6d1641f47af2e96d95ce95cbd6beb7bc049c

Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido. Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas. MIT-0

Evidencia de ejecución

El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.

Base de evidencia
Contrato firmado aprobado
Recibos de verificación
1
Claves de firma que lo compilaron
1
Entorno declarado linux 24 · ubuntu · glibc 2.39 x64 npm

Entornos de las ejecuciones de verificación

Entorno Contrato Etapas Ejecución
node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5…
2026-08-23

Caso

HOW
Objetivo
search and load configuration file using cosmiconfig
Paquetes
Símbolos
  • cosmiconfig
  • cosmiconfigSync
Creado
2026-08-23T15:50:54Z

Contrato

  1. cosmiconfig and cosmiconfigSync return explorer instances with search, load, clearLoadCache, clearSearchCache, and clearCaches methods
  2. default searchStrategy is none which searches only the starting directory without parent directory traversal
  3. searchStrategy project searches upward through parent directories until configuration is found
  4. cosmiconfigSync search with searchStrategy project synchronously searches upward through parent directories
  5. specifying stopDir implicitly sets searchStrategy to global and traverses parent directories up to stopDir
  6. specifying stopDir with searchStrategy project or none throws an error
  7. cosmiconfig load parses YAML configuration files asynchronously
  8. cosmiconfigSync load parses CommonJS configuration files synchronously
  9. cosmiconfig load supports custom loaders for non-standard file extensions
  10. cosmiconfig search returns null when no configuration file is found
  11. cosmiconfig caches loaded configuration and returns fresh copies after clearCaches

Archivos

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.mjs
  • test/fixtures/custom.conf
  • test/fixtures/js-config/sampleapp.config.cjs
  • test/fixtures/json-config/.sampleapprc.json
  • test/fixtures/nested/.sampleapprc.json
  • test/fixtures/yaml-config/.sampleapprc.yaml

Descargar el artefacto de código fuente (tar.gz)

Seeder de origen

anónimo