diff --git a/.gitignore b/.gitignore index 405128101..9ccba6545 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,8 @@ # See http://help.github.com/ignore-files/ for more about ignoring files. # compiled output -tmp -/out-tsc +# root dist/ is nx libs build output (actions/apps commit their own dist/) +/dist/ # dependencies node_modules @@ -59,3 +59,6 @@ bin/ /.pnpm-store/ .nx/migrate-runs + +# lefthook local overrides +lefthook-local.yml diff --git a/actions/advanced-triggers/src/event.ts b/actions/advanced-triggers/src/event.ts index 9660dc9f1..ead7351de 100644 --- a/actions/advanced-triggers/src/event.ts +++ b/actions/advanced-triggers/src/event.ts @@ -1,5 +1,5 @@ import * as github from "@actions/github"; -import { PushEvent, MergeGroupEvent } from "@octokit/webhooks-types"; +import type { PushEvent, MergeGroupEvent } from "@octokit/webhooks-types"; export type FileChangeEventData = PullRequestEventData | PushEventData | MergeGroupEventData; diff --git a/actions/advanced-triggers/src/github.ts b/actions/advanced-triggers/src/github.ts index b5cfdca4a..6bec45ecd 100644 --- a/actions/advanced-triggers/src/github.ts +++ b/actions/advanced-triggers/src/github.ts @@ -1,6 +1,6 @@ import * as core from "@actions/core"; -import * as github from "@actions/github"; -import { GetResponseTypeFromEndpointMethod } from "@octokit/types"; +import type * as github from "@actions/github"; +import type { GetResponseTypeFromEndpointMethod } from "@octokit/types"; export type OctokitType = ReturnType; type ListFilesResponse = GetResponseTypeFromEndpointMethod< diff --git a/actions/advanced-triggers/src/run.ts b/actions/advanced-triggers/src/run.ts index 29cd476e9..77fc8febe 100644 --- a/actions/advanced-triggers/src/run.ts +++ b/actions/advanced-triggers/src/run.ts @@ -3,7 +3,8 @@ import * as github from "@actions/github"; import { getInvokeContext, getInputs } from "./run-inputs"; import { parseFileSets, parseTriggers } from "./schema"; -import { applyTrigger, TriggerResult } from "./filters"; +import type { TriggerResult } from "./filters"; +import { applyTrigger } from "./filters"; import { getChangedFilesGit } from "./git"; import { getChangedFilesForMergeGroup, getChangedFilesForPR } from "./github"; import type { OctokitType } from "./github"; diff --git a/actions/advanced-triggers/tsconfig.json b/actions/advanced-triggers/tsconfig.json index 2129332d2..7e107a268 100644 --- a/actions/advanced-triggers/tsconfig.json +++ b/actions/advanced-triggers/tsconfig.json @@ -6,7 +6,6 @@ "noEmit": true, "isolatedModules": true, "strict": true, - "esModuleInterop": true, - "ignoreDeprecations": "6.0" + "esModuleInterop": true } } diff --git a/actions/apidiff-go/dist/index.js b/actions/apidiff-go/dist/index.js index 6f7da053c..aeb1aebaa 100644 --- a/actions/apidiff-go/dist/index.js +++ b/actions/apidiff-go/dist/index.js @@ -32678,7 +32678,7 @@ function renderFuncDiffCompactPre(oldText, newText) { // actions/apidiff-go/src/string-processor.ts function parseElement(element) { - let path8 = element.startsWith("./") ? element.slice(2) : element; + const path8 = element.startsWith("./") ? element.slice(2) : element; const i2 = path8.lastIndexOf("."); if (i2 === -1) return { packagePath: "", elementName: path8 }; return { packagePath: path8.slice(0, i2), elementName: path8.slice(i2 + 1) }; diff --git a/actions/apidiff-go/src/__tests__/go/compatible-changes/api.go b/actions/apidiff-go/src/__tests__/go/compatible-changes/api.go index 3995d3048..af51ea76a 100644 --- a/actions/apidiff-go/src/__tests__/go/compatible-changes/api.go +++ b/actions/apidiff-go/src/__tests__/go/compatible-changes/api.go @@ -7,7 +7,7 @@ func PublicFunc(input string) string { } // NewPublicFunc is a new function added in this version (compatible) -func NewPublicFunc(input string, prefix string) string { +func NewPublicFunc(input, prefix string) string { return prefix + ": " + input } diff --git a/actions/apidiff-go/src/__tests__/go/incompatible-changes/api.go b/actions/apidiff-go/src/__tests__/go/incompatible-changes/api.go index 8ec2d5e48..f4e2c19ea 100644 --- a/actions/apidiff-go/src/__tests__/go/incompatible-changes/api.go +++ b/actions/apidiff-go/src/__tests__/go/incompatible-changes/api.go @@ -15,7 +15,7 @@ type PublicStruct struct { } // NewPublicStruct creates a new PublicStruct with changed signature (BREAKING) -func NewPublicStruct(name string, newValue string) *PublicStruct { +func NewPublicStruct(name, newValue string) *PublicStruct { return &PublicStruct{ Name: name, NewValue: newValue, diff --git a/actions/apidiff-go/src/__tests__/go/multi-module-changed/submodule1/util.go b/actions/apidiff-go/src/__tests__/go/multi-module-changed/submodule1/util.go index 99d652ce5..1dd88090b 100644 --- a/actions/apidiff-go/src/__tests__/go/multi-module-changed/submodule1/util.go +++ b/actions/apidiff-go/src/__tests__/go/multi-module-changed/submodule1/util.go @@ -2,7 +2,7 @@ package submodule1 // UtilFunc is a utility function in submodule1 - signature changed! -func UtilFunc(input string, prefix string) string { +func UtilFunc(input, prefix string) string { return prefix + ": " + input } diff --git a/actions/apidiff-go/src/event.ts b/actions/apidiff-go/src/event.ts index b9fe74403..290e01ca3 100644 --- a/actions/apidiff-go/src/event.ts +++ b/actions/apidiff-go/src/event.ts @@ -1,5 +1,5 @@ import * as github from "@actions/github"; -import { PushEvent, PullRequestEvent } from "@octokit/webhooks-types"; +import type { PushEvent, PullRequestEvent } from "@octokit/webhooks-types"; export type EventData = PullRequestEventData | PushEventData | WorkflowDispatchEventData; diff --git a/actions/apidiff-go/src/github.ts b/actions/apidiff-go/src/github.ts index c5bd1cad8..981209a9e 100644 --- a/actions/apidiff-go/src/github.ts +++ b/actions/apidiff-go/src/github.ts @@ -1,5 +1,5 @@ import * as core from "@actions/core"; -import * as github from "@actions/github"; +import type * as github from "@actions/github"; export type OctokitType = ReturnType; diff --git a/actions/apidiff-go/src/render-diff.ts b/actions/apidiff-go/src/render-diff.ts index ad384f20a..bf0c626f7 100644 --- a/actions/apidiff-go/src/render-diff.ts +++ b/actions/apidiff-go/src/render-diff.ts @@ -2,7 +2,8 @@ * This logic is best maintained by an LLM. It is a bunch * of tedious string manipulation and formatting. */ -import { diffArrays, Change } from "diff"; +import type { Change } from "diff"; +import { diffArrays } from "diff"; function escapeHtml(s: string) { return s.replace(/&/g, "&").replace(//g, ">"); diff --git a/actions/apidiff-go/src/string-processor.ts b/actions/apidiff-go/src/string-processor.ts index 7408408c3..9f696e623 100644 --- a/actions/apidiff-go/src/string-processor.ts +++ b/actions/apidiff-go/src/string-processor.ts @@ -13,7 +13,7 @@ function parseElement(element: string): { packagePath: string; elementName: string; } { - let path = element.startsWith("./") ? element.slice(2) : element; + const path = element.startsWith("./") ? element.slice(2) : element; const i = path.lastIndexOf("."); if (i === -1) return { packagePath: "", elementName: path }; return { packagePath: path.slice(0, i), elementName: path.slice(i + 1) }; diff --git a/actions/apidiff-go/src/util.ts b/actions/apidiff-go/src/util.ts index 67f271802..5c76040e5 100644 --- a/actions/apidiff-go/src/util.ts +++ b/actions/apidiff-go/src/util.ts @@ -1,5 +1,4 @@ import * as core from "@actions/core"; -import * as semver from "semver"; import { basename, join } from "path"; import { readFileSync, existsSync, copyFileSync } from "fs"; diff --git a/actions/apidiff-go/tsconfig.json b/actions/apidiff-go/tsconfig.json index a39338de9..2840c42b4 100644 --- a/actions/apidiff-go/tsconfig.json +++ b/actions/apidiff-go/tsconfig.json @@ -1,11 +1,11 @@ { "compilerOptions": { "target": "esnext", - "module": "commonjs", + "module": "esnext", "noEmit": true, "isolatedModules": true, "strict": true, "esModuleInterop": true, - "ignoreDeprecations": "6.0" + "moduleResolution": "bundler" } } diff --git a/actions/changed-modules-go/src/event.ts b/actions/changed-modules-go/src/event.ts index 0425f1b41..9ddc212e0 100644 --- a/actions/changed-modules-go/src/event.ts +++ b/actions/changed-modules-go/src/event.ts @@ -1,5 +1,5 @@ import * as github from "@actions/github"; -import { +import type { PushEvent, PullRequestEvent, MergeGroupEvent, diff --git a/actions/changed-modules-go/src/github.ts b/actions/changed-modules-go/src/github.ts index 7309e17e5..ac6e1a557 100644 --- a/actions/changed-modules-go/src/github.ts +++ b/actions/changed-modules-go/src/github.ts @@ -1,6 +1,6 @@ import * as core from "@actions/core"; -import * as github from "@actions/github"; -import { GetResponseTypeFromEndpointMethod } from "@octokit/types"; +import type * as github from "@actions/github"; +import type { GetResponseTypeFromEndpointMethod } from "@octokit/types"; export type OctokitType = ReturnType; type ListFilesResponse = GetResponseTypeFromEndpointMethod< diff --git a/actions/changed-modules-go/src/run.ts b/actions/changed-modules-go/src/run.ts index c36e4f50e..aa64e35c4 100644 --- a/actions/changed-modules-go/src/run.ts +++ b/actions/changed-modules-go/src/run.ts @@ -1,14 +1,14 @@ import * as core from "@actions/core"; import * as github from "@actions/github"; -import { getInvokeContext, getInputs, RunInputs } from "./run-inputs"; +import { getInvokeContext, getInputs } from "./run-inputs"; import { getAllGoModuleRoots, matchModules, filterPaths } from "./path-ops"; import { getChangedFilesGit } from "./git"; import { getChangedFilesForPR } from "./github"; import type { OctokitType } from "./github"; -import type { InvokeContext } from "./run-inputs"; +import type { InvokeContext, RunInputs } from "./run-inputs"; interface Outputs { modifiedModules: string[]; diff --git a/actions/changed-modules-go/tsconfig.json b/actions/changed-modules-go/tsconfig.json index a39338de9..2840c42b4 100644 --- a/actions/changed-modules-go/tsconfig.json +++ b/actions/changed-modules-go/tsconfig.json @@ -1,11 +1,11 @@ { "compilerOptions": { "target": "esnext", - "module": "commonjs", + "module": "esnext", "noEmit": true, "isolatedModules": true, "strict": true, "esModuleInterop": true, - "ignoreDeprecations": "6.0" + "moduleResolution": "bundler" } } diff --git a/actions/changed-roots/src/event.ts b/actions/changed-roots/src/event.ts index 0425f1b41..9ddc212e0 100644 --- a/actions/changed-roots/src/event.ts +++ b/actions/changed-roots/src/event.ts @@ -1,5 +1,5 @@ import * as github from "@actions/github"; -import { +import type { PushEvent, PullRequestEvent, MergeGroupEvent, diff --git a/actions/changed-roots/src/github.ts b/actions/changed-roots/src/github.ts index 7309e17e5..ac6e1a557 100644 --- a/actions/changed-roots/src/github.ts +++ b/actions/changed-roots/src/github.ts @@ -1,6 +1,6 @@ import * as core from "@actions/core"; -import * as github from "@actions/github"; -import { GetResponseTypeFromEndpointMethod } from "@octokit/types"; +import type * as github from "@actions/github"; +import type { GetResponseTypeFromEndpointMethod } from "@octokit/types"; export type OctokitType = ReturnType; type ListFilesResponse = GetResponseTypeFromEndpointMethod< diff --git a/actions/changed-roots/src/run.ts b/actions/changed-roots/src/run.ts index 117052b64..298d9a9ab 100644 --- a/actions/changed-roots/src/run.ts +++ b/actions/changed-roots/src/run.ts @@ -1,14 +1,14 @@ import * as core from "@actions/core"; import * as github from "@actions/github"; -import { getInvokeContext, getInputs, RunInputs } from "./run-inputs"; +import { getInvokeContext, getInputs } from "./run-inputs"; import { getAllRoots, matchModules, filterPaths } from "./path-ops"; import { getChangedFilesGit } from "./git"; import { getChangedFilesForPR } from "./github"; import type { OctokitType } from "./github"; -import type { InvokeContext } from "./run-inputs"; +import type { InvokeContext, RunInputs } from "./run-inputs"; interface Outputs { changedRoots: string[]; diff --git a/actions/changed-roots/tsconfig.json b/actions/changed-roots/tsconfig.json index a39338de9..2840c42b4 100644 --- a/actions/changed-roots/tsconfig.json +++ b/actions/changed-roots/tsconfig.json @@ -1,11 +1,11 @@ { "compilerOptions": { "target": "esnext", - "module": "commonjs", + "module": "esnext", "noEmit": true, "isolatedModules": true, "strict": true, "esModuleInterop": true, - "ignoreDeprecations": "6.0" + "moduleResolution": "bundler" } } diff --git a/actions/ci-beholder-schema-validate/src/cmd/root.go b/actions/ci-beholder-schema-validate/src/cmd/root.go index f8fec4e6e..318bcd292 100644 --- a/actions/ci-beholder-schema-validate/src/cmd/root.go +++ b/actions/ci-beholder-schema-validate/src/cmd/root.go @@ -6,11 +6,10 @@ import ( "github.com/spf13/cobra" ) - var rootCmd = &cobra.Command{ Use: "ci-beholder-schema-validate", Short: "Schema validation", - Long: `Schema validation`, + Long: `Schema validation`, } func Execute() { @@ -23,9 +22,7 @@ func Execute() { var beholderFilePath string func init() { - // add persistent flag for beholder file path rootCmd.PersistentFlags().StringVarP(&beholderFilePath, "beholder-file", "f", "", "beholder file path") _ = rootCmd.MarkPersistentFlagRequired("beholder-file") - } diff --git a/actions/ci-beholder-schema-validate/src/cmd/validate.go b/actions/ci-beholder-schema-validate/src/cmd/validate.go index 2ee398f6b..880bddc8c 100644 --- a/actions/ci-beholder-schema-validate/src/cmd/validate.go +++ b/actions/ci-beholder-schema-validate/src/cmd/validate.go @@ -11,8 +11,8 @@ import ( var validateCmd = &cobra.Command{ Use: "validate", Short: "Validate schemas", - Long: `Validate schemas`, - Run: runValidateCmd, + Long: `Validate schemas`, + Run: runValidateCmd, } func init() { @@ -20,13 +20,10 @@ func init() { } func runValidateCmd(cmd *cobra.Command, args []string) { - beholderFileContents, err := os.ReadFile(beholderFilePath) if err != nil { log.Panic(err) } fmt.Printf("beholderFileContents: %s", beholderFileContents) - } - diff --git a/actions/ci-beholder-schema-validate/src/main.go b/actions/ci-beholder-schema-validate/src/main.go index 49173baad..7afaca52b 100644 --- a/actions/ci-beholder-schema-validate/src/main.go +++ b/actions/ci-beholder-schema-validate/src/main.go @@ -4,7 +4,6 @@ import ( "schema-validate/cmd" ) - -func main() { +func main() { cmd.Execute() -} \ No newline at end of file +} diff --git a/actions/ci-grafana-alert-test/src/comment.ts b/actions/ci-grafana-alert-test/src/comment.ts index f82ce6d79..36d1b0a67 100644 --- a/actions/ci-grafana-alert-test/src/comment.ts +++ b/actions/ci-grafana-alert-test/src/comment.ts @@ -1,5 +1,5 @@ import * as core from "@actions/core"; -import * as github from "@actions/github"; +import type * as github from "@actions/github"; export const SUMMARY_COMMENT_MARKER = ""; diff --git a/actions/ci-grafana-alert-test/tsconfig.json b/actions/ci-grafana-alert-test/tsconfig.json index a39338de9..2840c42b4 100644 --- a/actions/ci-grafana-alert-test/tsconfig.json +++ b/actions/ci-grafana-alert-test/tsconfig.json @@ -1,11 +1,11 @@ { "compilerOptions": { "target": "esnext", - "module": "commonjs", + "module": "esnext", "noEmit": true, "isolatedModules": true, "strict": true, "esModuleInterop": true, - "ignoreDeprecations": "6.0" + "moduleResolution": "bundler" } } diff --git a/actions/cicd-changesets-check/src/github.ts b/actions/cicd-changesets-check/src/github.ts index 5f9897a07..9f93d9d04 100644 --- a/actions/cicd-changesets-check/src/github.ts +++ b/actions/cicd-changesets-check/src/github.ts @@ -1,4 +1,4 @@ -import * as github from "@actions/github"; +import type * as github from "@actions/github"; type Octokit = ReturnType; diff --git a/actions/cicd-changesets-check/tsconfig.json b/actions/cicd-changesets-check/tsconfig.json index a39338de9..2840c42b4 100644 --- a/actions/cicd-changesets-check/tsconfig.json +++ b/actions/cicd-changesets-check/tsconfig.json @@ -1,11 +1,11 @@ { "compilerOptions": { "target": "esnext", - "module": "commonjs", + "module": "esnext", "noEmit": true, "isolatedModules": true, "strict": true, "esModuleInterop": true, - "ignoreDeprecations": "6.0" + "moduleResolution": "bundler" } } diff --git a/actions/codeowners-review-analysis/dist/index.js b/actions/codeowners-review-analysis/dist/index.js index 9c89659dc..01f77d236 100644 --- a/actions/codeowners-review-analysis/dist/index.js +++ b/actions/codeowners-review-analysis/dist/index.js @@ -24968,6 +24968,9 @@ async function getTeamMembers(octokit, org, teamSlug) { // actions/codeowners-review-analysis/src/codeowners-pattern.ts var CodeownersPattern = class { + pattern; + regex; + leftAnchoredLiteral; constructor(patternStr) { if (patternStr == null) { throw new Error("empty pattern"); @@ -25364,14 +25367,14 @@ async function getCurrentReviewStatusGQL(octokit, owner, repo, prNumber, pageSiz } // actions/codeowners-review-analysis/src/review-status.ts -var PullRequestReviewStateExt = ((PullRequestReviewStateExt3) => { - PullRequestReviewStateExt3[PullRequestReviewStateExt3["Approved"] = "APPROVED" /* Approved */] = "Approved"; - PullRequestReviewStateExt3[PullRequestReviewStateExt3["ChangesRequested"] = "CHANGES_REQUESTED" /* ChangesRequested */] = "ChangesRequested"; - PullRequestReviewStateExt3[PullRequestReviewStateExt3["Commented"] = "COMMENTED" /* Commented */] = "Commented"; - PullRequestReviewStateExt3[PullRequestReviewStateExt3["Dismissed"] = "DISMISSED" /* Dismissed */] = "Dismissed"; - PullRequestReviewStateExt3[PullRequestReviewStateExt3["Pending"] = "PENDING" /* Pending */] = "Pending"; - PullRequestReviewStateExt3["Unknown"] = "UNKNOWN"; - return PullRequestReviewStateExt3; +var PullRequestReviewStateExt = ((PullRequestReviewStateExt2) => { + PullRequestReviewStateExt2[PullRequestReviewStateExt2["Approved"] = "APPROVED" /* Approved */] = "Approved"; + PullRequestReviewStateExt2[PullRequestReviewStateExt2["ChangesRequested"] = "CHANGES_REQUESTED" /* ChangesRequested */] = "ChangesRequested"; + PullRequestReviewStateExt2[PullRequestReviewStateExt2["Commented"] = "COMMENTED" /* Commented */] = "Commented"; + PullRequestReviewStateExt2[PullRequestReviewStateExt2["Dismissed"] = "DISMISSED" /* Dismissed */] = "Dismissed"; + PullRequestReviewStateExt2[PullRequestReviewStateExt2["Pending"] = "PENDING" /* Pending */] = "Pending"; + PullRequestReviewStateExt2["Unknown"] = "UNKNOWN"; + return PullRequestReviewStateExt2; })(PullRequestReviewStateExt || {}); function getOverallStateForAllEntries(map) { const statuses = Array.from(map.values()).map((entry) => entry.state); diff --git a/actions/codeowners-review-analysis/src/github-gql.ts b/actions/codeowners-review-analysis/src/github-gql.ts index ae2721fa0..fcc75b368 100644 --- a/actions/codeowners-review-analysis/src/github-gql.ts +++ b/actions/codeowners-review-analysis/src/github-gql.ts @@ -1,7 +1,7 @@ import * as core from "@actions/core"; -import { Octokit } from "@octokit/core"; +import type { Octokit } from "@octokit/core"; -import { +import type { Repository, RateLimit, PullRequestReviewState, diff --git a/actions/codeowners-review-analysis/src/github.ts b/actions/codeowners-review-analysis/src/github.ts index cf930a5a0..ba47b2e1f 100644 --- a/actions/codeowners-review-analysis/src/github.ts +++ b/actions/codeowners-review-analysis/src/github.ts @@ -1,6 +1,6 @@ import * as core from "@actions/core"; import * as github from "@actions/github"; -import { GetResponseTypeFromEndpointMethod } from "@octokit/types"; +import type { GetResponseTypeFromEndpointMethod } from "@octokit/types"; const MARKDOWN_FINGERPRINT = ""; diff --git a/actions/codeowners-review-analysis/src/run.ts b/actions/codeowners-review-analysis/src/run.ts index 20282805f..312740592 100644 --- a/actions/codeowners-review-analysis/src/run.ts +++ b/actions/codeowners-review-analysis/src/run.ts @@ -24,13 +24,15 @@ import { formatSkippedAnalysisMarkdown, } from "./strings"; import { - PullRequestReviewStateExt, getOverallStateForAllEntries, getOverallStateForSingleEntry, getReviewForStatusFor, } from "./review-status"; -import type { OwnerReviewStatus } from "./review-status"; +import type { + OwnerReviewStatus, + PullRequestReviewStateExt, +} from "./review-status"; import type { CodeownersEntry, CodeOwnersToFilesMap } from "./codeowners"; import type { CurrentReviewStatus } from "./github-gql"; diff --git a/actions/codeowners-review-analysis/src/strings.ts b/actions/codeowners-review-analysis/src/strings.ts index 021f52eaa..ae9e93db0 100644 --- a/actions/codeowners-review-analysis/src/strings.ts +++ b/actions/codeowners-review-analysis/src/strings.ts @@ -3,10 +3,10 @@ import * as core from "@actions/core"; import type { CodeownersEntry } from "./codeowners"; import type { CodeOwnersReviewEntry } from "./run"; +import type { OwnerReviewStatus } from "./review-status"; import { filterFor, getOverallStateForSingleEntry, - OwnerReviewStatus, PullRequestReviewStateExt, iconFor, textFor, diff --git a/actions/codeowners-review-analysis/tsconfig.json b/actions/codeowners-review-analysis/tsconfig.json index a39338de9..2840c42b4 100644 --- a/actions/codeowners-review-analysis/tsconfig.json +++ b/actions/codeowners-review-analysis/tsconfig.json @@ -1,11 +1,11 @@ { "compilerOptions": { "target": "esnext", - "module": "commonjs", + "module": "esnext", "noEmit": true, "isolatedModules": true, "strict": true, "esModuleInterop": true, - "ignoreDeprecations": "6.0" + "moduleResolution": "bundler" } } diff --git a/actions/codeowners-sanity-check/src/strings.ts b/actions/codeowners-sanity-check/src/strings.ts index 7aa006acc..6eaf1c044 100644 --- a/actions/codeowners-sanity-check/src/strings.ts +++ b/actions/codeowners-sanity-check/src/strings.ts @@ -1,5 +1,5 @@ import * as core from "@actions/core"; -import { CodeOwnersError } from "./github"; +import type { CodeOwnersError } from "./github"; export function getNoCodeownersMsg(actor: string): string { return ` diff --git a/actions/codeowners-sanity-check/tsconfig.json b/actions/codeowners-sanity-check/tsconfig.json index a39338de9..2840c42b4 100644 --- a/actions/codeowners-sanity-check/tsconfig.json +++ b/actions/codeowners-sanity-check/tsconfig.json @@ -1,11 +1,11 @@ { "compilerOptions": { "target": "esnext", - "module": "commonjs", + "module": "esnext", "noEmit": true, "isolatedModules": true, "strict": true, "esModuleInterop": true, - "ignoreDeprecations": "6.0" + "moduleResolution": "bundler" } } diff --git a/actions/delete-deployments/src/github.ts b/actions/delete-deployments/src/github.ts index 7056c1e04..e61e94845 100644 --- a/actions/delete-deployments/src/github.ts +++ b/actions/delete-deployments/src/github.ts @@ -3,7 +3,7 @@ import * as github from "@actions/github"; import { throttling } from "@octokit/plugin-throttling"; import { retry } from "@octokit/plugin-retry"; -import { GetResponseTypeFromEndpointMethod } from "@octokit/types"; +import type { GetResponseTypeFromEndpointMethod } from "@octokit/types"; export type OctokitType = ReturnType; diff --git a/actions/delete-deployments/src/run.ts b/actions/delete-deployments/src/run.ts index 48e83971e..395425d90 100644 --- a/actions/delete-deployments/src/run.ts +++ b/actions/delete-deployments/src/run.ts @@ -1,5 +1,5 @@ import * as core from "@actions/core"; -import * as github from "@actions/github"; +import type * as github from "@actions/github"; export type Octokit = ReturnType; diff --git a/actions/delete-deployments/tsconfig.json b/actions/delete-deployments/tsconfig.json index a39338de9..2840c42b4 100644 --- a/actions/delete-deployments/tsconfig.json +++ b/actions/delete-deployments/tsconfig.json @@ -1,11 +1,11 @@ { "compilerOptions": { "target": "esnext", - "module": "commonjs", + "module": "esnext", "noEmit": true, "isolatedModules": true, "strict": true, "esModuleInterop": true, - "ignoreDeprecations": "6.0" + "moduleResolution": "bundler" } } diff --git a/actions/get-latest-tag/src/github.ts b/actions/get-latest-tag/src/github.ts index 71fefdcf6..ceb05a1e4 100644 --- a/actions/get-latest-tag/src/github.ts +++ b/actions/get-latest-tag/src/github.ts @@ -1,7 +1,7 @@ import * as core from "@actions/core"; -import * as github from "@actions/github"; +import type * as github from "@actions/github"; -import { GetResponseTypeFromEndpointMethod } from "@octokit/types"; +import type { GetResponseTypeFromEndpointMethod } from "@octokit/types"; export type OctokitType = ReturnType; type ListMatchingRefsResponse = GetResponseTypeFromEndpointMethod< diff --git a/actions/get-latest-tag/tsconfig.json b/actions/get-latest-tag/tsconfig.json index a39338de9..2840c42b4 100644 --- a/actions/get-latest-tag/tsconfig.json +++ b/actions/get-latest-tag/tsconfig.json @@ -1,11 +1,11 @@ { "compilerOptions": { "target": "esnext", - "module": "commonjs", + "module": "esnext", "noEmit": true, "isolatedModules": true, "strict": true, "esModuleInterop": true, - "ignoreDeprecations": "6.0" + "moduleResolution": "bundler" } } diff --git a/actions/get-refs-from-pr-body/src/github.ts b/actions/get-refs-from-pr-body/src/github.ts index 4daadb554..579c6858a 100644 --- a/actions/get-refs-from-pr-body/src/github.ts +++ b/actions/get-refs-from-pr-body/src/github.ts @@ -1,5 +1,5 @@ import * as core from "@actions/core"; -import * as github from "@actions/github"; +import type * as github from "@actions/github"; export type OctokitType = ReturnType; diff --git a/actions/get-refs-from-pr-body/src/run.ts b/actions/get-refs-from-pr-body/src/run.ts index 0905d13fb..9aac2f1d7 100644 --- a/actions/get-refs-from-pr-body/src/run.ts +++ b/actions/get-refs-from-pr-body/src/run.ts @@ -2,9 +2,11 @@ import * as core from "@actions/core"; import * as github from "@actions/github"; import { getInputs, getInvokeContext } from "./run-inputs"; -import { REPO_CONFIG, RepoConfig } from "./repo-config"; +import type { RepoConfig } from "./repo-config"; +import { REPO_CONFIG } from "./repo-config"; import { extractRefsFromBody, isFullSha, validateGitRef } from "./refs"; -import { getPullRequestBody, OctokitType, resolveRefToSha } from "./github"; +import type { OctokitType } from "./github"; +import { getPullRequestBody, resolveRefToSha } from "./github"; import { verifyCommit } from "./sigscanner"; type ProcessResult = { ok: true; sha: string } | { ok: false; failure: string }; diff --git a/actions/get-refs-from-pr-body/tsconfig.json b/actions/get-refs-from-pr-body/tsconfig.json index a39338de9..2840c42b4 100644 --- a/actions/get-refs-from-pr-body/tsconfig.json +++ b/actions/get-refs-from-pr-body/tsconfig.json @@ -1,11 +1,11 @@ { "compilerOptions": { "target": "esnext", - "module": "commonjs", + "module": "esnext", "noEmit": true, "isolatedModules": true, "strict": true, "esModuleInterop": true, - "ignoreDeprecations": "6.0" + "moduleResolution": "bundler" } } diff --git a/actions/gha-workflow-validator/dist/index.js b/actions/gha-workflow-validator/dist/index.js index 0efa33a88..a212a867f 100644 --- a/actions/gha-workflow-validator/dist/index.js +++ b/actions/gha-workflow-validator/dist/index.js @@ -27503,6 +27503,8 @@ var ActionRefValidation = class { this.octokit = octokit; this.options = options ?? { validateNodeVersion: true }; } + octokit; + options; async validateLine(line) { if (line.operation === "unchanged") { return []; @@ -27680,6 +27682,7 @@ function extractActionReferenceFromLine(line) { // actions/gha-workflow-validator/src/validations/actions-runner-validations.ts var ActionsRunnerValidation = class { + options; constructor(options) { this.options = options ?? {}; } @@ -27823,6 +27826,7 @@ function extractActionRunnerFromLine(line) { // actions/gha-workflow-validator/src/validations/ignores-comment-validation.ts var IgnoresCommentValidation = class { + options; constructor(options) { this.options = options ?? {}; } @@ -27855,6 +27859,7 @@ function extractIgnoresComment(fileLine) { // actions/gha-workflow-validator/src/validations/actions-cache-validation.ts var ActionsCacheVersionValidation = class { + options; constructor(options) { this.options = options ?? {}; } diff --git a/actions/gha-workflow-validator/src/__tests__/action-reference-validation.test.ts b/actions/gha-workflow-validator/src/__tests__/action-reference-validation.test.ts index ad2dd7893..29f562013 100644 --- a/actions/gha-workflow-validator/src/__tests__/action-reference-validation.test.ts +++ b/actions/gha-workflow-validator/src/__tests__/action-reference-validation.test.ts @@ -2,7 +2,7 @@ import { ActionRefValidation, extractActionReferenceFromLine, } from "../validations/action-reference-validations.js"; -import { FileLine } from "../parse-files.js"; +import type { FileLine } from "../parse-files.js"; import { getNock, getTestOctokit } from "./__helpers__/test-utils.js"; import { vi, describe, it, expect } from "vitest"; diff --git a/actions/gha-workflow-validator/src/__tests__/actions-runner-validation.test.ts b/actions/gha-workflow-validator/src/__tests__/actions-runner-validation.test.ts index 17bec5e41..806c96af9 100644 --- a/actions/gha-workflow-validator/src/__tests__/actions-runner-validation.test.ts +++ b/actions/gha-workflow-validator/src/__tests__/actions-runner-validation.test.ts @@ -2,7 +2,7 @@ import { ActionsRunnerValidation, extractActionRunnerFromLine, } from "../validations/actions-runner-validations.js"; -import { FileLine, ParsedFile } from "../parse-files.js"; +import type { FileLine, ParsedFile } from "../parse-files.js"; import { vi, describe, it, expect } from "vitest"; vi.mock("@actions/core", async () => { diff --git a/actions/gha-workflow-validator/src/__tests__/ignores-comment-validation.test.ts b/actions/gha-workflow-validator/src/__tests__/ignores-comment-validation.test.ts index 71f2bf8c1..0d24888d1 100644 --- a/actions/gha-workflow-validator/src/__tests__/ignores-comment-validation.test.ts +++ b/actions/gha-workflow-validator/src/__tests__/ignores-comment-validation.test.ts @@ -1,6 +1,6 @@ import { IgnoresCommentValidation } from "../validations/ignores-comment-validation.js"; import { VALIDATOR_IGNORE_LINE } from "../strings.js"; -import { FileLine } from "../parse-files.js"; +import type { FileLine } from "../parse-files.js"; import { vi, describe, it, expect } from "vitest"; vi.mock("@actions/core", async () => { diff --git a/actions/gha-workflow-validator/src/__tests__/output.test.ts b/actions/gha-workflow-validator/src/__tests__/output.test.ts index b919a4f37..f242c9cf9 100644 --- a/actions/gha-workflow-validator/src/__tests__/output.test.ts +++ b/actions/gha-workflow-validator/src/__tests__/output.test.ts @@ -1,10 +1,8 @@ import { setSummary } from "../output.js"; import { vi, afterEach, describe, it, expect } from "vitest"; import * as core from "@actions/core"; -import { - FileValidationResult, - ValidationType, -} from "../validations/validation-check.js"; +import type { FileValidationResult } from "../validations/validation-check.js"; +import { ValidationType } from "../validations/validation-check.js"; import { FIXING_ERRORS } from "../strings.js"; vi.mock("@actions/core", async (importOriginal) => { diff --git a/actions/gha-workflow-validator/src/__tests__/parse-files.test.ts b/actions/gha-workflow-validator/src/__tests__/parse-files.test.ts index 7d20fdd0a..b8738cb2b 100644 --- a/actions/gha-workflow-validator/src/__tests__/parse-files.test.ts +++ b/actions/gha-workflow-validator/src/__tests__/parse-files.test.ts @@ -1,14 +1,14 @@ +import type { ParsedFiles, FileLine } from "../parse-files.js"; import { combineParsedFiles, filterForRelevantChanges, getParsedFilesForValidation, parseGithubDiff, - ParsedFiles, combineFileLines, - FileLine, } from "../parse-files.js"; -import { getComparison, GithubFiles } from "../github.js"; -import { InvokeContext, RunInputs } from "../run.js"; +import type { GithubFiles } from "../github.js"; +import { getComparison } from "../github.js"; +import type { InvokeContext, RunInputs } from "../run.js"; import { getNock, getTestOctokit } from "./__helpers__/test-utils.js"; const nockBack = getNock(); diff --git a/actions/gha-workflow-validator/src/__tests__/validate.test.ts b/actions/gha-workflow-validator/src/__tests__/validate.test.ts index e799f05d1..12823799a 100644 --- a/actions/gha-workflow-validator/src/__tests__/validate.test.ts +++ b/actions/gha-workflow-validator/src/__tests__/validate.test.ts @@ -1,13 +1,11 @@ import { validate, doValidationErrorsExist } from "../validations/validate"; -import { - FileValidationResult, - ValidationType, -} from "../validations/validation-check"; -import { RunInputs } from "../run"; +import type { FileValidationResult } from "../validations/validation-check"; +import { ValidationType } from "../validations/validation-check"; +import type { RunInputs } from "../run"; import { VALIDATOR_IGNORE_LINE } from "../strings"; import { describe, it, expect } from "vitest"; -import { ParsedFiles } from "../parse-files"; +import type { ParsedFiles } from "../parse-files"; const DEFAULT_RUN_INPUTS: RunInputs = { evaluateMode: false, diff --git a/actions/gha-workflow-validator/src/github.ts b/actions/gha-workflow-validator/src/github.ts index 85579ed15..5a1dbb813 100644 --- a/actions/gha-workflow-validator/src/github.ts +++ b/actions/gha-workflow-validator/src/github.ts @@ -1,6 +1,6 @@ import * as core from "@actions/core"; -import * as github from "@actions/github"; -import { GetResponseTypeFromEndpointMethod } from "@octokit/types"; +import type * as github from "@actions/github"; +import type { GetResponseTypeFromEndpointMethod } from "@octokit/types"; import { join } from "node:path"; export type Octokit = ReturnType; diff --git a/actions/gha-workflow-validator/src/output.ts b/actions/gha-workflow-validator/src/output.ts index 6b3e21827..3d532a953 100644 --- a/actions/gha-workflow-validator/src/output.ts +++ b/actions/gha-workflow-validator/src/output.ts @@ -1,13 +1,13 @@ import * as core from "@actions/core"; -import { +import type { SummaryTableRow as TRow, SummaryTableCell as TCell, } from "@actions/core/lib/summary.js"; -import { +import type { FileValidationResult, LineValidationResult, - ValidationType, } from "./validations/validation-check.js"; +import { ValidationType } from "./validations/validation-check.js"; import { FIXING_ERRORS, htmlLink } from "./strings"; export function logValidationMessages( diff --git a/actions/gha-workflow-validator/src/parse-files.ts b/actions/gha-workflow-validator/src/parse-files.ts index 648ef5d85..9273ed996 100644 --- a/actions/gha-workflow-validator/src/parse-files.ts +++ b/actions/gha-workflow-validator/src/parse-files.ts @@ -2,8 +2,9 @@ import * as core from "@actions/core"; import { readFileSync } from "fs"; import { VALIDATOR_IGNORE_LINE } from "./strings.js"; -import { InvokeContext, RunInputs } from "./run.js"; -import { Octokit, getComparison, GithubFiles } from "./github.js"; +import type { InvokeContext, RunInputs } from "./run.js"; +import type { Octokit, GithubFiles } from "./github.js"; +import { getComparison } from "./github.js"; import { getAllWorkflowAndActionFiles } from "./utils.js"; export interface ParsedFile { diff --git a/actions/gha-workflow-validator/src/validations/action-reference-validations.ts b/actions/gha-workflow-validator/src/validations/action-reference-validations.ts index ace0384cc..50582985b 100644 --- a/actions/gha-workflow-validator/src/validations/action-reference-validations.ts +++ b/actions/gha-workflow-validator/src/validations/action-reference-validations.ts @@ -1,9 +1,10 @@ -import { ParsedFile, FileLine } from "../parse-files.js"; -import { Octokit, getActionFileFromGithub } from "../github.js"; +import type { FileLine } from "../parse-files.js"; +import { ParsedFile } from "../parse-files.js"; +import type { Octokit } from "../github.js"; +import { getActionFileFromGithub } from "../github.js"; import * as core from "@actions/core"; +import type { ValidationCheck, ValidationMessage } from "./validation-check.js"; import { - ValidationCheck, - ValidationMessage, FileValidationResult, LineValidationResult, ValidationType, diff --git a/actions/gha-workflow-validator/src/validations/actions-cache-validation.ts b/actions/gha-workflow-validator/src/validations/actions-cache-validation.ts index 8cbf14cc6..87102ac48 100644 --- a/actions/gha-workflow-validator/src/validations/actions-cache-validation.ts +++ b/actions/gha-workflow-validator/src/validations/actions-cache-validation.ts @@ -1,9 +1,6 @@ -import { FileLine } from "../parse-files.js"; -import { - ValidationCheck, - ValidationMessage, - ValidationType, -} from "./validation-check.js"; +import type { FileLine } from "../parse-files.js"; +import type { ValidationCheck, ValidationMessage } from "./validation-check.js"; +import { ValidationType } from "./validation-check.js"; import { extractActionReferenceFromLine } from "./action-reference-validations.js"; interface FileLineActionsCacheVersion extends FileLine { diff --git a/actions/gha-workflow-validator/src/validations/actions-runner-validations.ts b/actions/gha-workflow-validator/src/validations/actions-runner-validations.ts index 9a8d6a6a0..06e5f4d31 100644 --- a/actions/gha-workflow-validator/src/validations/actions-runner-validations.ts +++ b/actions/gha-workflow-validator/src/validations/actions-runner-validations.ts @@ -1,8 +1,8 @@ -import { ParsedFile, FileLine } from "../parse-files.js"; +import type { FileLine } from "../parse-files.js"; +import { ParsedFile } from "../parse-files.js"; import * as core from "@actions/core"; +import type { ValidationCheck, ValidationMessage } from "./validation-check.js"; import { - ValidationCheck, - ValidationMessage, FileValidationResult, LineValidationResult, ValidationType, diff --git a/actions/gha-workflow-validator/src/validations/ignores-comment-validation.ts b/actions/gha-workflow-validator/src/validations/ignores-comment-validation.ts index a16b6e9b0..07a625599 100644 --- a/actions/gha-workflow-validator/src/validations/ignores-comment-validation.ts +++ b/actions/gha-workflow-validator/src/validations/ignores-comment-validation.ts @@ -1,9 +1,6 @@ -import { FileLine } from "../parse-files.js"; -import { - ValidationCheck, - ValidationMessage, - ValidationType, -} from "./validation-check.js"; +import type { FileLine } from "../parse-files.js"; +import type { ValidationCheck, ValidationMessage } from "./validation-check.js"; +import { ValidationType } from "./validation-check.js"; import { VALIDATOR_IGNORE_LINE } from "../strings.js"; interface FileLineIgnoresComment extends FileLine { diff --git a/actions/gha-workflow-validator/src/validations/validate.ts b/actions/gha-workflow-validator/src/validations/validate.ts index b6c8ee207..7b0885ab7 100644 --- a/actions/gha-workflow-validator/src/validations/validate.ts +++ b/actions/gha-workflow-validator/src/validations/validate.ts @@ -5,17 +5,17 @@ import { ActionsRunnerValidation } from "./actions-runner-validations.js"; import { IgnoresCommentValidation } from "./ignores-comment-validation.js"; import { ActionsCacheVersionValidation } from "./actions-cache-validation.js"; -import { RunInputs } from "../run.js"; -import { Octokit } from "../github.js"; -import { +import type { RunInputs } from "../run.js"; +import type { Octokit } from "../github.js"; +import type { FileValidationResult, LineValidationResult, ValidationMessage, - ValidationType, ValidationCheck, } from "./validation-check.js"; +import { ValidationType } from "./validation-check.js"; -import { ParsedFiles, ParsedFile, FileLine } from "../parse-files.js"; +import type { ParsedFiles, ParsedFile, FileLine } from "../parse-files.js"; function getValidators( { diff --git a/actions/gha-workflow-validator/src/validations/validation-check.ts b/actions/gha-workflow-validator/src/validations/validation-check.ts index d4354a112..ce29ca68d 100644 --- a/actions/gha-workflow-validator/src/validations/validation-check.ts +++ b/actions/gha-workflow-validator/src/validations/validation-check.ts @@ -1,4 +1,5 @@ -import { FileLine, ParsedFile } from "../parse-files.js"; +import type { FileLine } from "../parse-files.js"; +import { ParsedFile } from "../parse-files.js"; export interface FileValidationResult { filename: string; diff --git a/actions/gha-workflow-validator/tsconfig.json b/actions/gha-workflow-validator/tsconfig.json index a39338de9..2840c42b4 100644 --- a/actions/gha-workflow-validator/tsconfig.json +++ b/actions/gha-workflow-validator/tsconfig.json @@ -1,11 +1,11 @@ { "compilerOptions": { "target": "esnext", - "module": "commonjs", + "module": "esnext", "noEmit": true, "isolatedModules": true, "strict": true, "esModuleInterop": true, - "ignoreDeprecations": "6.0" + "moduleResolution": "bundler" } } diff --git a/actions/matrix-job-check/src/__tests__/run.test.ts b/actions/matrix-job-check/src/__tests__/run.test.ts index b1d8dac1d..a061b8a7e 100644 --- a/actions/matrix-job-check/src/__tests__/run.test.ts +++ b/actions/matrix-job-check/src/__tests__/run.test.ts @@ -2,11 +2,8 @@ * This runs through the whole action e2e with mocks/fixtures. */ -import { - getNock, - getTestOctokit, - coreLoggingStubs, -} from "./__helpers__/test-utils.js"; +import type { coreLoggingStubs } from "./__helpers__/test-utils.js"; +import { getNock, getTestOctokit } from "./__helpers__/test-utils.js"; import { vi, beforeEach, describe, it, expect } from "vitest"; import type * as GithubImport from "@actions/github"; diff --git a/actions/matrix-job-check/src/github.ts b/actions/matrix-job-check/src/github.ts index b903ae34b..722643c6c 100644 --- a/actions/matrix-job-check/src/github.ts +++ b/actions/matrix-job-check/src/github.ts @@ -1,6 +1,6 @@ import * as core from "@actions/core"; -import * as github from "@actions/github"; -import { GetResponseTypeFromEndpointMethod } from "@octokit/types"; +import type * as github from "@actions/github"; +import type { GetResponseTypeFromEndpointMethod } from "@octokit/types"; export type OctokitType = ReturnType; diff --git a/actions/matrix-job-check/tsconfig.json b/actions/matrix-job-check/tsconfig.json index a39338de9..2840c42b4 100644 --- a/actions/matrix-job-check/tsconfig.json +++ b/actions/matrix-job-check/tsconfig.json @@ -1,11 +1,11 @@ { "compilerOptions": { "target": "esnext", - "module": "commonjs", + "module": "esnext", "noEmit": true, "isolatedModules": true, "strict": true, "esModuleInterop": true, - "ignoreDeprecations": "6.0" + "moduleResolution": "bundler" } } diff --git a/actions/parse-and-mask-test-secrets/mask-testsecrets/main.go b/actions/parse-and-mask-test-secrets/mask-testsecrets/main.go index 688b44ebc..7cef9c136 100644 --- a/actions/parse-and-mask-test-secrets/mask-testsecrets/main.go +++ b/actions/parse-and-mask-test-secrets/mask-testsecrets/main.go @@ -95,7 +95,7 @@ func mustAddToGithubEnv(key, value string) { } } -func mustMaskSecret(description string, secret string) { +func mustMaskSecret(description, secret string) { if secret != "" { fmt.Printf("Mask '%s'\n", description) fmt.Printf("::add-mask::%s\n", secret) diff --git a/actions/semver-compare/tsconfig.json b/actions/semver-compare/tsconfig.json index 962e3ce88..455f3de90 100644 --- a/actions/semver-compare/tsconfig.json +++ b/actions/semver-compare/tsconfig.json @@ -1,12 +1,12 @@ { "compilerOptions": { "target": "esnext", - "module": "commonjs", + "module": "esnext", "noEmit": true, "isolatedModules": true, "strict": true, "esModuleInterop": true, - "ignoreDeprecations": "6.0", - "types": ["node"] + "types": ["node"], + "moduleResolution": "bundler" } } diff --git a/actions/setup-gap/authz/main.go b/actions/setup-gap/authz/main.go index ecefa8fe8..e3362a53a 100644 --- a/actions/setup-gap/authz/main.go +++ b/actions/setup-gap/authz/main.go @@ -238,7 +238,7 @@ func handleCheck(w http.ResponseWriter, r *http.Request) { authResp.Status.Code = 200 authResp.HttpResponse.Headers = make(map[string]string) - addHeader(w, authResp, config.GithubOidcTokenHeaderName, "Bearer "+token) + addHeader(w, authResp, config.GithubOidcTokenHeaderName, "Bearer "+token) addHeader(w, authResp, "x-repository", config.GithubRepository) addHeader(w, authResp, "x-run-url", config.GithubRunURL) diff --git a/actions/signed-commits/dist/index.js b/actions/signed-commits/dist/index.js index 3d3d510e8..e9257c65f 100644 --- a/actions/signed-commits/dist/index.js +++ b/actions/signed-commits/dist/index.js @@ -58210,10 +58210,10 @@ var push = async (branch, { force } = {}) => { ); }; var switchToMaybeExistingBranch = async (branch) => { - let { stderr } = await getExecOutput("git", ["checkout", branch], { + const { stderr } = await getExecOutput("git", ["checkout", branch], { ignoreReturnCode: true }); - let createLocalBranch = !stderr.toString().includes(`Switched to a new branch '${branch}'`); + const createLocalBranch = !stderr.toString().includes(`Switched to a new branch '${branch}'`); if (createLocalBranch) { await exec("git", ["checkout", "-b", branch]); } @@ -62410,14 +62410,14 @@ var BumpLevels = { major: 3 }; async function getVersionsByDirectory(cwd) { - let { packages } = await (0, import_get_packages.getPackages)(cwd); + const { packages } = await (0, import_get_packages.getPackages)(cwd); return new Map(packages.map((x) => [x.dir, x.packageJson.version])); } async function getChangedPackages(cwd, previousVersions) { debug(`Getting changed packages from ${cwd}`); - let { packages } = await (0, import_get_packages.getPackages)(cwd); - let changedPackages = /* @__PURE__ */ new Set(); - for (let pkg of packages) { + const { packages } = await (0, import_get_packages.getPackages)(cwd); + const changedPackages = /* @__PURE__ */ new Set(); + for (const pkg of packages) { const previousVersion = previousVersions.get(pkg.dir); if (previousVersion !== pkg.packageJson.version) { changedPackages.add(pkg); @@ -62427,24 +62427,24 @@ async function getChangedPackages(cwd, previousVersions) { } function getChangelogEntry(changelog, version) { debug(`Getting changelog entry for ${version}`); - let ast = (0, import_unified.default)().use(import_remark_parse.default).parse(changelog); + const ast = (0, import_unified.default)().use(import_remark_parse.default).parse(changelog); let highestLevel = BumpLevels.dep; if (!isParentNode(ast)) { throw new Error("ast is not a parent node"); } - let nodes = ast.children; + const nodes = ast.children; let headingStartInfo; let endIndex; for (let i = 0; i < nodes.length; i++) { - let node = nodes[i]; + const node = nodes[i]; if (node.type === "heading") { if (!nodeHasDepthProperty(node)) { throw new Error("node is missing depth property"); } - let stringified = (0, import_mdast_util_to_string.default)(node); - let match = stringified.toLowerCase().match(/(major|minor|patch)/); + const stringified = (0, import_mdast_util_to_string.default)(node); + const match = stringified.toLowerCase().match(/(major|minor|patch)/); if (match !== null) { - let level = BumpLevels[match[0]]; + const level = BumpLevels[match[0]]; highestLevel = Math.max(level, highestLevel); } if (headingStartInfo === void 0 && stringified === version) { @@ -66217,10 +66217,10 @@ async function getChangesets(rootDir, sinceRef) { // actions/signed-commits/src/read-changeset-state.ts async function readChangesetState(cwd = process.cwd()) { - let preState = await readPreState(cwd); - let changesets = await getChangesets(cwd); + const preState = await readPreState(cwd); + const changesets = await getChangesets(cwd); if (preState !== void 0 && preState.mode === "pre") { - let changesetsToFilter = new Set(preState.changesets); + const changesetsToFilter = new Set(preState.changesets); return { preState, changesets: changesets.filter((x) => !changesetsToFilter.has(x.id)) @@ -66498,9 +66498,12 @@ var createRelease = async (octokit, { pkg, tagName }) => { debug( `Creating release for ${pkg.packageJson.name}@${pkg.packageJson.version} (tag: ${tagName})` ); - let changelogFileName = import_path5.default.join(pkg.dir, "CHANGELOG.md"); - let changelog = await import_fs_extra2.default.readFile(changelogFileName, "utf8"); - let changelogEntry = getChangelogEntry(changelog, pkg.packageJson.version); + const changelogFileName = import_path5.default.join(pkg.dir, "CHANGELOG.md"); + const changelog = await import_fs_extra2.default.readFile(changelogFileName, "utf8"); + const changelogEntry = getChangelogEntry( + changelog, + pkg.packageJson.version + ); if (!changelogEntry) { throw new Error( `Could not find changelog entry for ${pkg.packageJson.name}@${pkg.packageJson.version}` @@ -66560,8 +66563,8 @@ async function runPublish({ ); } const octokit = setupOctokit(githubToken); - let [publishCommand, ...publishArgs] = script.split(/\s+/); - let changesetPublishOutput = await getExecOutput( + const [publishCommand, ...publishArgs] = script.split(/\s+/); + const changesetPublishOutput = await getExecOutput( publishCommand, publishArgs, { cwd } @@ -66574,11 +66577,13 @@ async function runPublish({ ); debug(`Tags pushed: ${JSON.stringify(tags.map((tag) => tag.name))}`); const nonMajorTags = tags.filter((tag) => !tag.majorVersion); - let { packages, tool } = await (0, import_get_packages4.getPackages)(cwd); - let releasedPackages = []; + const { packages, tool } = await (0, import_get_packages4.getPackages)(cwd); + const releasedPackages = []; if (tool.type !== "root") { - let packagesByName = new Map(packages.map((x) => [x.packageJson.name, x])); - for (let tag of nonMajorTags) { + const packagesByName = new Map( + packages.map((x) => [x.packageJson.name, x]) + ); + for (const tag of nonMajorTags) { const [pkgName, _version] = tag.name.split(tagSeparator); const pkg = packagesByName.get(pkgName); if (pkg === void 0) { @@ -66612,10 +66617,10 @@ async function runPublish({ `No package found.This is probably a bug in the action, please open an issue` ); } - let pkg = packages[0]; - let newTagRegex = /New tag:/; - for (let line of changesetPublishOutput.stdout.split("\n")) { - let match = line.match(newTagRegex); + const pkg = packages[0]; + const newTagRegex = /New tag:/; + for (const line of changesetPublishOutput.stdout.split("\n")) { + const match = line.match(newTagRegex); if (match) { releasedPackages.push([ pkg, @@ -66662,15 +66667,15 @@ async function getVersionPrBody({ fullRepo, branch }) { - let messageHeader = `This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and ${hasPublishScript ? `the packages will be published to npm automatically` : `publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing)`}. If you're not ready to do a release yet, that's fine, whenever you add more changesets to ${branch}, this PR will be updated. + const messageHeader = `This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and ${hasPublishScript ? `the packages will be published to npm automatically` : `publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing)`}. If you're not ready to do a release yet, that's fine, whenever you add more changesets to ${branch}, this PR will be updated. `; - let messagePrestate = !!preState ? `\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F + const messagePrestate = !!preState ? `\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F \`${branch}\` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run \`changeset pre exit\` on \`${branch}\`. \u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F ` : ""; - let messageReleasesHeading = `# Releases`; + const messageReleasesHeading = `# Releases`; let fullMessage = [ messageHeader, messagePrestate, @@ -66717,10 +66722,10 @@ async function runVersion({ }) { const octokit = setupOctokit(githubToken); const { owner, repo } = context2.repo; - let fullRepo = `${owner}/${repo}`; - let branch = context2.ref.replace("refs/heads/", ""); - let versionBranch = `changeset-release/${branch}`; - let { preState } = await readChangesetState(cwd); + const fullRepo = `${owner}/${repo}`; + const branch = context2.ref.replace("refs/heads/", ""); + const versionBranch = `changeset-release/${branch}`; + const { preState } = await readChangesetState(cwd); await switchToMaybeExistingBranch(versionBranch); await reset(context2.sha); const searchQuery = `repo:${fullRepo}+state:open+head:${versionBranch}+base:${branch}+is:pull-request`; @@ -66730,23 +66735,26 @@ async function runVersion({ await push(versionBranch, { force: true }); const versionsByDirectory = await getVersionsByDirectory(cwd); if (script) { - let [versionCommand, ...versionArgs] = script.split(/\s+/); + const [versionCommand, ...versionArgs] = script.split(/\s+/); await exec(versionCommand, versionArgs, { cwd }); } else { - let changesetsCliPkgJson = requireChangesetsCliPkgJson(cwd); - let cmd = semver.lt(changesetsCliPkgJson.version, "2.0.0") ? "bump" : "version"; + const changesetsCliPkgJson = requireChangesetsCliPkgJson(cwd); + const cmd = semver.lt(changesetsCliPkgJson.version, "2.0.0") ? "bump" : "version"; await exec("node", [(0, import_resolve_from.default)(cwd, "@changesets/cli/bin.js"), cmd], { cwd }); } const changedPackages = await getChangedPackages(cwd, versionsByDirectory); - let changedPackagesInfoPromises = Promise.all( + const changedPackagesInfoPromises = Promise.all( changedPackages.map(async (pkg) => { - let changelogContents = await import_fs_extra2.default.readFile( + const changelogContents = await import_fs_extra2.default.readFile( import_path5.default.join(pkg.dir, "CHANGELOG.md"), "utf8" ); - let entry = getChangelogEntry(changelogContents, pkg.packageJson.version); + const entry = getChangelogEntry( + changelogContents, + pkg.packageJson.version + ); return { highestLevel: entry.highestLevel, private: !!pkg.packageJson.private, @@ -66776,7 +66784,7 @@ async function runVersion({ } info(JSON.stringify(searchResult.data, null, 2)); const changedPackagesInfo = (await changedPackagesInfoPromises).filter((x) => x).sort(sortTheThings); - let prBody = await getVersionPrBody({ + const prBody = await getVersionPrBody({ hasPublishScript, preState, fullRepo, @@ -66847,13 +66855,13 @@ var getOptionalInput = (name) => getInput(name) || void 0; login github-actions[bot] password ${githubToken}` ); - let { changesets } = await readChangesetState(); - let publishScript = getInput("publish"); - let hasChangesets = changesets.length !== 0; + const { changesets } = await readChangesetState(); + const publishScript = getInput("publish"); + const hasChangesets = changesets.length !== 0; const hasNonEmptyChangesets = changesets.some( (changeset) => changeset.releases.length > 0 ); - let hasPublishScript = !!publishScript; + const hasPublishScript = !!publishScript; setOutput("published", "false"); setOutput("publishedPackages", "[]"); setOutput("hasChangesets", String(hasChangesets)); @@ -66865,7 +66873,7 @@ password ${githubToken}` info( "No changesets found, attempting to publish any unpublished packages to npm" ); - let userNpmrcPath = `${process.env.HOME}/.npmrc`; + const userNpmrcPath = `${process.env.HOME}/.npmrc`; if (import_fs_extra3.default.existsSync(userNpmrcPath)) { info("Found existing user .npmrc file"); const userNpmrcContent = await import_fs_extra3.default.readFile(userNpmrcPath, "utf8"); diff --git a/actions/signed-commits/src/git/github-git/index.test.ts b/actions/signed-commits/src/git/github-git/index.test.ts index 19aff5d94..a2384a281 100644 --- a/actions/signed-commits/src/git/github-git/index.test.ts +++ b/actions/signed-commits/src/git/github-git/index.test.ts @@ -3,7 +3,7 @@ import fetch from "node-fetch"; import { getOctokit } from "@actions/github"; import nock from "nock"; import path from "path"; -import { CreateCommitOnBranchInput } from "../../generated/graphql"; +import type { CreateCommitOnBranchInput } from "../../generated/graphql"; import { getRemoteHeadOid } from "./index"; import { createCommitOnBranch } from "./index"; diff --git a/actions/signed-commits/src/git/github-git/index.ts b/actions/signed-commits/src/git/github-git/index.ts index c480b10ea..b6be418f1 100644 --- a/actions/signed-commits/src/git/github-git/index.ts +++ b/actions/signed-commits/src/git/github-git/index.ts @@ -1,7 +1,7 @@ -import { getOctokit } from "@actions/github"; +import type { getOctokit } from "@actions/github"; import * as core from "@actions/core"; import { dirname } from "path"; -import { +import type { CreateCommitOnBranchInput, CreateCommitOnBranchPayload, FileAddition, diff --git a/actions/signed-commits/src/git/github-git/repo-status.ts b/actions/signed-commits/src/git/github-git/repo-status.ts index ccd344d90..71531d95e 100644 --- a/actions/signed-commits/src/git/github-git/repo-status.ts +++ b/actions/signed-commits/src/git/github-git/repo-status.ts @@ -2,7 +2,7 @@ import * as core from "@actions/core"; import { execWithOutput } from "../../utils"; import { join } from "path"; import { readFileSync } from "fs"; -import { +import type { FileChanges, FileAddition, FileDeletion, diff --git a/actions/signed-commits/src/git/github-git/repo-tags.test.ts b/actions/signed-commits/src/git/github-git/repo-tags.test.ts index 6c66ee8cd..2055d52b9 100644 --- a/actions/signed-commits/src/git/github-git/repo-tags.test.ts +++ b/actions/signed-commits/src/git/github-git/repo-tags.test.ts @@ -1,9 +1,9 @@ import { execSync } from "child_process"; import { execWithOutput } from "../../utils"; +import type { GitTag } from "./repo-tags"; import { deleteTags, createLightweightTags, - GitTag, pushTags, getRemoteTagNames, getLocalTags, @@ -513,23 +513,23 @@ describe("repo-tags", () => { const releaseTagPushCalls = execSpy.mock.calls.filter( ([cmd, args]) => cmd === "git" && - args[0] === "push" && - args[1] === "origin" && - args[2] !== "--tags" && - args[2] !== "--force", + args?.[0] === "push" && + args?.[1] === "origin" && + args?.[2] !== "--tags" && + args?.[2] !== "--force", ); expect(releaseTagPushCalls).toHaveLength(testTags.localOnlyTags.length); expect( - releaseTagPushCalls.every(([, args]) => typeof args[2] === "string"), + releaseTagPushCalls.every(([, args]) => typeof args?.[2] === "string"), ).toBe(true); expect( execSpy.mock.calls.some( ([cmd, args]) => cmd === "git" && - args[0] === "push" && - args[1] === "origin" && - args[2] === "--tags", + args?.[0] === "push" && + args?.[1] === "origin" && + args?.[2] === "--tags", ), ).toBe(false); diff --git a/actions/signed-commits/src/git/local-git.ts b/actions/signed-commits/src/git/local-git.ts index 2d003e03e..f848cc157 100644 --- a/actions/signed-commits/src/git/local-git.ts +++ b/actions/signed-commits/src/git/local-git.ts @@ -30,10 +30,10 @@ export const pushTags = async () => { }; export const switchToMaybeExistingBranch = async (branch: string) => { - let { stderr } = await getExecOutput("git", ["checkout", branch], { + const { stderr } = await getExecOutput("git", ["checkout", branch], { ignoreReturnCode: true, }); - let createLocalBranch = !stderr + const createLocalBranch = !stderr .toString() .includes(`Switched to a new branch '${branch}'`); if (createLocalBranch) { diff --git a/actions/signed-commits/src/index.ts b/actions/signed-commits/src/index.ts index 8b10a4d6e..b651595e3 100644 --- a/actions/signed-commits/src/index.ts +++ b/actions/signed-commits/src/index.ts @@ -42,14 +42,14 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined; `machine github.com\nlogin github-actions[bot]\npassword ${githubToken}`, ); - let { changesets } = await readChangesetState(); + const { changesets } = await readChangesetState(); - let publishScript = core.getInput("publish"); - let hasChangesets = changesets.length !== 0; + const publishScript = core.getInput("publish"); + const hasChangesets = changesets.length !== 0; const hasNonEmptyChangesets = changesets.some( (changeset) => changeset.releases.length > 0, ); - let hasPublishScript = !!publishScript; + const hasPublishScript = !!publishScript; core.setOutput("published", "false"); core.setOutput("publishedPackages", "[]"); @@ -64,7 +64,7 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined; "No changesets found, attempting to publish any unpublished packages to npm", ); - let userNpmrcPath = `${process.env.HOME}/.npmrc`; + const userNpmrcPath = `${process.env.HOME}/.npmrc`; if (fs.existsSync(userNpmrcPath)) { core.info("Found existing user .npmrc file"); const userNpmrcContent = await fs.readFile(userNpmrcPath, "utf8"); diff --git a/actions/signed-commits/src/read-changeset-state.ts b/actions/signed-commits/src/read-changeset-state.ts index 2de88bede..4b8c9023c 100644 --- a/actions/signed-commits/src/read-changeset-state.ts +++ b/actions/signed-commits/src/read-changeset-state.ts @@ -1,4 +1,4 @@ -import { PreState, NewChangeset } from "@changesets/types"; +import type { PreState, NewChangeset } from "@changesets/types"; import { readPreState } from "@changesets/pre"; import readChangesets from "@changesets/read"; @@ -10,11 +10,11 @@ export type ChangesetState = { export default async function readChangesetState( cwd: string = process.cwd(), ): Promise { - let preState = await readPreState(cwd); - let changesets = await readChangesets(cwd); + const preState = await readPreState(cwd); + const changesets = await readChangesets(cwd); if (preState !== undefined && preState.mode === "pre") { - let changesetsToFilter = new Set(preState.changesets); + const changesetsToFilter = new Set(preState.changesets); return { preState, diff --git a/actions/signed-commits/src/run.test.ts b/actions/signed-commits/src/run.test.ts index 71d82bb6a..d8b933abf 100644 --- a/actions/signed-commits/src/run.test.ts +++ b/actions/signed-commits/src/run.test.ts @@ -3,7 +3,7 @@ import fs from "fs-extra"; import path from "path"; import nock from "nock"; import writeChangeset from "@changesets/write"; -import { Changeset } from "@changesets/types"; +import type { Changeset } from "@changesets/types"; import { runVersion } from "./run"; import { exec } from "@actions/exec"; @@ -68,7 +68,7 @@ vi.mock("@actions/github/lib/utils", () => ({ })); vi.mock("./git/local-git"); -let mockedGithubMethods = { +const mockedGithubMethods = { search: { issuesAndPullRequests: vi.fn(), }, @@ -197,7 +197,7 @@ describe("version", () => { }); it("only includes bumped packages in the PR body", async () => { - let cwd = f.copy("simple-project"); + const cwd = f.copy("simple-project"); setupRepo(cwd); mockedGithubMethods.search.issuesAndPullRequests.mockImplementationOnce( @@ -232,7 +232,7 @@ describe("version", () => { }); it("doesn't include ignored package that got a dependency update in the PR body", async () => { - let cwd = f.copy("ignored-package"); + const cwd = f.copy("ignored-package"); setupRepo(cwd); mockedGithubMethods.search.issuesAndPullRequests.mockImplementationOnce( @@ -267,7 +267,7 @@ describe("version", () => { }); it("does not include changelog entries if full message exceeds size limit", async () => { - let cwd = f.copy("simple-project"); + const cwd = f.copy("simple-project"); setupRepo(cwd); mockedGithubMethods.search.issuesAndPullRequests.mockImplementationOnce( @@ -326,7 +326,7 @@ fluminis divesque vulnere aquis parce lapsis rabie si visa fulmineis. }); it("does not include any release information if a message with simplified release info exceeds size limit", async () => { - let cwd = f.copy("simple-project"); + const cwd = f.copy("simple-project"); setupRepo(cwd); mockedGithubMethods.search.issuesAndPullRequests.mockImplementationOnce( diff --git a/actions/signed-commits/src/run.ts b/actions/signed-commits/src/run.ts index d2d6e19d2..1da248217 100644 --- a/actions/signed-commits/src/run.ts +++ b/actions/signed-commits/src/run.ts @@ -3,10 +3,11 @@ import { GitHub, getOctokitOptions } from "@actions/github/lib/utils"; import * as github from "@actions/github"; import * as core from "@actions/core"; import fs from "fs-extra"; -import { getPackages, Package } from "@manypkg/get-packages"; +import type { Package } from "@manypkg/get-packages"; +import { getPackages } from "@manypkg/get-packages"; import path from "path"; import * as semver from "semver"; -import { PreState } from "@changesets/types"; +import type { PreState } from "@changesets/types"; import { getChangelogEntry, getChangedPackages, @@ -18,7 +19,7 @@ import * as githubGitUtils from "./git/github-git"; import readChangesetState from "./read-changeset-state"; import resolveFrom from "resolve-from"; import { throttling } from "@octokit/plugin-throttling"; -import { GitTag } from "./git/github-git/repo-tags"; +import type { GitTag } from "./git/github-git/repo-tags"; // GitHub Issues/PRs messages have a max size limit on the // message body payload. @@ -73,11 +74,14 @@ const createRelease = async ( core.debug( `Creating release for ${pkg.packageJson.name}@${pkg.packageJson.version} (tag: ${tagName})`, ); - let changelogFileName = path.join(pkg.dir, "CHANGELOG.md"); + const changelogFileName = path.join(pkg.dir, "CHANGELOG.md"); - let changelog = await fs.readFile(changelogFileName, "utf8"); + const changelog = await fs.readFile(changelogFileName, "utf8"); - let changelogEntry = getChangelogEntry(changelog, pkg.packageJson.version); + const changelogEntry = getChangelogEntry( + changelog, + pkg.packageJson.version, + ); if (!changelogEntry) { // we can find a changelog but not the entry for this version // if this is true, something has probably gone wrong @@ -179,9 +183,9 @@ export async function runPublish({ const octokit = setupOctokit(githubToken); - let [publishCommand, ...publishArgs] = script.split(/\s+/); + const [publishCommand, ...publishArgs] = script.split(/\s+/); - let changesetPublishOutput = await getExecOutput( + const changesetPublishOutput = await getExecOutput( publishCommand, publishArgs, { cwd }, @@ -198,16 +202,18 @@ export async function runPublish({ const nonMajorTags = tags.filter((tag) => !tag.majorVersion); - let { packages, tool } = await getPackages(cwd); - let releasedPackages: [Package, GitTag][] = []; + const { packages, tool } = await getPackages(cwd); + const releasedPackages: [Package, GitTag][] = []; // if we are in a monorepo, then publish multiple packages // a "root" tool is a single package repo // https://github.com/Thinkmill/manypkg/blob/main/packages/tools/src/RootTool.ts#L17C4-L17C64 if (tool.type !== "root") { - let packagesByName = new Map(packages.map((x) => [x.packageJson.name, x])); + const packagesByName = new Map( + packages.map((x) => [x.packageJson.name, x]), + ); - for (let tag of nonMajorTags) { + for (const tag of nonMajorTags) { const [pkgName, _version] = tag.name.split(tagSeparator); const pkg = packagesByName.get(pkgName); @@ -251,11 +257,11 @@ export async function runPublish({ "This is probably a bug in the action, please open an issue", ); } - let pkg = packages[0]; - let newTagRegex = /New tag:/; + const pkg = packages[0]; + const newTagRegex = /New tag:/; - for (let line of changesetPublishOutput.stdout.split("\n")) { - let match = line.match(newTagRegex); + for (const line of changesetPublishOutput.stdout.split("\n")) { + const match = line.match(newTagRegex); if (match) { releasedPackages.push([ @@ -326,13 +332,13 @@ export async function getVersionPrBody({ fullRepo, branch, }: GetMessageOptions) { - let messageHeader = `This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and ${ + const messageHeader = `This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and ${ hasPublishScript ? `the packages will be published to npm automatically` : `publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing)` }. If you're not ready to do a release yet, that's fine, whenever you add more changesets to ${branch}, this PR will be updated. `; - let messagePrestate = !!preState + const messagePrestate = !!preState ? `⚠️⚠️⚠️⚠️⚠️⚠️ \`${branch}\` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run \`changeset pre exit\` on \`${branch}\`. @@ -340,7 +346,7 @@ export async function getVersionPrBody({ ⚠️⚠️⚠️⚠️⚠️⚠️ ` : ""; - let messageReleasesHeading = `# Releases`; + const messageReleasesHeading = `# Releases`; let fullMessage = [ messageHeader, @@ -404,11 +410,11 @@ export async function runVersion({ const octokit = setupOctokit(githubToken); const { owner, repo } = github.context.repo; - let fullRepo = `${owner}/${repo}`; - let branch = github.context.ref.replace("refs/heads/", ""); - let versionBranch = `changeset-release/${branch}`; + const fullRepo = `${owner}/${repo}`; + const branch = github.context.ref.replace("refs/heads/", ""); + const versionBranch = `changeset-release/${branch}`; - let { preState } = await readChangesetState(cwd); + const { preState } = await readChangesetState(cwd); await localGitUtils.switchToMaybeExistingBranch(versionBranch); // hard reset back to default branch @@ -436,11 +442,11 @@ export async function runVersion({ const versionsByDirectory = await getVersionsByDirectory(cwd); if (script) { - let [versionCommand, ...versionArgs] = script.split(/\s+/); + const [versionCommand, ...versionArgs] = script.split(/\s+/); await exec(versionCommand, versionArgs, { cwd }); } else { - let changesetsCliPkgJson = requireChangesetsCliPkgJson(cwd); - let cmd = semver.lt(changesetsCliPkgJson.version, "2.0.0") + const changesetsCliPkgJson = requireChangesetsCliPkgJson(cwd); + const cmd = semver.lt(changesetsCliPkgJson.version, "2.0.0") ? "bump" : "version"; await exec("node", [resolveFrom(cwd, "@changesets/cli/bin.js"), cmd], { @@ -449,14 +455,17 @@ export async function runVersion({ } const changedPackages = await getChangedPackages(cwd, versionsByDirectory); - let changedPackagesInfoPromises = Promise.all( + const changedPackagesInfoPromises = Promise.all( changedPackages.map(async (pkg) => { - let changelogContents = await fs.readFile( + const changelogContents = await fs.readFile( path.join(pkg.dir, "CHANGELOG.md"), "utf8", ); - let entry = getChangelogEntry(changelogContents, pkg.packageJson.version); + const entry = getChangelogEntry( + changelogContents, + pkg.packageJson.version, + ); return { highestLevel: entry.highestLevel, private: !!pkg.packageJson.private, @@ -510,7 +519,7 @@ export async function runVersion({ .filter((x) => x) .sort(sortTheThings); - let prBody = await getVersionPrBody({ + const prBody = await getVersionPrBody({ hasPublishScript, preState, fullRepo, diff --git a/actions/signed-commits/src/utils.ts b/actions/signed-commits/src/utils.ts index 45f417f49..4e546e1e1 100644 --- a/actions/signed-commits/src/utils.ts +++ b/actions/signed-commits/src/utils.ts @@ -5,8 +5,10 @@ import remarkParse from "remark-parse"; import remarkStringify from "remark-stringify"; // @ts-ignore import mdastToString from "mdast-util-to-string"; -import { getPackages, Package } from "@manypkg/get-packages"; -import { exec, getExecOutput } from "@actions/exec"; +import type { Package } from "@manypkg/get-packages"; +import { getPackages } from "@manypkg/get-packages"; +import type { exec } from "@actions/exec"; +import { getExecOutput } from "@actions/exec"; export const BumpLevels = { dep: 0, @@ -16,7 +18,7 @@ export const BumpLevels = { } as const; export async function getVersionsByDirectory(cwd: string) { - let { packages } = await getPackages(cwd); + const { packages } = await getPackages(cwd); return new Map(packages.map((x) => [x.dir, x.packageJson.version])); } @@ -25,10 +27,10 @@ export async function getChangedPackages( previousVersions: Map, ) { core.debug(`Getting changed packages from ${cwd}`); - let { packages } = await getPackages(cwd); - let changedPackages = new Set(); + const { packages } = await getPackages(cwd); + const changedPackages = new Set(); - for (let pkg of packages) { + for (const pkg of packages) { const previousVersion = previousVersions.get(pkg.dir); if (previousVersion !== pkg.packageJson.version) { changedPackages.add(pkg); @@ -40,14 +42,14 @@ export async function getChangedPackages( export function getChangelogEntry(changelog: string, version: string) { core.debug(`Getting changelog entry for ${version}`); - let ast = unified().use(remarkParse).parse(changelog); + const ast = unified().use(remarkParse).parse(changelog); let highestLevel: number = BumpLevels.dep; if (!isParentNode(ast)) { throw new Error("ast is not a parent node"); } - let nodes = ast.children; + const nodes = ast.children; let headingStartInfo: | { index: number; @@ -57,16 +59,16 @@ export function getChangelogEntry(changelog: string, version: string) { let endIndex: number | undefined; for (let i = 0; i < nodes.length; i++) { - let node = nodes[i]; + const node = nodes[i]; if (node.type === "heading") { if (!nodeHasDepthProperty(node)) { throw new Error("node is missing depth property"); } - let stringified: string = mdastToString(node); - let match = stringified.toLowerCase().match(/(major|minor|patch)/); + const stringified: string = mdastToString(node); + const match = stringified.toLowerCase().match(/(major|minor|patch)/); if (match !== null) { - let level = BumpLevels[match[0] as "major" | "minor" | "patch"]; + const level = BumpLevels[match[0] as "major" | "minor" | "patch"]; highestLevel = Math.max(level, highestLevel); } if (headingStartInfo === undefined && stringified === version) { diff --git a/actions/signed-commits/tsconfig.json b/actions/signed-commits/tsconfig.json index a39338de9..2840c42b4 100644 --- a/actions/signed-commits/tsconfig.json +++ b/actions/signed-commits/tsconfig.json @@ -1,11 +1,11 @@ { "compilerOptions": { "target": "esnext", - "module": "commonjs", + "module": "esnext", "noEmit": true, "isolatedModules": true, "strict": true, "esModuleInterop": true, - "ignoreDeprecations": "6.0" + "moduleResolution": "bundler" } } diff --git a/apps/actions-dependencies-updater/package.json b/apps/actions-dependencies-updater/package.json index 8cf6e9be0..65a6e7266 100644 --- a/apps/actions-dependencies-updater/package.json +++ b/apps/actions-dependencies-updater/package.json @@ -10,7 +10,7 @@ }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "start": "node --loader ts-node/esm src/index.mts" + "start": "tsx src/index.mts" }, "keywords": [], "author": "@smartcontractkit", @@ -28,7 +28,7 @@ "@types/minimist": "^1.2.5", "@types/node": "^26.6.4", "@types/semver": "^7.8.0", - "ts-node": "10.9.2", + "tsx": "^4.23.15", "vitest": "^5.0.3" } } diff --git a/apps/actions-dependencies-updater/src/caches.mts b/apps/actions-dependencies-updater/src/caches.mts index 0d318567d..50d87e7c5 100644 --- a/apps/actions-dependencies-updater/src/caches.mts +++ b/apps/actions-dependencies-updater/src/caches.mts @@ -1,7 +1,7 @@ import * as log from "./logger.mjs"; -import { GithubShaToVersionCache } from "./github.mjs"; -import { UpdateTransaction } from "./updater.mjs"; -import { ActionsByIdentifier } from "./workflows.mjs"; +import type { GithubShaToVersionCache } from "./github.mjs"; +import type { UpdateTransaction } from "./updater.mjs"; +import type { ActionsByIdentifier } from "./workflows.mjs"; import { isShaRefIdentifier } from "./utils.mjs"; import { join } from "node:path"; @@ -43,6 +43,7 @@ export function cleanup(caches: ReturnType) { Object.keys(actionsByIdentifier).forEach((key) => { const action = actionsByIdentifier[key]; if ( + !action || action.isLocal || action.type === "unknown" || !isShaRefIdentifier(action.identifier) @@ -50,7 +51,7 @@ export function cleanup(caches: ReturnType) { log.debug(`Clearing ${key} from cache`); return delete actionsByIdentifier[key]; } - actionsByIdentifier[key].referencePaths = []; + action.referencePaths = []; }); } diff --git a/apps/actions-dependencies-updater/src/generated/types/github-workflow.mts b/apps/actions-dependencies-updater/src/generated/types/github-workflow.mts index 923a6385b..cc229900c 100644 --- a/apps/actions-dependencies-updater/src/generated/types/github-workflow.mts +++ b/apps/actions-dependencies-updater/src/generated/types/github-workflow.mts @@ -40,8 +40,7 @@ export type StringContainingExpressionSyntax = string; * You can override the default shell settings in the runner's operating system using the shell keyword. You can use built-in shell keywords, or you can define a custom set of shell options. */ export type Shell = - | string - | ("bash" | "pwsh" | "python" | "sh" | "cmd" | "powershell"); + string | ("bash" | "pwsh" | "python" | "sh" | "cmd" | "powershell"); /** * Using the working-directory keyword, you can specify the working directory of where to run the command. */ diff --git a/apps/actions-dependencies-updater/src/generated/types/index.mts b/apps/actions-dependencies-updater/src/generated/types/index.mts index bb1cdbdde..64b141027 100644 --- a/apps/actions-dependencies-updater/src/generated/types/index.mts +++ b/apps/actions-dependencies-updater/src/generated/types/index.mts @@ -1,4 +1,4 @@ -import { MySchema as WorkflowSchema } from "./github-workflow.mjs"; -import { MySchema as ActionSchema } from "./github-action.mjs"; +import type { MySchema as WorkflowSchema } from "./github-workflow.mjs"; +import type { MySchema as ActionSchema } from "./github-action.mjs"; -export { ActionSchema, WorkflowSchema }; +export type { ActionSchema, WorkflowSchema }; diff --git a/apps/actions-dependencies-updater/src/git-cli.mts b/apps/actions-dependencies-updater/src/git-cli.mts index ccb4dfbe4..fb14df11f 100644 --- a/apps/actions-dependencies-updater/src/git-cli.mts +++ b/apps/actions-dependencies-updater/src/git-cli.mts @@ -1,5 +1,5 @@ import * as log from "./logger.mjs"; -import { RunContext } from "./index.mjs"; +import type { RunContext } from "./index.mjs"; import "zx/globals"; $.verbose = false; diff --git a/apps/actions-dependencies-updater/src/github.mts b/apps/actions-dependencies-updater/src/github.mts index f94cdabd1..47867b316 100644 --- a/apps/actions-dependencies-updater/src/github.mts +++ b/apps/actions-dependencies-updater/src/github.mts @@ -1,10 +1,10 @@ -import { RunContext } from "./index.mjs"; +import type { RunContext } from "./index.mjs"; import * as log from "./logger.mjs"; import { guessLatestVersion } from "./utils.mjs"; import { join } from "node:path"; -import { Octokit } from "octokit"; -import { GetResponseTypeFromEndpointMethod } from "@octokit/types"; +import type { Octokit } from "octokit"; +import type { GetResponseTypeFromEndpointMethod } from "@octokit/types"; export interface GithubShaToVersionCache { [ownerRepo: string]: { @@ -45,17 +45,19 @@ export async function getVersionFromSHA( addToCache(ctx, ownerRepo, ref, await getVersion(ctx, owner, repo, ref)); } + const refVersions = GH_SHA_TO_VER_CACHE[ownerRepo]?.[ref] ?? []; + if (repo === ".github" && repoPath) { const actionName = repoPath.split("/").pop(); if (actionName) { - const monorepoVersions = GH_SHA_TO_VER_CACHE[ownerRepo][ref].filter((v) => + const monorepoVersions = refVersions.filter((v) => v.startsWith(actionName), ); return monorepoVersions[0]; } } - return GH_SHA_TO_VER_CACHE[ownerRepo][ref][0]; + return refVersions[0]; } export function getLatestVersion( @@ -73,12 +75,14 @@ export function getLatestVersion( repo, repoPath, ); - const tuple = Object.entries(entry).find(([_, versions]) => - versions.includes(latestVersion.tag), - ); + if (latestVersion) { + const tuple = Object.entries(entry).find(([_, versions]) => + versions.includes(latestVersion.tag), + ); - if (tuple) { - return { sha: tuple[0], version: latestVersion.tag }; + if (tuple) { + return { sha: tuple[0], version: latestVersion.tag }; + } } } } @@ -112,11 +116,19 @@ async function getVersion( } if (filteredTags.length === 1) { - log.debug(`Found tag for ${owner}/${repo}@${ref}: ${filteredTags[0]}`); - return filteredTags[0]; + const [tag] = filteredTags; + if (tag !== undefined) { + log.debug(`Found tag for ${owner}/${repo}@${ref}: ${tag}`); + return tag; + } } const latestVersion = guessLatestVersion(filteredTags); + if (!latestVersion) { + throw new Error( + `Could not determine latest version for ${owner}/${repo}@${ref} from tags: ${filteredTags.join(", ")}`, + ); + } const latestVersionString = `${latestVersion.prefix}${latestVersion.major}.${latestVersion.minor}.${latestVersion.patch}`; log.debug( `Multiple tags found for ${owner}/${repo}@${ref}. Using latest version: ${latestVersionString}`, @@ -234,7 +246,7 @@ export async function getActionFile( owner: string, repo: string, repoPath: string, - ref: string, + ref?: string, ) { const ymlPath = join(repoPath, "action.yml"); const yamlPath = join(repoPath, "action.yaml"); @@ -251,7 +263,7 @@ export async function getFile( owner: string, repo: string, path: string, - ref: string, + ref?: string, ) { try { if (path.startsWith("/")) path = path.substring(1); diff --git a/apps/actions-dependencies-updater/src/github.test.ts b/apps/actions-dependencies-updater/src/github.test.ts index c2ce36ffe..cc15367cb 100644 --- a/apps/actions-dependencies-updater/src/github.test.ts +++ b/apps/actions-dependencies-updater/src/github.test.ts @@ -86,7 +86,7 @@ const contents: Record = { const requests: { method: string; url: string; auth?: string }[] = []; function normalizeUrl(raw: string): string { - const path = decodeURIComponent(raw.split("?")[0]); + const path = decodeURIComponent(raw.split("?")[0] ?? raw); return "/" + path.replace(/^\/+/, ""); } diff --git a/apps/actions-dependencies-updater/src/updater.mts b/apps/actions-dependencies-updater/src/updater.mts index f1f922a21..44dbff486 100644 --- a/apps/actions-dependencies-updater/src/updater.mts +++ b/apps/actions-dependencies-updater/src/updater.mts @@ -1,10 +1,7 @@ import * as log from "./logger.mjs"; -import { RunContext } from "./index.mjs"; -import { - Action, - WorkflowByName, - extractDetailsFromActionIdentifier, -} from "./workflows.mjs"; +import type { RunContext } from "./index.mjs"; +import type { Action, WorkflowByName } from "./workflows.mjs"; +import { extractDetailsFromActionIdentifier } from "./workflows.mjs"; import * as github from "./github.mjs"; import * as git from "./git-cli.mjs"; @@ -107,6 +104,12 @@ async function processActionDependency( } const { owner, repo, repoPath, ref } = details; + if (!ref) { + log.warn( + `Skipping action dependency without pinned ref: ${currentAction.identifier}`, + ); + return; + } log.debug(`Checking ${owner}/${repo}${repoPath}@${ref}`); diff --git a/apps/actions-dependencies-updater/src/utils.mts b/apps/actions-dependencies-updater/src/utils.mts index c57aa79da..1302845c2 100644 --- a/apps/actions-dependencies-updater/src/utils.mts +++ b/apps/actions-dependencies-updater/src/utils.mts @@ -3,7 +3,7 @@ import { readdir } from "node:fs/promises"; import { join } from "node:path"; import * as log from "./logger.mjs"; -import { Action, WorkflowByName } from "./workflows.mjs"; +import type { Action, WorkflowByName } from "./workflows.mjs"; /** * Get an environment variable or throw an error if it's not set @@ -97,8 +97,8 @@ export function parseTagToVersion(tag: string) { let prefix = ""; if (tag.includes("@")) { const parts = tag.split("@"); - tag = parts[1]; - prefix = parts[0]; + tag = parts[1] ?? tag; + prefix = parts[0] ?? ""; } // ^ - start of line @@ -111,7 +111,7 @@ export function parseTagToVersion(tag: string) { const match = tag.match(versionRegex); if (match) { - const major = match[1]; + const major = match[1] ?? "0"; const minor = match[2] || "0"; // Default to '0' if not present const patch = match[3] || "0"; // Default to '0' if not present @@ -207,5 +207,8 @@ export function isShaRefIdentifier(identifier: string) { const sha1Regex = /^[0-9a-f]{40}$/; const sha256Regex = /^[0-9a-f]{256}$/; const ref = identifier.split("@")[1]; - return (ref && sha1Regex.test(ref)) || sha256Regex.test(ref); + if (ref === undefined) { + return false; + } + return sha1Regex.test(ref) || sha256Regex.test(ref); } diff --git a/apps/actions-dependencies-updater/src/workflows.mts b/apps/actions-dependencies-updater/src/workflows.mts index 09317bfd4..e6ae08ed7 100644 --- a/apps/actions-dependencies-updater/src/workflows.mts +++ b/apps/actions-dependencies-updater/src/workflows.mts @@ -1,13 +1,13 @@ -import { ActionSchema, WorkflowSchema } from "./generated/types/index.mjs"; +import type { ActionSchema, WorkflowSchema } from "./generated/types/index.mjs"; import { listAllYamlFiles } from "./utils.mjs"; import * as log from "./logger.mjs"; import * as github from "./github.mjs"; -import { RunContext } from "./index.mjs"; +import type { RunContext } from "./index.mjs"; import { basename, join } from "node:path"; import { readFile } from "node:fs/promises"; import YAML from "yaml"; -import { NormalJob } from "./generated/types/github-workflow.mjs"; +import type { NormalJob } from "./generated/types/github-workflow.mjs"; /** * The return value of the parse workflows method. @@ -368,7 +368,16 @@ async function getActionYamlFromIdentifier( return; } - return await readFile(yamlActionFiles[0], "utf-8"); + const [yamlActionFile] = yamlActionFiles; + if (yamlActionFile === undefined) { + log.warn( + "Found invalid reference to local action yaml. No action file found: ", + actionDirectory, + ); + return; + } + + return await readFile(yamlActionFile, "utf-8"); } const actionDetails = extractDetailsFromActionIdentifier(identifier); @@ -405,7 +414,11 @@ export function extractDetailsFromActionIdentifier(identifier: string) { } const [ownerRepoPath, ref] = identifier.split("@"); - const [owner, repo, ...path] = ownerRepoPath.split("/"); + const [owner, repo, ...path] = (ownerRepoPath ?? "").split("/"); + if (owner === undefined || repo === undefined) { + log.warn(`Unexpected action identifier: ${identifier} - skipping.`); + return; + } const repoPath = (path.length > 0 ? "/" : "") + path.join("/"); return { owner, repo, repoPath, ref }; diff --git a/apps/actions-dependencies-updater/tsconfig.json b/apps/actions-dependencies-updater/tsconfig.json index 90af8cd6c..558719e41 100644 --- a/apps/actions-dependencies-updater/tsconfig.json +++ b/apps/actions-dependencies-updater/tsconfig.json @@ -2,15 +2,14 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "lib": ["es2023"], - "module": "node16", - "target": "es2022", + "module": "nodenext", + "target": "es2023", "strict": true, "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, - "moduleResolution": "node16", - "noEmit": true, - "ignoreDeprecations": "6.0" + "moduleResolution": "nodenext", + "noEmit": true }, "include": ["src/**/*", "src/**/*.json"], "exclude": ["src/**/*.spec.ts"] diff --git a/apps/go-conditional-tests/action.yaml b/apps/go-conditional-tests/action.yaml index a6da08717..87ad34ed6 100644 --- a/apps/go-conditional-tests/action.yaml +++ b/apps/go-conditional-tests/action.yaml @@ -58,4 +58,4 @@ inputs: runs: using: "node24" - main: "dist/index.js" + main: "dist/index.cjs" diff --git a/apps/go-conditional-tests/dist/index.js b/apps/go-conditional-tests/dist/index.cjs similarity index 99% rename from apps/go-conditional-tests/dist/index.js rename to apps/go-conditional-tests/dist/index.cjs index c4c33d8c5..0fbe65ef7 100644 --- a/apps/go-conditional-tests/dist/index.js +++ b/apps/go-conditional-tests/dist/index.cjs @@ -57106,8 +57106,8 @@ var require_package_version2 = __commonJS({ }); // apps/go-conditional-tests/src/main.ts -var fs13 = __toESM(require("fs")); -var path23 = __toESM(require("path")); +var fs13 = __toESM(require("fs"), 1); +var path23 = __toESM(require("path"), 1); var import_os5 = require("os"); // node_modules/.pnpm/@actions+core@3.0.1/node_modules/@actions/core/lib/command.js @@ -69977,7 +69977,7 @@ var { // apps/go-conditional-tests/src/log.ts var import_fs3 = require("fs"); -var path12 = __toESM(require("path")); +var path12 = __toESM(require("path"), 1); // node_modules/.pnpm/@actions+artifact@6.3.1_supports-color@8.1.1/node_modules/@actions/artifact/lib/internal/shared/config.js var import_os4 = __toESM(require("os"), 1); @@ -134575,7 +134575,7 @@ function saveCacheV2(paths_1, key_1, options_1) { } // apps/go-conditional-tests/src/github.ts -var fs12 = __toESM(require("fs")); +var fs12 = __toESM(require("fs"), 1); function getCacheKey(testSuite, branch, commitSha) { const key = `go-test-hashes-${testSuite}-${branch}`; return commitSha ? `${key}-${commitSha.substring(0, 7)}` : key; @@ -134652,12 +134652,15 @@ async function listPackages(moduleDirectory) { cwd: moduleDirectory }); return stdout.filter((line) => line.trim() !== "").reduce((acc, line) => { - const [importPath, directory] = line.split(":"); - if (acc[importPath]) { + const [importPath = "", directory] = line.split(":"); + if (directory === void 0) { + debug(`Skipping malformed package line: ${line}`); + return acc; + } + const existing = acc[importPath]; + if (existing) { info(`Duplicate package found`); - debug( - `Existing: ${acc[importPath].importPath} - ${acc[importPath].directory}` - ); + debug(`Existing: ${existing.importPath} - ${existing.directory}`); debug(`Duplicate: ${importPath} - ${directory}`); return acc; } @@ -134673,7 +134676,7 @@ async function listPackages(moduleDirectory) { // apps/go-conditional-tests/src/pipeline/build.ts var import_fs5 = require("fs"); -var path21 = __toESM(require("path")); +var path21 = __toESM(require("path"), 1); // node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js var Node = class { @@ -135020,7 +135023,7 @@ function comparePackagesToIndex(runAllTests, packages, hashIndex) { // apps/go-conditional-tests/src/pipeline/run.ts var import_fs7 = require("fs"); -var path22 = __toESM(require("path")); +var path22 = __toESM(require("path"), 1); var defaultExecaOptions2 = { cwd: "", all: true, @@ -135258,10 +135261,10 @@ async function generateHashes(compiledPackages) { }); debug(`Test files: ${testFiles.join(", ")}`); const hashedCompiledPackages = {}; - for (const { key, binary } of testFiles) { - const hash = await hashFile(binary); + for (const [key, pkg] of Object.entries(compiledPackages)) { + const hash = await hashFile(pkg.compile.binary); hashedCompiledPackages[key] = { - ...compiledPackages[key], + ...pkg, hash }; } diff --git a/apps/go-conditional-tests/package.json b/apps/go-conditional-tests/package.json index f11b8a031..9da0bb73f 100644 --- a/apps/go-conditional-tests/package.json +++ b/apps/go-conditional-tests/package.json @@ -3,12 +3,13 @@ "version": "0.5.2", "private": true, "description": "", + "type": "module", "engines": { "pnpm": "12" }, - "main": "dist/index.js", + "main": "dist/index.cjs", "scripts": { - "local": "GITHUB_STEP_SUMMARY=/dev/null ts-node src/index.ts", + "local": "GITHUB_STEP_SUMMARY=/dev/null tsx src/index.ts", "test": "vitest" }, "devDependencies": { @@ -20,7 +21,7 @@ "nock": "^13.5.6", "node-fetch": "^2.7.0", "simple-git": "^4.0.2", - "ts-node": "^10.9.2", + "tsx": "^4.23.15", "typescript": "^6.0.3" }, "dependencies": { diff --git a/apps/go-conditional-tests/project.json b/apps/go-conditional-tests/project.json index c9ac3af16..e36e0a7bb 100644 --- a/apps/go-conditional-tests/project.json +++ b/apps/go-conditional-tests/project.json @@ -25,10 +25,10 @@ "outputPath": "apps/go-conditional-tests/dist/", "main": "apps/go-conditional-tests/src/index.ts", "assets": [], - "outputFileName": "index.js", + "outputFileName": "index.cjs", "esbuildOptions": { "outExtension": { - ".js": ".js" + ".js": ".cjs" } }, "tsConfig": "tsconfig.json", diff --git a/apps/go-conditional-tests/src/pipeline.ts b/apps/go-conditional-tests/src/pipeline.ts index 51559de5f..2b0f1222f 100644 --- a/apps/go-conditional-tests/src/pipeline.ts +++ b/apps/go-conditional-tests/src/pipeline.ts @@ -1,6 +1,6 @@ import * as core from "@actions/core"; -import { Inputs } from "./main.js"; +import type { Inputs } from "./main.js"; import { logSection, logObject } from "./log.js"; import { getTestHashIndex, saveTestHashIndex } from "./github.js"; import { listPackages } from "./pipeline/filter.js"; @@ -119,10 +119,10 @@ export async function generateHashes( core.debug(`Test files: ${testFiles.join(", ")}`); const hashedCompiledPackages: HashedCompiledPackages = {}; - for (const { key, binary } of testFiles) { - const hash = await hashFile(binary); + for (const [key, pkg] of Object.entries(compiledPackages)) { + const hash = await hashFile(pkg.compile.binary); hashedCompiledPackages[key] = { - ...compiledPackages[key], + ...pkg, hash, }; } diff --git a/apps/go-conditional-tests/src/pipeline/build.ts b/apps/go-conditional-tests/src/pipeline/build.ts index 294ccdb9f..154f97a3f 100644 --- a/apps/go-conditional-tests/src/pipeline/build.ts +++ b/apps/go-conditional-tests/src/pipeline/build.ts @@ -5,7 +5,11 @@ import * as core from "@actions/core"; import { execa, ExecaError } from "execa"; import pLimit from "p-limit"; -import { GoPackage, CompiledPackages, LocalPackages } from "../pipeline.js"; +import type { + GoPackage, + CompiledPackages, + LocalPackages, +} from "../pipeline.js"; import { insertWithoutDuplicates } from "../utils.js"; const defaultExecaOptions = { diff --git a/apps/go-conditional-tests/src/pipeline/filter.ts b/apps/go-conditional-tests/src/pipeline/filter.ts index e0a8d63a5..99c0a40e3 100644 --- a/apps/go-conditional-tests/src/pipeline/filter.ts +++ b/apps/go-conditional-tests/src/pipeline/filter.ts @@ -1,7 +1,7 @@ import * as core from "@actions/core"; import { execa } from "execa"; -import { LocalPackages } from "../pipeline.js"; +import type { LocalPackages } from "../pipeline.js"; /** * Lists all packages in the given path. Defaults to the current directory (./). @@ -23,13 +23,16 @@ export async function listPackages(moduleDirectory: string) { return stdout .filter((line) => line.trim() !== "") .reduce((acc, line) => { - const [importPath, directory] = line.split(":"); + const [importPath = "", directory] = line.split(":"); + if (directory === undefined) { + core.debug(`Skipping malformed package line: ${line}`); + return acc; + } - if (acc[importPath]) { + const existing = acc[importPath]; + if (existing) { core.info(`Duplicate package found`); - core.debug( - `Existing: ${acc[importPath].importPath} - ${acc[importPath].directory}`, - ); + core.debug(`Existing: ${existing.importPath} - ${existing.directory}`); core.debug(`Duplicate: ${importPath} - ${directory}`); return acc; } diff --git a/apps/go-conditional-tests/src/pipeline/hash.ts b/apps/go-conditional-tests/src/pipeline/hash.ts index bf3f3672e..ce631836d 100644 --- a/apps/go-conditional-tests/src/pipeline/hash.ts +++ b/apps/go-conditional-tests/src/pipeline/hash.ts @@ -2,8 +2,8 @@ import { createReadStream } from "fs"; import { createHash } from "crypto"; import { pipeline } from "stream/promises"; -import { getTestHashIndex } from "../github.js"; -import { +import type { getTestHashIndex } from "../github.js"; +import type { HashedCompiledPackages, DiffedHashedCompiledPackages, } from "../pipeline.js"; diff --git a/apps/go-conditional-tests/src/pipeline/run.ts b/apps/go-conditional-tests/src/pipeline/run.ts index 329c27fca..33dbb3c61 100644 --- a/apps/go-conditional-tests/src/pipeline/run.ts +++ b/apps/go-conditional-tests/src/pipeline/run.ts @@ -5,7 +5,7 @@ import * as core from "@actions/core"; import { execa, ExecaError } from "execa"; import pLimit from "p-limit"; -import { +import type { GoPackage, DiffedHashedCompiledPackages, MaybeExecutedPackages, diff --git a/apps/go-conditional-tests/test/helper/execa-error-mock.ts b/apps/go-conditional-tests/test/helper/execa-error-mock.ts index c258bd602..c8e7e21e1 100644 --- a/apps/go-conditional-tests/test/helper/execa-error-mock.ts +++ b/apps/go-conditional-tests/test/helper/execa-error-mock.ts @@ -1,7 +1,7 @@ import { ExecaError } from "execa"; -import { BuildExecaOptions } from "../../src/pipeline/build.js"; -import { RunExecaOptions } from "../../src/pipeline/run.js"; +import type { BuildExecaOptions } from "../../src/pipeline/build.js"; +import type { RunExecaOptions } from "../../src/pipeline/run.js"; export class ExecaErrorMockBuild extends ExecaError { constructor(stdout: string, stderr: string) { diff --git a/apps/go-conditional-tests/test/pipeline.test.ts b/apps/go-conditional-tests/test/pipeline.test.ts index b2bfc5754..c74ac984a 100644 --- a/apps/go-conditional-tests/test/pipeline.test.ts +++ b/apps/go-conditional-tests/test/pipeline.test.ts @@ -1,10 +1,11 @@ -import { describe, it, expect, vi, beforeEach, Mock } from "vitest"; +import type { Mock } from "vitest"; +import { describe, it, expect, vi, beforeEach } from "vitest"; import * as core from "@actions/core"; -import { Inputs } from "../src/main.js"; +import type { Inputs } from "../src/main.js"; import { saveTestHashIndex } from "../src/github.js"; +import type { MaybeExecutedPackages } from "../src/pipeline.js"; import { - MaybeExecutedPackages, runTestBinaries, buildTestBinaries, maybeUpdateHashIndex, diff --git a/apps/go-conditional-tests/test/pipeline/build.test.ts b/apps/go-conditional-tests/test/pipeline/build.test.ts index 3e0401786..e832af375 100644 --- a/apps/go-conditional-tests/test/pipeline/build.test.ts +++ b/apps/go-conditional-tests/test/pipeline/build.test.ts @@ -1,8 +1,9 @@ // test/pipeline/build.test.ts -import { describe, it, expect, vi, beforeEach, Mock } from "vitest"; -import { GoPackage } from "../../src/pipeline.js"; +import type { Mock } from "vitest"; +import { describe, it, expect, vi, beforeEach } from "vitest"; +import type { GoPackage } from "../../src/pipeline.js"; +import type { CompilationSuccess } from "../../src/pipeline/build.js"; import { - CompilationSuccess, compileTestBinary, validateCompilationResultsOrThrow, } from "../../src/pipeline/build.js"; diff --git a/apps/go-conditional-tests/test/pipeline/filter.test.ts b/apps/go-conditional-tests/test/pipeline/filter.test.ts index 27d16fe79..1e712c87e 100644 --- a/apps/go-conditional-tests/test/pipeline/filter.test.ts +++ b/apps/go-conditional-tests/test/pipeline/filter.test.ts @@ -1,4 +1,5 @@ -import { describe, it, expect, vi, beforeEach, Mock } from "vitest"; +import type { Mock } from "vitest"; +import { describe, it, expect, vi, beforeEach } from "vitest"; import { execa } from "execa"; diff --git a/apps/go-conditional-tests/test/pipeline/run.test.ts b/apps/go-conditional-tests/test/pipeline/run.test.ts index a465fa0cb..f7fd4fb82 100644 --- a/apps/go-conditional-tests/test/pipeline/run.test.ts +++ b/apps/go-conditional-tests/test/pipeline/run.test.ts @@ -1,19 +1,23 @@ import * as fs from "fs"; -import { describe, it, expect, vi, beforeEach, Mock } from "vitest"; +import type { Mock } from "vitest"; +import { describe, it, expect, vi, beforeEach } from "vitest"; import { execa } from "execa"; import * as core from "@actions/core"; import { ExecaErrorMockRun } from "../helper/execa-error-mock.js"; +import type { RunResult } from "../../src/pipeline/run.js"; import { trimOutputLogs, runConcurrent, runTestBinary, validateRunResultsOrThrow, - RunResult, } from "../../src/pipeline/run.js"; -import { DiffedHashedCompiledPackages, GoPackage } from "../../src/pipeline.js"; +import type { + DiffedHashedCompiledPackages, + GoPackage, +} from "../../src/pipeline.js"; // Mock execa vi.mock("execa", async (importOriginal) => { diff --git a/apps/go-conditional-tests/tsconfig.json b/apps/go-conditional-tests/tsconfig.json index be4aef658..9dd75e495 100644 --- a/apps/go-conditional-tests/tsconfig.json +++ b/apps/go-conditional-tests/tsconfig.json @@ -1,11 +1,9 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "module": "commonjs", "outDir": "./dist", "resolveJsonModule": true, "esModuleInterop": true, - "ignoreDeprecations": "6.0", "rootDir": "." }, "include": ["src/**/*", "src/**/*.json"], diff --git a/apps/go-mod-validator/action.yaml b/apps/go-mod-validator/action.yaml index 951e139e0..f94954a8b 100644 --- a/apps/go-mod-validator/action.yaml +++ b/apps/go-mod-validator/action.yaml @@ -42,4 +42,4 @@ inputs: runs: using: "node24" - main: "dist/index.js" + main: "dist/index.cjs" diff --git a/apps/go-mod-validator/dist/index.js b/apps/go-mod-validator/dist/index.cjs similarity index 99% rename from apps/go-mod-validator/dist/index.js rename to apps/go-mod-validator/dist/index.cjs index 77c286ae3..8acb40fc5 100644 --- a/apps/go-mod-validator/dist/index.js +++ b/apps/go-mod-validator/dist/index.cjs @@ -29781,8 +29781,8 @@ function create(patterns, options) { } // apps/go-mod-validator/src/pseudo-version.ts -var import_go_semver = __toESM(require_dist()); -var semver = __toESM(require_semver()); +var import_go_semver = __toESM(require_dist(), 1); +var semver = __toESM(require_semver(), 1); var pseudoVersionRegex = /^v[0-9]+\.(0\.0-|\d+\.\d+-([^+]*\.)?0\.)\d{14}-[A-Za-z0-9]+(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/; function isPseudoVersion(v) { const hyphens = v.split("-").length; @@ -29897,12 +29897,14 @@ function lineForDependencyPathFinder() { debug( `Finding line number for ${path6} in ${goModFilePath}. (${name})` ); - if (!cache2[goModFilePath]) { - cache2[goModFilePath] = (0, import_fs3.readFileSync)(goModFilePath, "utf-8").split("\n").map((l) => l.trim()); + let lines = cache2[goModFilePath]; + if (!lines) { + lines = (0, import_fs3.readFileSync)(goModFilePath, "utf-8").split("\n").map((l) => l.trim()); + cache2[goModFilePath] = lines; } let line = -1; - for (let i = 0; i < cache2[goModFilePath].length; i++) { - if (cache2[goModFilePath][i].includes(path6 + " ")) { + for (let i = 0; i < lines.length; i++) { + if (lines[i]?.includes(path6 + " ")) { if (line !== -1) { warning( `Duplicate dependency path found: ${path6} in ${goModFilePath} (line ${i + 1}). Previously found on line ${line}. Annotations may be faulty. Skipping.` @@ -29928,7 +29930,7 @@ function goModsToGoModules(goModFilePath, goMods, depPrefix) { } return true; }).map((d) => { - const [, owner, repo, ...subModulePathElements] = d.Path.split("/"); + const [, owner = "", repo = "", ...subModulePathElements] = d.Path.split("/"); const baseModule = { owner, repo, @@ -30014,11 +30016,11 @@ function parsePatchAdditions(patch, depPrefix) { for (const line of lineChanges) { if (line.startsWith("@@")) { const [, , destination] = line.split(" "); - if (!destination.startsWith("+")) { + if (!destination || !destination.startsWith("+")) { throw new Error("Invalid git hunk format"); } const [destinationLine] = destination.substring(1).split(","); - currentLineInFile = parseInt(destinationLine, 10); + currentLineInFile = parseInt(destinationLine ?? "", 10); continue; } else if (line.startsWith("+")) { const currentLine = line.substring(1); @@ -30095,8 +30097,9 @@ async function isTagInBranch(gh, branch, mod) { var cache = {}; async function isGoModReferencingBranch(gh, mod, branch, c = cache) { const cacheKey = `${mod.path}:${mod.version}:${branch}`; - if (cacheKey in c) { - return c[cacheKey]; + const cached = c[cacheKey]; + if (cached !== void 0) { + return cached; } const promise = (async () => { debug( @@ -30123,12 +30126,17 @@ function defaultBranchCacheKey(owner, repo) { } async function getDefaultBranch(gh, { owner, repo }) { const key = defaultBranchCacheKey(owner, repo); - if (key in defaultBranchCache) { - return defaultBranchCache[key]; + const cached = defaultBranchCache[key]; + if (cached) { + return cached; } const promise = (async () => { const resp = await gh.rest.repos.get({ owner, repo }); - return resp.data.default_branch; + const defaultBranch = resp.data.default_branch; + if (!defaultBranch) { + throw new Error(`No default branch found for ${owner}/${repo}`); + } + return defaultBranch; })(); defaultBranchCache[key] = promise; return promise; @@ -30256,7 +30264,7 @@ function parseRepoBranchLine(line) { if (rest.length > 1) { throw new Error(`Multiple colons found in line: ${line}`); } - const branches = splitAndTrim(rest[0], ","); + const branches = splitAndTrim(rest[0] ?? "", ","); return [repo, branches]; } function splitAndTrim(s, separator) { diff --git a/apps/go-mod-validator/package.json b/apps/go-mod-validator/package.json index 5aeb6b2a3..59064bc38 100644 --- a/apps/go-mod-validator/package.json +++ b/apps/go-mod-validator/package.json @@ -3,13 +3,14 @@ "version": "1.7.2", "private": true, "description": "Parses 'go.mod' file given as input, and verifies it's dependencies", + "type": "module", "engines": { "pnpm": "12" }, - "main": "out/index.js", + "main": "dist/index.cjs", "scripts": { "test": "vitest", - "fixtures:gomods": "ts-node test/__helpers__/generate-gomod-fixtures.ts" + "fixtures:gomods": "tsx test/__helpers__/generate-gomod-fixtures.ts" }, "devDependencies": { "@octokit/types": "^18.0.0", @@ -20,7 +21,7 @@ "nock": "^13.5.6", "node-fetch": "^2.7.0", "simple-git": "^4.0.2", - "ts-node": "^10.9.2", + "tsx": "^4.23.15", "typescript": "^6.0.3" }, "dependencies": { diff --git a/apps/go-mod-validator/project.json b/apps/go-mod-validator/project.json index c21040f39..c668c693d 100644 --- a/apps/go-mod-validator/project.json +++ b/apps/go-mod-validator/project.json @@ -18,10 +18,10 @@ "outputPath": "apps/go-mod-validator/dist/", "main": "apps/go-mod-validator/src/index.ts", "assets": [], - "outputFileName": "index.js", + "outputFileName": "index.cjs", "esbuildOptions": { "outExtension": { - ".js": ".js" + ".js": ".cjs" } }, "tsConfig": "tsconfig.json", diff --git a/apps/go-mod-validator/scripts/test.sh b/apps/go-mod-validator/scripts/test.sh index 026656968..967f5546e 100755 --- a/apps/go-mod-validator/scripts/test.sh +++ b/apps/go-mod-validator/scripts/test.sh @@ -8,8 +8,10 @@ echo "Repo Root: $REPO_ROOT" pnpm nx build go-mod-validator -export GITHUB_TOKEN=$(gh auth token) -export GITHUB_ACTOR=$(gh api user --jq .login) +GITHUB_TOKEN="$(gh auth token)" +export GITHUB_TOKEN +GITHUB_ACTOR="$(gh api user --jq .login)" +export GITHUB_ACTOR export GITHUB_REPOSITORY="smartcontractkit/chainlink" export GITHUB_EVENT_NAME="push" export GITHUB_EVENT_PATH="apps/go-mod-validator/scripts/payload.json" @@ -26,7 +28,7 @@ export INPUT_DEP_PREFIX="github.com/smartcontractkit" export INPUT_REPO_SHA_EXCEPTIONS="smartcontractkit/chainlink-aptos:c2a8d09e5b46c1c7815700f645a50caf8a466bda" export CL_LOCAL_DEBUG="true" -node apps/go-mod-validator/dist/index.js +node apps/go-mod-validator/dist/index.cjs echo "Summary Output: $tmp_file" # cat "$tmp_file" diff --git a/apps/go-mod-validator/src/deps.ts b/apps/go-mod-validator/src/deps.ts index ae23d85ba..975161a55 100644 --- a/apps/go-mod-validator/src/deps.ts +++ b/apps/go-mod-validator/src/deps.ts @@ -245,16 +245,18 @@ export function lineForDependencyPathFinder() { core.debug( `Finding line number for ${path} in ${goModFilePath}. (${name})`, ); - if (!cache[goModFilePath]) { - cache[goModFilePath] = readFileSync(goModFilePath, "utf-8") + let lines = cache[goModFilePath]; + if (!lines) { + lines = readFileSync(goModFilePath, "utf-8") .split("\n") .map((l) => l.trim()); + cache[goModFilePath] = lines; } let line = -1; - for (let i = 0; i < cache[goModFilePath].length; i++) { + for (let i = 0; i < lines.length; i++) { // HACK: We add a space after the depPath to avoid matching substrings. - if (cache[goModFilePath][i].includes(path + " ")) { + if (lines[i]?.includes(path + " ")) { if (line !== -1) { core.warning( `Duplicate dependency path found: ${path} in ${goModFilePath} (line ${i + 1}). Previously found on line ${line}. Annotations may be faulty. Skipping.`, @@ -304,7 +306,8 @@ export function goModsToGoModules( }) .map((d: GoMod): GoModule => { // repo format github.com/smartcontractkit/chainlink - const [, owner, repo, ...subModulePathElements] = d.Path.split("/"); + const [, owner = "", repo = "", ...subModulePathElements] = + d.Path.split("/"); const baseModule: BaseGoModule = { owner, repo, diff --git a/apps/go-mod-validator/src/diff.ts b/apps/go-mod-validator/src/diff.ts index 2ec18620d..b87b7ad9d 100644 --- a/apps/go-mod-validator/src/diff.ts +++ b/apps/go-mod-validator/src/diff.ts @@ -1,6 +1,6 @@ import * as core from "@actions/core"; -import { GetResponseTypeFromEndpointMethod } from "@octokit/types"; -import { Octokit } from "./github"; +import type { GetResponseTypeFromEndpointMethod } from "@octokit/types"; +import type { Octokit } from "./github"; type CompareResponse = GetResponseTypeFromEndpointMethod< Octokit["rest"]["repos"]["compareCommitsWithBasehead"] >; @@ -80,12 +80,12 @@ function parsePatchAdditions(patch: string, depPrefix: string): FileAddition[] { // - "+16,10": "+" denotes destination file, "16,10" means the same as above const [, , destination] = line.split(" "); - if (!destination.startsWith("+")) { + if (!destination || !destination.startsWith("+")) { throw new Error("Invalid git hunk format"); } const [destinationLine] = destination.substring(1).split(","); - currentLineInFile = parseInt(destinationLine, 10); + currentLineInFile = parseInt(destinationLine ?? "", 10); continue; } else if (line.startsWith("+")) { const currentLine = line.substring(1); diff --git a/apps/go-mod-validator/src/github.ts b/apps/go-mod-validator/src/github.ts index c44382163..d919e5639 100644 --- a/apps/go-mod-validator/src/github.ts +++ b/apps/go-mod-validator/src/github.ts @@ -1,6 +1,6 @@ -import * as github from "@actions/github"; +import type * as github from "@actions/github"; import * as core from "@actions/core"; -import { +import type { BaseGoModule, GoModule, GoModuleWithCommitSha, @@ -116,8 +116,9 @@ export async function isGoModReferencingBranch( const cacheKey = `${mod.path}:${mod.version}:${branch}`; // Check if the result is already in the cache - if (cacheKey in c) { - return c[cacheKey]; + const cached = c[cacheKey]; + if (cached !== undefined) { + return cached; } // Store the promise in the cache @@ -153,13 +154,18 @@ export async function getDefaultBranch( { owner, repo }: BaseGoModule, ) { const key = defaultBranchCacheKey(owner, repo); - if (key in defaultBranchCache) { - return defaultBranchCache[key]; + const cached = defaultBranchCache[key]; + if (cached) { + return cached; } const promise = (async () => { const resp = await gh.rest.repos.get({ owner, repo }); - return resp.data.default_branch; + const defaultBranch = resp.data.default_branch; + if (!defaultBranch) { + throw new Error(`No default branch found for ${owner}/${repo}`); + } + return defaultBranch; })(); defaultBranchCache[key] = promise; diff --git a/apps/go-mod-validator/src/go-mod-validator.ts b/apps/go-mod-validator/src/go-mod-validator.ts index 4e3be1d19..9bb118c6b 100644 --- a/apps/go-mod-validator/src/go-mod-validator.ts +++ b/apps/go-mod-validator/src/go-mod-validator.ts @@ -2,14 +2,14 @@ import * as github from "@actions/github"; import * as core from "@actions/core"; import { throttling } from "@octokit/plugin-throttling"; -import { getDeps, BaseGoModule, lineForDependencyPathFinder } from "./deps"; +import { getDeps, lineForDependencyPathFinder } from "./deps"; import { getChangedGoModFiles } from "./diff"; import { getDefaultBranch, isGoModReferencingBranch } from "./github"; import { getInputs, shaMatches } from "./run-inputs"; import { FIXING_ERRORS } from "./strings"; import type { Octokit } from "./github"; -import type { GoModule } from "./deps"; +import type { GoModule, BaseGoModule } from "./deps"; import type { RunInputs } from "./run-inputs"; function getOctokits(inputs: RunInputs) { diff --git a/apps/go-mod-validator/src/run-inputs.ts b/apps/go-mod-validator/src/run-inputs.ts index 6cab81f1e..6438b2cab 100644 --- a/apps/go-mod-validator/src/run-inputs.ts +++ b/apps/go-mod-validator/src/run-inputs.ts @@ -176,7 +176,7 @@ function parseRepoBranchLine(line: string): [string, string[]] { if (rest.length > 1) { throw new Error(`Multiple colons found in line: ${line}`); } - const branches = splitAndTrim(rest[0], ","); + const branches = splitAndTrim(rest[0] ?? "", ","); return [repo, branches]; } diff --git a/apps/go-mod-validator/test/__helpers__/generate-gomod-fixtures.ts b/apps/go-mod-validator/test/__helpers__/generate-gomod-fixtures.ts index 5bebcb89e..7b77832b2 100644 --- a/apps/go-mod-validator/test/__helpers__/generate-gomod-fixtures.ts +++ b/apps/go-mod-validator/test/__helpers__/generate-gomod-fixtures.ts @@ -24,13 +24,14 @@ */ import { getAllGoModsWithin } from "../../src/deps"; -import { ensureFileSync, readFileSync, writeFileSync } from "fs-extra"; +import fse from "fs-extra"; +import { readFileSync, writeFileSync } from "node:fs"; import path from "path"; import { simpleGit } from "simple-git"; async function main() { const commitSha = process.argv[3]; - const fixtures = path.join(__dirname, "../__fixtures__"); + const fixtures = path.join(import.meta.dirname, "../__fixtures__"); const dirToGlob = process.argv[2]; if (!dirToGlob) { throw new Error("Please provide a directory to glob"); @@ -118,8 +119,8 @@ async function copyGoModAndGoSumFiles( goSumRelPath, ); - ensureFileSync(goModFixturePath); - ensureFileSync(goSumFixturePath); + fse.ensureFileSync(goModFixturePath); + fse.ensureFileSync(goSumFixturePath); console.log("Copying", goMod, "to", goModFixturePath); writeFileSync(goModFixturePath, goModContent); diff --git a/apps/go-mod-validator/test/deps.test.ts b/apps/go-mod-validator/test/deps.test.ts index 2c857223d..72b4b4ed0 100644 --- a/apps/go-mod-validator/test/deps.test.ts +++ b/apps/go-mod-validator/test/deps.test.ts @@ -1,6 +1,7 @@ import { execSync } from "child_process"; import { getDeps, getVersionType } from "../src/deps"; -import { describe, expect, it, vi, MockedObject, beforeEach } from "vitest"; +import type { MockedObject } from "vitest"; +import { describe, expect, it, vi, beforeEach } from "vitest"; import * as glob from "@actions/glob"; // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/apps/go-mod-validator/test/github.test.ts b/apps/go-mod-validator/test/github.test.ts index 2bf8e977b..5a6087a01 100644 --- a/apps/go-mod-validator/test/github.test.ts +++ b/apps/go-mod-validator/test/github.test.ts @@ -1,7 +1,8 @@ /* eslint @typescript-eslint/no-explicit-any: 0 */ -import { isGoModReferencingBranch, Octokit } from "../src/github"; +import type { Octokit } from "../src/github"; +import { isGoModReferencingBranch } from "../src/github"; import { describe, expect, it, vi } from "vitest"; -import { GoModule } from "../src/deps"; +import type { GoModule } from "../src/deps"; vi.mock("@actions/core", async (importOriginal: any) => ({ ...(await importOriginal(typeof import("@actions/core"))), diff --git a/apps/go-mod-validator/tsconfig.json b/apps/go-mod-validator/tsconfig.json index be4aef658..9dd75e495 100644 --- a/apps/go-mod-validator/tsconfig.json +++ b/apps/go-mod-validator/tsconfig.json @@ -1,11 +1,9 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "module": "commonjs", "outDir": "./dist", "resolveJsonModule": true, "esModuleInterop": true, - "ignoreDeprecations": "6.0", "rootDir": "." }, "include": ["src/**/*", "src/**/*.json"], diff --git a/apps/update-action-versions/action.yml b/apps/update-action-versions/action.yml index 41026f086..4bcde0579 100644 --- a/apps/update-action-versions/action.yml +++ b/apps/update-action-versions/action.yml @@ -21,4 +21,4 @@ inputs: runs: using: "node24" - main: "out/index.js" + main: "out/index.cjs" diff --git a/apps/update-action-versions/out/index.js b/apps/update-action-versions/out/index.cjs similarity index 99% rename from apps/update-action-versions/out/index.js rename to apps/update-action-versions/out/index.cjs index 82eb36087..b2fc9d5d8 100644 --- a/apps/update-action-versions/out/index.js +++ b/apps/update-action-versions/out/index.cjs @@ -34010,11 +34010,11 @@ function getInput(name, options) { } // src/index.ts -var import_minimist = __toESM(require_minimist()); +var import_minimist = __toESM(require_minimist(), 1); var import_promises5 = require("node:fs/promises"); var import_node_path2 = require("node:path"); -var import_yaml = __toESM(require_dist()); -var semver = __toESM(require_semver2()); +var import_yaml = __toESM(require_dist(), 1); +var semver = __toESM(require_semver2(), 1); // ../../node_modules/.pnpm/replace-in-file@9.0.0/node_modules/replace-in-file/dist/src/helpers/config.js var import_promises = __toESM(require("node:fs/promises"), 1); @@ -38060,9 +38060,10 @@ function isWorkflowFileName(fileName) { } async function buildMonorepoActionMap(data) { return data.filter((tag) => tag.name.includes("@")).reduce((accumulator, tag) => { - const [tagName, tagVersion] = tag.name.split("@"); - if (tagName in accumulator) { - accumulator[tagName].push({ + const [tagName = "", tagVersion = ""] = tag.name.split("@"); + const entries = accumulator[tagName]; + if (entries) { + entries.push({ version: tagVersion, shasum: tag.commit.sha }); @@ -38117,9 +38118,11 @@ async function updateActionsInWorkflowMap(wm, am) { const actionVersion = (_b = action.commentBefore) == null ? void 0 : _b.split("@")[1]; if (semver.valid(actionVersion)) { const actionName = action.name.replace(ACTION_PATH_PREFIX, ""); - const versions = am[actionName].map((x2) => x2.version); + const actionMapItem = am[actionName]; + if (!actionMapItem) continue; + const versions = actionMapItem.map((x2) => x2.version); const sortedVersions = semver.rsort(versions || []); - action.refAfter = am[actionName].reduce( + action.refAfter = actionMapItem.reduce( (acc, curr) => curr.version === sortedVersions[0] ? curr.shasum : acc, "" ); @@ -38131,7 +38134,7 @@ async function updateActionsInWorkflowMap(wm, am) { } async function updateActionsInWorkflowFiles(dir, files, wm) { for (const file of files) { - for (const action of wm[file]) { + for (const action of wm[file] ?? []) { if (!action.refAfter) continue; if (!action.commentAfter) continue; const options = { diff --git a/apps/update-action-versions/package.json b/apps/update-action-versions/package.json index e5311e5c7..bb727bcc0 100644 --- a/apps/update-action-versions/package.json +++ b/apps/update-action-versions/package.json @@ -3,12 +3,13 @@ "version": "0.3.1", "private": true, "description": "update-action-versions", - "main": "out/index.js", + "main": "out/index.cjs", + "type": "module", "scripts": { - "v1": "ts-node ./src/v1.ts --local --tokenEnv=GITHUB_TOKEN --dir=../../.github/workflows", - "build": "esbuild src/index.ts --bundle --platform=node --target=node16 --tsconfig=./tsconfig.json --outfile=out/index.js", - "local": "ts-node ./src/index.ts --local --tokenEnv=GITHUB_TOKEN --dir=../../.github/workflows", - "scratch": "ts-node ./src/index.ts --local --tokenEnv=GITHUB_TOKEN --dir=./test" + "v1": "tsx ./src/v1.ts --local --tokenEnv=GITHUB_TOKEN --dir=../../.github/workflows", + "build": "esbuild src/index.ts --bundle --platform=node --target=node16 --tsconfig=./tsconfig.json --outfile=out/index.cjs", + "local": "tsx ./src/index.ts --local --tokenEnv=GITHUB_TOKEN --dir=../../.github/workflows", + "scratch": "tsx ./src/index.ts --local --tokenEnv=GITHUB_TOKEN --dir=./test" }, "dependencies": { "@actions/core": "^3.0.1", @@ -23,7 +24,7 @@ "@types/node": "^26.6.4", "@types/semver": "^7.8.0", "esbuild": "^0.28.2", - "ts-node": "10.9.2" + "tsx": "^4.23.15" }, "author": "@smartcontractkit", "license": "MIT", diff --git a/apps/update-action-versions/src/index.ts b/apps/update-action-versions/src/index.ts index 2498386c2..a7ede4a59 100644 --- a/apps/update-action-versions/src/index.ts +++ b/apps/update-action-versions/src/index.ts @@ -68,9 +68,10 @@ async function buildMonorepoActionMap( return data .filter((tag) => tag.name.includes("@")) .reduce((accumulator, tag) => { - const [tagName, tagVersion] = tag.name.split("@"); - if (tagName in accumulator) { - accumulator[tagName].push({ + const [tagName = "", tagVersion = ""] = tag.name.split("@"); + const entries = accumulator[tagName]; + if (entries) { + entries.push({ version: tagVersion, shasum: tag.commit.sha, }); @@ -132,9 +133,11 @@ async function updateActionsInWorkflowMap( const actionVersion = action.commentBefore?.split("@")[1]; if (semver.valid(actionVersion)) { const actionName = action.name.replace(ACTION_PATH_PREFIX, ""); - const versions = am[actionName].map((x) => x.version); + const actionMapItem = am[actionName]; + if (!actionMapItem) continue; + const versions = actionMapItem.map((x) => x.version); const sortedVersions = semver.rsort(versions || []); - action.refAfter = am[actionName].reduce( + action.refAfter = actionMapItem.reduce( (acc, curr) => curr.version === sortedVersions[0] ? curr.shasum : acc, "", @@ -153,7 +156,7 @@ async function updateActionsInWorkflowFiles( wm: WorkflowMap, ) { for (const file of files) { - for (const action of wm[file]) { + for (const action of wm[file] ?? []) { if (!action.refAfter) continue; if (!action.commentAfter) continue; diff --git a/apps/update-action-versions/src/v1.ts b/apps/update-action-versions/src/v1.ts index b498188cf..47eeb2e2b 100644 --- a/apps/update-action-versions/src/v1.ts +++ b/apps/update-action-versions/src/v1.ts @@ -57,9 +57,10 @@ async function buildMonorepoTagMap( return data .filter((tag) => tag.name.includes("@")) .reduce((accumulator, tag) => { - const [tagName, tagVersion] = tag.name.split("@"); - if (tagName in accumulator) { - accumulator[tagName].push(tagVersion); + const [tagName = "", tagVersion = ""] = tag.name.split("@"); + const entries = accumulator[tagName]; + if (entries) { + entries.push(tagVersion); } else { accumulator[tagName] = [tagVersion]; } @@ -119,7 +120,7 @@ async function updateActionsInWorkflowFiles( wm: WorkflowMap, ) { for (const file of files) { - for (const action of wm[file]) { + for (const action of wm[file] ?? []) { if (!action.tagAfter) continue; const options = { diff --git a/apps/update-action-versions/tsconfig.json b/apps/update-action-versions/tsconfig.json index be4aef658..9dd75e495 100644 --- a/apps/update-action-versions/tsconfig.json +++ b/apps/update-action-versions/tsconfig.json @@ -1,11 +1,9 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "module": "commonjs", "outDir": "./dist", "resolveJsonModule": true, "esModuleInterop": true, - "ignoreDeprecations": "6.0", "rootDir": "." }, "include": ["src/**/*", "src/**/*.json"], diff --git a/eslint.config.mjs b/eslint.config.mjs index 9a4f8dc34..7c4cc8494 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -7,7 +7,7 @@ import tseslint from "typescript-eslint"; export default tseslint.config( ...nx.configs["flat/base"], { - files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"], + files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.js", "**/*.jsx"], rules: { "@nx/enforce-module-boundaries": [ "error", @@ -25,8 +25,18 @@ export default tseslint.config( }, }, { - files: ["**/*.ts", "**/*.tsx"], + files: ["**/*.ts", "**/*.tsx", "**/*.mts"], extends: [tseslint.configs.recommended], + rules: { + "@typescript-eslint/consistent-type-imports": [ + "error", + { + prefer: "type-imports", + fixStyle: "separate-type-imports", + disallowTypeAnnotations: false, + }, + ], + }, languageOptions: { parser: tseslint.parser, ecmaVersion: 2020, diff --git a/lefthook.yml b/lefthook.yml index 778029239..796865f55 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -5,29 +5,52 @@ output: pre-commit: parallel: true - commands: - prettier: - description: "Fix prettier formatting" - glob: "*.{json,md,scss,yaml,yml}" - run: pnpm prettier:write {staged_files} - stage_fixed: true - reusable-workflows: - description: "Fix reusable workflows sync" - glob: "{workflows/*/*,.github/workflows/*}.{yml,yaml}" - run: pnpm workflows:fix --stage {staged_files} - stage_fixed: true - actionlint: - description: "Run actionlint" - glob: "{workflows/*/*,.github/workflows/*}.{yml,yaml}" - run: actionlint {staged_files} - shellcheck: - description: "Run shellcheck" + jobs: + - name: betterleaks + run: betterleaks git . --pre-commit --staged -v + - name: shellcheck glob: "*.sh" run: shellcheck {staged_files} - build-artifacts: - description: "Build artifacts for affected projects" - glob: "*.{js,ts,json}" - env: - CI: "true" - run: pnpm build:affected - stage_fixed: true + - name: pipeline + group: + piped: true + jobs: + - name: code-lint + glob: "*.{js,cjs,mjs,ts,cts,mts,tsx}" + exclude: + - "{dist,out}/*" + - "*/{dist,out}/*" + run: pnpm exec eslint --fix {staged_files} + stage_fixed: true + - name: prettier + glob: "*.{js,cjs,mjs,ts,cts,mts,tsx,json,md,scss,yaml,yml}" + exclude: + - "{dist,out}/*" + - "*/{dist,out}/*" + - "{workflows,.github/workflows}/*" + run: + pnpm exec prettier --write --ignore-path=.prettierignore + {staged_files} + stage_fixed: true + - name: reusable-workflows + glob: "{workflows/*/*,.github/workflows/*}.{yml,yaml}" + run: pnpm workflows:fix --stage {staged_files} + stage_fixed: true + - name: actionlint + glob: "{workflows/*/*,.github/workflows/*}.{yml,yaml}" + run: actionlint {staged_files} + - name: build-artifacts + glob: "*.{js,ts,json}" + exclude: + - "{dist,out}/*" + - "*/{dist,out}/*" + env: + CI: "true" + run: pnpm build:affected + stage_fixed: true + +pre-push: + commands: + test: + glob: "*.{js,cjs,mjs,ts,cts,mts,tsx,json,sh,yaml,yml}" + run: pnpm test:affected diff --git a/libs/jira-tracing/axios.ts b/libs/jira-tracing/axios.ts index f04669253..9864b21f8 100644 --- a/libs/jira-tracing/axios.ts +++ b/libs/jira-tracing/axios.ts @@ -1,4 +1,4 @@ -import { +import type { AxiosRequestConfig, AxiosResponse, AxiosError, diff --git a/libs/jira-tracing/changeset-lib.ts b/libs/jira-tracing/changeset-lib.ts index ef1b5a559..d133866fe 100644 --- a/libs/jira-tracing/changeset-lib.ts +++ b/libs/jira-tracing/changeset-lib.ts @@ -66,20 +66,24 @@ export async function extractChangesetFile( `Found ${changesetFiles.length} changeset files, but only 1 was expected.`, ); } + const changesetFile = changesetFiles[0]; + if (!changesetFile) { + throw new Error("No changeset file found, but 1 was expected."); + } const gitTopLevel = await getGitTopLevel(); - const fullChangesetPath = join(gitTopLevel, changesetFiles[0]); + const fullChangesetPath = join(gitTopLevel, changesetFile); const changesetContents = await fs.readFile(fullChangesetPath, "utf-8"); const parsed = matter(changesetContents); if (!changesetKey) { - return changesetFiles[0]; + return changesetFile; } if (!(changesetKey in parsed.data)) { throw new Error( - `Changeset file ${changesetFiles[0]} does not contain the key: ${changesetKey}`, + `Changeset file ${changesetFile} does not contain the key: ${changesetKey}`, ); } - return changesetFiles[0]; + return changesetFile; } diff --git a/libs/jira-tracing/create-jira-traceability.ts b/libs/jira-tracing/create-jira-traceability.ts index 7f6c2d860..06f17499b 100644 --- a/libs/jira-tracing/create-jira-traceability.ts +++ b/libs/jira-tracing/create-jira-traceability.ts @@ -1,4 +1,4 @@ -import * as jira from "jira.js"; +import type * as jira from "jira.js"; import { createJiraClient, extractJiraIssueNumbersFrom, diff --git a/libs/jira-tracing/enforce-jira-solidity-review.test.ts b/libs/jira-tracing/enforce-jira-solidity-review.test.ts index e7354adfd..066409d5d 100644 --- a/libs/jira-tracing/enforce-jira-solidity-review.test.ts +++ b/libs/jira-tracing/enforce-jira-solidity-review.test.ts @@ -11,7 +11,7 @@ import { transitionIssueWithComment, } from "./enforce-jira-solidity-review"; import * as core from "@actions/core"; -import jira from "jira.js"; +import type jira from "jira.js"; import axios from "axios"; vi.mock("jira.js"); diff --git a/libs/jira-tracing/enforce-jira-solidity-review.ts b/libs/jira-tracing/enforce-jira-solidity-review.ts index 2139d6a2e..7701377a1 100644 --- a/libs/jira-tracing/enforce-jira-solidity-review.ts +++ b/libs/jira-tracing/enforce-jira-solidity-review.ts @@ -1,5 +1,5 @@ import * as core from "@actions/core"; -import jira from "jira.js"; +import type jira from "jira.js"; import axios from "axios"; import { join } from "path"; import { @@ -34,6 +34,9 @@ async function main() { } const jiraPRIssueKey = jiraPRIssueKeys[0]; + if (!jiraPRIssueKey) { + return; + } const client = createJiraClient(); const jiraSolidityIssues = await extractJiraIssueNumbersFrom( @@ -56,7 +59,10 @@ async function main() { `Found linked Solidity Review issue(s): ${join(...jiraSolidityIssues)}. Nothing more needs to be done.`, ); - exportIssueKeysToGithubEnv(jiraPRIssueKey, jiraSolidityIssues[0]); + const firstSolidityIssue = jiraSolidityIssues[0]; + if (firstSolidityIssue) { + exportIssueKeysToGithubEnv(jiraPRIssueKey, firstSolidityIssue); + } if (jiraSolidityIssues.length > 1) { core.warning( `Found more than one Solidity Review issue linked to PR. Only the first one will be exported to GitHub environment.`, @@ -91,7 +97,13 @@ async function main() { solidityReviewTemplateKey, ); } else if (openSolidityReviewIssues.length === 1) { - solidityReviewIssueKey = openSolidityReviewIssues[0]; + const [onlySolidityIssue] = openSolidityReviewIssues; + if (onlySolidityIssue === undefined) { + core.setFailed("Found an open Solidity Review issue, but it is invalid."); + + return; + } + solidityReviewIssueKey = onlySolidityIssue; } else { core.setFailed(`Found following open Solidity Review issues for project ${jiraProject}: ${join(...openSolidityReviewIssues)}. Since we are unable to automatically determine, which one to use, please manualy add it to changeset file: ${changesetFile}. Use this exact format: diff --git a/libs/jira-tracing/update-jira-issue.ts b/libs/jira-tracing/update-jira-issue.ts index 01637ad5b..17586709e 100644 --- a/libs/jira-tracing/update-jira-issue.ts +++ b/libs/jira-tracing/update-jira-issue.ts @@ -1,5 +1,5 @@ import * as core from "@actions/core"; -import jira from "jira.js"; +import type jira from "jira.js"; import { tagsToLabels, createJiraClient, diff --git a/libs/nx-chainlink/src/generators/create-gh-action/generator.spec.ts b/libs/nx-chainlink/src/generators/create-gh-action/generator.spec.ts index 8bba86946..7514c38fe 100644 --- a/libs/nx-chainlink/src/generators/create-gh-action/generator.spec.ts +++ b/libs/nx-chainlink/src/generators/create-gh-action/generator.spec.ts @@ -1,8 +1,9 @@ import { createTreeWithEmptyWorkspace } from "@nx/devkit/testing"; -import { Tree, readProjectConfiguration } from "@nx/devkit"; +import type { Tree } from "@nx/devkit"; +import { readProjectConfiguration } from "@nx/devkit"; -import { createGhActionGenerator } from "./generator"; -import { CreateGhActionGeneratorSchema } from "./schema"; +import { createGhActionGenerator } from "./generator.js"; +import type { CreateGhActionGeneratorSchema } from "./schema.js"; import { describe, it, expect, beforeEach } from "vitest"; diff --git a/libs/nx-chainlink/src/generators/create-gh-action/generator.ts b/libs/nx-chainlink/src/generators/create-gh-action/generator.ts index 529ae25f3..2a3ac4ab2 100644 --- a/libs/nx-chainlink/src/generators/create-gh-action/generator.ts +++ b/libs/nx-chainlink/src/generators/create-gh-action/generator.ts @@ -1,11 +1,11 @@ +import type { Tree } from "@nx/devkit"; import { addProjectConfiguration, formatFiles, generateFiles, - Tree, } from "@nx/devkit"; import * as path from "path"; -import { CreateGhActionGeneratorSchema } from "./schema"; +import type { CreateGhActionGeneratorSchema } from "./schema.js"; export async function createGhActionGenerator( tree: Tree, diff --git a/libs/nx-chainlink/tsconfig.json b/libs/nx-chainlink/tsconfig.json index 16b289944..4c61ee8b4 100644 --- a/libs/nx-chainlink/tsconfig.json +++ b/libs/nx-chainlink/tsconfig.json @@ -1,13 +1,13 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "module": "commonjs", + "module": "nodenext", "outDir": "./dist", "resolveJsonModule": true, "esModuleInterop": true, - "ignoreDeprecations": "6.0", "types": ["node"], - "rootDir": "." + "rootDir": ".", + "moduleResolution": "nodenext" }, "include": ["src/**/*", "src/**/*.json"], "exclude": ["src/**/*.spec.ts"] diff --git a/libs/nx-chainlink/tsconfig.spec.json b/libs/nx-chainlink/tsconfig.spec.json index 48cacaef0..02ddf1e3b 100644 --- a/libs/nx-chainlink/tsconfig.spec.json +++ b/libs/nx-chainlink/tsconfig.spec.json @@ -2,7 +2,6 @@ "extends": "./tsconfig.json", "compilerOptions": { "outDir": "../../dist/out-tsc", - "module": "commonjs", "rootDir": "." } } diff --git a/package.json b/package.json index 0331a8323..5267a178c 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ "devDependencies": { "@changesets/changelog-github": "^0.5.2", "@changesets/cli": "^2.31.1", - "@eslint/eslintrc": "^3.0.0", "@eslint/js": "^9.8.0", "@nx/devkit": "23.3.0", "@nx/esbuild": "23.3.0", @@ -38,7 +37,6 @@ "@nx/eslint-plugin": "23.3.0", "@nx/js": "23.3.0", "@nx/plugin": "23.3.0", - "@swc-node/register": "1.12.1", "@swc/cli": "0.8.1", "@swc/core": "1.16.13", "@swc/helpers": "0.5.23", @@ -54,8 +52,8 @@ "nx": "23.3.0", "prettier": "^3.9.9", "rimraf": "^6.1.3", - "ts-node": "10.9.2", "tslib": "^2.8.1", + "tsx": "^4.23.15", "typescript": "^6.0.3", "typescript-eslint": "^8.58.0", "update-ts-references": "^3.6.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 97a2d29ff..a7b2b8b5c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -30,9 +30,6 @@ importers: '@changesets/cli': specifier: ^2.31.1 version: 2.31.1(@types/node@26.6.4) - '@eslint/eslintrc': - specifier: ^3.0.0 - version: 3.3.7(supports-color@8.1.1) '@eslint/js': specifier: ^9.8.0 version: 9.39.5 @@ -54,9 +51,6 @@ importers: '@nx/plugin': specifier: 23.3.0 version: 23.3.0(@babel/traverse@7.29.8(supports-color@8.1.1))(@swc-node/register@1.12.1(@swc/core@1.16.13(@swc/helpers@0.5.23))(@swc/types@0.1.28)(supports-color@8.1.1)(typescript@6.0.3))(@swc/cli@0.8.1(@swc/core@1.16.13(@swc/helpers@0.5.23))(supports-color@8.1.1))(@swc/core@1.16.13(@swc/helpers@0.5.23))(@types/node@26.6.4)(@zkochan/js-yaml@0.0.7)(babel-plugin-macros@3.1.0)(eslint@9.39.5(jiti@2.7.0)(supports-color@8.1.1))(nx@23.3.0(@swc-node/register@1.12.1(@swc/core@1.16.13(@swc/helpers@0.5.23))(@swc/types@0.1.28)(supports-color@8.1.1)(typescript@6.0.3))(@swc/core@1.16.13(@swc/helpers@0.5.23)))(supports-color@8.1.1)(ts-node@10.9.2(@swc/core@1.16.13(@swc/helpers@0.5.23))(@types/node@26.6.4)(typescript@6.0.3))(typescript@6.0.3) - '@swc-node/register': - specifier: 1.12.1 - version: 1.12.1(@swc/core@1.16.13(@swc/helpers@0.5.23))(@swc/types@0.1.28)(supports-color@8.1.1)(typescript@6.0.3) '@swc/cli': specifier: 0.8.1 version: 0.8.1(@swc/core@1.16.13(@swc/helpers@0.5.23))(supports-color@8.1.1) @@ -102,12 +96,12 @@ importers: rimraf: specifier: ^6.1.3 version: 6.1.3 - ts-node: - specifier: 10.9.2 - version: 10.9.2(@swc/core@1.16.13(@swc/helpers@0.5.23))(@types/node@26.6.4)(typescript@6.0.3) tslib: specifier: ^2.8.1 version: 2.8.1 + tsx: + specifier: ^4.23.15 + version: 4.23.15 typescript: specifier: ^6.0.3 version: 6.0.3 @@ -850,9 +844,9 @@ importers: '@types/semver': specifier: ^7.8.0 version: 7.8.0 - ts-node: - specifier: 10.9.2 - version: 10.9.2(@swc/core@1.16.13(@swc/helpers@0.5.23))(@types/node@26.6.4)(typescript@6.0.3) + tsx: + specifier: ^4.23.15 + version: 4.23.15 vitest: specifier: ^5.0.3 version: 5.0.3(@types/node@26.6.4)(jsdom@24.1.3(supports-color@8.1.1))(vite@7.3.7(@types/node@26.6.4)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1)) @@ -917,9 +911,9 @@ importers: simple-git: specifier: ^4.0.2 version: 4.0.2(supports-color@8.1.1) - ts-node: - specifier: ^10.9.2 - version: 10.9.2(@swc/core@1.16.13(@swc/helpers@0.5.23))(@types/node@26.6.4)(typescript@6.0.3) + tsx: + specifier: ^4.23.15 + version: 4.23.15 typescript: specifier: ^6.0.3 version: 6.0.3 @@ -969,9 +963,9 @@ importers: simple-git: specifier: ^4.0.2 version: 4.0.2(supports-color@8.1.1) - ts-node: - specifier: ^10.9.2 - version: 10.9.2(@swc/core@1.16.13(@swc/helpers@0.5.23))(@types/node@26.6.4)(typescript@6.0.3) + tsx: + specifier: ^4.23.15 + version: 4.23.15 typescript: specifier: ^6.0.3 version: 6.0.3 @@ -1009,9 +1003,9 @@ importers: esbuild: specifier: ^0.28.2 version: 0.28.2 - ts-node: - specifier: 10.9.2 - version: 10.9.2(@swc/core@1.16.13(@swc/helpers@0.5.23))(@types/node@26.6.4)(typescript@6.0.3) + tsx: + specifier: ^4.23.15 + version: 4.23.15 libs/jira-tracing: dependencies: @@ -8551,6 +8545,7 @@ snapshots: '@cspotcode/source-map-support@0.8.1': dependencies: '@jridgewell/trace-mapping': 0.3.9 + optional: true '@csstools/color-helpers@5.1.0': {} @@ -9479,6 +9474,7 @@ snapshots: dependencies: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.6.0 + optional: true '@keyv/serialize@1.1.1': {} @@ -9681,6 +9677,7 @@ snapshots: '@node-rs/xxhash-win32-arm64-msvc': 1.7.8 '@node-rs/xxhash-win32-ia32-msvc': 1.7.8 '@node-rs/xxhash-win32-x64-msvc': 1.7.8 + optional: true '@nodelib/fs.scandir@2.1.5': dependencies: @@ -10368,6 +10365,7 @@ snapshots: dependencies: '@swc/core': 1.16.13(@swc/helpers@0.5.23) '@swc/types': 0.1.28 + optional: true '@swc-node/register@1.12.1(@swc/core@1.16.13(@swc/helpers@0.5.23))(@swc/types@0.1.28)(supports-color@8.1.1)(typescript@6.0.3)': dependencies: @@ -10385,11 +10383,13 @@ snapshots: transitivePeerDependencies: - '@swc/types' - supports-color + optional: true '@swc-node/sourcemap-support@0.6.1': dependencies: source-map-support: 0.5.21 tslib: 2.8.1 + optional: true '@swc/cli@0.8.1(@swc/core@1.16.13(@swc/helpers@0.5.23))(supports-color@8.1.1)': dependencies: @@ -10482,13 +10482,17 @@ snapshots: '@tokenizer/token@0.3.0': {} - '@tsconfig/node10@1.0.13': {} + '@tsconfig/node10@1.0.13': + optional: true - '@tsconfig/node12@1.0.11': {} + '@tsconfig/node12@1.0.11': + optional: true - '@tsconfig/node14@1.0.3': {} + '@tsconfig/node14@1.0.3': + optional: true - '@tsconfig/node16@1.0.4': {} + '@tsconfig/node16@1.0.4': + optional: true '@tybys/wasm-util@0.10.4': dependencies: @@ -10935,6 +10939,7 @@ snapshots: acorn-walk@8.3.5: dependencies: acorn: 8.19.0 + optional: true acorn@8.19.0: {} @@ -11015,7 +11020,8 @@ snapshots: - bare-buffer - react-native-b4a - arg@4.1.3: {} + arg@4.1.3: + optional: true argparse@1.0.10: dependencies: @@ -11506,7 +11512,8 @@ snapshots: crc-32: 1.2.2 readable-stream: 4.7.0 - create-require@1.1.1: {} + create-require@1.1.1: + optional: true cross-inspect@1.0.1: dependencies: @@ -11594,7 +11601,8 @@ snapshots: dependencies: address: 2.0.3 - diff@4.0.4: {} + diff@4.0.4: + optional: true diff@9.0.0: {} @@ -13010,7 +13018,8 @@ snapshots: dependencies: semver: 7.8.5 - make-error@1.3.6: {} + make-error@1.3.6: + optional: true map-cache@0.2.2: {} @@ -13349,6 +13358,7 @@ snapshots: '@oxc-resolver/binding-wasm32-wasi': 11.24.2 '@oxc-resolver/binding-win32-arm64-msvc': 11.24.2 '@oxc-resolver/binding-win32-x64-msvc': 11.24.2 + optional: true p-cancelable@4.0.1: {} @@ -13830,6 +13840,7 @@ snapshots: dependencies: buffer-from: 1.1.2 source-map: 0.6.1 + optional: true source-map@0.6.1: {} @@ -14115,6 +14126,7 @@ snapshots: yn: 3.1.1 optionalDependencies: '@swc/core': 1.16.13(@swc/helpers@0.5.23) + optional: true tsconfig-paths@4.2.0: dependencies: @@ -14302,7 +14314,8 @@ snapshots: util-deprecate@1.0.2: {} - v8-compile-cache-lib@3.0.1: {} + v8-compile-cache-lib@3.0.1: + optional: true v8-to-istanbul@9.3.0: dependencies: @@ -14519,7 +14532,8 @@ snapshots: dependencies: pend: 1.2.0 - yn@3.1.1: {} + yn@3.1.1: + optional: true yocto-queue@0.1.0: {} diff --git a/tsconfig.base.json b/tsconfig.base.json index 5a8f29d1e..ecaa0f68f 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1,7 +1,6 @@ { "compilerOptions": { "allowSyntheticDefaultImports": true, - "baseUrl": ".", "composite": true, "declaration": true, "declarationMap": true, @@ -11,17 +10,18 @@ "incremental": true, "inlineSourceMap": true, "inlineSources": true, - "module": "commonjs", - "moduleResolution": "node", + "module": "esnext", + "moduleResolution": "bundler", "noEmit": false, "noErrorTruncation": true, + "noUncheckedIndexedAccess": true, "resolveJsonModule": true, "skipLibCheck": true, "strict": true, - "target": "es2021", + "target": "es2023", + "verbatimModuleSyntax": true, "paths": { - "nx-chainlink": ["libs/nx-chainlink/src/index.ts"] - }, - "ignoreDeprecations": "6.0" + "nx-chainlink": ["./libs/nx-chainlink/src/index.ts"] + } } } diff --git a/tsconfig.json b/tsconfig.json index 585e665c4..76923ceb4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,8 +9,5 @@ { "path": "actions/signed-commits" } - ], - "compilerOptions": { - "ignoreDeprecations": "6.0" - } + ] }