...
You have the ability to split the single slnodejs buildscan
command into a build scan command and several “instrumentations only” commands. For example below, we’ll instrument the application for two different LabIDs (MyFirstLab
and My-2nd-Lab
)
Code Block | ||
---|---|---|
| ||
#Build Scan without Instrumentation - Unix ./node_modules/.bin/slnodejs buildscan --tokenfile /path/to/sltoken.txt --buildsessionidfile buildSessionId --workspacepath dist --scm git --projectRoot /path/to/source/root #Instrumentation for first environment (i.e. MyFirstLab) ./node_modules/.bin/slnodejs buildscan --tokenfile /path/to/sltoken.txt --buildsessionidfile buildSessionId --labid MyFirstLab --instrumentForBrowsers --instrumentationOnly --workspacepath dist --outputpath sl_dist_MyFirstLab #Instrumentation for second environment (i.e. My-2nd-Lab) ./node_modules/.bin/slnodejs buildscan --tokenfile /path/to/sltoken.txt --buildsessionidfile buildSessionId --labid My-2nd-Lab --instrumentForBrowsers --instrumentationOnly --workspacepath dist --outputpath sl_dist_My-2nd-Lab |
...
Another solution is to execute the slnodejs build scan --instrumentForBrowsers
command with a generic labid
that is replaced in the JS files (string operation) prior to the artifact deployment in each environment
Code Block | ||
---|---|---|
| ||
Unix: ./node_modules/.bin/slnodejs buildscan --tokenfile /path/to/sltoken.txt --buildsessionidfile buildSessionId --labid sl_LabId_ReplaceMe --instrumentForBrowsers --workspacepath dist --outputpath sl_dist --scm git --projectRoot /path/to/source/root #Instrumentation for first environment (i.e. MyFirstLab) find sl_dist -type f -name "*.js" -exec sed -i 's/sl_LabId_ReplaceMe/MyFirstLab/g' {} + #Second Instrumentation with a "clean copy" of sl_dist for My-2nd-Lab find sl_dist -type f -name "*.js" -exec sed -i 's/sl_LabId_ReplaceMe/My-2nd-Lab/g' {} + |
...