Skip to content

Commit 88317d8

Browse files
committed
chore(release)!: 2.0.0 — fix bin, modernize tooling, update CI
BREAKING CHANGE: `bin.ohlc` now points at `dist/cli.js` (was `src/cli.ts`). The previous binary was non-functional post-install because npm has no way to execute raw TypeScript; this fix changes the resolved path. Combined with the library and CLI breaking changes in the same release, this warrants a major bump. - `bin.ohlc` → `dist/cli.js`; `src/cli.ts` retains its shebang so the emitted JS is directly executable. - Drop unused `chalk` runtime dep; drop `coveralls` devDep. - Move `ts-node` to devDependencies (no longer needed at runtime now that the bin points at compiled JS). - `prebuild` now cleans `dist/` (was incorrectly cleaning `build/`). - `prepublishOnly` simplified: a single test+build pass without the coveralls step that always failed without a token. - Drop obsolete `.npmignore` — superseded by `package.json#files`. - Add `types: dist/index.d.ts` to advertise type declarations. - CI workflow now triggers on `main` (was `master`) and runs Node 20.x and 22.x (was EOL 10.x and 12.x). Switched to pnpm with frozen lockfile, bumped action versions. - Added CHANGELOG.md with the full 2.0.0 breaking-change list.
1 parent 540f98e commit 88317d8

4 files changed

Lines changed: 55 additions & 395 deletions

File tree

.github/workflows/nodejs.yml

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
1-
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3-
41
name: Node.js CI
52

63
on:
74
push:
8-
branches: [ master ]
5+
branches: [main]
96
pull_request:
10-
branches: [ master ]
7+
branches: [main]
118

129
jobs:
1310
build:
14-
1511
runs-on: ubuntu-latest
16-
1712
strategy:
1813
matrix:
19-
node-version: [10.x, 12.x]
20-
14+
node-version: [20.x, 22.x]
2115
steps:
22-
- uses: actions/checkout@v2
23-
- name: Use Node.js ${{ matrix.node-version }}
24-
uses: actions/setup-node@v1
25-
with:
26-
node-version: ${{ matrix.node-version }}
27-
- run: npm ci
28-
- run: npm run build
29-
- run: npm test
16+
- uses: actions/checkout@v4
17+
- name: Use Node.js ${{ matrix.node-version }}
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: ${{ matrix.node-version }}
21+
- uses: pnpm/action-setup@v4
22+
with:
23+
version: 9
24+
- run: pnpm install --frozen-lockfile
25+
- run: pnpm run build
26+
- run: pnpm test

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Changelog
2+
3+
## 2.0.0
4+
5+
### Breaking changes
6+
- **Removed legacy `default` export** from the package entrypoint. The aliases `resample_ohlcv`, `array`, `json`, `trade_to_candle`, and `tick_chart` are gone — use the named exports `resampleOhlcv`, `resampleTicksByTime`, and `resampleTicksByCount` instead.
7+
- **`bin.ohlc` now points at `dist/cli.js`** (was `src/cli.ts`). The previously published binary was non-functional; this fix changes the resolved path post-install.
8+
- **`parseCSV` (CLI helper) now returns `{ rows, skipped }`** instead of `IOHLCV[]`. Internal API; only relevant if you imported it from `ohlc-resample/dist/cli`.
9+
10+
### CLI
11+
- The CLI is now actually functional — replaces the stub in 1.x.
12+
- `--input-format <csv|json|auto>` now actually honors the requested format (was previously a no-op heuristic).
13+
- New `-s, --shape <object|array|auto>` flag for OHLCV tuple vs object JSON output. Closes #8 (the array-of-arrays requirement).
14+
- Auto-detects tuple vs object shape on JSON input and preserves it through the pipeline by default.
15+
- Malformed CSV rows are now reported as a warning to stderr, and a CSV with zero valid rows now exits non-zero instead of producing an empty output.
16+
- SIGINT/SIGTERM no longer clobber a non-zero exit code.
17+
18+
### Library
19+
- `resampleOhlcv` now has overloaded signatures: pass `OHLCV[]` and TypeScript narrows the return to `OHLCV[]`; pass `IOHLCV[]` and you get `IOHLCV[]`.
20+
- Fixed inverted JSDoc on `resampleOhlcvArray`.
21+
- The package now also re-exports types (`IOHLCV`, `OHLCV`, `TradeTick`, etc.) from the entrypoint.
22+
23+
### Build & tooling
24+
- Dropped `fast-csv` dependency (1.x branch removed it; 2.0 ships clean).
25+
- Dropped unused `chalk` dep.
26+
- Moved `ts-node` to `devDependencies`.
27+
- Dropped `coveralls` from `prepublishOnly` (was guaranteed to fail without a token).
28+
- `prebuild` now cleans `dist/` (was cleaning a non-existent `build/`).
29+
- CI workflow updated to trigger on `main` and run Node 20.x / 22.x (was `master` + Node 10/12).
30+
- Removed obsolete `.npmignore` (superseded by `package.json#files`).

package.json

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
{
22
"name": "ohlc-resample",
3-
"version": "1.3.0",
3+
"version": "2.0.0",
44
"description": "Resample (inter-convert) trade, ticks or OHLCV data to different time frames, includes CLI",
55
"main": "dist/index.js",
6+
"types": "dist/index.d.ts",
67
"engines": {
78
"node": ">=20.12.2"
89
},
910
"files": [
1011
"dist"
1112
],
1213
"scripts": {
13-
"prebuild": "rimraf build",
14+
"prebuild": "rimraf dist",
1415
"build": "tsc --build",
1516
"build:check": "node -e \"require('./dist')\"",
16-
"prepublishOnly": "npm test && npm run build && npm run coveralls && npm run build && npm run build:check",
17-
"test": "jest",
18-
"coveralls": "jest --coverage --coverageReporters=text-lcov | coveralls"
17+
"prepublishOnly": "npm test && npm run build && npm run build:check",
18+
"test": "jest"
1919
},
2020
"bin": {
21-
"ohlc": "./src/cli.ts"
21+
"ohlc": "./dist/cli.js"
2222
},
2323
"keywords": [
2424
"ohlc",
@@ -46,15 +46,14 @@
4646
"@types/jest": "^29.5.14",
4747
"@types/lodash": "^4.14.173",
4848
"@types/node": "^24.0.1",
49-
"coveralls": "^3.1.1",
5049
"jest": ">=27.2.1",
5150
"rimraf": "^6.0.1",
5251
"ts-jest": ">=25.1.0",
52+
"ts-node": "^10.9.1",
5353
"typescript": "^5.8.3"
5454
},
5555
"dependencies": {
5656
"commander": "^14.0.0",
57-
"lodash": "^4.17.21",
58-
"ts-node": "^10.9.1"
57+
"lodash": "^4.17.21"
5958
}
6059
}

0 commit comments

Comments
 (0)