Skip to content

Commit 31aac08

Browse files
Merge pull request #414 from technote-space/release/next-v5.3.5
release: v5.3.6
2 parents d40575a + 4fcab31 commit 31aac08

17 files changed

+704
-623
lines changed

package.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@technote-space/github-action-helper",
3-
"version": "5.3.5",
3+
"version": "5.3.6",
44
"description": "Helper for GitHub Action.",
55
"keywords": [
66
"github",
@@ -31,7 +31,7 @@
3131
"dist"
3232
],
3333
"scripts": {
34-
"build": "tsc && rm -f dist/*.js && rollup -c",
34+
"build": "tsc --emitDeclarationOnly && rollup -c",
3535
"cover": "vitest run --coverage",
3636
"postinstall": "[ -n \"$CI\" ] || [ ! -f node_modules/.bin/husky ] || husky install",
3737
"lint": "eslint 'src/**/*.ts' --cache",
@@ -43,33 +43,33 @@
4343
"update": "npm_config_yes=true npx npm-check-updates -u --timeout 100000 && yarn install && yarn upgrade && yarn audit"
4444
},
4545
"dependencies": {
46-
"@actions/core": "^1.6.0",
47-
"@actions/github": "^5.0.1",
46+
"@actions/core": "^1.8.2",
47+
"@actions/github": "^5.0.3",
4848
"@octokit/openapi-types": "^11.2.0",
4949
"@octokit/plugin-rest-endpoint-methods": "^5.13.0",
50-
"@technote-space/github-action-log-helper": "^0.2.4",
50+
"@technote-space/github-action-log-helper": "^0.2.5",
5151
"shell-escape": "^0.2.0",
5252
"sprintf-js": "^1.1.2"
5353
},
5454
"devDependencies": {
55-
"@commitlint/cli": "^16.2.3",
56-
"@commitlint/config-conventional": "^16.2.1",
55+
"@commitlint/cli": "^17.0.2",
56+
"@commitlint/config-conventional": "^17.0.2",
5757
"@rollup/plugin-typescript": "^8.3.2",
58-
"@sindresorhus/tsconfig": "^2.0.0",
59-
"@technote-space/github-action-test-helper": "^0.9.5",
60-
"@types/node": "^17.0.25",
58+
"@sindresorhus/tsconfig": "^3.0.1",
59+
"@technote-space/github-action-test-helper": "^0.9.7",
60+
"@types/node": "^17.0.38",
6161
"@types/shell-escape": "^0.2.0",
62-
"@typescript-eslint/eslint-plugin": "^5.20.0",
63-
"@typescript-eslint/parser": "^5.20.0",
64-
"c8": "^7.11.2",
65-
"eslint": "^8.13.0",
62+
"@typescript-eslint/eslint-plugin": "^5.27.0",
63+
"@typescript-eslint/parser": "^5.27.0",
64+
"c8": "^7.11.3",
65+
"eslint": "^8.16.0",
6666
"eslint-plugin-import": "^2.26.0",
67-
"husky": "^7.0.4",
68-
"lint-staged": "^12.4.0",
67+
"husky": "^8.0.1",
68+
"lint-staged": "^13.0.0",
6969
"nock": "^13.2.4",
70-
"rollup": "^2.70.2",
71-
"typescript": "^4.6.3",
72-
"vitest": "^0.9.4"
70+
"rollup": "^2.75.4",
71+
"typescript": "^4.7.2",
72+
"vitest": "^0.13.1"
7373
},
7474
"publishConfig": {
7575
"access": "public"

src/api-helper.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import type { Octokit } from './types';
2-
import type { Context } from '@actions/github/lib/context';
1+
import type { Octokit } from './types.js';
2+
import type { Context } from '@actions/github/lib/context.js';
33
import type { components } from '@octokit/openapi-types';
44
import type { OctokitResponse } from '@octokit/types';
55
import type { Logger } from '@technote-space/github-action-log-helper';
66
import fs from 'fs';
77
import path from 'path';
88
import { exportVariable } from '@actions/core';
9-
import { getSender } from './context-helper';
9+
import { getSender } from './context-helper.js';
1010
import {
1111
getRefForUpdate,
1212
isPrRef,
@@ -18,7 +18,7 @@ import {
1818
generateNewMinorVersion,
1919
ensureNotNull,
2020
objectGet,
21-
} from './utils';
21+
} from './utils.js';
2222

2323
type GitGetCommitResponseData = components['schemas']['git-commit'];
2424
type PullsGetResponseData = components['schemas']['pull-request'];

src/api-helper1.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from '@technote-space/github-action-test-helper';
1616
import nock from 'nock';
1717
import { beforeEach, describe, expect, it, vi } from 'vitest';
18-
import { ApiHelper } from '../src';
18+
import { ApiHelper } from '../src/index.js';
1919

2020
type GitCreateCommitResponseData = components['schemas']['git-commit'];
2121
const rootDir = path.resolve(__dirname, 'fixtures');

src/api-helper2.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
} from '@technote-space/github-action-test-helper';
1414
import nock from 'nock';
1515
import { beforeEach, describe, expect, it, vi } from 'vitest';
16-
import { ApiHelper } from '../src';
16+
import { ApiHelper } from '../src/index.js';
1717

1818
type GitCreateCommitResponseData = components['schemas']['git-commit'];
1919
const rootDir = path.resolve(__dirname, 'fixtures');

src/command1.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
stdoutCalledWith,
1010
} from '@technote-space/github-action-test-helper';
1111
import { beforeEach, describe, expect, it } from 'vitest';
12-
import { Command } from '../src';
12+
import { Command } from '../src/index.js';
1313

1414
describe('execAsync', () => {
1515
testChildProcess();

src/command2.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
stdoutCalledWith,
1010
} from '@technote-space/github-action-test-helper';
1111
import { beforeEach, describe, expect, it } from 'vitest';
12-
import { Command } from '../src';
12+
import { Command } from '../src/index.js';
1313

1414
describe('execAsync', () => {
1515
testChildProcess();

src/context-helper.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
} from '@technote-space/github-action-test-helper';
88
import { testEnv, getContext } from '@technote-space/github-action-test-helper';
99
import { beforeEach, describe, expect, it } from 'vitest';
10-
import { ContextHelper } from '../src';
10+
import { ContextHelper } from '../src/index.js';
1111

1212
const { isRelease, isPush, isPr, isIssue, isCron, isCustomEvent, isManualEvent, isWorkflowRun, isCreateTag } = ContextHelper;
1313
const { getGitUrl, getRepository, getTagName, getSender, showActionInfo } = ContextHelper;

src/context-helper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import type { Context } from '@actions/github/lib/context';
1+
import type { Context } from '@actions/github/lib/context.js';
22
import type { Logger } from '@technote-space/github-action-log-helper';
33
import path from 'path';
4-
import { getAccessToken, getActor, getBuildInfo, mask } from './utils';
4+
import { getAccessToken, getActor, getBuildInfo, mask } from './utils.js';
55

66
export const isRelease = (context: Context): boolean => 'release' === context.eventName;
77

src/git-helper.test.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable no-magic-numbers */
2-
import type { Context } from '@actions/github/lib/context';
2+
import type { Context } from '@actions/github/lib/context.js';
33
import type { ExecException } from 'child_process';
44
import { Logger } from '@technote-space/github-action-log-helper';
55
import {
@@ -14,7 +14,7 @@ import {
1414
stdoutCalledWith,
1515
} from '@technote-space/github-action-test-helper';
1616
import { beforeEach, describe, expect, it } from 'vitest';
17-
import { GitHelper } from '../src';
17+
import { GitHelper } from '../src/index.js';
1818

1919
beforeEach(() => {
2020
Logger.resetForTesting();
@@ -355,13 +355,9 @@ describe('GitHelper', () => {
355355
});
356356

357357
it('should throw error', async() => {
358-
/**
359-
* Logger
360-
*/
361358
class ThrowErrorLogger extends Logger {
362-
/**
363-
* @return {void}
364-
*/
359+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
360+
// @ts-ignore
365361
public override displayStdout = (): void => {
366362
throw new Error('test');
367363
};

src/git-helper.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import type { Context } from '@actions/github/lib/context';
1+
import type { Context } from '@actions/github/lib/context.js';
22
import type { Logger } from '@technote-space/github-action-log-helper';
33
import fs from 'fs';
4-
import Command from './command';
5-
import { getGitUrlWithToken } from './context-helper';
4+
import Command from './command.js';
5+
import { getGitUrlWithToken } from './context-helper.js';
66
import {
77
getBranch,
88
isBranch,
@@ -18,7 +18,7 @@ import {
1818
generateNewMajorVersion,
1919
isCommandDebug,
2020
isOutputDebug,
21-
} from './utils';
21+
} from './utils.js';
2222

2323
type CommandType = string | {
2424
command: string;

src/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect, it } from 'vitest';
2-
import { Command, ApiHelper, GitHelper, Types, Utils, ContextHelper } from '.';
2+
import { Command, ApiHelper, GitHelper, Types, Utils, ContextHelper } from './index.js';
33

44
it('helpers can be imported', () => {
55
expect(Command).not.toBeFalsy();

src/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import ApiHelper from './api-helper';
2-
import Command from './command';
3-
import GitHelper from './git-helper';
1+
import ApiHelper from './api-helper.js';
2+
import Command from './command.js';
3+
import GitHelper from './git-helper.js';
44

5-
export * as Types from './types';
6-
export * as Utils from './utils';
7-
export * as ContextHelper from './context-helper';
5+
export * as Types from './types.js';
6+
export * as Utils from './utils.js';
7+
export * as ContextHelper from './context-helper.js';
88

99
export { Command, ApiHelper, GitHelper };

src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { GitHub } from '@actions/github/lib/utils';
2-
import type { RestEndpointMethods } from '@octokit/plugin-rest-endpoint-methods/dist-types/generated/method-types';
1+
import type { GitHub } from '@actions/github/lib/utils.js';
2+
import type { RestEndpointMethods } from '@octokit/plugin-rest-endpoint-methods/dist-types/generated/method-types.js';
33

44
export type Octokit = InstanceType<typeof GitHub> & {
55
rest: RestEndpointMethods;

src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { Octokit } from './types';
2-
import type { Context } from '@actions/github/lib/context';
1+
import type { Octokit } from './types.js';
2+
import type { Context } from '@actions/github/lib/context.js';
33
import fs from 'fs';
44
import path from 'path';
55
import { getInput } from '@actions/core' ;

src/utils1.test.ts

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22
import path from 'path';
33
import { testEnv, getContext, testFs } from '@technote-space/github-action-test-helper';
44
import { describe, expect, it, vi } from 'vitest';
5-
import { Utils } from '../src';
5+
import { Utils } from '../src/index.js';
66

77
const { getWorkspace, getActor, escapeRegExp, getRegExp, getPrefixRegExp, getSuffixRegExp, getPrBranch, getPrHeadRef } = Utils;
88
const { parseVersion, normalizeVersion, isValidSemanticVersioning, isPrRef, getPrMergeRef, replaceAll, sleep } = Utils;
99
const { getBranch, getRefForUpdate, uniqueArray, getBuildInfo, split, getArrayInput, useNpm, getBoolValue } = Utils;
1010

11-
vi.useFakeTimers();
12-
1311
describe('getWorkspace', () => {
1412
testEnv();
1513

@@ -500,16 +498,23 @@ describe('getArrayInput', () => {
500498
});
501499

502500
describe('sleep', () => {
503-
it('should sleep', done => {
504-
const fn = vi.fn();
505-
506-
sleep(1000).then(() => {
507-
fn();
508-
done();
509-
});
510-
511-
expect(fn).not.toBeCalled();
512-
vi.advanceTimersByTime(1500);
501+
it('should sleep', async() => {
502+
vi.useFakeTimers();
503+
try {
504+
const fn = vi.fn();
505+
506+
const promise = sleep(1000).then(() => {
507+
fn();
508+
});
509+
510+
expect(fn).not.toBeCalled();
511+
512+
vi.advanceTimersByTime(1100);
513+
await promise;
514+
expect(fn).toBeCalled();
515+
} finally {
516+
vi.useRealTimers();
517+
}
513518
});
514519
});
515520

src/utils2.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable no-magic-numbers */
22
import { testEnv } from '@technote-space/github-action-test-helper';
33
import { describe, expect, it, vi } from 'vitest';
4-
import { Utils } from '../src';
4+
import { Utils } from '../src/index.js';
55

66
const { generateNewPatchVersion, generateNewMinorVersion, generateNewMajorVersion, arrayChunk, versionCompare, isCommandDebug, isOutputDebug, objectGet, mask } = Utils;
77
const { isBranch, isTagRef, normalizeRef, trimRef, getTag, getRefspec, getRemoteRefspec, getLocalRefspec, getOctokit, replaceVariables, ensureNotNullValue, ensureNotNull } = Utils;

0 commit comments

Comments
 (0)