compatx
🌴 Gradual feature flags.
Last updated 2 years ago by pi0 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install compatx 
SYNC missed versions from official npm registry.

compatx

npm version npm downloads

???? Compatibility toolkit.

[!NOTE] This is a WIP toolkit. See RFC for initial motivations.

Install

# ✨ Auto-detect
npx nypm install -D compatx

# npm
npm install -D compatx

# yarn
yarn add -D compatx

# pnpm
pnpm install -D compatx

# bun
bun install -D compatx

Utils

formatCompatibilityDate(input)

Format compatibility date spec to a string

formatDate(date)

Format a date to a YYYY-MM-DD string

Example:

formatDateString(new Date("2021/01/01")) // "2021-01-01"

getCompatibilityChanges(allUpdates, compatibilityDate1, compatibilityDate2)

Get compatibility changes between two dates.

getCompatibilityUpdates(allUpdates, compatibilityDate)

Get compatibility updates applicable for the user given platform and date range.

platforms

  • Type: array
  • Default: ["aws","azure","cloudflare","deno","firebase","netlify","vercel"]

resolveCompatibilityDates(input?, defaults?)

Normalize the compatibility dates from input config and defaults.

resolveCompatibilityDatesFromEnv(overridesInput?)

Resolve compatibility dates with environment variables as defaults.

Environment variable name format is COMPATIBILITY_DATE for default and COMPATIBILITY_DATE_<PLATFORM> for specific platforms.

Types

import type {
  // Typed date string in `YYYY-MM-DD` format
  DateString,
  // Platform names
  PlatformName,
  // Compatibility dates
  CompatibilityDateSpec,
  CompatibilityDates,
  // Compatibility updates
  CompatibilityUpdate,
  CompatibilityUpdates
} from "./types";

Development

  • Clone this repository
  • Install latest LTS version of Node.js
  • Enable Corepack using corepack enable
  • Install dependencies using pnpm install
  • Run interactive tests using pnpm dev

License

Made with ????

Published under MIT License.

Current Tags

  • 0.1.8                                ...           latest (2 years ago)

10 Versions

  • 0.1.8                                ...           2 years ago
  • 0.1.7                                ...           2 years ago
  • 0.1.6                                ...           2 years ago
  • 0.1.5                                ...           2 years ago
  • 0.1.4                                ...           2 years ago
  • 0.1.3                                ...           2 years ago
  • 0.1.2                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
  • 0.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 1
Dependencies (0)
None
Dev Dependencies (11)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |