build: create npm package (#2151)

* build: create npm package

This commit makes sure that the common modules of the GRS package can be
imported as an npm package.

* feat: export card render functions

* style: update formatting
This commit is contained in:
Rick Staa 2022-10-13 10:27:19 +02:00 committed by GitHub
parent 6fdf73f39c
commit dea583d426
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 60 additions and 8 deletions

View file

@ -1,9 +1,23 @@
{
"name": "github-readme-stats",
"version": "1.0.0",
"description": "Dynamically generate stats for your github readmes",
"main": "index.js",
"description": "Dynamically generate stats for your GitHub readme",
"keywords": [
"github-readme-stats",
"readme-stats",
"cards",
"card-generator"
],
"main": "src/index.js",
"type": "module",
"homepage": "https://github.com/anuraghazra/github-readme-stats",
"bugs": {
"url": "https://github.com/anuraghazra/github-readme-stats/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/anuraghazra/github-readme-stats.git"
},
"scripts": {
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage",
"test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch",

4
src/cards/index.js Normal file
View file

@ -0,0 +1,4 @@
export { renderRepoCard } from "./repo-card.js";
export { renderStatsCard } from "./stats-card.js";
export { renderTopLanguages } from "./top-languages-card.js";
export { renderWakatimeCard } from "./wakatime-card.js";

30
src/common/index.js Normal file
View file

@ -0,0 +1,30 @@
export { blacklist } from "./blacklist.js";
export { Card } from "./Card.js";
export { createProgressNode } from "./createProgressNode.js";
export { i18n } from "./i18n.js";
export { icons } from "./icons.js";
export { retryer } from "./retryer.js";
export {
ERROR_CARD_LENGTH,
renderError,
encodeHTML,
kFormatter,
isValidHexColor,
parseBoolean,
parseArray,
clampValue,
isValidGradient,
fallbackColor,
request,
flexLayout,
getCardColors,
wrapTextMultiline,
logger,
CONSTANTS,
CustomError,
MissingParamError,
measureText,
lowercaseTrim,
chunkArray,
parseEmojis,
} from "./utils.js";

View file

@ -414,25 +414,26 @@ function parseEmojis(str) {
}
export {
ERROR_CARD_LENGTH,
renderError,
kFormatter,
encodeHTML,
kFormatter,
isValidHexColor,
request,
parseArray,
parseBoolean,
parseArray,
clampValue,
isValidGradient,
fallbackColor,
request,
flexLayout,
getCardColors,
clampValue,
wrapTextMultiline,
measureText,
logger,
CONSTANTS,
CustomError,
MissingParamError,
measureText,
lowercaseTrim,
chunkArray,
parseEmojis,
ERROR_CARD_LENGTH,
};

3
src/index.js Normal file
View file

@ -0,0 +1,3 @@
export * from "./common/index.js";
export * from "./cards/index.js";
export { getStyles, getAnimations } from "./getStyles.js";