Skip to content

Commit

Permalink
build: create npm package (#2151)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
rickstaa authored Oct 13, 2022
1 parent 6fdf73f commit dea583d
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 8 deletions.
18 changes: 16 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 4 additions & 0 deletions src/cards/index.js
Original file line number Diff line number Diff line change
@@ -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 changes: 30 additions & 0 deletions src/common/index.js
Original file line number Diff line number Diff line change
@@ -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";
13 changes: 7 additions & 6 deletions src/common/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from "./common/index.js";
export * from "./cards/index.js";
export { getStyles, getAnimations } from "./getStyles.js";

1 comment on commit dea583d

@vercel
Copy link

@vercel vercel bot commented on dea583d Oct 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.