Skip to content

Commit

Permalink
docs: added size-limit (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandrjet committed Mar 4, 2024
1 parent ea38376 commit 0749496
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 20 deletions.
19 changes: 19 additions & 0 deletions .size-limit.cjs
@@ -0,0 +1,19 @@
const funcs = require("./dist/index.cjs")

const path = "./dist/index.mjs"

module.exports = [
...Object.keys(funcs)
.map((name) => {
if (name === "format" || name === "parse") {
return
}
return { path, name, import: `{ ${name} }` }
})
.filter(Boolean),

{ path, limit: "2.9 kb", import: "{ format }", name: "format" },
{ path, limit: "4.3 kb", import: "{ parse }", name: "parse" },
{ path, limit: "5.1 kb", import: "*", name: "all esm" },
{ path: "./dist/index.cjs", limit: "5.4 kb", import: "*", name: "all cjs" },
]
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -10,6 +10,8 @@ Tempo is a new library in a proud tradition of JavaScript date and time librarie

Tempo is best thought of as a collection of utilities for working with `Date` objects — an important distinction from other libraries that provide custom date primitives. Under the hood, Tempo mines JavaScript's `Intl.DateTimeFormat` to extract complex data like timezones offsets and locale aware date formats giving you a simple API to format, parse, and manipulates dates.

Tempo is tiny tree-shakable framework, you can only take what you need. All functionality is available in **5.1 kB for esm** and **5.4 kB for cjs** modules (minified and brotlied). [Size Limit](https://github.com/ai/size-limit) controls the size.

<a href="https://tempo.formkit.com">
<img src="docs/public/read-the-docs.png" alt="Read the docs" width="200" height="43">
</a>
Expand Down
5 changes: 4 additions & 1 deletion package.json
Expand Up @@ -23,7 +23,8 @@
"test": "TZ=\"America/New_York\" vitest",
"docs-build": "cd ./docs && pnpm run build",
"publint": "publint",
"release": "pnpm build && bumpp && pnpm publish"
"release": "pnpm build && bumpp && pnpm publish",
"size": "npm run build && size-limit"
},
"files": [
"dist",
Expand All @@ -39,9 +40,11 @@
"author": "Justin Schroeder <justin@formkit.com>",
"license": "MIT",
"devDependencies": {
"@size-limit/preset-small-lib": "^11.0.2",
"@types/node": "^20.11.10",
"bumpp": "^9.3.0",
"publint": "^0.2.7",
"size-limit": "^11.0.2",
"tsup": "^8.0.1",
"typescript": "^5.3.3",
"vitest": "^1.2.1"
Expand Down
106 changes: 87 additions & 19 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0749496

Please sign in to comment.