1- import { porcelain , hooks , Path , utils , PackageRequirement } from "@teaxyz/lib "
1+ import { porcelain , hooks , Path , utils , PackageRequirement } from "libpkgx "
22import { exec } from "@actions/exec"
33import * as core from '@actions/core'
44import * as path from 'path'
@@ -9,14 +9,14 @@ const { install } = porcelain
99const { flatmap } = utils
1010
1111async function go ( ) {
12- const TEA_DIR = core . getInput ( 'TEA_DIR' )
12+ const PKGX_DIR = core . getInput ( 'PKGX_DIR' ) || core . getInput ( 'TEA_DIR' )
1313
14- let vtea = core . getInput ( 'version' ) ?? ""
15- if ( vtea && ! / ^ [ * ^ ~ @ = ] / . test ( vtea ) ) {
16- vtea = `@${ vtea } `
14+ let vpkgx = core . getInput ( 'version' ) ?? ""
15+ if ( vpkgx && ! / ^ [ * ^ ~ @ = ] / . test ( vpkgx ) ) {
16+ vpkgx = `@${ vpkgx } `
1717 }
1818
19- const pkgs = [ `tea.xyz ${ vtea } ` ]
19+ const pkgs = [ `pkgx.sh ${ vpkgx } ` ]
2020 for ( let key in process . env ) {
2121 if ( key . startsWith ( "INPUT_+" ) ) {
2222 const value = process . env [ key ] !
@@ -32,19 +32,20 @@ async function go() {
3232
3333 // we build to /opt and special case this action so people new to
3434 // building aren’t immediately flumoxed
35- if ( TEA_DIR == '/opt' && os . platform ( ) == 'darwin' ) {
35+ if ( PKGX_DIR == '/opt' && os . platform ( ) == 'darwin' ) {
3636 await exec ( 'sudo' , [ 'chown' , `${ os . userInfo ( ) . username } :staff` , '/opt' ] )
3737 }
3838
3939 core . info ( `fetching ${ pkgs . join ( ", " ) } …` )
4040
41- const prefix = flatmap ( TEA_DIR , ( x : string ) => new Path ( x ) ) ?? Path . home ( ) . join ( ".tea " )
41+ const prefix = flatmap ( PKGX_DIR , ( x : string ) => new Path ( x ) ) ?? Path . home ( ) . join ( ".pkgx " )
4242
4343 useConfig ( {
4444 prefix,
45+ data : prefix . join ( ".data" ) ,
4546 cache : prefix . join ( ".cache" ) ,
4647 pantries : [ ] ,
47- UserAgent : 'tea .setup/0.1.0' , //TODO version
48+ UserAgent : 'pkgx .setup/0.1.0' , //TODO version
4849 options : { compression : 'gz' }
4950 } )
5051 const { map, flatten } = useShellEnv ( )
@@ -63,8 +64,8 @@ async function go() {
6364 }
6465 }
6566
66- if ( TEA_DIR ) {
67- core . exportVariable ( 'TEA_DIR ' , TEA_DIR )
67+ if ( PKGX_DIR ) {
68+ core . exportVariable ( 'PKGX_DIR ' , PKGX_DIR )
6869 }
6970
7071 if ( os . platform ( ) != 'darwin' ) {
@@ -91,7 +92,7 @@ async function parse(input: string): Promise<PackageRequirement> {
9192 if ( projects . length <= 0 ) throw new Error ( `not found ${ rawpkg . project } ` )
9293 if ( projects . length > 1 ) throw new Error ( `ambiguous project ${ rawpkg . project } ` )
9394
94- const project = projects [ 0 ] . project //FIXME libtea forgets to correctly assign type
95+ const project = projects [ 0 ] . project //FIXME libpkgx forgets to correctly assign type
9596 const constraint = rawpkg . constraint
9697
9798 return { project, constraint }
0 commit comments