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 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
@@ -0,0 +1,4 @@
1
+ //#region src/index.d.ts
2
+ declare const fn: () => string;
3
+ //#endregion
4
+ export { fn };
package/dist/index.mjs ADDED
@@ -0,0 +1,5 @@
1
+ //#region src/index.ts
2
+ const fn = () => "Hello, tsdown!";
3
+
4
+ //#endregion
5
+ export { fn };
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
+ }