fix(deps): update dependency simple-git to v3 [security] (#6305)

This commit is contained in:
renovate[bot] 2022-03-28 11:16:07 +00:00 committed by GitHub
parent 6c535320da
commit e99710116d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 19 deletions

View File

@ -1,5 +1,5 @@
const path = require('path'); const path = require('path');
const simpleGit = require('simple-git/promise'); const { default: simpleGit } = require('simple-git');
const GIT_SSH_COMMAND = 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'; const GIT_SSH_COMMAND = 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no';
const GIT_SSL_NO_VERIFY = true; const GIT_SSL_NO_VERIFY = true;

View File

@ -157,7 +157,7 @@
"react-test-renderer": "^16.8.4", "react-test-renderer": "^16.8.4",
"rehype": "^7.0.0", "rehype": "^7.0.0",
"rimraf": "^3.0.0", "rimraf": "^3.0.0",
"simple-git": "^2.0.0", "simple-git": "^3.0.0",
"start-server-and-test": "^1.7.11", "start-server-and-test": "^1.7.11",
"stylelint": "^14.5.3", "stylelint": "^14.5.3",
"stylelint-config-standard-scss": "^3.0.0", "stylelint-config-standard-scss": "^3.0.0",

View File

@ -28,7 +28,7 @@
"dotenv": "^10.0.0", "dotenv": "^10.0.0",
"express": "^4.17.1", "express": "^4.17.1",
"morgan": "^1.9.1", "morgan": "^1.9.1",
"simple-git": "^2.0.0", "simple-git": "^3.0.0",
"what-the-diff": "^0.6.0", "what-the-diff": "^0.6.0",
"winston": "^3.3.3" "winston": "^3.3.3"
}, },

View File

@ -7,7 +7,7 @@ import type Joi from '@hapi/joi';
import type express from 'express'; import type express from 'express';
jest.mock('netlify-cms-lib-util', () => jest.fn()); jest.mock('netlify-cms-lib-util', () => jest.fn());
jest.mock('simple-git/promise'); jest.mock('simple-git');
function assetFailure(result: Joi.ValidationResult, expectedMessage: string) { function assetFailure(result: Joi.ValidationResult, expectedMessage: string) {
const { error } = result; const { error } = result;
@ -22,7 +22,7 @@ const defaultParams = {
}; };
describe('localGitMiddleware', () => { describe('localGitMiddleware', () => {
const simpleGit = require('simple-git/promise'); const simpleGit = require('simple-git');
const git = { const git = {
checkIsRepo: jest.fn(), checkIsRepo: jest.fn(),

View File

@ -10,7 +10,7 @@ import {
parseContentKey, parseContentKey,
} from 'netlify-cms-lib-util/src/APIUtils'; } from 'netlify-cms-lib-util/src/APIUtils';
import { parse } from 'what-the-diff'; import { parse } from 'what-the-diff';
import simpleGit from 'simple-git/promise'; import simpleGit from 'simple-git';
import { Mutex, withTimeout } from 'async-mutex'; import { Mutex, withTimeout } from 'async-mutex';
import { defaultSchema, joi } from '../joi'; import { defaultSchema, joi } from '../joi';
@ -40,8 +40,9 @@ import type {
} from '../types'; } from '../types';
import type express from 'express'; import type express from 'express';
import type winston from 'winston'; import type winston from 'winston';
import type { SimpleGit } from 'simple-git';
async function commit(git: simpleGit.SimpleGit, commitMessage: string) { async function commit(git: SimpleGit, commitMessage: string) {
await git.add('.'); await git.add('.');
await git.commit(commitMessage, undefined, { await git.commit(commitMessage, undefined, {
// setting the value to a string passes name=value // setting the value to a string passes name=value
@ -51,12 +52,12 @@ async function commit(git: simpleGit.SimpleGit, commitMessage: string) {
}); });
} }
async function getCurrentBranch(git: simpleGit.SimpleGit) { async function getCurrentBranch(git: SimpleGit) {
const currentBranch = await git.branchLocal().then(summary => summary.current); const currentBranch = await git.branchLocal().then(summary => summary.current);
return currentBranch; return currentBranch;
} }
async function runOnBranch<T>(git: simpleGit.SimpleGit, branch: string, func: () => Promise<T>) { async function runOnBranch<T>(git: SimpleGit, branch: string, func: () => Promise<T>) {
const currentBranch = await getCurrentBranch(git); const currentBranch = await getCurrentBranch(git);
try { try {
if (currentBranch !== branch) { if (currentBranch !== branch) {
@ -79,7 +80,7 @@ type GitOptions = {
}; };
async function commitEntry( async function commitEntry(
git: simpleGit.SimpleGit, git: SimpleGit,
repoPath: string, repoPath: string,
dataFiles: DataFile[], dataFiles: DataFile[],
assets: Asset[], assets: Asset[],
@ -103,7 +104,7 @@ async function commitEntry(
await commit(git, commitMessage); await commit(git, commitMessage);
} }
async function rebase(git: simpleGit.SimpleGit, branch: string) { async function rebase(git: SimpleGit, branch: string) {
const gpgSign = await git.raw(['config', 'commit.gpgsign']); const gpgSign = await git.raw(['config', 'commit.gpgsign']);
try { try {
if (gpgSign === 'true') { if (gpgSign === 'true') {
@ -117,7 +118,7 @@ async function rebase(git: simpleGit.SimpleGit, branch: string) {
} }
} }
async function merge(git: simpleGit.SimpleGit, from: string, to: string) { async function merge(git: SimpleGit, from: string, to: string) {
const gpgSign = await git.raw(['config', 'commit.gpgsign']); const gpgSign = await git.raw(['config', 'commit.gpgsign']);
try { try {
if (gpgSign === 'true') { if (gpgSign === 'true') {
@ -131,12 +132,12 @@ async function merge(git: simpleGit.SimpleGit, from: string, to: string) {
} }
} }
async function isBranchExists(git: simpleGit.SimpleGit, branch: string) { async function isBranchExists(git: SimpleGit, branch: string) {
const branchExists = await git.branchLocal().then(({ all }) => all.includes(branch)); const branchExists = await git.branchLocal().then(({ all }) => all.includes(branch));
return branchExists; return branchExists;
} }
async function getDiffs(git: simpleGit.SimpleGit, source: string, dest: string) { async function getDiffs(git: SimpleGit, source: string, dest: string) {
const rawDiff = await git.diff([source, dest]); const rawDiff = await git.diff([source, dest]);
const diffs = parse(rawDiff).map(d => { const diffs = parse(rawDiff).map(d => {
const oldPath = d.oldPath?.replace(/b\//, '') || ''; const oldPath = d.oldPath?.replace(/b\//, '') || '';

View File

@ -16439,14 +16439,14 @@ signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7:
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9"
integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==
simple-git@^2.0.0: simple-git@^3.0.0:
version "2.48.0" version "3.4.0"
resolved "https://registry.yarnpkg.com/simple-git/-/simple-git-2.48.0.tgz#87c262dba8f84d7b96bb3a713e9e34701c1f6e3b" resolved "https://registry.yarnpkg.com/simple-git/-/simple-git-3.4.0.tgz#dea49dfafbc16a67b26221917fca1caaeb976e4a"
integrity sha512-z4qtrRuaAFJS4PUd0g+xy7aN4y+RvEt/QTJpR184lhJguBA1S/LsVlvE/CM95RsYMOFJG3NGGDjqFCzKU19S/A== integrity sha512-sBRdudUc1yvi0xQQPuHXc1L9gTWkRn4hP2bbc7q4BTxR502d3JJAGsDOhrmsBY+wAZAw5JLl82tx55fSWYE65w==
dependencies: dependencies:
"@kwsites/file-exists" "^1.1.1" "@kwsites/file-exists" "^1.1.1"
"@kwsites/promise-deferred" "^1.1.1" "@kwsites/promise-deferred" "^1.1.1"
debug "^4.3.2" debug "^4.3.3"
simple-html-tokenizer@^0.1.1: simple-html-tokenizer@^0.1.1:
version "0.1.1" version "0.1.1"