Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

480 B
Raw Blame
const ORDER = ['production', 'staging', 'development'];

const rank = name => {
  const index = ORDER.indexOf(String(name).toLowerCase());
  return index === -1 ? ORDER.length : index;
};

/**
 * Sort order of environment names: production, staging, and development first, then the others by name.
 * Environment::compareNames() has the same order for the project page.
 */
export const compareEnvironmentNames = (a, b) => rank(a) - rank(b) || String(a).localeCompare(String(b));