Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

For example, if your original folder was named 'dist' and the new folder with the instrumented code is 'sl_dist’, you can follow the steps below:

  1. Rename the original folder from ‘dist’ to ‘dist_original

    Code Block
    Windows OS:
    rename dist dist_original
    
    Linux/Unix OS:
    mv dist dist_original
  2. Use the instrumented folder instead of using one of the following options by renaming the ‘sl_dist’ to ‘dist

    Code Block
    Windows OS:
    rename sl_dist dist
    
    Linux/Unix OS:
    mv sl_dist dist

On Unix/Linux system you also have the ability to define a ‘dist’ soft link to the ‘sl_dist’ folder.

ln -s sl_dist dist

...

Code Block
languagebash
#Build Scan without Instrumentation - Unix
./node_modules/.bin/npx slnodejs scan --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/
npx slnodejs scan --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/
npx slnodejs scan --tokenfile /path/to/sltoken.txt --buildsessionidfile buildSessionId --labid My-2nd-Lab --instrumentForBrowsers --instrumentationOnly --workspacepath dist --outputpath sl_dist_My-2nd-Lab  

...

Code Block
languagebash
Unix:
./node_modules/.bin/
npx slnodejs scan --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' {} + 

...