@@ -11,6 +11,7 @@ import { createPrinter } from "../../util/printer";
1111import { leafCommand , makeCommandInfo } from "../../framework/command" ;
1212import { S_IRWXO } from "constants" ;
1313import { resolveProject } from "../../util/resolveProject" ;
14+ import { findSamplesRelativeDir } from "../../util/findSamplesDir" ;
1415
1516const log = createPrinter ( "check-node-versions-samples" ) ;
1617
@@ -68,25 +69,6 @@ async function cleanup(
6869 await deleteDockerImages ( dockerImageNames ) ;
6970}
7071
71- function findSamplesDir ( samplesDir : string , rootDir : string ) : string {
72- const dirs = [ ] ;
73- for ( const file of fs . readdirSync ( samplesDir ) ) {
74- const stats = fs . statSync ( path . join ( samplesDir , file ) ) ;
75- if ( stats . isDirectory ( ) ) {
76- if ( file . match ( / ^ v [ 0 - 9 ] * .* $ / ) ) {
77- dirs . push ( file ) ;
78- }
79- }
80- }
81- if ( dirs . length === 0 ) {
82- return `${ rootDir } /samples` ;
83- } else {
84- return `${ rootDir } /samples/${ dirs
85- . sort ( )
86- . slice ( - 1 )
87- . pop ( ) } `;
88- }
89- }
9072function buildRunSamplesScript (
9173 containerWorkspacePath : string ,
9274 samplesPath : string ,
@@ -97,7 +79,7 @@ function buildRunSamplesScript(
9779 function compileCMD ( cmd : string , printToScreen ?: boolean ) {
9880 return printToScreen ? cmd : `${ cmd } >> ${ logFilePath } 2>&1` ;
9981 }
100- const samplesDir = findSamplesDir ( samplesPath , containerWorkspacePath ) ;
82+ const samplesDir = ` ${ containerWorkspacePath } / ${ findSamplesRelativeDir ( samplesPath ) } ` ;
10183 const printToScreen = logFilePath === undefined ;
10284 const envFilePath = `${ containerWorkspacePath } /${ envFileName } ` ;
10385 const javascriptSamplesPath = `${ samplesDir } /javascript` ;
@@ -232,7 +214,7 @@ export const commandInfo = makeCommandInfo(
232214 {
233215 "artifact-path" : {
234216 kind : "string" ,
235- description : "Path to the downloaded artifact built by the release pipeline"
217+ description : "The URL/path to the artifact built by the release pipeline"
236218 } ,
237219 directory : {
238220 kind : "string" ,
0 commit comments