@dmno/vercel-platform

0.0.3 • Public • Published

Check out the docs for more information on how to use DMNO with Vercel.

If you have any questions, please reach out to us on Discord.


@dmno/vercel-platform npm

This package provides a set of prebuilt types and environment variables for Vercel.

Installation

npm add @dmno/vercel-platform

Example Usage

import { defineDmnoService, switchBy, pickFromSchemaObject } from 'dmno';
import { VercelEnvSchema } from '@dmno/vercel-platform';

export default defineDmnoService({
  schema: {
    ...pickFromSchemaObject(VercelEnvSchema, 'VERCEL_ENV', 'VERCEL_GIT_COMMIT_REF'),
    // example of adding more specificity/control over env flag using vercel's env vars
    APP_ENV: {
      value: () => {
        if (DMNO_CONFIG.VERCEL_ENV === 'production') return 'production';
        if (DMNO_CONFIG.VERCEL_ENV === 'preview') {
          if (DMNO_CONFIG.VERCEL_GIT_COMMIT_REF === 'staging') return 'staging';
          else return 'preview';
        }
        return 'development';
      },
    },
  },
});

Package Sidebar

Install

npm i @dmno/vercel-platform

Weekly Downloads

9

Version

0.0.3

License

MIT

Unpacked Size

22.1 kB

Total Files

6

Last publish

Collaborators

  • theo
  • philmillman