11import { TileMatrixSets } from '@basemaps/geo' ;
2- import { fsa , LogType , Url , UrlArrayJsonFile } from '@basemaps/shared' ;
2+ import { fsa , isArgo , LogType , Url , UrlArrayJsonFile } from '@basemaps/shared' ;
33import { CliId , CliInfo } from '@basemaps/shared/build/cli/info.js' ;
44import { getLogger , logArguments } from '@basemaps/shared/build/cli/log.js' ;
55import { command , option , string } from 'cmd-ts' ;
@@ -109,7 +109,8 @@ export const JoinCommand = command({
109109 const bucketPath = new URL ( `vector/${ tileMatrix . projection . code } /` , args . target ) ;
110110 const filePaths = await download ( args . fromFile , outputPath , logger ) ;
111111
112- const outputMbtiles = fsa . toUrl ( `${ outputPath } /${ args . filename } .mbtiles` ) ;
112+ // Mbtiles output path to be string type path to avoid issues with tippecanoe and better-sqlite3
113+ const outputMbtiles = `${ outputPath } /${ args . filename } .mbtiles` ;
113114 logger . info ( { files : filePaths . length , outputMbtiles } , 'JoinMbtiles: Start' ) ;
114115 await tileJoin ( filePaths , outputMbtiles , logger ) ;
115116 logger . info ( { files : filePaths . length , outputMbtiles } , 'JoinMbtiles: End' ) ;
@@ -130,13 +131,19 @@ export const JoinCommand = command({
130131
131132 // Upload output to s3
132133 logger . info ( { target : bucketPath , tileMatrix : tileMatrix . identifier } , 'Upload: Start' ) ;
133- await upload ( outputMbtiles , bucketPath , logger ) ;
134+ await upload ( fsa . toUrl ( outputMbtiles ) , bucketPath , logger ) ;
134135 await upload ( outputCotar , bucketPath , logger ) ;
135136 await upload ( outputIndex , bucketPath , logger ) ;
136137 // Upload stac Files
137138 for ( const file of stacFiles ) {
138139 await upload ( file , bucketPath , logger ) ;
139140 }
140141 logger . info ( { target : bucketPath , tileMatrix : tileMatrix . identifier } , 'Upload: End' ) ;
142+
143+ // Write output target for argo tasks to create pull request
144+ if ( isArgo ( ) ) {
145+ const target = new URL ( `topographic/${ CliId } /${ args . filename } .tar.co` , bucketPath ) ;
146+ await fsa . write ( fsa . toUrl ( '/tmp/target' ) , JSON . stringify ( [ target ] ) ) ;
147+ }
141148 } ,
142149} ) ;
0 commit comments