Skip to content

Commit

Permalink
fix: remove vulnerable dependency (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
crutchcorn authored Jan 13, 2025
1 parent afac7f8 commit 0e74550
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 135 deletions.
2 changes: 0 additions & 2 deletions packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
"@eslint/js": "^9.18.0",
"@stylistic/eslint-plugin-js": "^2.13.0",
"commander": "^13.0.0",
"current-git-branch": "^1.1.0",
"esbuild-register": "^3.6.0",
"eslint-plugin-import-x": "^4.6.1",
"eslint-plugin-n": "^17.15.1",
Expand All @@ -86,7 +85,6 @@
"vue-eslint-parser": "^9.4.3"
},
"devDependencies": {
"@types/current-git-branch": "^1.1.6",
"@types/eslint": "^9.6.1",
"@types/interpret": "^1.1.3",
"@types/jsonfile": "^6.1.4",
Expand Down
25 changes: 24 additions & 1 deletion packages/config/src/publish/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import path from 'node:path'
import { execSync } from 'node:child_process'
import { existsSync, readdirSync } from 'node:fs'
import { platform } from 'node:os'
import * as semver from 'semver'
import currentGitBranch from 'current-git-branch'
import { parse as parseCommit } from '@commitlint/parse'
import { simpleGit } from 'simple-git'
import {
Expand All @@ -16,6 +16,29 @@ import {
updatePackageJson,
} from './utils.js'

function currentGitBranch() {
let stdout

try {
let cmd = ''

if (platform() === 'win32') {
cmd = `git branch | findstr \\*`
} else {
cmd = `git branch | grep \\*`
}

stdout = execSync(cmd).toString()
} catch (e) {
console.error(e)
return false
}

const branchName = stdout.slice(2, stdout.length).trim()

return branchName
}

/**
* Execute a script being published
* @param {import('./index.js').Options} options
Expand Down
Loading

0 comments on commit 0e74550

Please sign in to comment.