mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
chore(ci): add tag resolution for npm releases based on package version; (#6404)
This commit is contained in:
@@ -1,41 +1,8 @@
|
||||
import util from "util";
|
||||
import cp from "child_process";
|
||||
import Handlebars from "handlebars";
|
||||
import fs from "fs/promises";
|
||||
import prettyBytes from 'pretty-bytes';
|
||||
import {gzipSize} from 'gzip-size';
|
||||
|
||||
const exec = util.promisify(cp.exec);
|
||||
|
||||
const getBlobHistory = async (filepath, maxCount= 5) => {
|
||||
const log = (await exec(
|
||||
`git log --max-count=${maxCount} --no-walk --tags=v* --oneline --format=%H%d -- ${filepath}`
|
||||
)).stdout;
|
||||
|
||||
const commits = [];
|
||||
|
||||
let match;
|
||||
|
||||
const regexp = /^(\w+) \(tag: (v?[.\d]+)\)$/gm;
|
||||
|
||||
while((match = regexp.exec(log))) {
|
||||
commits.push({
|
||||
sha: match[1],
|
||||
tag: match[2],
|
||||
size: await getBlobSize(filepath, match[1])
|
||||
})
|
||||
}
|
||||
|
||||
return commits;
|
||||
}
|
||||
|
||||
const getBlobSize = async (filepath, sha ='HEAD') => {
|
||||
const size = (await exec(
|
||||
`git cat-file -s ${sha}:${filepath}`
|
||||
)).stdout;
|
||||
|
||||
return size ? +size : 0;
|
||||
}
|
||||
import {getBlobHistory} from './repo.js';
|
||||
|
||||
const generateFileReport = async (files) => {
|
||||
const stat = {};
|
||||
|
||||
Reference in New Issue
Block a user