howlongtoread 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +136 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.mjs +5 -0
- package/package.json +67 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Dobroslav Radosavljevic
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# ๐ฆ npm-ts-start
|
|
2
|
+
|
|
3
|
+
A minimal starter template for creating npm packages in pure TypeScript.
|
|
4
|
+
|
|
5
|
+
## โจ Features
|
|
6
|
+
|
|
7
|
+
- ๐ท **TypeScript** - Write type-safe code with full TypeScript support
|
|
8
|
+
- โก **tsdown** - Fast bundling powered by Rolldown
|
|
9
|
+
- ๐งช **Bun Test** - Fast built-in test runner
|
|
10
|
+
- ๐จ **Ultracite** - Zero-config linting and formatting with Oxlint + Oxfmt
|
|
11
|
+
- ๐ฆ **ESM** - Ships as ES modules with TypeScript declarations
|
|
12
|
+
- ๐ **GitHub Actions** - CI/CD pipeline with automated testing and npm publishing
|
|
13
|
+
- ๐ถ **Husky** - Pre-commit hooks for code quality enforcement
|
|
14
|
+
- ๐ **Commitlint** - Conventional commit message validation
|
|
15
|
+
|
|
16
|
+
## ๐ Getting Started
|
|
17
|
+
|
|
18
|
+
1. Clone or use this template:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
git clone https://github.com/dobroslavradosavljevic/npm-ts-start.git my-package
|
|
22
|
+
cd my-package
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
2. Update `package.json` with your package name, description, and author info.
|
|
26
|
+
|
|
27
|
+
3. Install dependencies:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
bun install
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
4. Start developing in `src/index.ts`.
|
|
34
|
+
|
|
35
|
+
## ๐ Scripts
|
|
36
|
+
|
|
37
|
+
| Command | Description |
|
|
38
|
+
| ------------------- | ----------------------------------- |
|
|
39
|
+
| `bun run build` | Build the package |
|
|
40
|
+
| `bun run dev` | Build in watch mode |
|
|
41
|
+
| `bun run test` | Run tests |
|
|
42
|
+
| `bun run lint` | Check for linting issues |
|
|
43
|
+
| `bun run format` | Fix linting and formatting issues |
|
|
44
|
+
| `bun run typecheck` | Run TypeScript type checking |
|
|
45
|
+
| `bun run bump` | Bump version and generate changelog |
|
|
46
|
+
| `bun run release` | Publish the package to npm |
|
|
47
|
+
|
|
48
|
+
## ๐ Project Structure
|
|
49
|
+
|
|
50
|
+
```txt
|
|
51
|
+
โโโ src/
|
|
52
|
+
โ โโโ index.ts # Package entry point
|
|
53
|
+
โโโ tests/
|
|
54
|
+
โ โโโ index.test.ts # Test files
|
|
55
|
+
โโโ dist/ # Build output (generated)
|
|
56
|
+
โโโ .github/
|
|
57
|
+
โ โโโ workflows/
|
|
58
|
+
โ โโโ ci.yml # CI pipeline (lint, test, build)
|
|
59
|
+
โ โโโ release.yml # Automated npm publishing
|
|
60
|
+
โโโ .husky/
|
|
61
|
+
โ โโโ pre-commit # Runs lint-staged before commits
|
|
62
|
+
โ โโโ commit-msg # Validates commit messages
|
|
63
|
+
โโโ tsdown.config.ts # Build configuration
|
|
64
|
+
โโโ tsconfig.json # TypeScript configuration
|
|
65
|
+
โโโ commitlint.config.ts # Commit message rules
|
|
66
|
+
โโโ package.json
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## ๐ถ Git Hooks
|
|
70
|
+
|
|
71
|
+
This template uses Husky for Git hooks:
|
|
72
|
+
|
|
73
|
+
- **pre-commit**: Runs `lint-staged` to lint and format staged files
|
|
74
|
+
- **commit-msg**: Validates commit messages follow [Conventional Commits](https://www.conventionalcommits.org/)
|
|
75
|
+
|
|
76
|
+
### Commit Message Format
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
type(scope): description
|
|
80
|
+
|
|
81
|
+
# Examples:
|
|
82
|
+
feat: add new feature
|
|
83
|
+
fix: resolve bug in parser
|
|
84
|
+
docs: update README
|
|
85
|
+
chore: update dependencies
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## ๐ CI/CD
|
|
89
|
+
|
|
90
|
+
### Continuous Integration
|
|
91
|
+
|
|
92
|
+
On every push to `main` and pull request, the CI workflow runs:
|
|
93
|
+
|
|
94
|
+
- โ
Lint check
|
|
95
|
+
- โ
Type check
|
|
96
|
+
- โ
Tests
|
|
97
|
+
- โ
Build
|
|
98
|
+
|
|
99
|
+
### Automated Releases
|
|
100
|
+
|
|
101
|
+
When you push a version tag (`v*`), the release workflow:
|
|
102
|
+
|
|
103
|
+
1. Runs all CI checks
|
|
104
|
+
2. Publishes to npm with provenance
|
|
105
|
+
3. Creates a GitHub release with auto-generated notes
|
|
106
|
+
|
|
107
|
+
### Setup for Publishing
|
|
108
|
+
|
|
109
|
+
Add `NPM_TOKEN` to your repository secrets:
|
|
110
|
+
|
|
111
|
+
1. Go to **Settings** > **Secrets and variables** > **Actions**
|
|
112
|
+
2. Add `NPM_TOKEN` with your npm automation token
|
|
113
|
+
|
|
114
|
+
## ๐ข Publishing
|
|
115
|
+
|
|
116
|
+
1. Bump the version (creates a tag):
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
bun run bump
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
2. Push the tag to trigger the release workflow:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
git push --tags
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Or publish manually:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
bun publish
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## ๐ License
|
|
135
|
+
|
|
136
|
+
MIT
|
package/dist/index.d.mts
ADDED
package/dist/index.mjs
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "howlongtoread",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Estimate how long it takes to read text content.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"reading-time",
|
|
7
|
+
"read-time",
|
|
8
|
+
"estimate",
|
|
9
|
+
"text",
|
|
10
|
+
"words",
|
|
11
|
+
"typescript"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/dobroslavradosavljevic/howlongtoread#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/dobroslavradosavljevic/howlongtoread/issues"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"author": "Dobroslav Radosavljevic <dobroslav.radosavljevic@gmail.com>",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/dobroslavradosavljevic/howlongtoread.git"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"type": "module",
|
|
27
|
+
"main": "./dist/index.mjs",
|
|
28
|
+
"module": "./dist/index.mjs",
|
|
29
|
+
"types": "./dist/index.d.mts",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": "./dist/index.mjs",
|
|
32
|
+
"./package.json": "./package.json"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "tsdown",
|
|
36
|
+
"dev": "tsdown --watch",
|
|
37
|
+
"test": "bun test",
|
|
38
|
+
"lint": "bun ultracite check",
|
|
39
|
+
"format": "bun ultracite fix",
|
|
40
|
+
"typecheck": "tsc --noEmit",
|
|
41
|
+
"prepare": "husky",
|
|
42
|
+
"prepublishOnly": "bun run build",
|
|
43
|
+
"bump": "bumpp --changelog",
|
|
44
|
+
"release": "bun publish"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@commitlint/cli": "^20.3.1",
|
|
48
|
+
"@commitlint/config-conventional": "^20.3.1",
|
|
49
|
+
"@types/bun": "latest",
|
|
50
|
+
"bumpp": "^10.3.2",
|
|
51
|
+
"husky": "^9.1.7",
|
|
52
|
+
"lint-staged": "^16.2.7",
|
|
53
|
+
"oxfmt": "^0.26.0",
|
|
54
|
+
"oxlint": "^1.41.0",
|
|
55
|
+
"tsdown": "^0.18.1",
|
|
56
|
+
"typescript": "^5.9.3",
|
|
57
|
+
"ultracite": "7.0.12"
|
|
58
|
+
},
|
|
59
|
+
"lint-staged": {
|
|
60
|
+
"*.{ts,tsx,js,jsx,mjs,cjs}": [
|
|
61
|
+
"bun ultracite fix"
|
|
62
|
+
],
|
|
63
|
+
"*.{json,md,yml,yaml}": [
|
|
64
|
+
"bun ultracite fix"
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
}
|