diff --git a/dist/ruff-action/index.js b/dist/ruff-action/index.js index c942f36..84a297a 100644 Binary files a/dist/ruff-action/index.js and b/dist/ruff-action/index.js differ diff --git a/dist/update-known-checksums/index.js b/dist/update-known-checksums/index.js index 03dbed3..62e6267 100644 Binary files a/dist/update-known-checksums/index.js and b/dist/update-known-checksums/index.js differ diff --git a/package-lock.json b/package-lock.json index 660ab85..d8c8e2d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@actions/exec": "^1.1.1", "@actions/github": "^6.0.0", "@actions/tool-cache": "^2.0.1", - "@iarna/toml": "^2.2.5" + "smol-toml": "^1.3.1" }, "devDependencies": { "@biomejs/biome": "1.9.4", @@ -242,11 +242,6 @@ "node": ">=14" } }, - "node_modules/@iarna/toml": { - "version": "2.2.5", - "resolved": "https://registry.npmjs.org/@iarna/toml/-/toml-2.2.5.tgz", - "integrity": "sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg==" - }, "node_modules/@octokit/auth-token": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz", @@ -459,6 +454,17 @@ "semver": "bin/semver.js" } }, + "node_modules/smol-toml": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.3.1.tgz", + "integrity": "sha512-tEYNll18pPKHroYSmLLrksq233j021G0giwW7P3D24jC54pQ5W5BXMsQ/Mvw1OJCmEYDgY+lrzT+3nNUtoNfXQ==", + "engines": { + "node": ">= 18" + }, + "funding": { + "url": "https://github.com/sponsors/cyyynthia" + } + }, "node_modules/tunnel": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", diff --git a/package.json b/package.json index 6a258d9..a9bc3ea 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "@actions/exec": "^1.1.1", "@actions/github": "^6.0.0", "@actions/tool-cache": "^2.0.1", - "@iarna/toml": "^2.2.5" + "smol-toml": "^1.3.1" }, "devDependencies": { "@biomejs/biome": "1.9.4", diff --git a/src/utils/pyproject.ts b/src/utils/pyproject.ts index afcbf89..4fb6776 100644 --- a/src/utils/pyproject.ts +++ b/src/utils/pyproject.ts @@ -1,15 +1,28 @@ import * as fs from "node:fs"; import * as core from "@actions/core"; -import * as toml from "@iarna/toml"; +import * as toml from "smol-toml"; export function getRuffVersionFromPyproject( filePath: string, ): string | undefined { + if (!fs.existsSync(filePath)) { + core.warning(`Could not find file: ${filePath}`); + return undefined; + } const pyprojectContent = fs.readFileSync(filePath, "utf-8"); - const pyproject = toml.parse(pyprojectContent) as { - project?: { dependencies?: string[] }; - "dependency-groups"?: { dev?: string[] }; - }; + let pyproject: + | { + project?: { dependencies?: string[] }; + "dependency-groups"?: { dev?: string[] }; + } + | undefined; + try { + pyproject = toml.parse(pyprojectContent); + } catch (err) { + const message = (err as Error).message; + core.warning(`Error while parsing ${filePath}: ${message}`); + return undefined; + } const dependencies: string[] = pyproject?.project?.dependencies || []; const devDependencies: string[] = pyproject?.["dependency-groups"]?.dev || []; diff --git a/tsconfig.json b/tsconfig.json index 4a6c661..d8d5291 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "es6" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */, + "target": "ES2022" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */, "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, "outDir": "./lib" /* Redirect output structure to the directory. */, "rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,