@@ -3,11 +3,6 @@ import os from "os";
33import * as core from "@actions/core" ;
44import * as tc from "@actions/tool-cache" ;
55
6- import { type Installer } from "./index" ;
7- import { LinuxInstaller } from "./linux" ;
8- import { MacOsInstaller } from "./macos" ;
9- import { WindowsInstaller } from "./windows" ;
10-
116export type SupportedPlatform = Extract <
127 NodeJS . Platform ,
138 "linux" | "darwin" | "win32"
@@ -21,6 +16,7 @@ const archMap: Record<string, string> = {
2116 arm64 : "arm64" ,
2217} ;
2318
19+ // Builds the download URL for the 1Password CLI based on the platform and version.
2420export const cliUrlBuilder : Record <
2521 SupportedPlatform ,
2622 ( version : string , arch ?: string ) => string
@@ -34,28 +30,14 @@ export const cliUrlBuilder: Record<
3430} ;
3531
3632export class CliInstaller {
37- protected readonly version : string ;
38- protected readonly arch : string ;
33+ public readonly version : string ;
34+ public readonly arch : string ;
3935
4036 public constructor ( version : string ) {
4137 this . version = version ;
4238 this . arch = this . getArch ( ) ;
4339 }
4440
45- public static create ( version : string ) : Installer {
46- const platform = os . platform ( ) ;
47- switch ( platform ) {
48- case "linux" :
49- return new LinuxInstaller ( version ) ;
50- case "darwin" :
51- return new MacOsInstaller ( version ) ;
52- case "win32" :
53- return new WindowsInstaller ( version ) ;
54- default :
55- throw new Error ( `Unsupported platform: ${ platform } ` ) ;
56- }
57- }
58-
5941 public async install ( url : string ) : Promise < void > {
6042 console . info ( `Downloading 1Password CLI from: ${ url } ` ) ;
6143 const downloadPath = await tc . downloadTool ( url ) ;
0 commit comments