Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove auto-generated list on readme #38

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import sortby from 'lodash.sortby';
import request from 'sync-request';
import ora from 'ora';
import chalk from 'chalk';
import {getDetailSummaryFromSymbolData} from './utils/markdown-table.js';

const endpoint = 'https://www.cryptocompare.com/api/data/coinlist/';

Expand Down Expand Up @@ -56,7 +55,7 @@ fetch(endpoint)
spinner.start('Saving Readme');

/**
* Build the Markdown Table of currencies in the Readme.
* Build the markdown table of currency info in the Readme.
*/
const template = fs.readFileSync('readme.md').toString();
const data = JSON.parse(
Expand All @@ -69,17 +68,14 @@ fetch(endpoint)
table += `\n<small><em>* Last updated: ${new Date().toUTCString()}</em></small>`;
table += '\n\n';

table += getDetailSummaryFromSymbolData(data);

// Look for the HTML comments in the README as a target
const targetRegex
= /<!-- begin table inject -->(\w|\W)*<!-- end table inject -->/gim;
const targetRegex = /<!-- begin inject -->(\w|\W)*<!-- end inject -->/gim;
const updated = template.replaceAll(
targetRegex,
`<!-- BEGIN TABLE INJECT -->\n${table}\n<!-- END TABLE INJECT -->`,
`<!-- BEGIN INJECT -->\n${table}\n<!-- END INJECT -->`,
);
fs.writeFileSync('readme.md', updated);
spinner.succeed(['Readme Markdown Table updated']);
spinner.succeed(['Readme Markdown updated']);

console.log(
'\n',
Expand Down
Loading