Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
86ba26b
feat(cli): add pipe support and improve data handling
adiled Jun 15, 2025
d8e0f4d
test(cli): add comprehensive test cases for CLI functionality
adiled Jun 15, 2025
7c91fc3
feat(cli): integrate resampling functionality
adiled Jun 15, 2025
7eb4387
chore: bump version to 1.3.0
adiled Jun 15, 2025
5e9fbe9
chore: remove unused test data files
adiled Jun 15, 2025
f6ddebd
feat(cli): add format detection for pipe input
adiled Jun 15, 2025
7df5f5f
feat(cli): add support for raw text input through pipes
adiled Jun 15, 2025
8cb37d8
Robust error handling for CLI, improved test reliability, fixed ENOEN…
adiled Jun 15, 2025
4eb6e72
Update tests for invalid JSON, invalid CSV, and custom timeframes
adiled Jun 15, 2025
e68616a
fix: robust error handling for invalid CSV/JSON and update tests to c…
adiled Jun 15, 2025
2e5abfa
refactor: remove fast-csv dependency and implement custom CSV writer
adiled Jun 15, 2025
4e068f4
docs: improve function documentation to focus on behavior
adiled Jun 15, 2025
fdbce6f
docs: update CLI usage documentation to match current implementation
adiled Jun 15, 2025
8c7c932
refactor(lib)!: drop default export aliases, add overloads, fix JSDoc
adiled May 9, 2026
540f98e
feat(cli)!: wire --input-format, add --shape flag, refactor internals
adiled May 9, 2026
88317d8
chore(release)!: 2.0.0 — fix bin, modernize tooling, update CI
adiled May 9, 2026
4804f3b
chore(test): migrate jest → vitest
adiled May 9, 2026
8c63d11
fix(release): keep backward compatibility, target 1.4.0
adiled May 9, 2026
deee26f
ci: add tag-triggered npm publish workflow with provenance
adiled May 9, 2026
22f5603
ci: adopt Changesets for release management
adiled May 9, 2026
a03aa3e
chore: clean stale docs and tooling references
adiled May 9, 2026
c370c6a
Merge remote-tracking branch 'origin/main' into feat/cli-improvements
adiled May 9, 2026
0b028a5
docs: document hosting independence and manual release flow
adiled May 9, 2026
0cc9b6c
ci: switch release flow from PR-driven to direct-commit
adiled May 9, 2026
843a868
fix(lib): preserve union-typed call signature for resampleOhlcv
adiled May 9, 2026
38c010e
fix(release): leave package.json#version untouched, let Changesets drive
adiled May 9, 2026
674d0d1
chore(deps)!: bump to current-LTS Node + latest deps + TS 6 + vitest 4
adiled May 9, 2026
4246856
docs(readme): strip maintainer sections — README is the marketing pitch
adiled May 9, 2026
c899689
feat(dist): add install.sh + bun-compiled standalone binaries
adiled May 9, 2026
43672e6
refactor(dist): drop bun-compile, install.sh now BYO-Nodes if needed
adiled May 9, 2026
f705ea4
feat(install): add --uninstall mode
adiled May 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Changesets

This directory holds the source of truth for release notes and version bumps.

## How it works

Every PR that affects users (or anything you'd want to mention in a release) carries a markdown file in this directory. The CI workflow `release.yml` consumes these files when publishing.

## Adding a changeset

```bash
pnpm changeset
```

The CLI prompts for:
1. Bump type — `patch` (bugfix), `minor` (backward-compatible feature), or `major` (breaking change).
2. A summary — used as the release note.

It writes a file like `.changeset/quiet-foxes-paint.md`. Commit it alongside your code change.

## Manual format

If you'd rather write the file directly (LLM-friendly), the format is:

```markdown
---
"ohlc-resample": minor
---

One-line summary of the change.

Optional longer description in markdown. Bullets, code blocks, links — whatever
makes the release note useful.
```

The filename can be anything ending in `.md` other than `README.md` and `config.json`.

## What happens after merge

1. PR with code + changeset → merges to `main`
2. `release.yml` opens (or updates) a "Version Packages" PR that:
- Bumps `package.json#version`
- Prepends a `CHANGELOG.md` section assembled from pending changesets
- Deletes the consumed changeset files
3. Merging the Version Packages PR triggers `release.yml` again, which:
- Publishes to npm with provenance
- Creates a `vX.Y.Z` git tag
- Creates a GitHub Release with the CHANGELOG entry as the body

Trivial changes (typos, internal refactors that don't affect users) don't need a changeset.

## Reference

- https://github.com/changesets/changesets
- https://github.com/changesets/action
14 changes: 14 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
"changelog": [
"@changesets/changelog-github",
{ "repo": "adiled/ohlc-resample" }
],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
38 changes: 38 additions & 0 deletions .changeset/working-cli-and-modern-tooling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
"ohlc-resample": major
---

Working CLI, vitest, modernized tooling. Closes #8.

**Breaking change**

- `engines.node` bumped from `>=20.12.2` to `>=22.12.0` (current LTS floor). The runtime API surface is unchanged — this is purely an install-constraint update. Library consumers on Node 22+ see no behavioural difference.

**Distribution**

- New `install.sh` for non-Node users: `curl -fsSL https://github.com/adiled/ohlc-resample/raw/main/install.sh | sh`. The installer uses your existing Node ≥22.12 if present; otherwise it downloads the official Node binary distribution from nodejs.org into `~/.ohlc/runtime/` and uses that. The package itself is the only release artifact — no per-platform binaries.

**CLI** (was a non-functional stub in 1.x; now ships)

- `--input-format <csv|json|auto>` honors the requested format (was a no-op heuristic).
- New `-s, --shape <object|array|auto>` for OHLCV tuple vs object JSON output. Auto-detects shape on JSON input and preserves it through the pipeline by default.
- `-i` always wins over stdin, even in non-TTY contexts (CI, scripts).
- Malformed CSV rows reported to stderr; zero valid rows now exits non-zero instead of producing empty output.
- `bin.ohlc` → `dist/cli.js` (was `src/cli.ts`, non-functional post-install).
- SIGINT/SIGTERM preserve a previously-set non-zero exit code.

**Library**

- `resampleOhlcv` now has overloaded signatures so the return type follows the input shape (`OHLCV[]` in → `OHLCV[]` out, same for `IOHLCV[]`). The original union signature is preserved as a third overload, so 1.x TS callers with union-typed data still compile.
- Types (`IOHLCV`, `OHLCV`, `TradeTick`, etc.) are now re-exported from the package entrypoint.
- Fixed inverted JSDoc on `resampleOhlcvArray`.
- The legacy `default` export with `resample_ohlcv`, `array`, `json`, `trade_to_candle`, `tick_chart` aliases is preserved unchanged.

**Build & tooling**

- Test runner migrated jest → vitest 4. Cold-start time ~9s → ~2.5s.
- TypeScript bumped to 6.x; tsconfig modernized (`target: es2022`, `lib: es2022`, explicit `types: ["node"]`).
- Releases managed by [Changesets](https://github.com/changesets/changesets) with a direct-commit workflow: a push to `main` with a changeset triggers bump + commit + npm publish (with provenance) + tag + GitHub Release in a single CI run.
- Dropped unused `chalk`, `coveralls`, `fast-csv` deps; moved `ts-node` to devDependencies.
- CI workflow: triggers on `main`, runs Node 22.x and 24.x.
- Removed obsolete `.npmignore`, dropped stale `deprecated.md`, cleaned coveralls/yarn/master references from README.
31 changes: 14 additions & 17 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
push:
branches: [ master ]
branches: [main]
pull_request:
branches: [ master ]
branches: [main]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [10.x, 12.x]

node-version: [22.x, 24.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build
- run: npm test
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: pnpm/action-setup@v4
with:
version: 9
- run: pnpm install --frozen-lockfile
- run: pnpm run build
- run: pnpm test
100 changes: 100 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Release workflow.
#
# Fires on every push to `main`. The decision to release is driven entirely by
# what's in `.changeset/`:
#
# - If pending `.changeset/*.md` files exist, the workflow runs the changesets
# CLI to bump `package.json#version`, regenerate `CHANGELOG.md`, and delete
# the consumed changeset files. It commits and pushes those changes to main
# (with `[skip ci]` so the bot's own commit doesn't re-trigger this workflow),
# then publishes to npm with provenance, tags `vX.Y.Z`, and creates a
# matching GitHub Release.
#
# - If there are no pending changesets, the workflow exits cleanly. Nothing
# to release.
#
# All of this happens in a single workflow run from one push to main.
#
# The npm tarball is the only release artifact. `install.sh` (run client-side
# by users) handles platform-specific work, including bringing a Node runtime
# along when the user doesn't have one. No per-platform binaries are built or
# uploaded.
#
# One-time setup:
# - In repo Settings → Secrets and variables → Actions, add `NPM_TOKEN`
# (an npm "Granular Access Token" with read+write on this package).

name: Release

on:
push:
branches: [main]

# Prevent two release runs from racing each other.
concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write # push the bump commit + tag, create GH Release
id-token: write # npm provenance (OIDC)
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # full history; changesets needs it

- uses: pnpm/action-setup@v4
with:
version: 10

- uses: actions/setup-node@v4
with:
node-version: 24.x
cache: pnpm
registry-url: https://registry.npmjs.org

- run: pnpm install --frozen-lockfile
- run: pnpm run build
- run: pnpm test

- name: Apply pending changesets and publish
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
set -euo pipefail

# Consume any pending changesets — bumps version, updates CHANGELOG,
# deletes the consumed .changeset/*.md files. No-op if none pending.
pnpm changeset version

if [[ -z $(git status --porcelain) ]]; then
echo "No pending changesets — nothing to release."
exit 0
fi

VERSION=$(node -p "require('./package.json').version")
TAG="v${VERSION}"

git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add -A
git commit -m "chore(release): ${TAG} [skip ci]"
git push origin HEAD:main

# Publish first so a push success + publish failure doesn't leave a
# phantom version on main. (npm rejects duplicate versions, so a
# retried run is safe.)
pnpm publish --no-git-checks --access public --provenance

git tag "${TAG}"
git push origin "${TAG}"

# Extract the just-prepended CHANGELOG entry (everything between the
# first `## ` heading and the next one, minus the heading itself) and
# use it as the GitHub Release body.
awk '/^## /{i++} i==1' CHANGELOG.md | tail -n +2 > /tmp/release-notes.md
gh release create "${TAG}" \
--title "${TAG}" \
--notes-file /tmp/release-notes.md
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,7 @@ typings/
build/
dist/
.coveralls.yml

# Local agent context — kept out of the repo
AGENTS.md
CLAUDE.md
15 changes: 0 additions & 15 deletions .npmignore

This file was deleted.

1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# ohlc-resample
Loading
Loading