Skip to content

Commit 8a48419

Browse files
committed
Adding comments from demo
1 parent 9acdc02 commit 8a48419

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

scripts/build-listing.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// @todo warn about SVGs in Pantheon 1
77
// @todo add button to submit request
88
// @todo There may be less bandwidth from Jess, does there need to be a warning on new requests?
9-
// @todo Standards if you make your own
9+
// @todo Standards if you make your own? This will probably be a future thing, Jess is working with LucidCharts
1010
// @todo Are there any issues like "this diagram can't be used"? Good reason not to put this on prod.
1111
// @todo Usage instructions for images on the webpage?
1212
// @todo Feature requests for the listing page?

scripts/modules/build-csv.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ const runCliCommand = require('./runCliCommand');
1111
const localAssetsTsvPath = './data/localAssets.tsv';
1212
const tsvDelimeter = '\t';
1313

14-
// TSV data vars
15-
16-
1714
/**
1815
* Flat object with folder path as key and array of file (not folder) names inside.
1916
* For example:
@@ -79,7 +76,7 @@ const crawlDir = (dirToCrawl, filesByFolder, fileMetadata) => {
7976
}
8077
}
8178
else {
82-
// Instantiate
79+
// Instantiate key in the object if it doesn't exist
8380
if (typeof filesByFolder[dirToCrawl] === 'undefined') {
8481
filesByFolder[dirToCrawl] = [fileName];
8582
}
@@ -97,6 +94,8 @@ const crawlDir = (dirToCrawl, filesByFolder, fileMetadata) => {
9794

9895
// Add the file metadata for inclusion in the TSV
9996
filesByFolder[dirToCrawl].push(fileName);
97+
98+
// See fileMetadataEntry typedef
10099
fileMetadata[fullPath] = {
101100
'productName': productName,
102101
'extension': extension,
@@ -130,15 +129,19 @@ const processLocalAssetsTsv = (fileMetadata, callback) => {
130129
else {
131130
// Populate tsvRows with data
132131
tsvRows.push(row);
132+
133133
// Populate tsvFileFullPaths
134+
// Get the column number for the fullPath, in case they get reordered
134135
const fullPathHeaderIndex = tsvHeaders.indexOf('fullPath');
135136
if (!fullPathHeaderIndex) {
136137
console.error('Couldn\'t get the column id for fullPath in TSV Header', tsvHeaders);
137138
return;
138139
}
139140
else {
141+
// Get the value of the for path column
140142
const fullPath = row[fullPathHeaderIndex].trim();
141143
if (fullPath) {
144+
// Populate an array of fullPaths that are in the TSV so we can figure out what files aren't in the TSV later
142145
tsvFileFullPaths.push(fullPath);
143146
}
144147
else {
@@ -164,6 +167,7 @@ const processLocalAssetsTsv = (fileMetadata, callback) => {
164167
const rowsToAddToTsv = [];
165168

166169
localFullFilePaths.forEach((fullPath) => {
170+
// Check to see if file already exists in the TSV
167171
if (tsvFileFullPaths.indexOf(fullPath) >= 0) {
168172
// console.log('Not adding to TSV', fullPath);
169173
return;
@@ -196,6 +200,7 @@ const processLocalAssetsTsv = (fileMetadata, callback) => {
196200
}
197201

198202
// Set the metadata to the correct column
203+
// Making sure column exists in TSV, indexOf will return -1 if the column doesn't exist
199204
if (tsvColumnIndex >= 0) {
200205
rowToAdd[tsvColumnIndex] = currentFileMetadata[metadataKey];
201206
}
@@ -265,7 +270,7 @@ const processLocalAssetsTsv = (fileMetadata, callback) => {
265270
}
266271
});
267272
}
268-
// Otherwise just create the index page
273+
// There weren't any new rows, just create the index page
269274
else {
270275
console.log(`No new files to add to the TSV.\n`);
271276
if (typeof callback === 'function') {

scripts/modules/build-landing-page.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const buildListingTable = (headerRow, rows) => {
3333
const extensionIndex = headerRow.indexOf('extension');
3434
const createdDateIndex = headerRow.indexOf('createdDate');
3535

36+
// Adding 1 to each because a preview column was added as the first column
3637
const sortableColumns = [
3738
fileNameIndex + 1,
3839
relatedProductsIndex + 1,

0 commit comments

Comments
 (0)