mirror of
https://github.com/astral-sh/setup-uv.git
synced 2025-05-17 14:44:46 +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:
parent
1785c7bde0
commit
182c9c7e92
32 changed files with 5536 additions and 5497 deletions
60
dist/save-cache/index.js
generated
vendored
60
dist/save-cache/index.js
generated
vendored
|
@ -82795,9 +82795,9 @@ const core = __importStar(__nccwpck_require__(2186));
|
|||
const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||
const inputs_1 = __nccwpck_require__(9378);
|
||||
const platforms_1 = __nccwpck_require__(6005);
|
||||
exports.STATE_CACHE_KEY = 'cache-key';
|
||||
exports.STATE_CACHE_MATCHED_KEY = 'cache-matched-key';
|
||||
const CACHE_VERSION = '1';
|
||||
exports.STATE_CACHE_KEY = "cache-key";
|
||||
exports.STATE_CACHE_MATCHED_KEY = "cache-matched-key";
|
||||
const CACHE_VERSION = "1";
|
||||
function restoreCache(version) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const cacheKey = yield computeKeys(version);
|
||||
|
@ -82809,7 +82809,7 @@ function restoreCache(version) {
|
|||
catch (err) {
|
||||
const message = err.message;
|
||||
core.warning(message);
|
||||
core.setOutput('cache-hit', false);
|
||||
core.setOutput("cache-hit", false);
|
||||
return;
|
||||
}
|
||||
core.saveState(exports.STATE_CACHE_KEY, cacheKey);
|
||||
|
@ -82819,30 +82819,30 @@ function restoreCache(version) {
|
|||
exports.restoreCache = restoreCache;
|
||||
function computeKeys(version) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let cacheDependencyPathHash = '-';
|
||||
if (inputs_1.cacheDependencyGlob !== '') {
|
||||
const fullCacheDependencyGlob = `${process.env['GITHUB_WORKSPACE']}${path_1.default.sep}${inputs_1.cacheDependencyGlob}`;
|
||||
let cacheDependencyPathHash = "-";
|
||||
if (inputs_1.cacheDependencyGlob !== "") {
|
||||
const fullCacheDependencyGlob = `${process.env["GITHUB_WORKSPACE"]}${path_1.default.sep}${inputs_1.cacheDependencyGlob}`;
|
||||
cacheDependencyPathHash += yield glob.hashFiles(fullCacheDependencyGlob);
|
||||
if (cacheDependencyPathHash === '-') {
|
||||
if (cacheDependencyPathHash === "-") {
|
||||
throw new Error(`No file in ${process.cwd()} matched to [${inputs_1.cacheDependencyGlob}], make sure you have checked out the target repository`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
cacheDependencyPathHash += 'no-dependency-glob';
|
||||
cacheDependencyPathHash += "no-dependency-glob";
|
||||
}
|
||||
const suffix = inputs_1.cacheSuffix ? `-${inputs_1.cacheSuffix}` : '';
|
||||
const suffix = inputs_1.cacheSuffix ? `-${inputs_1.cacheSuffix}` : "";
|
||||
return `setup-uv-${CACHE_VERSION}-${(0, platforms_1.getArch)()}-${(0, platforms_1.getPlatform)()}-${version}${cacheDependencyPathHash}${suffix}`;
|
||||
});
|
||||
}
|
||||
function handleMatchResult(matchedKey, primaryKey) {
|
||||
if (!matchedKey) {
|
||||
core.info(`No GitHub Actions cache found for key: ${primaryKey}`);
|
||||
core.setOutput('cache-hit', false);
|
||||
core.setOutput("cache-hit", false);
|
||||
return;
|
||||
}
|
||||
core.saveState(exports.STATE_CACHE_MATCHED_KEY, matchedKey);
|
||||
core.info(`uv cache restored from GitHub Actions cache with key: ${matchedKey}`);
|
||||
core.setOutput('cache-hit', true);
|
||||
core.setOutput("cache-hit", true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -82912,7 +82912,7 @@ function saveCache() {
|
|||
const cacheKey = core.getState(restore_cache_1.STATE_CACHE_KEY);
|
||||
const matchedKey = core.getState(restore_cache_1.STATE_CACHE_MATCHED_KEY);
|
||||
if (!cacheKey) {
|
||||
core.warning('Error retrieving cache key from state.');
|
||||
core.warning("Error retrieving cache key from state.");
|
||||
return;
|
||||
}
|
||||
else if (matchedKey === cacheKey) {
|
||||
|
@ -82928,11 +82928,11 @@ function saveCache() {
|
|||
function pruneCache() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const options = {
|
||||
silent: !core.isDebug()
|
||||
silent: !core.isDebug(),
|
||||
};
|
||||
const execArgs = ['cache', 'prune', '--ci'];
|
||||
core.info('Pruning cache...');
|
||||
yield exec.exec('uv', execArgs, options);
|
||||
const execArgs = ["cache", "prune", "--ci"];
|
||||
core.info("Pruning cache...");
|
||||
yield exec.exec("uv", execArgs, options);
|
||||
});
|
||||
}
|
||||
run();
|
||||
|
@ -82971,13 +82971,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.cacheDependencyGlob = exports.githubToken = exports.cacheLocalPath = exports.cacheSuffix = exports.enableCache = exports.checkSum = exports.version = void 0;
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
exports.version = core.getInput('version');
|
||||
exports.checkSum = core.getInput('checksum');
|
||||
exports.enableCache = core.getInput('enable-cache') === 'true';
|
||||
exports.cacheSuffix = core.getInput('cache-suffix') || '';
|
||||
exports.cacheLocalPath = core.getInput('cache-local-path');
|
||||
exports.githubToken = core.getInput('github-token');
|
||||
exports.cacheDependencyGlob = core.getInput('cache-dependency-glob');
|
||||
exports.version = core.getInput("version");
|
||||
exports.checkSum = core.getInput("checksum");
|
||||
exports.enableCache = core.getInput("enable-cache") === "true";
|
||||
exports.cacheSuffix = core.getInput("cache-suffix") || "";
|
||||
exports.cacheLocalPath = core.getInput("cache-local-path");
|
||||
exports.githubToken = core.getInput("github-token");
|
||||
exports.cacheDependencyGlob = core.getInput("cache-dependency-glob");
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
@ -82992,9 +82992,9 @@ exports.getPlatform = exports.getArch = void 0;
|
|||
function getArch() {
|
||||
const arch = process.arch;
|
||||
const archMapping = {
|
||||
ia32: 'i686',
|
||||
x64: 'x86_64',
|
||||
arm64: 'aarch64'
|
||||
ia32: "i686",
|
||||
x64: "x86_64",
|
||||
arm64: "aarch64",
|
||||
};
|
||||
if (arch in archMapping) {
|
||||
return archMapping[arch];
|
||||
|
@ -83004,9 +83004,9 @@ exports.getArch = getArch;
|
|||
function getPlatform() {
|
||||
const platform = process.platform;
|
||||
const platformMapping = {
|
||||
linux: 'unknown-linux-gnu',
|
||||
darwin: 'apple-darwin',
|
||||
win32: 'pc-windows-msvc'
|
||||
linux: "unknown-linux-gnu",
|
||||
darwin: "apple-darwin",
|
||||
win32: "pc-windows-msvc",
|
||||
};
|
||||
if (platform in platformMapping) {
|
||||
return platformMapping[platform];
|
||||
|
|
3410
dist/setup/index.js
generated
vendored
3410
dist/setup/index.js
generated
vendored
File diff suppressed because it is too large
Load diff
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";
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue