mirror of
https://github.com/peter-evans/create-pull-request.git
synced 2026-12-05 05:02:57 +00:00
refactor: replace uuid dep with Node.js built-in crypto.randomUUID (#4377)
Replace the third-party `uuid` package with the native `crypto.randomUUID()`
function available in Node.js, reducing the bundle size and external
dependencies.
- Remove `uuid` from `dependencies` in `package.json`
- Replace `import {v4 as uuidv4} from 'uuid'` with `import {randomUUID} from 'crypto'` in `src/create-or-update-branch.ts`
- Replace all `uuidv4()` calls with `randomUUID()` in `__test__/create-or-update-branch.int.test.ts`
- Rebuild `dist/index.js`, removing ~680 lines of bundled `uuid` library code
- Update `package-lock.json` to reflect removed dependency
This commit is contained in:
1 parent
d8c15c739f
commit
aa523f9db6
5 files changed
+94
-776
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import * as core from '@actions/core'
|
||||
import {randomUUID} from 'crypto'
|
||||
import {GitCommandManager, Commit} from './git-command-manager'
|
||||
import {v4 as uuidv4} from 'uuid'
|
||||
import * as utils from './utils'
|
||||
|
||||
const CHERRYPICK_EMPTY =
|
||||
@@ -189,7 +189,7 @@ export async function createOrUpdateBranch(
|
||||
const baseRemote = 'origin'
|
||||
|
||||
// Save the working base changes to a temporary branch
|
||||
const tempBranch = uuidv4()
|
||||
const tempBranch = randomUUID()
|
||||
await git.checkout(tempBranch, 'HEAD')
|
||||
// Commit any uncommitted changes
|
||||
if (await git.isDirty(true, addPaths)) {
|
||||
|
||||
Reference in new issue
Block a user