Skip to content

Commit

Permalink
chore: add postinstall message
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Dec 13, 2024
1 parent 1fca46e commit b7234ea
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 6 deletions.
28 changes: 23 additions & 5 deletions bin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import openBrowser from 'open'
import pc from 'picocolors'
import mri from 'mri'

const { white, black } = pc

import {
vercelUrl,
getSlugAndSection,
Expand All @@ -16,6 +18,22 @@ async function main () {
const { org, project, section } = await getSlugAndSection({ args })

switch (section) {
case 'help': {
console.log(
[
'',
' Usage:',
` ${white('vc open')} [${white('current')}|${white('latest')}] [${white('--visit')}]`,
'',
' Jump to any section:',
` ${white('vc open')} [${white('current')}|${white('latest')}] <${white('logs')}|${white('settings')}|${white('etc')}> [${white('--query-parameter')}]`
]
.map(line => black(line))
.join('\n')
)
break
}

case 'latest': {
const { id, url: deploymentUrl } = await getLatestDeployment()
const url = visit ? deploymentUrl : vercelUrl({ org, project, section: id, flags })
Expand All @@ -28,17 +46,17 @@ async function main () {
}
case 'info': {
const { id: latestId } = await getLatestDeployment()
const { id: currentId} = await getProductionDeployment()
const { id: currentId } = await getProductionDeployment()

console.log(
pc.black(
black(
[
'',
`${pc.white('▲ overview')} https://vercel.com/${org}/${project}/`,
`${pc.white(
`${white('▲ overview')} https://vercel.com/${org}/${project}/`,
`${white(
'▲ current (production)'
)} https://vercel.com/${org}/${project}/${currentId}/`,
`${pc.white(
`${white(
'▲ latest (preview)'
)} https://vercel.com/${org}/${project}/${latestId}/`
].join('\n')
Expand Down
10 changes: 10 additions & 0 deletions bin/welcome.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import pc from 'picocolors'

console.log(
[
pc.black(`✨ ${pc.white('vercel-open')} installed ✨`),
pc.black(`For using it, just type '${pc.white('vc open')}' or '${pc.white('vercel open')}' in your terminal`),
'',
pc.black(`Type '${pc.white('vc open help')}' to learn about the command`)
].join('\n')
)
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@
"vitest": "latest"
},
"files": [
"bin/index.js"
"bin/index.js",
"bin/welcome.mjs"
],
"scripts": {
"build": "tsup --format esm bin/index.ts -d bin/",
"contributors": "(npx git-authors-cli && npx finepack && git add package.json && git commit -m 'build: contributors' --no-verify) || true",
"postinstall": "node bin/welcome.mjs",
"postrelease": "npm run release:tags && npm run release:github && (ci-publish || npm publish --access=public)",
"prepublishOnly": "npm run build",
"release": "standard-version -a",
Expand Down

0 comments on commit b7234ea

Please sign in to comment.