Skip to content

Commit

Permalink
lol this is silly but it works
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharthkp committed Mar 25, 2022
1 parent 826ca12 commit 2f07c80
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions packages/babel-plugin-open-source/github-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ const ini = require('ini');

const getGitHubUrl = (localFilePath, lineNumber) => {
if (process.env.VERCEL) {
// TODO: I bet I'll regret hardcoding this
const gitRoot = '/vercel/path0/';

const repo = process.env.VERCEL_GIT_REPO_OWNER + '/' + process.env.VERCEL_GIT_REPO_SLUG;
const filePath = localFilePath.replace(gitRoot, '');

// TODO: I bet I'll regret hardcoding this
const filePath = localFilePath
.replace('/vercel/path0/', '')
.replace('/vercel/path1/', '')
.replace('/vercel/path2/', '')
.replace('/vercel/path3/', '')
.replace('/vercel/path4/', '');

// TODO: replace with ci-env
const branchName = process.env.VERCEL_GIT_COMMIT_REF || 'main';
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-plugin-open-source/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babel-plugin-open-source",
"version": "1.3.0",
"version": "1.3.1",
"description": "Alt + Click on rendered JSX to open it's source code in VSCode",
"main": "babel.js",
"keywords": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"react-dom": "17.0.2"
},
"devDependencies": {
"babel-plugin-open-source": "1.3.0",
"babel-plugin-open-source": "1.3.1",
"dotenv": "^16.0.0",
"eslint": "7.32.0",
"eslint-config-next": "11.1.2",
Expand Down

1 comment on commit 2f07c80

@vercel
Copy link

@vercel vercel bot commented on 2f07c80 Mar 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.