-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to check tracking configuration
- in the past it happens that we forgot to adjust all the test numbers/start dates for banners in the campaigns_info.toml file This commit adds a node command that runs a script to check the configuration file for consistency on those 2 issues. - use chalk to highlight error messages - cleans up some codestyle in related files - update documentation
- Loading branch information
Showing
7 changed files
with
53 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# How to get an overview which banner uses which theme | ||
|
||
You can use the shell script `show_theme_usage.sh` used to get an overview which banner uses which theme(s). It filters the `UseOfFunds` and `Fijitiv` themes, because the `UseOfFunds` is used in all banners and the `Fijitiv` theme is only for the desktop fallback banner that we display when the regular banner does not fit the screen. | ||
You can use the shell script `tools/show_theme_usage.sh` used to get an overview which banner uses which theme(s). It filters the `UseOfFunds` and `Fijitiv` themes, because the `UseOfFunds` is used in all banners and the `Fijitiv` theme is only for the desktop fallback banner that we display when the regular banner does not fit the screen. | ||
|
||
The output shows the banner name and the theme(s) used in the banner. The count at the end of the line shows how many files from the theme are included in the banner. For Banners that have two style files, the count will be inaccurate (i.e twice as high), because most themes files are included in both styles. | ||
The output shows the banner name and the theme(s) used in the banner. The count at the end of the line shows how many files from the theme are included in the banner. For Banners that have two style files, the count will be inaccurate (i.e. twice as high), because most themes files are included in both styles. | ||
|
||
Ideally, each banner should use only one theme. If a banner uses more than one theme, please have a look and adjust the banner. The Desktop banners up until 04 accidentally use some variables from the `Treedip` theme even when their main theme is `Svingle`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { parse as parseTOML } from 'toml'; | ||
import { readFileSync } from 'fs'; | ||
import { campaignInfoToCampaignConfig } from '../webpack/convert_info_to_type.js'; | ||
import chalk from 'chalk'; | ||
|
||
const rawConfigForAllCampaigns = parseTOML( readFileSync( 'campaign_info.toml', 'utf-8' ) ); | ||
const configObject = campaignInfoToCampaignConfig( rawConfigForAllCampaigns ); | ||
|
||
for ( const channelConfig of Object.values( configObject ) ) { | ||
|
||
// check test number | ||
let testNumber = ''; | ||
const testNumberMatchResult = channelConfig.campaign.match( /_\d{2}/ ); | ||
if ( testNumberMatchResult === null ) { | ||
console.warn( `${ chalk.red( 'CAMPAIGN CONFIGURATION ERROR:' ) } Cannot parse test number ( "_dd" format) for ${ channelConfig.campaign } ` ); | ||
process.exit( 1 ); | ||
} | ||
testNumber = testNumberMatchResult[ 0 ]; | ||
const testNumberSearchString = testNumber.slice( 1 ) + '-'; | ||
if ( !channelConfig.tracking.includes( testNumberSearchString ) || | ||
!channelConfig.banners.ctrl.tracking.includes( testNumberSearchString ) || | ||
!channelConfig.banners.var.tracking.includes( testNumberSearchString ) ) { | ||
console.warn( `${ chalk.red( 'CAMPAIGN CONFIGURATION ERROR:' ) } Faulty tracking config (test number) for ${ channelConfig.campaign } ` ); | ||
process.exit( 1 ); | ||
} | ||
|
||
// check start date | ||
let startDate = ''; | ||
const startDateMatchResult = channelConfig.tracking.match( /-\d{6}$/ ); | ||
if ( startDateMatchResult === null ) { | ||
console.warn( `${ chalk.red( 'CAMPAIGN CONFIGURATION ERROR:' ) } Cannot parse 6-digit start date for ${ channelConfig.campaign } ` ); | ||
process.exit( 1 ); | ||
} | ||
startDate = startDateMatchResult[ 0 ]; | ||
if ( !channelConfig.tracking.includes( startDate ) || | ||
!channelConfig.banners.ctrl.tracking.includes( startDate ) || | ||
!channelConfig.banners.var.tracking.includes( startDate ) ) { | ||
console.warn( `${ chalk.red( 'CAMPAIGN CONFIGURATION ERROR:' ) } Faulty tracking config (start date) for ${ channelConfig.campaign } ` ); | ||
process.exit( 1 ); | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters