chore: add types for numerous and time-delta

This commit is contained in:
Amin Yahyaabadi 2023-01-22 14:21:39 -08:00
parent d1061ec733
commit e31abde3c6
3 changed files with 50 additions and 37 deletions

View File

@ -1,56 +1,50 @@
#!/usr/bin/env node #!/usr/bin/env node
/* eslint-disable node/shebang */ /* eslint-disable node/shebang */
import { getInput, endGroup, startGroup, notice } from "@actions/core" import { endGroup, getInput, notice, startGroup } from "@actions/core"
import ciDetect from "@npmcli/ci-detect"
import { error, info, success, warning } from "ci-log"
import mri from "mri"
import * as numerous from "numerous"
import numerousLocale from "numerous/locales/en.js"
import { join } from "patha"
import semverValid from "semver/functions/valid"
import * as timeDelta from "time-delta"
import timeDeltaLocale from "time-delta/locales/en.js"
import { untildifyUser } from "untildify-user"
import { setupBazel } from "./bazel/bazel"
import { setupBrew } from "./brew/brew" import { setupBrew } from "./brew/brew"
import { setupCcache } from "./ccache/ccache" import { setupCcache } from "./ccache/ccache"
import { setupMake } from "./make/make"
import { setupTask } from "./task/task"
import { setupChocolatey } from "./chocolatey/chocolatey" import { setupChocolatey } from "./chocolatey/chocolatey"
import { setupCmake } from "./cmake/cmake" import { setupCmake } from "./cmake/cmake"
import { setupConan } from "./conan/conan" import { setupConan } from "./conan/conan"
import { setupCppcheck } from "./cppcheck/cppcheck" import { setupCppcheck } from "./cppcheck/cppcheck"
import { setupDoxygen } from "./doxygen/doxygen" import { setupDoxygen } from "./doxygen/doxygen"
import { setupGcc } from "./gcc/gcc"
import { activateGcovGCC, activateGcovLLVM, setupGcovr } from "./gcovr/gcovr" import { activateGcovGCC, activateGcovLLVM, setupGcovr } from "./gcovr/gcovr"
import { setupLLVM, setupClangTools } from "./llvm/llvm" import { setupGraphviz } from "./graphviz/graphviz"
import { setupKcov } from "./kcov/kcov"
import { setupClangTools, setupLLVM } from "./llvm/llvm"
import { setupMake } from "./make/make"
import { setupMeson } from "./meson/meson" import { setupMeson } from "./meson/meson"
import { setupMSVC } from "./msvc/msvc" import { setupMSVC } from "./msvc/msvc"
import { setupNala } from "./nala/nala"
import { setupNinja } from "./ninja/ninja" import { setupNinja } from "./ninja/ninja"
import { setupOpencppcoverage } from "./opencppcoverage/opencppcoverage" import { setupOpencppcoverage } from "./opencppcoverage/opencppcoverage"
import { setupPython } from "./python/python"
import mri from "mri"
import { untildifyUser } from "untildify-user"
import ciDetect from "@npmcli/ci-detect"
import * as timeDelta from "time-delta"
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import timeDeltaLocale from "time-delta/locales/en.js"
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import * as numerous from "numerous"
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import numerousLocale from "numerous/locales/en.js"
import { ubuntuVersion } from "./utils/env/ubuntu_version"
import semverValid from "semver/functions/valid"
import { getVersion, syncVersions } from "./versions/versions"
import { setupGcc } from "./gcc/gcc"
import { InstallationInfo } from "./utils/setup/setupBin"
import { error, info, success, warning } from "ci-log"
import { setupVcpkg } from "./vcpkg/vcpkg"
import { join } from "patha"
import { setupVCVarsall } from "./vcvarsall/vcvarsall"
import { setupKcov } from "./kcov/kcov"
import { addEnv, finalizeCpprc } from "./utils/env/addEnv"
import { setupSevenZip } from "./sevenzip/sevenzip"
import { setupGraphviz } from "./graphviz/graphviz"
import { setupNala } from "./nala/nala"
import { setupBazel } from "./bazel/bazel"
import { setupPowershell } from "./powershell/powershell" import { setupPowershell } from "./powershell/powershell"
import { isArch } from "./utils/env/isArch" import { setupPython } from "./python/python"
import { setupPacmanPack } from "./utils/setup/setupPacmanPack"
import { setupSccache } from "./sccache/sccache" import { setupSccache } from "./sccache/sccache"
import { setupSevenZip } from "./sevenzip/sevenzip"
import { setupTask } from "./task/task"
import { addEnv, finalizeCpprc } from "./utils/env/addEnv"
import { isArch } from "./utils/env/isArch"
import { ubuntuVersion } from "./utils/env/ubuntu_version"
import { InstallationInfo } from "./utils/setup/setupBin"
import { setupPacmanPack } from "./utils/setup/setupPacmanPack"
import { setupVcpkg } from "./vcpkg/vcpkg"
import { setupVCVarsall } from "./vcvarsall/vcvarsall"
import { getVersion, syncVersions } from "./versions/versions"
/** The setup functions */ /** The setup functions */
const setups = { const setups = {
@ -119,7 +113,7 @@ export async function main(args: string[]): Promise<number> {
const timeFormatter = timeDelta.create({ autoloadLocales: true }) const timeFormatter = timeDelta.create({ autoloadLocales: true })
timeDelta.addLocale(timeDeltaLocale as timeDelta.Locale) timeDelta.addLocale(timeDeltaLocale as timeDelta.Locale)
numerous.addLocale(numerousLocale) numerous.addLocale(numerousLocale as numerous.Locale)
let time1: number let time1: number
let time2: number let time2: number

13
src/types/numerous.d.ts vendored Normal file
View File

@ -0,0 +1,13 @@
declare module "numerous" {
export type Locale = unknown
/** Adds pluralization data for the specified locale. Should be called in browser. */
export function addLocale(localeData: Locale | Locale[])
}
declare module "numerous/locales/en.js" {
import { Locale } from "numerous"
declare const En = Locale
export = En
}

6
src/types/time-delta.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
declare module "time-delta/locales/en.js" {
import { Locale } from "time-delta"
declare const En = Locale
export = En
}