Skip to content

Commit cf38808

Browse files
authored
Add datestamp to catalog update runs, updated catalog (#536)
* Add datestamp to catalog update runs, updated catalog * append not overwrite * remake catalog * wait for the script to finish before committing next time
1 parent 2bb4042 commit cf38808

File tree

5 files changed

+3072
-3054
lines changed

5 files changed

+3072
-3054
lines changed

scripts/catalog.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const slugify = (displayName) => {
1818
.replace('.','-')
1919

2020
if (slug === '-net') slug = 'net'
21+
if (slug === 'talon-one') slug = 'talonone'
2122
if (slug === 'roku-alpha') slug = 'roku'
2223
if (slug === 'shopify-by-littledata') slug = 'shopify-littledata'
2324
if (slug === 'talon-one') slug = 'talonone'
@@ -189,11 +190,16 @@ const updateSources = async () => {
189190

190191
// Create source catalog yaml file
191192
const options = { noArrayIndent: true };
192-
let output = yaml.safeDump({ items: sourcesUpdated }, options);
193+
var todayDate = new Date().toISOString().slice(0,10);
194+
output = "# AUTOGENERATED FROM PLATFORM API. DO NOT EDIT\n"
195+
output += "# sources last updated " + todayDate + " \n";
196+
output += yaml.safeDump({ items: sourcesUpdated }, options);
193197
fs.writeFileSync(path.resolve(__dirname, `../src/_data/catalog/sources.yml`), output);
194198

195199
// Create source-category mapping yaml file
200+
var todayDate = new Date().toISOString().slice(0,10);
196201
output = "# AUTOGENERATED FROM PLATFORM API. DO NOT EDIT\n"
202+
output += "# source cateogries last updated " + todayDate + " \n";
197203
output += yaml.safeDump({ items: sourceCategories }, options);
198204
fs.writeFileSync(path.resolve(__dirname, `../src/_data/catalog/source_categories.yml`), output);
199205
}
@@ -272,10 +278,16 @@ const updateDestinations = async () => {
272278

273279
// Create destination catalog yaml file
274280
const options = { noArrayIndent: true };
275-
let output = yaml.safeDump({ items: destinationsUpdated }, options);
281+
output = "# AUTOGENERATED FROM PLATFORM API. DO NOT EDIT\n"
282+
var todayDate = new Date().toISOString().slice(0,10);
283+
output += "# destination data last updated " + todayDate + " \n";
284+
output += yaml.safeDump({ items: destinationsUpdated }, options);
276285
fs.writeFileSync(path.resolve(__dirname, `../src/_data/catalog/destinations.yml`), output);
277-
// Create source-category mapping yaml file
286+
287+
// Create destination-category mapping yaml file
278288
output = "# AUTOGENERATED FROM PLATFORM API. DO NOT EDIT\n"
289+
var todayDate = new Date().toISOString().slice(0,10);
290+
output += "# destination categories last updated " + todayDate + " \n";
279291
output += yaml.safeDump({ items: destinationCategories }, options);
280292
fs.writeFileSync(path.resolve(__dirname, `../src/_data/catalog/destination_categories.yml`), output);
281293
}

src/_data/catalog/destination_categories.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# AUTOGENERATED FROM PLATFORM API. DO NOT EDIT
2+
# destination categories last updated 2020-01-22
23
items:
34
- display_name: Email Marketing
45
slug: email-marketing

0 commit comments

Comments
 (0)