Merge pull request #902 from crazy-max/dev-deps

update dev dependencies
This commit is contained in:
CrazyMax
2025-12-16 10:05:22 +01:00
committed by GitHub
23 changed files with 1824 additions and 1611 deletions

View File

@@ -1,4 +0,0 @@
/.yarn/**
/lib/**
/coverage/**
/node_modules/**

View File

@@ -1,36 +0,0 @@
{
"env": {
"node": true,
"es6": true,
"mocha": true,
"jest": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/typescript", // this is needed to allow importing typescript files from JS
"plugin:import/warnings",
"plugin:jest/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2023,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"jest",
"prettier"
],
"rules": {
"import/no-unresolved": [
"error", {
"ignore": ["csv-parse/sync", "@octokit/openapi-types"]
}
],
"jest/no-disabled-tests": 0
}
}

View File

@@ -49,7 +49,6 @@ describe('exists', () => {
const execSpy = jest.spyOn(Exec, 'getExecOutput'); const execSpy = jest.spyOn(Exec, 'getExecOutput');
const builder = new Builder(); const builder = new Builder();
await builder.exists('foo'); await builder.exists('foo');
// eslint-disable-next-line jest/no-standalone-expect
expect(execSpy).toHaveBeenCalledWith(`docker`, ['buildx', 'inspect', 'foo'], { expect(execSpy).toHaveBeenCalledWith(`docker`, ['buildx', 'inspect', 'foo'], {
silent: true, silent: true,
ignoreReturnCode: true ignoreReturnCode: true

View File

@@ -91,7 +91,6 @@ describe('isAvailable', () => {
standalone: false standalone: false
}); });
await buildx.isAvailable(); await buildx.isAvailable();
// eslint-disable-next-line jest/no-standalone-expect
expect(execSpy).toHaveBeenCalledWith(`docker`, ['buildx'], { expect(execSpy).toHaveBeenCalledWith(`docker`, ['buildx'], {
silent: true, silent: true,
ignoreReturnCode: true ignoreReturnCode: true
@@ -103,7 +102,6 @@ describe('isAvailable', () => {
standalone: true standalone: true
}); });
await buildx.isAvailable(); await buildx.isAvailable();
// eslint-disable-next-line jest/no-standalone-expect
expect(execSpy).toHaveBeenCalledWith(`buildx`, [], { expect(execSpy).toHaveBeenCalledWith(`buildx`, [], {
silent: true, silent: true,
ignoreReturnCode: true ignoreReturnCode: true

View File

@@ -94,7 +94,6 @@ describe('download', () => {
}); });
describe('build', () => { describe('build', () => {
// eslint-disable-next-line jest/no-disabled-tests
it.skip('builds refs/pull/648/head', async () => { it.skip('builds refs/pull/648/head', async () => {
const install = new Install(); const install = new Install();
const toolPath = await install.build('https://github.com/docker/buildx.git#refs/pull/648/head'); const toolPath = await install.build('https://github.com/docker/buildx.git#refs/pull/648/head');
@@ -103,7 +102,6 @@ describe('build', () => {
expect(fs.existsSync(buildxBin)).toBe(true); expect(fs.existsSync(buildxBin)).toBe(true);
}, 100000); }, 100000);
// eslint-disable-next-line jest/no-disabled-tests
it.skip('builds 67bd6f4dc82a9cd96f34133dab3f6f7af803bb14', async () => { it.skip('builds 67bd6f4dc82a9cd96f34133dab3f6f7af803bb14', async () => {
const install = new Install(); const install = new Install();
const toolPath = await install.build('https://github.com/docker/buildx.git#67bd6f4dc82a9cd96f34133dab3f6f7af803bb14'); const toolPath = await install.build('https://github.com/docker/buildx.git#67bd6f4dc82a9cd96f34133dab3f6f7af803bb14');

View File

@@ -49,7 +49,6 @@ describe('isAvailable', () => {
standalone: false standalone: false
}); });
await compose.isAvailable(); await compose.isAvailable();
// eslint-disable-next-line jest/no-standalone-expect
expect(execSpy).toHaveBeenCalledWith(`docker`, ['compose'], { expect(execSpy).toHaveBeenCalledWith(`docker`, ['compose'], {
silent: true, silent: true,
ignoreReturnCode: true ignoreReturnCode: true
@@ -61,7 +60,6 @@ describe('isAvailable', () => {
standalone: true standalone: true
}); });
await compose.isAvailable(); await compose.isAvailable();
// eslint-disable-next-line jest/no-standalone-expect
expect(execSpy).toHaveBeenCalledWith(`compose`, [], { expect(execSpy).toHaveBeenCalledWith(`compose`, [], {
silent: true, silent: true,
ignoreReturnCode: true ignoreReturnCode: true

View File

@@ -29,7 +29,6 @@ describe('isAvailable', () => {
const execSpy = jest.spyOn(Exec, 'getExecOutput'); const execSpy = jest.spyOn(Exec, 'getExecOutput');
const cosign = new Cosign(); const cosign = new Cosign();
await cosign.isAvailable(); await cosign.isAvailable();
// eslint-disable-next-line jest/no-standalone-expect
expect(execSpy).toHaveBeenCalledWith(`cosign`, [], { expect(execSpy).toHaveBeenCalledWith(`cosign`, [], {
silent: true, silent: true,
ignoreReturnCode: true ignoreReturnCode: true

View File

@@ -57,7 +57,7 @@ describe('isInsideWorkTree', () => {
const execSpy = jest.spyOn(Exec, 'getExecOutput'); const execSpy = jest.spyOn(Exec, 'getExecOutput');
try { try {
await Git.isInsideWorkTree(); await Git.isInsideWorkTree();
} catch (err) { } catch {
// noop // noop
} }
expect(execSpy).toHaveBeenCalledWith(`git`, ['rev-parse', '--is-inside-work-tree'], { expect(execSpy).toHaveBeenCalledWith(`git`, ['rev-parse', '--is-inside-work-tree'], {
@@ -81,7 +81,7 @@ describe('remoteURL', () => {
const execSpy = jest.spyOn(Exec, 'getExecOutput'); const execSpy = jest.spyOn(Exec, 'getExecOutput');
try { try {
await Git.remoteURL(); await Git.remoteURL();
} catch (err) { } catch {
// noop // noop
} }
expect(execSpy).toHaveBeenCalledWith(`git`, ['remote', 'get-url', 'origin'], { expect(execSpy).toHaveBeenCalledWith(`git`, ['remote', 'get-url', 'origin'], {
@@ -415,7 +415,7 @@ describe('fullCommit', () => {
const execSpy = jest.spyOn(Exec, 'getExecOutput'); const execSpy = jest.spyOn(Exec, 'getExecOutput');
try { try {
await Git.fullCommit(); await Git.fullCommit();
} catch (err) { } catch {
// noop // noop
} }
expect(execSpy).toHaveBeenCalledWith(`git`, ['show', '--format=%H', 'HEAD', '--quiet', '--'], { expect(execSpy).toHaveBeenCalledWith(`git`, ['show', '--format=%H', 'HEAD', '--quiet', '--'], {
@@ -430,7 +430,7 @@ describe('shortCommit', () => {
const execSpy = jest.spyOn(Exec, 'getExecOutput'); const execSpy = jest.spyOn(Exec, 'getExecOutput');
try { try {
await Git.shortCommit(); await Git.shortCommit();
} catch (err) { } catch {
// noop // noop
} }
expect(execSpy).toHaveBeenCalledWith(`git`, ['show', '--format=%h', 'HEAD', '--quiet', '--'], { expect(execSpy).toHaveBeenCalledWith(`git`, ['show', '--format=%h', 'HEAD', '--quiet', '--'], {
@@ -445,7 +445,7 @@ describe('tag', () => {
const execSpy = jest.spyOn(Exec, 'getExecOutput'); const execSpy = jest.spyOn(Exec, 'getExecOutput');
try { try {
await Git.tag(); await Git.tag();
} catch (err) { } catch {
// noop // noop
} }
expect(execSpy).toHaveBeenCalledWith(`git`, ['tag', '--points-at', 'HEAD', '--sort', '-version:creatordate'], { expect(execSpy).toHaveBeenCalledWith(`git`, ['tag', '--points-at', 'HEAD', '--sort', '-version:creatordate'], {

View File

@@ -141,6 +141,7 @@ describe('actionsRuntimeToken', () => {
it('malformed', async () => { it('malformed', async () => {
process.env.ACTIONS_RUNTIME_TOKEN = 'foo'; process.env.ACTIONS_RUNTIME_TOKEN = 'foo';
expect(() => { expect(() => {
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
GitHub.actionsRuntimeToken; GitHub.actionsRuntimeToken;
}).toThrow(); }).toThrow();
}); });

View File

@@ -85,7 +85,6 @@ describe('isAvailable', () => {
const execSpy = jest.spyOn(Exec, 'getExecOutput'); const execSpy = jest.spyOn(Exec, 'getExecOutput');
const regctl = new Regctl(); const regctl = new Regctl();
await regctl.isAvailable(); await regctl.isAvailable();
// eslint-disable-next-line jest/no-standalone-expect
expect(execSpy).toHaveBeenCalledWith(`regctl`, [], { expect(execSpy).toHaveBeenCalledWith(`regctl`, [], {
silent: true, silent: true,
ignoreReturnCode: true ignoreReturnCode: true

View File

@@ -14,16 +14,14 @@
* limitations under the License. * limitations under the License.
*/ */
// eslint-disable-next-line @typescript-eslint/no-var-requires /* eslint-disable @typescript-eslint/no-require-imports */
const fs = require('fs'); const fs = require('fs');
module.exports = results => { module.exports = results => {
const allSkipped = results.testResults.every(result => { const allSkipped = results.testResults.every(result => result.skipped);
return result.skipped;
});
if (allSkipped) { if (allSkipped) {
console.log('All tests were skipped!'); console.log('All tests were skipped!');
// create an empty file to signal that all tests were skipped for CI fs.mkdirSync('./coverage', {recursive: true});
fs.closeSync(fs.openSync('./coverage/allSkipped.txt', 'w')); fs.closeSync(fs.openSync('./coverage/allSkipped.txt', 'w'));
} }
return results; return results;

View File

@@ -46,7 +46,6 @@ describe('isAvailable', () => {
const execSpy = jest.spyOn(Exec, 'getExecOutput'); const execSpy = jest.spyOn(Exec, 'getExecOutput');
const undock = new Undock(); const undock = new Undock();
await undock.isAvailable(); await undock.isAvailable();
// eslint-disable-next-line jest/no-standalone-expect
expect(execSpy).toHaveBeenCalledWith(`undock`, [], { expect(execSpy).toHaveBeenCalledWith(`undock`, [], {
silent: true, silent: true,
ignoreReturnCode: true ignoreReturnCode: true

84
eslint.config.js Normal file
View File

@@ -0,0 +1,84 @@
/**
* Copyright 2025 actions-toolkit authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable @typescript-eslint/no-require-imports */
const {defineConfig, globalIgnores} = require('eslint/config');
const {fixupConfigRules, fixupPluginRules} = require('@eslint/compat');
const typescriptEslint = require('@typescript-eslint/eslint-plugin');
const jestPlugin = require('eslint-plugin-jest');
const prettier = require('eslint-plugin-prettier');
const globals = require('globals');
const tsParser = require('@typescript-eslint/parser');
const js = require('@eslint/js');
const {FlatCompat} = require('@eslint/eslintrc');
// __dirname and __filename exist natively in CommonJS
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
module.exports = defineConfig([
globalIgnores(['.yarn/**/*', 'lib/**/*', 'coverage/**/*', 'node_modules/**/*']),
{
extends: fixupConfigRules(
compat.extends(
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/errors',
'plugin:import/typescript',
'plugin:import/warnings',
'plugin:jest/recommended',
'plugin:prettier/recommended'
)
),
plugins: {
'@typescript-eslint': fixupPluginRules(typescriptEslint),
jest: fixupPluginRules(jestPlugin),
prettier: fixupPluginRules(prettier)
},
languageOptions: {
globals: {
...globals.node,
...globals.mocha,
...globals.jest
},
parser: tsParser,
ecmaVersion: 2023,
sourceType: 'commonjs'
},
rules: {
'@typescript-eslint/no-require-imports': [
'error',
{
allowAsImport: true
}
],
'import/no-unresolved': [
'error',
{
ignore: ['csv-parse/sync', '@octokit/openapi-types']
}
],
'jest/no-disabled-tests': 0
}
}
]);

View File

@@ -26,6 +26,6 @@ module.exports = {
moduleNameMapper: { moduleNameMapper: {
'^csv-parse/sync': '<rootDir>/node_modules/csv-parse/dist/cjs/sync.cjs' '^csv-parse/sync': '<rootDir>/node_modules/csv-parse/dist/cjs/sync.cjs'
}, },
testResultsProcessor: './__tests__/testResultsProcessor.ts', testResultsProcessor: '<rootDir>/__tests__/testResultsProcessor.js',
verbose: false verbose: false
}; };

View File

@@ -14,9 +14,10 @@
* limitations under the License. * limitations under the License.
*/ */
import fs from 'fs'; /* eslint-disable @typescript-eslint/no-require-imports */
import os from 'os'; const fs = require('fs');
import path from 'path'; const os = require('os');
const path = require('path');
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-actions-toolkit-')); const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-actions-toolkit-'));
@@ -28,9 +29,7 @@ process.env = Object.assign({}, process.env, {
GITHUB_RUN_NUMBER: 15, GITHUB_RUN_NUMBER: 15,
RUNNER_TEMP: path.join(tmpDir, 'runner-temp'), RUNNER_TEMP: path.join(tmpDir, 'runner-temp'),
RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache') RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache')
}) as { });
[key: string]: string;
};
module.exports = { module.exports = {
clearMocks: true, clearMocks: true,
@@ -46,6 +45,6 @@ module.exports = {
}, },
collectCoverageFrom: ['src/**/{!(index.ts),}.ts'], collectCoverageFrom: ['src/**/{!(index.ts),}.ts'],
coveragePathIgnorePatterns: ['lib/', 'node_modules/', '__mocks__/', '__tests__/'], coveragePathIgnorePatterns: ['lib/', 'node_modules/', '__mocks__/', '__tests__/'],
testResultsProcessor: './__tests__/testResultsProcessor.ts', testResultsProcessor: '<rootDir>/__tests__/testResultsProcessor.js',
verbose: true verbose: true
}; };

View File

@@ -12,9 +12,9 @@
"prettier:fix": "prettier --write \"./**/*.ts\"", "prettier:fix": "prettier --write \"./**/*.ts\"",
"test": "jest", "test": "jest",
"test:coverage": "jest --coverage", "test:coverage": "jest --coverage",
"test:itg": "jest -c jest.config.itg.ts --runInBand --detectOpenHandles", "test:itg": "jest -c jest.config.itg.js --runInBand",
"test:itg-list": "jest -c jest.config.itg.ts --listTests", "test:itg-list": "jest -c jest.config.itg.js --listTests",
"test:itg-coverage": "jest --coverage -c jest.config.itg.ts --runInBand --detectOpenHandles" "test:itg-coverage": "jest -c jest.config.itg.js --coverage --runInBand"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@@ -70,27 +70,30 @@
"tmp": "^0.2.5" "tmp": "^0.2.5"
}, },
"devDependencies": { "devDependencies": {
"@eslint/compat": "^2.0.0",
"@eslint/eslintrc": "^3.3.3",
"@eslint/js": "^9.39.2",
"@sigstore/rekor-types": "^3.0.0", "@sigstore/rekor-types": "^3.0.0",
"@types/gunzip-maybe": "^1.4.2", "@types/gunzip-maybe": "^1.4.3",
"@types/he": "^1.2.3", "@types/he": "^1.2.3",
"@types/js-yaml": "^4.0.9", "@types/js-yaml": "^4.0.9",
"@types/node": "^20.19.9", "@types/node": "^20.19.27",
"@types/semver": "^7.7.1", "@types/semver": "^7.7.1",
"@types/tar-stream": "^3.1.4", "@types/tar-stream": "^3.1.4",
"@types/tmp": "^0.2.6", "@types/tmp": "^0.2.6",
"@typescript-eslint/eslint-plugin": "^7.18.0", "@typescript-eslint/eslint-plugin": "^8.50.0",
"@typescript-eslint/parser": "^7.18.0", "@typescript-eslint/parser": "^8.50.0",
"dotenv": "^17.2.1", "dotenv": "^17.2.3",
"eslint": "^8.57.1", "eslint": "^9.39.2",
"eslint-config-prettier": "^9.1.2", "eslint-config-prettier": "^10.1.8",
"eslint-plugin-import": "^2.32.0", "eslint-plugin-import": "^2.32.0",
"eslint-plugin-jest": "^28.14.0", "eslint-plugin-jest": "^29.5.0",
"eslint-plugin-prettier": "^5.5.3", "eslint-plugin-prettier": "^5.5.4",
"jest": "^29.7.0", "jest": "^30.2.0",
"prettier": "^3.6.2", "prettier": "^3.7.4",
"rimraf": "^6.0.1", "rimraf": "^6.1.2",
"ts-jest": "^29.4.1", "ts-jest": "^29.4.6",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"typescript": "^5.9.2" "typescript": "^5.9.3"
} }
} }

View File

@@ -85,7 +85,7 @@ export class BuildKit {
if (!bkversion) { if (!bkversion) {
try { try {
bkversion = await this.getVersionWithinImage(node.name || ''); bkversion = await this.getVersionWithinImage(node.name || '');
} catch (e) { } catch {
core.debug(`BuildKit.versionSatisfies ${node.name}: can't get version`); core.debug(`BuildKit.versionSatisfies ${node.name}: can't get version`);
return false; return false;
} }

View File

@@ -169,7 +169,7 @@ export class Build {
} }
try { try {
return core.getBooleanInput(name) ? `builder-id=${GitHub.workflowRunURL(true)}` : 'false'; return core.getBooleanInput(name) ? `builder-id=${GitHub.workflowRunURL(true)}` : 'false';
} catch (err) { } catch {
// not a valid boolean, so we assume it's a string // not a valid boolean, so we assume it's a string
return Build.resolveProvenanceAttrs(input); return Build.resolveProvenanceAttrs(input);
} }
@@ -302,7 +302,7 @@ export class Build {
// https://github.com/docker/buildx/blob/8abef5908705e49f7ba88ef8c957e1127b597a2a/util/buildflags/attests.go#L13-L21 // https://github.com/docker/buildx/blob/8abef5908705e49f7ba88ef8c957e1127b597a2a/util/buildflags/attests.go#L13-L21
const v = Util.parseBool(attr); const v = Util.parseBool(attr);
res.push(`disabled=${!v}`); res.push(`disabled=${!v}`);
} catch (err) { } catch {
res.push(attr); res.push(attr);
} }
} }

View File

@@ -148,7 +148,7 @@ export class Buildx {
let url: URL; let url: URL;
try { try {
url = new URL(endpoint); url = new URL(endpoint);
} catch (e) { } catch {
return []; return [];
} }
if (url.protocol != 'tcp:') { if (url.protocol != 'tcp:') {
@@ -280,7 +280,7 @@ export class Buildx {
const fnGitURL = function (inp: string): GitURL | undefined { const fnGitURL = function (inp: string): GitURL | undefined {
try { try {
return Git.parseURL(inp); return Git.parseURL(inp);
} catch (e) { } catch {
// noop // noop
} }
}; };

View File

@@ -60,7 +60,7 @@ export class Docker {
silent: true silent: true
}); });
return true; return true;
} catch (e) { } catch {
return false; return false;
} }
} }

View File

@@ -69,7 +69,6 @@ export interface ContextInfo {
Name: string; Name: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
Metadata: any; Metadata: any;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Endpoints: Record<string, EndpointInfo>; Endpoints: Record<string, EndpointInfo>;
TLSMaterial: Record<string, Array<string>>; TLSMaterial: Record<string, Array<string>>;
Storage: StorageInfo; Storage: StorageInfo;

View File

@@ -82,7 +82,7 @@ export class Util {
let url; let url;
try { try {
url = new URL(urlStr); url = new URL(urlStr);
} catch (e) { } catch {
return false; return false;
} }
return url.protocol === 'http:' || url.protocol === 'https:'; return url.protocol === 'http:' || url.protocol === 'https:';
@@ -115,10 +115,10 @@ export class Util {
}; };
} }
public static isDirectory(p) { public static isDirectory(p: string) {
try { try {
return fs.lstatSync(p).isDirectory(); return fs.lstatSync(p).isDirectory();
} catch (_) { } catch {
// noop // noop
} }
return false; return false;

3211
yarn.lock

File diff suppressed because it is too large Load Diff