src/utils/npm-audit.js
function removePackageLockFrom(projectDir, response) {
    try {
        const file = pathJoin(projectDir, 'package-lock.json');
        unlink(file);
        return response;
    } catch (error) {
        if (error.code === 'ENOENT') {
            return response;
        }
        if (response) {
            response.internalErrors = response.internalErrors || [];
            response.internalErrors.push(error);
            return response;
        }
        return response;
    }
}
function removePackageLockFrom(projectDir, response) {
    try {
        const file = pathJoin(projectDir, 'package-lock.json');
        unlink(file);
        return response;
    } catch (error) {
        if (error.code === 'ENOENT') {
            return response;
        }
        if (response) {
            response.internalErrors = response.internalErrors || [];
            response.internalErrors.push(error);
            return response;
        }
        return response;
    }
}
function removePackageLockFrom ( projectDir , response ) { try { const file = pathJoin ( projectDir , 'package-lock.json' ) ; unlink ( file ) ; return response ; } catch ( error ) { if ( error . code === 'ENOENT' ) { return response ; } if ( response ) { response . internalErrors = response . internalErrors || [ ] ; response . internalErrors . push ( error ) ; return response ; } return response ; } }
Middleware that removes the auto-generated package-lock.json
@param {string} projectDir - folder where the package-lock.json file has been generated
@param {*} response - result of the npm audit command (eventually modified by previous middlewares execution)
@returns input response if file removal is ok
In case of error it adds or updates into the input response object the property 'internalErrors'
Middleware that removes the auto - generated package - lock . json