JSPM

@code-pushup/models

0.65.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7939
  • Score
    100M100P100Q144054F
  • License MIT

Model definitions and validators for the Code PushUp CLI

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@code-pushup/models) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    @code-pushup/models

    npm downloads dependencies

    Model definitions and validators for the Code PushUp CLI.

    For a full list of models defined by this package, see the auto-generated Code PushUp models reference.

    Setup

    If you've already installed another @code-pushup/* package, then you may have already installed @code-pushup/models indirectly.

    If not, you can always install it separately:

    npm install --save-dev @code-pushup/models
    yarn add --dev @code-pushup/models
    pnpm add --save-dev @code-pushup/models

    Usage

    Import the type definitions if using TypeScript:

    • in code-pushup.config.ts:

      import type { CoreConfig } from '@code-pushup/models';
      
      export default {
        // ... this is type-checked ...
      } satisfies CoreConfig;
    • in custom plugin:

      import type { PluginConfig } from '@code-pushup/models';
      
      export default function myCustomPlugin(): PluginConfig {
        return {
          // ... this is type-checked ...
        };
      }
      import type { AuditOutput } from '@code-pushup/models';
      
      async function myCustomPluginRunner() {
        const audits: AuditOutput[] = await collectAudits();
      
        await writeFile(RUNNER_OUTPUT_FILE, JSON.strinfigy(audits));
      }

    If you need runtime validation, use the underlying Zod schemas:

    import { coreConfigSchema } from '@code-pushup/models';
    
    const json = JSON.parse(readFileSync('code-pushup.config.json'));
    const config = coreConfigSchema.parse(json); // throws ZodError if invalid