-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 885f08b
Showing
15 changed files
with
492 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# http://editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
max_line_length = 100 | ||
indent_brace_style = 1TBS | ||
spaces_around_operators = true | ||
quote_type = auto | ||
|
||
[package.json] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: npm | ||
directory: '/' | ||
schedule: | ||
interval: daily | ||
- package-ecosystem: 'github-actions' | ||
directory: '/' | ||
schedule: | ||
# Check for updates to GitHub Actions every weekday | ||
interval: 'daily' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: main | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
contributors: | ||
if: "${{ github.event.head_commit.message != 'build: contributors' }}" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
- name: Contributors | ||
run: | | ||
git config --global user.email ${{ secrets.GIT_EMAIL }} | ||
git config --global user.name ${{ secrets.GIT_USERNAME }} | ||
npm run contributors | ||
- name: Push changes | ||
run: | | ||
git push origin ${{ github.head_ref }} | ||
release: | ||
if: | | ||
!startsWith(github.event.head_commit.message, 'chore(release):') && | ||
!startsWith(github.event.head_commit.message, 'docs:') && | ||
!startsWith(github.event.head_commit.message, 'ci:') | ||
needs: [contributors] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
- name: Setup PNPM | ||
uses: pnpm/action-setup@v4 | ||
with: | ||
version: latest | ||
run_install: true | ||
- name: Test | ||
run: pnpm test | ||
- name: Report | ||
run: npx c8 report --reporter=text-lcov > coverage/lcov.info | ||
- name: Coverage | ||
uses: coverallsapp/github-action@main | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Release | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: | | ||
git config --global user.email ${{ secrets.GIT_EMAIL }} | ||
git config --global user.name ${{ secrets.GIT_USERNAME }} | ||
git pull origin master | ||
pnpm run release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: pull_request | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
test: | ||
if: github.ref != 'refs/heads/master' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
- name: Setup PNPM | ||
uses: pnpm/action-setup@v4 | ||
with: | ||
version: latest | ||
run_install: true | ||
- name: Test | ||
run: pnpm test | ||
- name: Report | ||
run: npx c8 report --reporter=text-lcov > coverage/lcov.info | ||
- name: Coverage | ||
uses: coverallsapp/github-action@main | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
############################ | ||
# npm | ||
############################ | ||
node_modules | ||
npm-debug.log | ||
|
||
############################ | ||
# tmp, editor & OS files | ||
############################ | ||
.tmp | ||
*.swo | ||
*.swp | ||
*.swn | ||
*.swm | ||
.DS_Store | ||
*# | ||
*~ | ||
.idea | ||
*sublime* | ||
nbproject | ||
|
||
############################ | ||
# Tests | ||
############################ | ||
testApp | ||
coverage | ||
.nyc_output | ||
|
||
############################ | ||
# Other | ||
############################ | ||
.node_history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.idea | ||
.project | ||
*.sublime-* | ||
.DS_Store | ||
*.seed | ||
*.log | ||
*.csv | ||
*.dat | ||
*.out | ||
*.pid | ||
*.swp | ||
*.swo | ||
node_modules | ||
coverage | ||
*.tgz | ||
*.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
unsafe-perm=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright © 2024 Vercel | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# vercel-open | ||
|
||
The `vercel-open` command is an extension for Vercel CLI | ||
|
||
## Installation | ||
|
||
``` | ||
npm install -g vercel-open | ||
``` | ||
|
||
## Usage | ||
|
||
Assuming your terminal is pointing in a local vercel project: | ||
|
||
``` | ||
vc open # open the vercel dahboard for the current project | ||
vc open logs # open logs of the project | ||
vc open logs --timeline=maximum # any query parameter is supported | ||
``` | ||
|
||
Additionally, you can specify the project open: | ||
|
||
``` | ||
vc open vercel/v0 logs # will open `https://vercel.com/vercel/v0/logs` in the browser | ||
``` | ||
|
||
Also `vc open info` will print revelant information about your project: | ||
|
||
``` | ||
> vc open info | ||
▲ overview https://vercel.com/vercel/v0/ | ||
▲ latest (production) https://vercel.com/vercel/v0/2fVgMqXL3km1nAwqg7aAR58gtt1A/ | ||
▲ latest (preview) https://vercel.com/vercel/v0/UhnKLjQb7SDaLFT2GBM2eVwLUsdE/ | ||
``` | ||
|
||
## License | ||
|
||
**vercel-open** © [Vercel](https://vercel.com), released under the [MIT](https://github.com/microlink/microlink-function/blob/master/LICENSE.md) License.<br> | ||
|
||
> [vercel.com](https://vercel.com) · GitHub [vercel](https://github.com/vercel) · X [@vercel](https://x.com/vercel) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import openBrowser from 'open' | ||
import mri from 'mri' | ||
import pc from 'picocolors' | ||
|
||
import { | ||
getSlugAndSection, | ||
getLatestDeployment, | ||
getProductionDeployment | ||
} from '../src' | ||
|
||
async function main () { | ||
const { _: args, ...flags } = mri(process.argv.slice(2)) | ||
|
||
const { org, project, section } = await getSlugAndSection({ args }) | ||
|
||
if (section === 'info') { | ||
const latestDeployment = await getLatestDeployment() | ||
const productionDeployment = await getProductionDeployment() | ||
|
||
console.log( | ||
pc.black( | ||
[ | ||
'', | ||
`${pc.white('▲ overview')} https://vercel.com/${org}/${project}/`, | ||
`${pc.white('▲ latest (production)')} https://vercel.com/${org}/${project}/${latestDeployment}/`, | ||
`${pc.white('▲ latest (preview)')} https://vercel.com/${org}/${project}/${productionDeployment}/` | ||
].join('\n') | ||
) | ||
) | ||
} else { | ||
const url = new URL(`${org}/${project}/${section}`, 'https://vercel.com/') | ||
url.search = new URLSearchParams(flags).toString() | ||
|
||
await openBrowser(url.toString()) | ||
} | ||
} | ||
|
||
main() | ||
.then(() => { | ||
process.exit(0) | ||
}) | ||
.catch(err => { | ||
console.error(err) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{ | ||
"name": "vercel-open", | ||
"version": "1.0.0", | ||
"preferGlobal": true, | ||
"type": "module", | ||
"bin": { | ||
"vercel-open": "bin/index.js" | ||
}, | ||
"scripts": { | ||
"build": "tsup --format esm bin/index.ts -d bin/", | ||
"test": "vitest", | ||
"contributors": "(npx git-authors-cli && npx finepack && git add package.json && git commit -m 'build: contributors' --no-verify) || true", | ||
"postrelease": "npm run release:tags && npm run release:github && (ci-publish || npm publish --access=public)", | ||
"release:github": "github-generate-release", | ||
"release:tags": "git push --follow-tags origin HEAD:master", | ||
"release": "standard-version -a" | ||
}, | ||
"author": "Kiko Beats", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@commitlint/cli": "latest", | ||
"@commitlint/config-conventional": "latest", | ||
"@ksmithut/prettier-standard": "latest", | ||
"ci-publish": "latest", | ||
"finepack": "latest", | ||
"git-authors-cli": "latest", | ||
"github-generate-release": "latest", | ||
"nano-staged": "latest", | ||
"simple-git-hooks": "latest", | ||
"standard-version": "latest", | ||
"ts-standard": "latest", | ||
"vitest": "latest" | ||
}, | ||
"dependencies": { | ||
"arg": "~5.0.2", | ||
"got": "11", | ||
"mri": "~1.2.0", | ||
"node-fetch": "2", | ||
"open": "~10.1.0", | ||
"picocolors": "~1.1.1", | ||
"typescript": "~5.7.2" | ||
}, | ||
"commitlint": { | ||
"extends": [ | ||
"@commitlint/config-conventional" | ||
] | ||
}, | ||
"nano-staged": { | ||
"*.js": [ | ||
"prettier-standard", | ||
"ts-standard --fix" | ||
], | ||
"package.json": [ | ||
"finepack" | ||
] | ||
}, | ||
"simple-git-hooks": { | ||
"commit-msg": "npx commitlint --edit", | ||
"pre-commit": "npx nano-staged" | ||
} | ||
} |
Oops, something went wrong.