Remove unused code

This commit is contained in:
Tonye Jack 2023-05-22 23:09:53 -06:00
parent 335c663a08
commit f018002631
3 changed files with 9 additions and 14 deletions

19
dist/index.js generated vendored
View File

@ -83,7 +83,7 @@ const getRenamedFiles = ({ inputs, workingDirectory, hasSubmodule, shaResult })
})); }));
} }
if (inputs.json) { if (inputs.json) {
return (0, utils_1.jsonOutput)({ value: renamedFiles, escape: inputs.escape_json }); return (0, utils_1.jsonOutput)({ value: renamedFiles, escape: inputs.escapeJson });
} }
return renamedFiles.join(inputs.oldNewFilesSeparator); return renamedFiles.join(inputs.oldNewFilesSeparator);
}); });
@ -131,7 +131,7 @@ const getDiffFiles = ({ inputs, workingDirectory, hasSubmodule, shaResult, diffF
})); }));
} }
if (inputs.json) { if (inputs.json) {
return (0, utils_1.jsonOutput)({ value: files, escape: inputs.escape_json }); return (0, utils_1.jsonOutput)({ value: files, escape: inputs.escapeJson });
} }
return files.join(inputs.separator); return files.join(inputs.separator);
}); });
@ -633,7 +633,7 @@ const getInputs = () => {
required: false required: false
}); });
const json = core.getBooleanInput('json', { required: false }); const json = core.getBooleanInput('json', { required: false });
const escape_json = core.getBooleanInput('escape_json', { required: false }); const escapeJson = core.getBooleanInput('escape_json', { required: false });
const fetchDepth = core.getInput('fetch_depth', { required: false }); const fetchDepth = core.getInput('fetch_depth', { required: false });
const sinceLastRemoteCommit = core.getBooleanInput('since_last_remote_commit', { required: false }); const sinceLastRemoteCommit = core.getBooleanInput('since_last_remote_commit', { required: false });
const writeOutputFiles = core.getBooleanInput('write_output_files', { const writeOutputFiles = core.getBooleanInput('write_output_files', {
@ -666,7 +666,7 @@ const getInputs = () => {
dirNames, dirNames,
dirNamesExcludeRoot, dirNamesExcludeRoot,
json, json,
escape_json, escapeJson,
sinceLastRemoteCommit, sinceLastRemoteCommit,
writeOutputFiles, writeOutputFiles,
outputDir, outputDir,
@ -738,7 +738,7 @@ function run() {
var _a; var _a;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const env = (0, env_1.getEnv)(); const env = (0, env_1.getEnv)();
core.debug(`Env: ${JSON.stringify(env, null, 2)}`); core.debug(`Env: ${JSON.stringify(process.env, null, 2)}`);
const inputs = (0, inputs_1.getInputs)(); const inputs = (0, inputs_1.getInputs)();
core.debug(`Inputs: ${JSON.stringify(inputs, null, 2)}`); core.debug(`Inputs: ${JSON.stringify(inputs, null, 2)}`);
yield (0, utils_1.verifyMinimumGitVersion)(); yield (0, utils_1.verifyMinimumGitVersion)();
@ -1507,13 +1507,8 @@ const getDirnameMaxDepth = ({ pathStr, dirNamesMaxDepth, excludeRoot }) => {
}; };
exports.getDirnameMaxDepth = getDirnameMaxDepth; exports.getDirnameMaxDepth = getDirnameMaxDepth;
const jsonOutput = ({ value, escape }) => { const jsonOutput = ({ value, escape }) => {
return JSON.stringify(value, (key, value) => { let result = JSON.stringify(value);
if (typeof value === 'string') { return escape ? result.replace(/"/g, '\\"') : result;
// if escape is true, escape quotes and backslashes
return escape ? value.replace(/\\/g, '\\\\').replace(/"/g, '\\"') : value;
}
return value;
});
}; };
exports.jsonOutput = jsonOutput; exports.jsonOutput = jsonOutput;
const getFilePatterns = ({ inputs }) => __awaiter(void 0, void 0, void 0, function* () { const getFilePatterns = ({ inputs }) => __awaiter(void 0, void 0, void 0, function* () {

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -14,7 +14,7 @@
"lint:fix": "eslint --fix src/**/*.ts", "lint:fix": "eslint --fix src/**/*.ts",
"package": "ncc build lib/main.js --source-map --license licenses.txt", "package": "ncc build lib/main.js --source-map --license licenses.txt",
"test": "jest --coverage", "test": "jest --coverage",
"all": "yarn build && yarn format && yarn lint:fix && yarn lint && yarn package && yarn test" "all": "yarn build && yarn format && yarn lint && yarn package && yarn test"
}, },
"repository": { "repository": {
"type": "git", "type": "git",