diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d4abe09..8b7deb1 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,6 +4,8 @@ updates: directory: / schedule: interval: monthly + cooldown: + default-days: 5 groups: github-actions: patterns: @@ -14,6 +16,8 @@ updates: versioning-strategy: widen schedule: interval: weekly + cooldown: + default-days: 5 groups: dependencies: dependency-type: "production" diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index e8b453c..881bacf 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [20.x] + node-version: [24.x] fail-fast: false steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -20,7 +20,7 @@ jobs: with: node-version: ${{ matrix.node-version }} - name: Install dependencies - run: npm i + run: npm install --ignore-scripts - name: Lint run: npm run lint - name: Run tests diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..3f5efa7 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,29 @@ +name: Publish Package + +on: + push: + tags: + - 'v*' + +permissions: + id-token: write # Required for OIDC + contents: read + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + + - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 + with: + node-version: '24.x' + registry-url: 'https://registry.npmjs.org' + + # Ensure npm 11.5.1 or later is installed + - name: Update npm + run: npm install -g npm@latest + - run: npm install --ignore-scripts + - run: npm run build --if-present + - run: npm test + - run: npm publish diff --git a/.npmrc b/.npmrc index 43c97e7..61cbf3f 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,3 @@ package-lock=false +save-exact=true +ignore-scripts=true diff --git a/package.json b/package.json index f2a5b58..1470f79 100644 --- a/package.json +++ b/package.json @@ -6,12 +6,17 @@ "exports": "./dist/index.js", "types": "./dist/index.d.ts", "scripts": { - "build": "rimraf ./dist && tsc", + "build": "tsc", "prepublishOnly": "npm run build", - "test": "glob -c \"tsx --test\" \"./test/**/*.spec.ts\"", + "test": "node --test ./test/**/*.spec.ts", "coverage": "c8 --all -r html npm test", "lint": "eslint src test" }, + "publishConfig": { + "registry": "https://registry.npmjs.org", + "access": "public", + "provenance": true + }, "repository": { "type": "git", "url": "git+https://github.com/dashlog/core.git" @@ -27,22 +32,19 @@ }, "homepage": "https://github.com/dashlog/core#readme", "devDependencies": { - "@openally/config.eslint": "^2.1.0", - "@openally/config.typescript": "^1.0.3", - "@types/node": "^22.15.21", - "c8": "^10.1.2", - "glob": "^11.0.0", - "rimraf": "^6.0.1", - "tsx": "^4.16.2" + "@openally/config.eslint": "^2.2.0", + "@openally/config.typescript": "^1.2.1", + "@types/node": "^25.0.3", + "c8": "^10.1.2" }, "dependencies": { "@dashlog/fetch-github-repositories": "^3.0.2", - "@myunisoft/httpie": "^5.0.0", - "@nodesecure/npm-registry-sdk": "^3.0.0", - "@nodesecure/npm-types": "^1.2.0", + "@nodesecure/npm-registry-sdk": "^4.4.0", + "@nodesecure/npm-types": "^1.3.0", "@nodesecure/ossf-scorecard-sdk": "^3.2.1", - "@nodesecure/scanner": "^6.4.0", - "@octokit/types": "^14.0.0", - "@openally/mutex": "^1.0.0" + "@nodesecure/scanner": "^8.2.0", + "@octokit/types": "^16.0.0", + "@openally/httpie": "1.0.0", + "@openally/mutex": "^2.0.0" } } diff --git a/src/index.ts b/src/index.ts index 864bf23..5b2de98 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ // Import Internal Dependencies -import Github from "./services/github.js"; -import * as plugins from "./plugins/index.js"; -import { type DashlogRepository } from "./services/repository.js"; +import Github from "./services/github.ts"; +import * as plugins from "./plugins/index.ts"; +import { type DashlogRepository } from "./services/repository.ts"; export type DashlogAllPlugins = plugins.nodesecure.NodesecurePlugin & @@ -14,13 +14,13 @@ export type DashlogOrganization = { projects: DashlogRepository[]; }; -export interface IFetchOrgMetadataOptions { +export interface FetchOrgMetadataOptions { plugins: Plugins[]; } export async function fetchOrgMetadata( orgName: string, - options: IFetchOrgMetadataOptions = { plugins: [] } + options: FetchOrgMetadataOptions = { plugins: [] } ): Promise>> { const githubRepository = new Github(orgName); diff --git a/src/plugins/index.ts b/src/plugins/index.ts index 91b91b7..99a3c49 100644 --- a/src/plugins/index.ts +++ b/src/plugins/index.ts @@ -1,2 +1,2 @@ -export * as scorecard from "./scorecard.js"; -export * as nodesecure from "./nodesecure.js"; +export * as scorecard from "./scorecard.ts"; +export * as nodesecure from "./nodesecure.ts"; diff --git a/src/plugins/nodesecure.ts b/src/plugins/nodesecure.ts index 5e492ad..31d4f92 100644 --- a/src/plugins/nodesecure.ts +++ b/src/plugins/nodesecure.ts @@ -3,7 +3,7 @@ import * as scanner from "@nodesecure/scanner"; import { Mutex } from "@openally/mutex"; // Import Internal Dependencies -import { type DashlogRepository } from "../services/repository.js"; +import { type DashlogRepository } from "../services/repository.ts"; // CONSTANTS const kScannerLock = new Mutex({ concurrency: 5 }); diff --git a/src/plugins/scorecard.ts b/src/plugins/scorecard.ts index 5edd870..b0408ba 100644 --- a/src/plugins/scorecard.ts +++ b/src/plugins/scorecard.ts @@ -2,7 +2,7 @@ import * as scorecard from "@nodesecure/ossf-scorecard-sdk"; // Import Internal Dependencies -import { type DashlogRepository } from "../services/repository.js"; +import { type DashlogRepository } from "../services/repository.ts"; export type ScorecardPlugin = { scorecard?: scorecard.ScorecardResult | null; diff --git a/src/services/github.ts b/src/services/github.ts index cb7bd30..d93b0dd 100644 --- a/src/services/github.ts +++ b/src/services/github.ts @@ -1,10 +1,10 @@ // Import Third-party Dependencies -import * as httpie from "@myunisoft/httpie"; +import * as httpie from "@openally/httpie"; import type { Endpoints } from "@octokit/types"; import { fetchLazy } from "@dashlog/fetch-github-repositories"; // Import Internal Dependencies -import GithubRepository, { type DashlogRepository } from "./repository.js"; +import GithubRepository, { type DashlogRepository } from "./repository.ts"; export default class Github { public orgName: string; diff --git a/src/services/repository.ts b/src/services/repository.ts index 431ce2c..cb0e215 100644 --- a/src/services/repository.ts +++ b/src/services/repository.ts @@ -2,15 +2,15 @@ import path from "node:path"; // Import Third-party Dependencies -import * as httpie from "@myunisoft/httpie"; +import * as httpie from "@openally/httpie"; import type { Endpoints } from "@octokit/types"; import * as Dashlog from "@dashlog/fetch-github-repositories"; import { packument } from "@nodesecure/npm-registry-sdk"; import type { PackageJSON } from "@nodesecure/npm-types"; // Import Internal Dependencies -import Github from "./github.js"; -import { getCoverageLib, getTestFrameworkName } from "../utils/index.js"; +import Github from "./github.ts"; +import { getCoverageLib, getTestFrameworkName } from "../utils/index.ts"; // CONSTANTS const kMaxCommitFetch = 60; diff --git a/src/utils/index.ts b/src/utils/index.ts index d8f879a..4438a9c 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,2 +1,2 @@ -export * from "./getCoverageLib.js"; -export * from "./getTestFrameworkName.js"; +export * from "./getCoverageLib.ts"; +export * from "./getTestFrameworkName.ts"; diff --git a/test/getCoverageLib.spec.ts b/test/getCoverageLib.spec.ts index 9e71901..c77dba3 100644 --- a/test/getCoverageLib.spec.ts +++ b/test/getCoverageLib.spec.ts @@ -3,7 +3,7 @@ import { describe, it } from "node:test"; import assert from "node:assert/strict"; // Import Internal Dependencies -import { getCoverageLib } from "../src/utils"; +import { getCoverageLib } from "../src/utils/index.ts"; describe("getCoverageLib()", () => { it("Should return N/A", () => { diff --git a/test/getTestFrameworkName.spec.ts b/test/getTestFrameworkName.spec.ts index 35553ab..9dff935 100644 --- a/test/getTestFrameworkName.spec.ts +++ b/test/getTestFrameworkName.spec.ts @@ -3,7 +3,7 @@ import { describe, it } from "node:test"; import assert from "node:assert/strict"; // Import Internal Dependencies -import { getTestFrameworkName } from "../src/utils"; +import { getTestFrameworkName } from "../src/utils/index.ts"; describe("getTestFrameworkName()", () => { it("Should return N/A", () => { diff --git a/test/github.spec.ts b/test/github.spec.ts index e1f8cee..3623cae 100644 --- a/test/github.spec.ts +++ b/test/github.spec.ts @@ -5,14 +5,17 @@ import fs from "node:fs"; // Import Third-party Dependencies import { MockAgent, setGlobalDispatcher } from "undici"; +import type { Repository } from "@dashlog/fetch-github-repositories"; // Import Internal Dependencies -import Github from "../src/services/github.js"; +import Github from "../src/services/github.ts"; const kMaxCommitFetch = 60; const nsGithubOrg = JSON.parse(fs.readFileSync("./test/fixtures/nodesecure-github-org.json", "utf-8")); -const repositories = JSON.parse(fs.readFileSync("./test/fixtures/repos.json", "utf-8")); +const repositories = JSON.parse( + fs.readFileSync("./test/fixtures/repos.json", "utf-8") +) as Repository[]; const issues = JSON.parse(fs.readFileSync("./test/fixtures/issues.json", "utf-8")); const pulls = JSON.parse(fs.readFileSync("./test/fixtures/pulls.json", "utf-8")); const commits = JSON.parse(fs.readFileSync("./test/fixtures/commits.json", "utf-8")); diff --git a/test/plugins/nodesecure.spec.ts b/test/plugins/nodesecure.spec.ts index b194271..2df801f 100644 --- a/test/plugins/nodesecure.spec.ts +++ b/test/plugins/nodesecure.spec.ts @@ -6,7 +6,7 @@ import assert from "node:assert"; import { MockAgent, setGlobalDispatcher } from "undici"; // Import Internal Dependencies -import { execute } from "../../src/plugins/nodesecure"; +import { execute } from "../../src/plugins/nodesecure.ts"; const kApiUrl = "https://api.securityscorecards.dev"; diff --git a/test/plugins/scorecard.spec.ts b/test/plugins/scorecard.spec.ts index 5788878..1f2b74c 100644 --- a/test/plugins/scorecard.spec.ts +++ b/test/plugins/scorecard.spec.ts @@ -6,7 +6,7 @@ import assert from "node:assert"; import { MockAgent, setGlobalDispatcher } from "undici"; // Import Internal Dependencies -import { execute } from "../../src/plugins/scorecard"; +import { execute } from "../../src/plugins/scorecard.ts"; const kApiUrl = "https://api.securityscorecards.dev"; diff --git a/tsconfig.json b/tsconfig.json index bc2279b..7c35c2b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "@openally/config.typescript/esm", + "extends": "@openally/config.typescript/esm-ts-next", "compilerOptions": { "outDir": "dist", "rootDir": "./src"