@@ -3,6 +3,7 @@ const path = require("path");
33const _ = require ( "lodash" ) ;
44const datasyncManager = require ( "@contentstack/datasync-manager" ) ;
55const config = require ( "./config/all" ) ;
6+ const messages = require ( "./messages" ) ;
67/**
78 * Listener module. Currently Contentstack offers
89 * - @contentstack/webhook-listener
@@ -37,9 +38,9 @@ if (appConfig.checkpoint?.enabled) {
3738 const checkpointPath = path . join ( __dirname , appConfig . checkpoint . filePath || ".checkpoint" ) ;
3839 const checkPoint = readHiddenFile ( checkpointPath ) ;
3940 if ( checkPoint ) {
40- console . log ( "Found sync token in checkpoint file:" , checkPoint ) ;
41+ console . log ( messages . sync . tokenFound ( checkPoint ) ) ;
4142 appConfig . contentstack . sync_token = checkPoint . token ;
42- console . log ( "Using sync token:" , appConfig . contentstack . sync_token ) ;
43+ console . log ( messages . sync . usingToken ( appConfig . contentstack . sync_token ) ) ;
4344 }
4445}
4546
@@ -51,21 +52,21 @@ datasyncManager.setListener(listener);
5152datasyncManager
5253 . start ( )
5354 . then ( ( ) => {
54- console . log ( "Boilerplate: DataSync started successfully!" ) ;
55+ console . log ( messages . sync . startSuccess ( ) ) ;
5556 } )
5657 . catch ( ( error ) => {
57- console . error ( error ) ;
58+ console . error ( messages . sync . error ( error ) ) ;
5859 } ) ;
5960
6061function readHiddenFile ( filePath ) {
6162 try {
6263 if ( ! fs . existsSync ( filePath ) ) {
63- console . error ( "File does not exist:" , filePath ) ;
64+ console . error ( messages . file . notExist ( filePath ) ) ;
6465 return ;
6566 }
6667 const data = fs . readFileSync ( filePath , "utf8" ) ;
6768 return JSON . parse ( data ) ;
6869 } catch ( err ) {
69- console . error ( "Error reading file:" , err ?. message ) ;
70+ console . error ( messages . file . readError ( err ?. message ) ) ;
7071 }
7172}
0 commit comments