mirror of
https://github.com/supabase/setup-cli.git
synced 2026-02-10 12:21:40 +00:00
chore: migrate to esm (#334)
* chore: update unit tests * fix: follow latest action template * chore: add licenses and workflows * chore: remove bloat * chore: fix linter
This commit is contained in:
8
src/index.ts
Normal file
8
src/index.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* The entrypoint for the action. This file simply imports and runs the action's
|
||||
* main logic.
|
||||
*/
|
||||
import { run } from './main.js'
|
||||
|
||||
/* istanbul ignore next */
|
||||
run()
|
||||
13
src/main.ts
13
src/main.ts
@@ -1,11 +1,16 @@
|
||||
import * as core from '@actions/core'
|
||||
import * as tc from '@actions/tool-cache'
|
||||
import gte from 'semver/functions/gte'
|
||||
import {getDownloadUrl, determineInstalledVersion} from './utils'
|
||||
import { gte } from 'semver'
|
||||
import { getDownloadUrl, determineInstalledVersion } from './utils.js'
|
||||
|
||||
export const CLI_CONFIG_REGISTRY = 'SUPABASE_INTERNAL_IMAGE_REGISTRY'
|
||||
|
||||
async function run(): Promise<void> {
|
||||
/**
|
||||
* The main function for the action.
|
||||
*
|
||||
* @returns Resolves when the action is complete.
|
||||
*/
|
||||
export async function run(): Promise<void> {
|
||||
try {
|
||||
// Get version of tool to be installed
|
||||
const version = core.getInput('version')
|
||||
@@ -32,5 +37,3 @@ async function run(): Promise<void> {
|
||||
if (error instanceof Error) core.setFailed(error.message)
|
||||
}
|
||||
}
|
||||
|
||||
run()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {exec} from 'child_process'
|
||||
import { exec } from 'child_process'
|
||||
import os from 'os'
|
||||
import lt from 'semver/functions/lt'
|
||||
import {promisify} from 'util'
|
||||
import { lt } from 'semver'
|
||||
import { promisify } from 'util'
|
||||
|
||||
const doExec = promisify(exec)
|
||||
|
||||
@@ -37,7 +37,7 @@ export const getDownloadUrl = async (version: string): Promise<string> => {
|
||||
}
|
||||
|
||||
export const determineInstalledVersion = async (): Promise<string> => {
|
||||
const {stdout} = await doExec('supabase --version')
|
||||
const { stdout } = await doExec('supabase --version')
|
||||
|
||||
const version = stdout.trim()
|
||||
if (!version) {
|
||||
|
||||
Reference in New Issue
Block a user