Merge pull request #927 from crazy-max/esm

switch to ESM and update config/test wiring
This commit is contained in:
CrazyMax
2026-03-03 16:25:25 +01:00
committed by GitHub
41 changed files with 1599 additions and 3795 deletions

View File

@@ -1,3 +0,0 @@
/dist/**
/coverage/**
/node_modules/**

View File

@@ -1,24 +0,0 @@
{
"env": {
"node": true,
"es6": true,
"jest": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"jest",
"prettier"
]
}

View File

@@ -6,6 +6,5 @@
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "avoid",
"parser": "typescript"
"arrowParens": "avoid"
}

View File

@@ -1,7 +1,7 @@
import {beforeEach, describe, expect, jest, test} from '@jest/globals';
import {beforeEach, describe, expect, test, vi} from 'vitest';
import {AuthorizationData} from '@aws-sdk/client-ecr';
import * as aws from '../src/aws';
import * as aws from '../src/aws.js';
describe('isECR', () => {
test.each([
@@ -65,26 +65,28 @@ describe('getAccountIDs', () => {
});
});
const mockEcrGetAuthToken = jest.fn();
const mockEcrPublicGetAuthToken = jest.fn();
jest.mock('@aws-sdk/client-ecr', () => {
const mockEcrGetAuthToken = vi.fn();
const mockEcrPublicGetAuthToken = vi.fn();
vi.mock('@aws-sdk/client-ecr', () => {
class ECR {
getAuthorizationToken = mockEcrGetAuthToken;
}
return {
ECR: jest.fn(() => ({
getAuthorizationToken: mockEcrGetAuthToken
}))
ECR
};
});
jest.mock('@aws-sdk/client-ecr-public', () => {
vi.mock('@aws-sdk/client-ecr-public', () => {
class ECRPUBLIC {
getAuthorizationToken = mockEcrPublicGetAuthToken;
}
return {
ECRPUBLIC: jest.fn(() => ({
getAuthorizationToken: mockEcrPublicGetAuthToken
}))
ECRPUBLIC
};
});
describe('getRegistriesData', () => {
beforeEach(() => {
jest.clearAllMocks();
vi.clearAllMocks();
delete process.env.AWS_ACCOUNT_IDS;
});
// prettier-ignore

View File

@@ -1,6 +1,6 @@
import {expect, test} from '@jest/globals';
import {expect, test} from 'vitest';
import {getInputs} from '../src/context';
import {getInputs} from '../src/context.js';
test('with password and username getInputs does not throw error', async () => {
process.env['INPUT_USERNAME'] = 'dbowie';

View File

@@ -1,16 +1,16 @@
import {expect, jest, test} from '@jest/globals';
import {expect, test, vi} from 'vitest';
import * as path from 'path';
import {loginStandard, logout} from '../src/docker';
import {Docker} from '@docker/actions-toolkit/lib/docker/docker.js';
import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
import {loginStandard, logout} from '../src/docker.js';
process.env['RUNNER_TEMP'] = path.join(__dirname, 'runner');
test('loginStandard calls exec', async () => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const execSpy = jest.spyOn(Docker, 'getExecOutput').mockImplementation(async () => {
const execSpy = vi.spyOn(Docker, 'getExecOutput').mockImplementation(async () => {
return {
exitCode: expect.any(Number),
stdout: expect.any(Function),
@@ -40,7 +40,7 @@ test('loginStandard calls exec', async () => {
test('logout calls exec', async () => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const execSpy = jest.spyOn(Docker, 'getExecOutput').mockImplementation(async () => {
const execSpy = vi.spyOn(Docker, 'getExecOutput').mockImplementation(async () => {
return {
exitCode: expect.any(Number),
stdout: expect.any(Function),

12
__tests__/setup.unit.ts Normal file
View File

@@ -0,0 +1,12 @@
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-login-action-'));
process.env = Object.assign({}, process.env, {
TEMP: tmpDir,
GITHUB_REPOSITORY: 'docker/login-action',
RUNNER_TEMP: path.join(tmpDir, 'runner-temp'),
RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache')
});

View File

@@ -3,10 +3,11 @@
ARG NODE_VERSION=20
FROM node:${NODE_VERSION}-alpine AS base
RUN apk add --no-cache cpio findutils git
RUN apk add --no-cache cpio findutils git rsync
WORKDIR /src
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/.yarn/cache <<EOT
set -e
corepack enable
yarn --version
yarn config set --home enableTelemetry 0
@@ -34,18 +35,27 @@ RUN --mount=type=bind,target=.,rw <<EOT
EOT
FROM deps AS build
RUN --mount=type=bind,target=.,rw \
RUN --mount=target=/context \
--mount=type=cache,target=/src/.yarn/cache \
--mount=type=cache,target=/src/node_modules \
yarn run build && mkdir /out && cp -Rf dist /out/
--mount=type=cache,target=/src/node_modules <<EOT
set -e
rsync -a /context/. .
rm -rf dist
yarn run build
mkdir /out
cp -r dist /out
EOT
FROM scratch AS build-update
COPY --from=build /out /
FROM build AS build-validate
RUN --mount=type=bind,target=.,rw <<EOT
RUN --mount=target=/context \
--mount=target=.,type=tmpfs <<EOT
set -e
rsync -a /context/. .
git add -A
rm -rf dist
cp -rf /out/* .
if [ -n "$(git status --porcelain -- dist)" ]; then
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
@@ -58,8 +68,7 @@ FROM deps AS format
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/.yarn/cache \
--mount=type=cache,target=/src/node_modules \
yarn run format \
&& mkdir /out && find . -name '*.ts' -not -path './node_modules/*' -not -path './.yarn/*' | cpio -pdm /out
yarn run format && mkdir /out && find . -name '*.ts' -not -path './node_modules/*' -not -path './.yarn/*' | cpio -pdm /out
FROM scratch AS format-update
COPY --from=format /out /
@@ -76,7 +85,7 @@ ENV RUNNER_TOOL_CACHE=/tmp/github_tool_cache
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/.yarn/cache \
--mount=type=cache,target=/src/node_modules \
yarn run test --coverage --coverageDirectory=/tmp/coverage
yarn run test --coverage --coverage.reportsDirectory=/tmp/coverage
FROM scratch AS test-coverage
COPY --from=test /tmp/coverage /

9
dist/136.index.js generated vendored
View File

@@ -1,7 +1,6 @@
"use strict";
exports.id = 136;
exports.ids = [136];
exports.modules = {
export const id = 136;
export const ids = [136];
export const modules = {
/***/ 63723:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
@@ -895,5 +894,5 @@ module.exports = /*#__PURE__*/JSON.parse('{"name":"@aws-sdk/nested-clients","ver
/***/ })
};
;
//# sourceMappingURL=136.index.js.map

2
dist/136.index.js.map generated vendored

File diff suppressed because one or more lines are too long

9
dist/360.index.js generated vendored
View File

@@ -1,7 +1,6 @@
"use strict";
exports.id = 360;
exports.ids = [360];
exports.modules = {
export const id = 360;
export const ids = [360];
export const modules = {
/***/ 75360:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
@@ -90,5 +89,5 @@ exports.fromProcess = fromProcess;
/***/ })
};
;
//# sourceMappingURL=360.index.js.map

2
dist/360.index.js.map generated vendored
View File

@@ -1 +1 @@
{"version":3,"file":"360.index.js","mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sources":[".././node_modules/@aws-sdk/credential-provider-process/dist-cjs/index.js"],"sourcesContent":["'use strict';\n\nvar sharedIniFileLoader = require('@smithy/shared-ini-file-loader');\nvar propertyProvider = require('@smithy/property-provider');\nvar child_process = require('child_process');\nvar util = require('util');\nvar client = require('@aws-sdk/core/client');\n\nconst getValidatedProcessCredentials = (profileName, data, profiles) => {\n if (data.Version !== 1) {\n throw Error(`Profile ${profileName} credential_process did not return Version 1.`);\n }\n if (data.AccessKeyId === undefined || data.SecretAccessKey === undefined) {\n throw Error(`Profile ${profileName} credential_process returned invalid credentials.`);\n }\n if (data.Expiration) {\n const currentTime = new Date();\n const expireTime = new Date(data.Expiration);\n if (expireTime < currentTime) {\n throw Error(`Profile ${profileName} credential_process returned expired credentials.`);\n }\n }\n let accountId = data.AccountId;\n if (!accountId && profiles?.[profileName]?.aws_account_id) {\n accountId = profiles[profileName].aws_account_id;\n }\n const credentials = {\n accessKeyId: data.AccessKeyId,\n secretAccessKey: data.SecretAccessKey,\n ...(data.SessionToken && { sessionToken: data.SessionToken }),\n ...(data.Expiration && { expiration: new Date(data.Expiration) }),\n ...(data.CredentialScope && { credentialScope: data.CredentialScope }),\n ...(accountId && { accountId }),\n };\n client.setCredentialFeature(credentials, \"CREDENTIALS_PROCESS\", \"w\");\n return credentials;\n};\n\nconst resolveProcessCredentials = async (profileName, profiles, logger) => {\n const profile = profiles[profileName];\n if (profiles[profileName]) {\n const credentialProcess = profile[\"credential_process\"];\n if (credentialProcess !== undefined) {\n const execPromise = util.promisify(sharedIniFileLoader.externalDataInterceptor?.getTokenRecord?.().exec ?? child_process.exec);\n try {\n const { stdout } = await execPromise(credentialProcess);\n let data;\n try {\n data = JSON.parse(stdout.trim());\n }\n catch {\n throw Error(`Profile ${profileName} credential_process returned invalid JSON.`);\n }\n return getValidatedProcessCredentials(profileName, data, profiles);\n }\n catch (error) {\n throw new propertyProvider.CredentialsProviderError(error.message, { logger });\n }\n }\n else {\n throw new propertyProvider.CredentialsProviderError(`Profile ${profileName} did not contain credential_process.`, { logger });\n }\n }\n else {\n throw new propertyProvider.CredentialsProviderError(`Profile ${profileName} could not be found in shared credentials file.`, {\n logger,\n });\n }\n};\n\nconst fromProcess = (init = {}) => async ({ callerClientConfig } = {}) => {\n init.logger?.debug(\"@aws-sdk/credential-provider-process - fromProcess\");\n const profiles = await sharedIniFileLoader.parseKnownFiles(init);\n return resolveProcessCredentials(sharedIniFileLoader.getProfileName({\n profile: init.profile ?? callerClientConfig?.profile,\n }), profiles, init.logger);\n};\n\nexports.fromProcess = fromProcess;\n"],"names":[],"sourceRoot":""}
{"version":3,"file":"360.index.js","mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sources":[".././node_modules/@aws-sdk/credential-provider-process/dist-cjs/index.js"],"sourcesContent":["'use strict';\n\nvar sharedIniFileLoader = require('@smithy/shared-ini-file-loader');\nvar propertyProvider = require('@smithy/property-provider');\nvar child_process = require('child_process');\nvar util = require('util');\nvar client = require('@aws-sdk/core/client');\n\nconst getValidatedProcessCredentials = (profileName, data, profiles) => {\n if (data.Version !== 1) {\n throw Error(`Profile ${profileName} credential_process did not return Version 1.`);\n }\n if (data.AccessKeyId === undefined || data.SecretAccessKey === undefined) {\n throw Error(`Profile ${profileName} credential_process returned invalid credentials.`);\n }\n if (data.Expiration) {\n const currentTime = new Date();\n const expireTime = new Date(data.Expiration);\n if (expireTime < currentTime) {\n throw Error(`Profile ${profileName} credential_process returned expired credentials.`);\n }\n }\n let accountId = data.AccountId;\n if (!accountId && profiles?.[profileName]?.aws_account_id) {\n accountId = profiles[profileName].aws_account_id;\n }\n const credentials = {\n accessKeyId: data.AccessKeyId,\n secretAccessKey: data.SecretAccessKey,\n ...(data.SessionToken && { sessionToken: data.SessionToken }),\n ...(data.Expiration && { expiration: new Date(data.Expiration) }),\n ...(data.CredentialScope && { credentialScope: data.CredentialScope }),\n ...(accountId && { accountId }),\n };\n client.setCredentialFeature(credentials, \"CREDENTIALS_PROCESS\", \"w\");\n return credentials;\n};\n\nconst resolveProcessCredentials = async (profileName, profiles, logger) => {\n const profile = profiles[profileName];\n if (profiles[profileName]) {\n const credentialProcess = profile[\"credential_process\"];\n if (credentialProcess !== undefined) {\n const execPromise = util.promisify(sharedIniFileLoader.externalDataInterceptor?.getTokenRecord?.().exec ?? child_process.exec);\n try {\n const { stdout } = await execPromise(credentialProcess);\n let data;\n try {\n data = JSON.parse(stdout.trim());\n }\n catch {\n throw Error(`Profile ${profileName} credential_process returned invalid JSON.`);\n }\n return getValidatedProcessCredentials(profileName, data, profiles);\n }\n catch (error) {\n throw new propertyProvider.CredentialsProviderError(error.message, { logger });\n }\n }\n else {\n throw new propertyProvider.CredentialsProviderError(`Profile ${profileName} did not contain credential_process.`, { logger });\n }\n }\n else {\n throw new propertyProvider.CredentialsProviderError(`Profile ${profileName} could not be found in shared credentials file.`, {\n logger,\n });\n }\n};\n\nconst fromProcess = (init = {}) => async ({ callerClientConfig } = {}) => {\n init.logger?.debug(\"@aws-sdk/credential-provider-process - fromProcess\");\n const profiles = await sharedIniFileLoader.parseKnownFiles(init);\n return resolveProcessCredentials(sharedIniFileLoader.getProfileName({\n profile: init.profile ?? callerClientConfig?.profile,\n }), profiles, init.logger);\n};\n\nexports.fromProcess = fromProcess;\n"],"names":[],"sourceRoot":""}

9
dist/443.index.js generated vendored
View File

@@ -1,7 +1,6 @@
"use strict";
exports.id = 443;
exports.ids = [443];
exports.modules = {
export const id = 443;
export const ids = [443];
export const modules = {
/***/ 8396:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
@@ -735,5 +734,5 @@ module.exports = /*#__PURE__*/JSON.parse('{"name":"@aws-sdk/nested-clients","ver
/***/ })
};
;
//# sourceMappingURL=443.index.js.map

2
dist/443.index.js.map generated vendored

File diff suppressed because one or more lines are too long

9
dist/566.index.js generated vendored
View File

@@ -1,7 +1,6 @@
"use strict";
exports.id = 566;
exports.ids = [566];
exports.modules = {
export const id = 566;
export const ids = [566];
export const modules = {
/***/ 40566:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
@@ -384,5 +383,5 @@ __webpack_unused_export__ = providerConfigFromInit;
/***/ })
};
;
//# sourceMappingURL=566.index.js.map

2
dist/566.index.js.map generated vendored

File diff suppressed because one or more lines are too long

9
dist/579.index.js generated vendored
View File

@@ -1,7 +1,6 @@
"use strict";
exports.id = 579;
exports.ids = [579];
exports.modules = {
export const id = 579;
export const ids = [579];
export const modules = {
/***/ 56579:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
@@ -267,5 +266,5 @@ exports.EventStreamSerde = EventStreamSerde;
/***/ })
};
;
//# sourceMappingURL=579.index.js.map

2
dist/579.index.js.map generated vendored

File diff suppressed because one or more lines are too long

9
dist/605.index.js generated vendored
View File

@@ -1,7 +1,6 @@
"use strict";
exports.id = 605;
exports.ids = [605];
exports.modules = {
export const id = 605;
export const ids = [605];
export const modules = {
/***/ 1509:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
@@ -231,5 +230,5 @@ Object.defineProperty(exports, "fromHttp", ({ enumerable: true, get: function ()
/***/ })
};
;
//# sourceMappingURL=605.index.js.map

2
dist/605.index.js.map generated vendored

File diff suppressed because one or more lines are too long

9
dist/762.index.js generated vendored
View File

@@ -1,7 +1,6 @@
"use strict";
exports.id = 762;
exports.ids = [762];
exports.modules = {
export const id = 762;
export const ids = [762];
export const modules = {
/***/ 77709:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
@@ -584,5 +583,5 @@ module.exports = /*#__PURE__*/JSON.parse('{"name":"@aws-sdk/nested-clients","ver
/***/ })
};
;
//# sourceMappingURL=762.index.js.map

2
dist/762.index.js.map generated vendored

File diff suppressed because one or more lines are too long

9
dist/869.index.js generated vendored
View File

@@ -1,7 +1,6 @@
"use strict";
exports.id = 869;
exports.ids = [869];
exports.modules = {
export const id = 869;
export const ids = [869];
export const modules = {
/***/ 75869:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
@@ -528,5 +527,5 @@ exports.fromLoginCredentials = fromLoginCredentials;
/***/ })
};
;
//# sourceMappingURL=869.index.js.map

2
dist/869.index.js.map generated vendored

File diff suppressed because one or more lines are too long

9
dist/956.index.js generated vendored
View File

@@ -1,7 +1,6 @@
"use strict";
exports.id = 956;
exports.ids = [956,136];
exports.modules = {
export const id = 956;
export const ids = [956,136];
export const modules = {
/***/ 88079:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
@@ -1031,5 +1030,5 @@ module.exports = /*#__PURE__*/JSON.parse('{"name":"@aws-sdk/nested-clients","ver
/***/ })
};
;
//# sourceMappingURL=956.index.js.map

2
dist/956.index.js.map generated vendored

File diff suppressed because one or more lines are too long

9
dist/998.index.js generated vendored
View File

@@ -1,7 +1,6 @@
"use strict";
exports.id = 998;
exports.ids = [998];
exports.modules = {
export const id = 998;
export const ids = [998];
export const modules = {
/***/ 62041:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
@@ -1370,5 +1369,5 @@ module.exports = /*#__PURE__*/JSON.parse('{"name":"@aws-sdk/client-sso","descrip
/***/ })
};
;
//# sourceMappingURL=998.index.js.map

2
dist/998.index.js.map generated vendored

File diff suppressed because one or more lines are too long

31
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

3
dist/package.json generated vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"type": "module"
}

52
eslint.config.mjs Normal file
View File

@@ -0,0 +1,52 @@
import {defineConfig} from 'eslint/config';
import js from '@eslint/js';
import tseslint from '@typescript-eslint/eslint-plugin';
import vitest from '@vitest/eslint-plugin';
import globals from 'globals';
import eslintConfigPrettier from 'eslint-config-prettier/flat';
import eslintPluginPrettier from 'eslint-plugin-prettier';
export default defineConfig([
{
ignores: ['.yarn/**/*', 'coverage/**/*', 'dist/**/*']
},
js.configs.recommended,
...tseslint.configs['flat/recommended'],
eslintConfigPrettier,
{
languageOptions: {
globals: {
...globals.node
}
}
},
{
files: ['__tests__/**'],
...vitest.configs.recommended,
languageOptions: {
globals: {
...globals.node,
...vitest.environments.env.globals
}
},
rules: {
...vitest.configs.recommended.rules,
'vitest/no-conditional-expect': 'error',
'vitest/no-disabled-tests': 0
}
},
{
plugins: {
prettier: eslintPluginPrettier
},
rules: {
'prettier/prettier': 'error',
'@typescript-eslint/no-require-imports': [
'error',
{
allowAsImport: true
}
]
}
}
]);

View File

@@ -1,30 +0,0 @@
import fs from 'fs';
import os from 'os';
import path from 'path';
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-login-action-')).split(path.sep).join(path.posix.sep);
process.env = Object.assign({}, process.env, {
TEMP: tmpDir,
GITHUB_REPOSITORY: 'docker/login-action',
RUNNER_TEMP: path.join(tmpDir, 'runner-temp').split(path.sep).join(path.posix.sep),
RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache').split(path.sep).join(path.posix.sep)
}) as {
[key: string]: string;
};
module.exports = {
clearMocks: true,
testEnvironment: 'node',
moduleFileExtensions: ['js', 'ts'],
testMatch: ['**/*.test.ts'],
transform: {
'^.+\\.ts$': 'ts-jest'
},
moduleNameMapper: {
'^csv-parse/sync': '<rootDir>/node_modules/csv-parse/dist/cjs/sync.cjs'
},
collectCoverageFrom: ['src/**/{!(main.ts),}.ts'],
coveragePathIgnorePatterns: ['lib/', 'node_modules/', '__tests__/'],
verbose: true
};

View File

@@ -1,16 +1,13 @@
{
"name": "docker-login",
"description": "GitHub Action to login against a Docker registry",
"type": "module",
"main": "src/main.ts",
"scripts": {
"build": "ncc build --source-map --minify --license licenses.txt",
"lint": "yarn run prettier && yarn run eslint",
"format": "yarn run prettier:fix && yarn run eslint:fix",
"eslint": "eslint --max-warnings=0 .",
"eslint:fix": "eslint --fix .",
"prettier": "prettier --check \"./**/*.ts\"",
"prettier:fix": "prettier --write \"./**/*.ts\"",
"test": "jest"
"lint": "eslint --max-warnings=0 .",
"format": "eslint --fix .",
"test": "vitest run"
},
"repository": {
"type": "git",
@@ -34,19 +31,20 @@
"js-yaml": "^4.1.0"
},
"devDependencies": {
"@eslint/js": "^9.39.3",
"@types/js-yaml": "^4.0.9",
"@types/node": "^20.19.9",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@vercel/ncc": "^0.38.3",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.2",
"eslint-plugin-jest": "^28.14.0",
"eslint-plugin-prettier": "^5.5.4",
"jest": "^29.7.0",
"prettier": "^3.6.2",
"ts-jest": "^29.4.1",
"ts-node": "^10.9.2",
"typescript": "^5.9.2"
"@types/node": "^20.19.35",
"@typescript-eslint/eslint-plugin": "^8.56.1",
"@typescript-eslint/parser": "^8.56.1",
"@vercel/ncc": "^0.38.4",
"@vitest/coverage-v8": "^4.0.18",
"@vitest/eslint-plugin": "^1.6.9",
"eslint": "^9.39.3",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.5",
"globals": "^17.3.0",
"prettier": "^3.8.1",
"typescript": "^5.9.3",
"vitest": "^4.0.18"
}
}

View File

@@ -2,8 +2,8 @@ import path from 'path';
import * as core from '@actions/core';
import * as yaml from 'js-yaml';
import {Buildx} from '@docker/actions-toolkit/lib/buildx/buildx';
import {Util} from '@docker/actions-toolkit/lib/util';
import {Buildx} from '@docker/actions-toolkit/lib/buildx/buildx.js';
import {Util} from '@docker/actions-toolkit/lib/util.js';
export interface Inputs {
registry: string;

View File

@@ -1,9 +1,9 @@
import * as core from '@actions/core';
import * as aws from './aws';
import * as context from './context';
import {Docker} from '@docker/actions-toolkit/lib/docker/docker.js';
import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
import * as aws from './aws.js';
import * as context from './context.js';
export async function login(auth: context.Auth): Promise<void> {
if (/true/i.test(auth.ecr) || (auth.ecr == 'auto' && aws.isECR(auth.registry))) {

View File

@@ -1,9 +1,9 @@
import * as core from '@actions/core';
import * as actionsToolkit from '@docker/actions-toolkit';
import * as context from './context';
import * as docker from './docker';
import * as stateHelper from './state-helper';
import * as context from './context.js';
import * as docker from './docker.js';
import * as stateHelper from './state-helper.js';
export async function main(): Promise<void> {
const inputs: context.Inputs = context.getInputs();

View File

@@ -1,9 +1,8 @@
{
"compilerOptions": {
"module": "nodenext",
"moduleResolution": "nodenext",
"esModuleInterop": true,
"target": "es6",
"module": "commonjs",
"strict": true,
"newLine": "lf",
"outDir": "./lib",
"rootDir": "./src",
@@ -12,10 +11,7 @@
"resolveJsonModule": true,
"useUnknownInCatchVariables": false,
},
"exclude": [
"./__tests__/**/*",
"./lib/**/*",
"node_modules",
"jest.config.ts"
"include": [
"src/**/*.ts"
]
}

16
vitest.config.ts Normal file
View File

@@ -0,0 +1,16 @@
import {defineConfig} from 'vitest/config';
export default defineConfig({
test: {
clearMocks: true,
environment: 'node',
setupFiles: ['./__tests__/setup.unit.ts'],
include: ['**/*.test.ts'],
coverage: {
provider: 'v8',
reporter: ['clover'],
include: ['src/**/*.ts'],
exclude: ['src/**/main.ts']
}
}
});

4975
yarn.lock

File diff suppressed because it is too large Load Diff