mirror of
https://github.com/actions/typescript-action.git
synced 2025-12-19 08:50:19 +00:00
Convert to ESM
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
* The entrypoint for the action.
|
||||
* The entrypoint for the action. This file simply imports and runs the action's
|
||||
* main logic.
|
||||
*/
|
||||
import { run } from './main'
|
||||
import { run } from './main.js'
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
/* istanbul ignore next */
|
||||
run()
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import * as core from '@actions/core'
|
||||
import { wait } from './wait'
|
||||
import { wait } from './wait.js'
|
||||
|
||||
/**
|
||||
* The main function for the action.
|
||||
* @returns {Promise<void>} Resolves when the action is complete.
|
||||
*
|
||||
* @returns Resolves when the action is complete.
|
||||
*/
|
||||
export async function run(): Promise<void> {
|
||||
try {
|
||||
|
||||
11
src/wait.ts
11
src/wait.ts
@@ -1,13 +1,12 @@
|
||||
/**
|
||||
* Wait for a number of milliseconds.
|
||||
* Waits for a number of milliseconds.
|
||||
*
|
||||
* @param milliseconds The number of milliseconds to wait.
|
||||
* @returns {Promise<string>} Resolves with 'done!' after the wait is over.
|
||||
* @returns Resolves with 'done!' after the wait is over.
|
||||
*/
|
||||
export async function wait(milliseconds: number): Promise<string> {
|
||||
return new Promise(resolve => {
|
||||
if (isNaN(milliseconds)) {
|
||||
throw new Error('milliseconds not a number')
|
||||
}
|
||||
return new Promise((resolve) => {
|
||||
if (isNaN(milliseconds)) throw new Error('milliseconds is not a number')
|
||||
|
||||
setTimeout(() => resolve('done!'), milliseconds)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user