0.0.3 • Published 10 months ago

@dmno/vercel-platform v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

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';
      },
    },
  },
});
0.0.3

10 months ago

0.0.2

1 year ago

0.0.1

1 year ago