mirror of
https://github.com/astral-sh/setup-uv.git
synced 2025-07-27 16:21:42 +00:00
Change Prettier settings (#36)
## Summary I know this is a little tedious but I'd prefer to use the same settings as in Ruff.
This commit is contained in:
38
dist/update-default-version/index.js
generated
vendored
38
dist/update-default-version/index.js
generated
vendored
@ -32713,34 +32713,34 @@ const tc = __importStar(__nccwpck_require__(7784));
|
||||
function updateChecksums(filePath, downloadUrls) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield fs_1.promises.rm(filePath);
|
||||
yield fs_1.promises.appendFile(filePath, '// AUTOGENERATED_DO_NOT_EDIT\nexport const KNOWN_CHECKSUMS: {[key: string]: string} = {\n');
|
||||
yield fs_1.promises.appendFile(filePath, "// AUTOGENERATED_DO_NOT_EDIT\nexport const KNOWN_CHECKSUMS: {[key: string]: string} = {\n");
|
||||
let firstLine = true;
|
||||
for (const downloadUrl of downloadUrls) {
|
||||
const content = yield downloadAssetContent(downloadUrl);
|
||||
const checksum = content.split(' ')[0].trim();
|
||||
const checksum = content.split(" ")[0].trim();
|
||||
const key = getKey(downloadUrl);
|
||||
if (!firstLine) {
|
||||
yield fs_1.promises.appendFile(filePath, ',\n');
|
||||
yield fs_1.promises.appendFile(filePath, ",\n");
|
||||
}
|
||||
yield fs_1.promises.appendFile(filePath, ` '${key}':\n '${checksum}'`);
|
||||
firstLine = false;
|
||||
}
|
||||
yield fs_1.promises.appendFile(filePath, '}\n');
|
||||
yield fs_1.promises.appendFile(filePath, "}\n");
|
||||
});
|
||||
}
|
||||
exports.updateChecksums = updateChecksums;
|
||||
function getKey(downloadUrl) {
|
||||
// https://github.com/astral-sh/uv/releases/download/0.3.2/uv-aarch64-apple-darwin.tar.gz.sha256
|
||||
const parts = downloadUrl.split('/');
|
||||
const parts = downloadUrl.split("/");
|
||||
const fileName = parts[parts.length - 1];
|
||||
const name = fileName.split('.')[0].split('uv-')[1];
|
||||
const name = fileName.split(".")[0].split("uv-")[1];
|
||||
const version = parts[parts.length - 2];
|
||||
return `${name}-${version}`;
|
||||
}
|
||||
function downloadAssetContent(downloadUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const downloadPath = yield tc.downloadTool(downloadUrl);
|
||||
const content = yield fs_1.promises.readFile(downloadPath, 'utf8');
|
||||
const content = yield fs_1.promises.readFile(downloadPath, "utf8");
|
||||
return content;
|
||||
});
|
||||
}
|
||||
@ -32808,16 +32808,16 @@ function run() {
|
||||
const octokit = github.getOctokit(github_token);
|
||||
const response = yield octokit.paginate(octokit.rest.repos.listReleases, {
|
||||
owner: utils_1.OWNER,
|
||||
repo: utils_1.REPO
|
||||
repo: utils_1.REPO,
|
||||
});
|
||||
const downloadUrls = response.flatMap(release => release.assets
|
||||
.filter(asset => asset.name.endsWith('.sha256'))
|
||||
.map(asset => asset.browser_download_url));
|
||||
const downloadUrls = response.flatMap((release) => release.assets
|
||||
.filter((asset) => asset.name.endsWith(".sha256"))
|
||||
.map((asset) => asset.browser_download_url));
|
||||
yield (0, update_known_checksums_1.updateChecksums)(checksumFilePath, downloadUrls);
|
||||
const latestVersion = response
|
||||
.map(release => release.tag_name)
|
||||
.map((release) => release.tag_name)
|
||||
.sort(semver.rcompare)[0];
|
||||
core.setOutput('latest-version', latestVersion);
|
||||
core.setOutput("latest-version", latestVersion);
|
||||
yield updateDefaultVersion(defaultVersionFilePath, latestVersion);
|
||||
});
|
||||
}
|
||||
@ -32826,7 +32826,7 @@ function updateDefaultVersion(filePath, latestVersion) {
|
||||
var _a, e_1, _b, _c;
|
||||
const fileStream = (0, fs_1.createReadStream)(filePath);
|
||||
const rl = readline.createInterface({
|
||||
input: fileStream
|
||||
input: fileStream,
|
||||
});
|
||||
let foundDescription = false;
|
||||
const lines = [];
|
||||
@ -32839,7 +32839,7 @@ function updateDefaultVersion(filePath, latestVersion) {
|
||||
line.includes("description: 'The version of uv to install'")) {
|
||||
foundDescription = true;
|
||||
}
|
||||
else if (foundDescription && line.includes('default: ')) {
|
||||
else if (foundDescription && line.includes("default: ")) {
|
||||
line = line.replace(/'[^']*'/, `'${latestVersion}'`);
|
||||
foundDescription = false;
|
||||
}
|
||||
@ -32853,7 +32853,7 @@ function updateDefaultVersion(filePath, latestVersion) {
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
yield fs_1.promises.writeFile(filePath, lines.join('\n'));
|
||||
yield fs_1.promises.writeFile(filePath, lines.join("\n"));
|
||||
});
|
||||
}
|
||||
run();
|
||||
@ -32868,9 +32868,9 @@ run();
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.TOOL_CACHE_NAME = exports.OWNER = exports.REPO = void 0;
|
||||
exports.REPO = 'uv';
|
||||
exports.OWNER = 'astral-sh';
|
||||
exports.TOOL_CACHE_NAME = 'uv';
|
||||
exports.REPO = "uv";
|
||||
exports.OWNER = "astral-sh";
|
||||
exports.TOOL_CACHE_NAME = "uv";
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
Reference in New Issue
Block a user