1
0
mirror of synced 2025-12-21 10:57:10 -05:00
Files
docs/script/deployment/create-staging-app-name.js
Kevin Heis b29e37318a Remove import x statements (#20594)
* Clear out most import x

* Update rimraf use

* Move up readme blocks in scripts
2021-07-29 20:28:30 +00:00

20 lines
519 B
JavaScript

#!/usr/bin/env node
import GithubSlugger from 'github-slugger'
const slugify = GithubSlugger.slug
const APP_NAME_MAX_LENGTH = 30
export default function ({ repo, pullNumber, branch }) {
return (
`${repo}-${pullNumber}--${slugify(branch)}`
// Shorten the string to the max allowed length
.slice(0, APP_NAME_MAX_LENGTH)
// Convert underscores to dashes
.replace(/_/g, '-')
// Remove trailing dashes
.replace(/-+$/, '')
// Make it all lowercase
.toLowerCase()
)
}