jell-utils 0.0.17 โ†’ 0.1.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.
@@ -0,0 +1,16 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(npm run semantic-release:*)",
5
+ "Bash(npm version:*)",
6
+ "Bash(git add:*)",
7
+ "Bash(git checkout:*)",
8
+ "Bash(git merge:*)",
9
+ "Bash(echo:*)",
10
+ "Bash(git push:*)",
11
+ "Bash(npm run build:*)",
12
+ "Bash(npm run lint)"
13
+ ],
14
+ "deny": []
15
+ }
16
+ }
@@ -0,0 +1,115 @@
1
+ {
2
+ "branches": [
3
+ "main",
4
+ "master",
5
+ {
6
+ "name": "beta",
7
+ "prerelease": true
8
+ },
9
+ {
10
+ "name": "alpha",
11
+ "prerelease": true
12
+ }
13
+ ],
14
+ "plugins": [
15
+ [
16
+ "@semantic-release/commit-analyzer",
17
+ {
18
+ "preset": "conventionalcommits",
19
+ "releaseRules": [
20
+ { "type": "feat", "release": "minor" },
21
+ { "type": "fix", "release": "patch" },
22
+ { "type": "perf", "release": "patch" },
23
+ { "type": "revert", "release": "patch" },
24
+ { "type": "docs", "release": "patch" },
25
+ { "type": "style", "release": false },
26
+ { "type": "refactor", "release": "patch" },
27
+ { "type": "test", "release": false },
28
+ { "type": "build", "release": false },
29
+ { "type": "ci", "release": false },
30
+ { "scope": "no-release", "release": false },
31
+ { "breaking": true, "release": "major" }
32
+ ],
33
+ "parserOpts": {
34
+ "noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"]
35
+ }
36
+ }
37
+ ],
38
+ [
39
+ "@semantic-release/release-notes-generator",
40
+ {
41
+ "preset": "conventionalcommits",
42
+ "presetConfig": {
43
+ "types": [
44
+ { "type": "feat", "section": "โœจ Features", "hidden": false },
45
+ { "type": "fix", "section": "๐Ÿ› Bug Fixes", "hidden": false },
46
+ { "type": "perf", "section": "โšก Performance", "hidden": false },
47
+ { "type": "revert", "section": "โช Reverts", "hidden": false },
48
+ { "type": "docs", "section": "๐Ÿ“ Documentation", "hidden": false },
49
+ { "type": "style", "section": "๐Ÿ’„ Styles", "hidden": false },
50
+ {
51
+ "type": "refactor",
52
+ "section": "โ™ป๏ธ Refactoring",
53
+ "hidden": false
54
+ },
55
+ { "type": "test", "section": "๐Ÿงช Tests", "hidden": false },
56
+ { "type": "build", "section": "๐Ÿ“ฆ Build", "hidden": false },
57
+ { "type": "ci", "section": "๐Ÿ‘ท CI/CD", "hidden": false }
58
+ ]
59
+ },
60
+ "writerOpts": {
61
+ "commitsSort": ["subject", "scope"]
62
+ }
63
+ }
64
+ ],
65
+ [
66
+ "@semantic-release/changelog",
67
+ {
68
+ "changelogFile": "CHANGELOG.md",
69
+ "changelogTitle": "# ๐Ÿ“‹ Changelog\n\nAll notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines."
70
+ }
71
+ ],
72
+ [
73
+ "@semantic-release/npm",
74
+ {
75
+ "npmPublish": true,
76
+ "tarballDir": "dist"
77
+ }
78
+ ],
79
+ [
80
+ "@semantic-release/github",
81
+ {
82
+ "successComment": "๐ŸŽ‰ This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version [${nextRelease.version}](${releases.filter(release => !!release.name)[0].url}) which has been released! ๐Ÿš€\n\n๐Ÿ“ฆ Install the latest version:\n```bash\nnpm install jell-utils@${nextRelease.version}\n```",
83
+ "failTitle": "โŒ The automated release is failing ๐Ÿšจ",
84
+ "failComment": "The automated release from the `${branch.name}` branch failed. ๐Ÿ˜ž\n\n๐Ÿ“ Full changelog: ${nextRelease.notes}\n๐Ÿ” [Workflow run](${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID})",
85
+ "labels": ["released"],
86
+ "releasedLabels": [
87
+ "released<%= nextRelease.type === 'prerelease' ? `-${nextRelease.prerelease}` : '' %>"
88
+ ],
89
+ "addReleases": "bottom",
90
+ "assets": [
91
+ {
92
+ "path": "lib/**/*",
93
+ "label": "Compiled JavaScript (${nextRelease.version})"
94
+ },
95
+ {
96
+ "path": "dist/*.tgz",
97
+ "label": "NPM Package (${nextRelease.version})"
98
+ }
99
+ ]
100
+ }
101
+ ],
102
+ [
103
+ "@semantic-release/git",
104
+ {
105
+ "assets": [
106
+ "package.json",
107
+ "package-lock.json",
108
+ "CHANGELOG.md",
109
+ "lib/**/*"
110
+ ],
111
+ "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
112
+ }
113
+ ]
114
+ ]
115
+ }
package/CLAUDE.md ADDED
@@ -0,0 +1,139 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ This is a TypeScript utility library (`jell-utils`) containing utility functions primarily focused on:
8
+ - Korean text processing and detection
9
+ - Date/time manipulation and formatting
10
+ - String transformations (camelCase, snake_case, title case)
11
+ - HTML/text parsing and cleaning
12
+ - Array comparison utilities
13
+ - iOS device detection
14
+
15
+ The library is designed for both browser and Node.js environments, with compiled output in CommonJS format.
16
+
17
+ ## Development Commands
18
+
19
+ ### Build & Compilation
20
+ ```bash
21
+ # Build TypeScript to JavaScript (outputs to lib/ directory)
22
+ yarn build
23
+ # or
24
+ npm run build
25
+ ```
26
+
27
+ ### Testing
28
+ ```bash
29
+ # Run all tests using Jest
30
+ yarn test
31
+ # or
32
+ npm test
33
+
34
+ # Test files are in __tests__/ directory
35
+ # Tests are written for TypeScript but run against compiled JS in lib/
36
+ ```
37
+
38
+ ### Code Quality
39
+ ```bash
40
+ # Lint TypeScript files
41
+ yarn lint
42
+ # or
43
+ npm run lint
44
+
45
+ # Auto-fix linting issues
46
+ yarn lint:fix
47
+ # or
48
+ npm run lint:fix
49
+
50
+ # Format code with Prettier
51
+ yarn format
52
+ # or
53
+ npm run format
54
+ ```
55
+
56
+ ### Publishing Workflow
57
+ ```bash
58
+ # Pre-publish checks (runs test, lint, and lint:fix)
59
+ yarn prepublishOnly
60
+
61
+ # Version management (includes linting and formatting)
62
+ yarn preversion # lint check
63
+ yarn version # format and git add
64
+ yarn postversion # git push with tags
65
+ ```
66
+
67
+ ## Architecture & Structure
68
+
69
+ ### Core Module Structure
70
+ - **Source**: `src/index.ts` - Single file containing all utility functions as a default export object
71
+ - **Compiled Output**: `lib/index.js` + `lib/index.d.ts` - ES5 CommonJS with TypeScript declarations
72
+ - **Tests**: `__tests__/korean.test.ts` - Jest tests importing from compiled lib directory
73
+
74
+ ### Key Design Patterns
75
+ - **Single Object Export**: All utilities are methods on a single `util` object
76
+ - **Pure Functions**: All utility functions are stateless and side-effect free (except `clearTag` which uses DOM)
77
+ - **Defensive Programming**: Functions include type checking and fallback values
78
+ - **Browser Compatibility**: Uses DOM APIs for `clearTag` and `navigator` for `isiOS`
79
+
80
+ ### Function Categories
81
+
82
+ 1. **Korean Text Processing**:
83
+ - `isKorean()` - Detects Korean characters using Unicode ranges
84
+
85
+ 2. **Date/Time Utilities**:
86
+ - `getNowDate()` - Current datetime in local timezone
87
+ - `getKoreanDate()` - Korean date format ("์›”์ผ" format)
88
+ - `formatDate()` - yyyy-mm-dd formatting
89
+ - `calDDay()` - D-day calculator
90
+ - `parseTime()` - Parse time strings to milliseconds
91
+
92
+ 3. **String Transformations**:
93
+ - `toCamelCase()` - Convert to camelCase
94
+ - `toSnakeCase()` - Convert to snake_case
95
+ - `toTitleCase()` - Convert to Title Case with space handling
96
+ - `replaceBetween()` - Replace substring at specific indices
97
+
98
+ 4. **HTML/Text Processing**:
99
+ - `parseTag()` - Decode HTML entities (&lt; to <)
100
+ - `toText()` - Convert <br> tags to newlines
101
+ - `toHtml()` - Convert newlines to <br> tags
102
+ - `clearTag()` - Remove HTML tags (browser only)
103
+
104
+ 5. **Data Utilities**:
105
+ - `clone()` - Shallow object cloning
106
+ - `equalArrays()` - Array comparison
107
+ - `parseNumber()` - Safe number parsing with defaults
108
+
109
+ 6. **Browser Detection**:
110
+ - `isiOS()` - Detect iOS devices via user agent
111
+
112
+ ## Development Notes
113
+
114
+ ### Build Process
115
+ - TypeScript compiles to ES5 for broad compatibility
116
+ - Outputs both JavaScript and TypeScript declaration files
117
+ - Uses strict TypeScript configuration with proper module resolution
118
+
119
+ ### Testing Strategy
120
+ - Tests run against compiled JavaScript in `lib/` directory, not source TypeScript
121
+ - Jest configuration supports both .ts and .js files
122
+ - Tests focus on core functionality rather than edge cases
123
+
124
+ ### Type Safety Considerations
125
+ - Uses `Record<string, unknown>` for generic object types
126
+ - TODO comment indicates need to improve object typing
127
+ - Functions include runtime type checking for safety
128
+
129
+ ### Browser Dependencies
130
+ - `clearTag()` function requires DOM environment (uses `document.createElement`)
131
+ - `isiOS()` function requires browser environment (uses `navigator.userAgent`)
132
+ - Other functions are environment-agnostic
133
+
134
+ When adding new utilities:
135
+ 1. Add to the main util object in `src/index.ts`
136
+ 2. Follow existing patterns for type safety and error handling
137
+ 3. Add comprehensive JSDoc documentation
138
+ 4. Write tests in `__tests__/` directory
139
+ 5. Test against compiled output, not source
package/DEPLOYMENT.md ADDED
@@ -0,0 +1,351 @@
1
+ # ๐Ÿš€ Deployment Guide - jell-utils
2
+
3
+ ## ๐Ÿ“‹ Overview
4
+
5
+ This project uses a **modern automated CI/CD pipeline** with semantic versioning, conventional commits, and automatic NPM publishing.
6
+
7
+ ### ๐ŸŽฏ Key Features
8
+
9
+ - โœ… **Automatic versioning** based on conventional commits
10
+ - โœ… **Semantic Release** with changelog generation
11
+ - โœ… **Multi-Node.js version testing** (18.x, 20.x, 21.x)
12
+ - โœ… **Cross-platform testing** (Ubuntu, Windows, macOS)
13
+ - โœ… **Security scanning** and vulnerability checks
14
+ - โœ… **Supply chain security** with provenance attestation
15
+ - โœ… **Automated NPM publishing** to registry
16
+ - โœ… **GitHub releases** with assets and notes
17
+ - โœ… **Slack notifications** (if configured)
18
+ - โœ… **Rollback capabilities** for failed releases
19
+
20
+ ---
21
+
22
+ ## ๐Ÿ”„ Workflow Overview
23
+
24
+ ### 1. ๐Ÿ“ Development Workflow
25
+
26
+ ```mermaid
27
+ graph LR
28
+ A[Code Changes] --> B[Conventional Commit]
29
+ B --> C[Push to Feature Branch]
30
+ C --> D[Create PR to main]
31
+ D --> E[CI Tests Run]
32
+ E --> F[Merge to main]
33
+ F --> G[Auto Release & Deploy]
34
+ ```
35
+
36
+ ### 2. ๐Ÿค– Automated Pipeline
37
+
38
+ 1. **Quality Gate**: Builds, tests, and lints across multiple environments
39
+ 2. **Security Audit**: Vulnerability scanning and dependency analysis
40
+ 3. **Release Check**: Semantic analysis of commits for version calculation
41
+ 4. **Automated Release**: Version bump, changelog, GitHub release, NPM publish
42
+ 5. **Notifications**: Success/failure alerts via Slack and GitHub issues
43
+
44
+ ---
45
+
46
+ ## ๐ŸŽจ Commit Message Format
47
+
48
+ This project uses **[Conventional Commits](https://conventionalcommits.org/)** specification.
49
+
50
+ ### Format
51
+
52
+ ```
53
+ <type>[optional scope]: <description>
54
+
55
+ [optional body]
56
+
57
+ [optional footer(s)]
58
+ ```
59
+
60
+ ### Supported Types
61
+
62
+ | Type | Release | Description | Example |
63
+ | ---------- | -------------- | ----------------------- | -------------------------------------- |
64
+ | `feat` | **minor** | New feature | `feat: add Korean text detection` |
65
+ | `fix` | **patch** | Bug fix | `fix: resolve parseTime radix issue` |
66
+ | `perf` | **patch** | Performance improvement | `perf: optimize toTitleCase algorithm` |
67
+ | `docs` | **patch** | Documentation changes | `docs: update API documentation` |
68
+ | `refactor` | **patch** | Code refactoring | `refactor: simplify isiOS function` |
69
+ | `test` | **no release** | Test additions | `test: add parseNumber edge cases` |
70
+ | `ci` | **no release** | CI configuration | `ci: update GitHub Actions workflow` |
71
+ | `style` | **no release** | Code formatting | `style: fix indentation` |
72
+
73
+ ### Breaking Changes
74
+
75
+ Add `BREAKING CHANGE:` in footer or `!` after type for **major** version bump:
76
+
77
+ ```
78
+ feat!: remove deprecated clone function
79
+
80
+ BREAKING CHANGE: clone function now requires explicit type parameter
81
+ ```
82
+
83
+ ### ๐Ÿ› ๏ธ Easy Commit Tool
84
+
85
+ ```bash
86
+ # Interactive commit message builder
87
+ npm run commit
88
+ ```
89
+
90
+ ---
91
+
92
+ ## ๐Ÿšฆ Branch Strategy
93
+
94
+ ### Main Branches
95
+
96
+ - **`main`/`master`**: Production-ready code, auto-deploys to NPM
97
+ - **`beta`**: Beta releases with `-beta` prerelease tag
98
+ - **`alpha`**: Alpha releases with `-alpha` prerelease tag
99
+
100
+ ### Feature Development
101
+
102
+ 1. Create feature branch from `main`
103
+ 2. Make changes with conventional commits
104
+ 3. Create PR to `main`
105
+ 4. Auto-merge after CI passes
106
+
107
+ ---
108
+
109
+ ## โš™๏ธ Setup Instructions
110
+
111
+ ### 1. ๐Ÿ“ฆ Install Dependencies
112
+
113
+ ```bash
114
+ npm install
115
+ ```
116
+
117
+ ### 2. ๐ŸŽฃ Initialize Git Hooks
118
+
119
+ ```bash
120
+ npx husky install
121
+ ```
122
+
123
+ ### 3. ๐Ÿ”‘ Configure Secrets (Repository Admin)
124
+
125
+ #### Required GitHub Secrets:
126
+
127
+ ```bash
128
+ # NPM Publishing Token (https://npmjs.com/settings/tokens)
129
+ NPM_TOKEN=npm_xxxxxxxxxxxxxxxx
130
+
131
+ # Optional: Slack notifications
132
+ SLACK_WEBHOOK_URL=https://hooks.slack.com/services/...
133
+
134
+ # Optional: Code coverage
135
+ CODECOV_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
136
+ ```
137
+
138
+ #### Setting Secrets:
139
+
140
+ 1. Go to repository **Settings** โ†’ **Secrets and variables** โ†’ **Actions**
141
+ 2. Click **New repository secret**
142
+ 3. Add each secret above
143
+
144
+ ### 4. ๐Ÿ“‹ Branch Protection Rules
145
+
146
+ Configure branch protection for `main`:
147
+
148
+ 1. **Settings** โ†’ **Branches** โ†’ **Add rule**
149
+ 2. Branch name pattern: `main`
150
+ 3. Enable:
151
+ - โœ… Require a pull request before merging
152
+ - โœ… Require status checks to pass before merging
153
+ - โœ… Require up-to-date branches before merging
154
+ - โœ… Include administrators
155
+
156
+ ---
157
+
158
+ ## ๐ŸŽฎ Usage Commands
159
+
160
+ ### Development
161
+
162
+ ```bash
163
+ # Build project
164
+ npm run build
165
+
166
+ # Run tests with coverage
167
+ npm run test:coverage
168
+
169
+ # Lint and fix code
170
+ npm run lint:fix
171
+
172
+ # Format code
173
+ npm run format
174
+
175
+ # Interactive commit (recommended)
176
+ npm run commit
177
+ ```
178
+
179
+ ### Release Management
180
+
181
+ ```bash
182
+ # Test semantic release (dry run)
183
+ npm run semantic-release:dry-run
184
+
185
+ # Manual version bump (emergency only)
186
+ npm run release:patch # x.x.X
187
+ npm run release:minor # x.X.0
188
+ npm run release:major # X.0.0
189
+ ```
190
+
191
+ ### CI Commands
192
+
193
+ ```bash
194
+ # Full CI pipeline locally
195
+ npm run ci:install
196
+ npm run ci:build
197
+ npm run ci:test
198
+ npm run ci:lint
199
+ ```
200
+
201
+ ---
202
+
203
+ ## ๐Ÿ”ง Configuration Files
204
+
205
+ ### Core Configuration
206
+
207
+ - **`.releaserc.json`**: Semantic release configuration
208
+ - **`package.json`**: NPM scripts and dependencies
209
+ - **`.github/workflows/`**: GitHub Actions workflows
210
+
211
+ ### Code Quality
212
+
213
+ - **`.husky/`**: Git hooks for commit validation
214
+ - **`commitlint.config.js`**: Commit message linting
215
+ - **`lint-staged`**: Pre-commit code formatting
216
+ - **`.eslintrc`**: Code linting rules
217
+
218
+ ---
219
+
220
+ ## ๐Ÿšจ Troubleshooting
221
+
222
+ ### Common Issues
223
+
224
+ #### 1. โŒ Commit Message Rejected
225
+
226
+ ```bash
227
+ Error: Commit message does not follow Conventional Commits format
228
+ ```
229
+
230
+ **Solution**: Use `npm run commit` or follow the format above.
231
+
232
+ #### 2. โŒ NPM Publish Failed
233
+
234
+ ```bash
235
+ Error: 401 Unauthorized - PUT https://registry.npmjs.org/jell-utils
236
+ ```
237
+
238
+ **Solution**: Check `NPM_TOKEN` in repository secrets.
239
+
240
+ #### 3. โŒ No Release Created
241
+
242
+ ```bash
243
+ No new version is released
244
+ ```
245
+
246
+ **Solution**: Ensure commits follow conventional format and have appropriate types.
247
+
248
+ #### 4. โŒ Tests Failing in CI
249
+
250
+ ```bash
251
+ Tests are failing on multiple Node.js versions
252
+ ```
253
+
254
+ **Solution**: Run tests locally on Node.js 18+ and fix compatibility issues.
255
+
256
+ ### ๐Ÿ”„ Manual Recovery
257
+
258
+ #### Emergency Release
259
+
260
+ If automated release fails:
261
+
262
+ ```bash
263
+ # 1. Create manual release
264
+ npm version patch # or minor/major
265
+ git push origin main --tags
266
+
267
+ # 2. Publish to NPM
268
+ npm publish
269
+
270
+ # 3. Create GitHub release manually
271
+ ```
272
+
273
+ #### Rollback Release
274
+
275
+ If release has issues:
276
+
277
+ ```bash
278
+ # 1. Deprecate NPM version
279
+ npm deprecate jell-utils@X.X.X "Version withdrawn due to issues"
280
+
281
+ # 2. Revert git commits
282
+ git revert <commit-hash>
283
+ git push origin main
284
+ ```
285
+
286
+ ---
287
+
288
+ ## ๐Ÿ“Š Monitoring & Analytics
289
+
290
+ ### Release Notifications
291
+
292
+ - โœ… **Slack alerts** for successful/failed releases
293
+ - โœ… **GitHub issues** created for failed deployments
294
+ - โœ… **Email notifications** via GitHub settings
295
+
296
+ ### Package Analytics
297
+
298
+ - ๐Ÿ“ˆ **NPM download stats**: https://npm-stat.com/charts.html?package=jell-utils
299
+ - ๐Ÿ” **Bundle size analysis**: Automated in CI pipeline
300
+ - ๐Ÿ“Š **Test coverage reports**: Generated with each release
301
+
302
+ ---
303
+
304
+ ## ๐Ÿค Contributing
305
+
306
+ ### Quick Start for Contributors
307
+
308
+ 1. Fork the repository
309
+ 2. Create feature branch: `git checkout -b feat/amazing-feature`
310
+ 3. Make changes with conventional commits
311
+ 4. Push and create PR
312
+ 5. Wait for CI to pass
313
+ 6. Merge and automatic release!
314
+
315
+ ### Commit Examples
316
+
317
+ ```bash
318
+ # New feature
319
+ git commit -m "feat: add parseTime millisecond support"
320
+
321
+ # Bug fix
322
+ git commit -m "fix: handle null values in clone function"
323
+
324
+ # Documentation
325
+ git commit -m "docs: add deployment guide"
326
+
327
+ # Breaking change
328
+ git commit -m "feat!: remove deprecated API methods
329
+
330
+ BREAKING CHANGE: parseOldFormat() has been removed, use parseTime() instead"
331
+ ```
332
+
333
+ ---
334
+
335
+ ## ๐Ÿ”— Useful Links
336
+
337
+ - ๐Ÿ“š **[Conventional Commits](https://conventionalcommits.org/)**
338
+ - ๐Ÿ“– **[Semantic Release](https://semantic-release.gitbook.io/)**
339
+ - ๐Ÿš€ **[GitHub Actions](https://docs.github.com/en/actions)**
340
+ - ๐Ÿ“ฆ **[NPM Package](https://www.npmjs.com/package/jell-utils)**
341
+ - ๐Ÿ  **[Repository](https://github.com/jellive/jell-utils.js)**
342
+
343
+ ---
344
+
345
+ ## ๐Ÿ†˜ Support
346
+
347
+ - ๐Ÿ› **Bug reports**: [Create GitHub Issue](https://github.com/jellive/jell-utils.js/issues/new?template=bug_report.md)
348
+ - ๐Ÿ’ก **Feature requests**: [Create GitHub Issue](https://github.com/jellive/jell-utils.js/issues/new?template=feature_request.md)
349
+ - ๐Ÿ’ฌ **Questions**: [GitHub Discussions](https://github.com/jellive/jell-utils.js/discussions)
350
+
351
+ _Last updated: $(date)_
package/README.md CHANGED
@@ -10,6 +10,8 @@
10
10
 
11
11
  This is personal project.
12
12
 
13
+ ## Change log
14
+
13
15
  ## License
14
16
 
15
17
  [MIT](LICENSE)