Skip to content

Commit 3b338e4

Browse files
committed
feat: monorepo
1 parent a03cce7 commit 3b338e4

54 files changed

Lines changed: 239 additions & 185 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yaml‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ jobs:
4444
bun-version: latest
4545
- run: bun install --frozen-lockfile
4646
- run: bunx [email protected] publish --bun
47+
working-directory: packages/ccusage
4748

4849
spell-check:
4950
runs-on: ubuntu-latest
@@ -67,15 +68,15 @@ jobs:
6768
run: bun run generate:schema
6869
- name: Check if schema files are up-to-date
6970
run: |
70-
if git diff --exit-code config-schema.json docs/public/config-schema.json; then
71+
if git diff --exit-code packages/ccusage/config-schema.json docs/public/config-schema.json; then
7172
echo "✅ Schema files are up-to-date"
7273
else
7374
echo "❌ Schema files are not up-to-date. Please run 'bun run generate:schema' and commit the changes."
7475
echo ""
7576
echo "Changed files:"
76-
git diff --name-only config-schema.json docs/public/config-schema.json
77+
git diff --name-only packages/ccusage/config-schema.json docs/public/config-schema.json
7778
echo ""
7879
echo "Diff:"
79-
git diff config-schema.json docs/public/config-schema.json
80+
git diff packages/ccusage/config-schema.json docs/public/config-schema.json
8081
exit 1
8182
fi

‎.github/workflows/release.yaml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
tags:
66
- '*'
77

8+
env:
9+
PACKAGE_DIR: packages/ccusage
10+
811
jobs:
912
npm:
1013
runs-on: ubuntu-latest

‎bun.lock‎

Lines changed: 85 additions & 64 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎bunfig.toml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[install]
2+
linker = "isolated"

‎docs/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"description": "Documentation for ccusage",
66
"type": "module",
77
"scripts": {
8-
"build": "bun run docs:api && cp ../config-schema.json public/config-schema.json && vitepress build",
8+
"build": "bun run docs:api && cp ../packages/ccusage/config-schema.json public/config-schema.json && vitepress build",
99
"deploy": "wrangler deploy",
10-
"dev": "bun run docs:api && cp ../config-schema.json public/config-schema.json && vitepress dev",
10+
"dev": "bun run docs:api && cp ../packages/ccusage/config-schema.json public/config-schema.json && vitepress dev",
1111
"docs:api": "./update-api-index.ts",
1212
"preview": "vitepress preview"
1313
},

‎docs/tsconfig.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "../tsconfig.json",
2+
"extends": "../packages/ccusage/tsconfig.json",
33
"compilerOptions": {
44
"allowImportingTsExtensions": false,
55
"allowJs": true,

‎docs/typedoc.config.mjs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@ import { globSync } from 'tinyglobby'
33

44
const entryPoints = [
55
...globSync([
6-
'../src/*.ts',
7-
'!../src/**/*.test.ts', // Exclude test files
8-
'!../src/_*.ts', // Exclude internal files with underscore prefix
6+
'../packages/ccusage/src/*.ts',
7+
'!../packages/ccusage/src/**/*.test.ts', // Exclude test files
8+
'!../packages/ccusage/src/_*.ts', // Exclude internal files with underscore prefix
99
], {
1010
absolute: false,
1111
onlyFiles: true,
1212
}),
13-
'../src/_consts.ts', // Include constants for documentation
13+
'../packages/ccusage/src/_consts.ts', // Include constants for documentation
1414
];
1515

1616
/** @type {import('typedoc').TypeDocOptions & import('typedoc-plugin-markdown').PluginOptions & { docsRoot?: string } } */
1717
export default {
1818
// typedoc options
1919
// ref: https://typedoc.org/documents/Options.html
2020
entryPoints,
21-
tsconfig: '../tsconfig.json',
21+
tsconfig: '../packages/ccusage/tsconfig.json',
2222
out: 'api',
2323
plugin: ['typedoc-plugin-markdown', 'typedoc-vitepress-theme'],
2424
readme: 'none',

‎package.json‎

Lines changed: 20 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,120 +1,35 @@
11
{
2-
"name": "ccusage",
2+
"name": "ccusage-monorepo",
3+
"private": true,
34
"type": "module",
4-
"version": "16.2.5",
5-
"description": "Usage analysis tool for Claude Code",
6-
"author": "ryoppippi",
7-
"license": "MIT",
8-
"funding": "https://github.com/ryoppippi/ccusage?sponsor=1",
9-
"homepage": "https://github.com/ryoppippi/ccusage#readme",
10-
"repository": {
11-
"type": "git",
12-
"url": "git+https://github.com/ryoppippi/ccusage.git"
13-
},
14-
"bugs": {
15-
"url": "https://github.com/ryoppippi/ccusage/issues"
16-
},
17-
"exports": {
18-
".": "./dist/index.js",
19-
"./calculate-cost": "./dist/calculate-cost.js",
20-
"./data-loader": "./dist/data-loader.js",
21-
"./debug": "./dist/debug.js",
22-
"./logger": "./dist/logger.js",
23-
"./mcp": "./dist/mcp.js",
24-
"./pricing-fetcher": "./dist/pricing-fetcher.js",
25-
"./package.json": "./package.json"
26-
},
27-
"main": "./dist/index.js",
28-
"module": "./dist/index.js",
29-
"types": "./dist/index.d.ts",
30-
"bin": "./dist/index.js",
31-
"files": [
32-
"config-schema.json",
33-
"dist"
34-
],
355
"workspaces": [
36-
".",
6+
"packages/*",
377
"docs"
388
],
39-
"engines": {
40-
"node": ">=20.19.4"
41-
},
429
"scripts": {
43-
"build": "bun run generate:schema && tsdown",
44-
"docs:build": "cd docs && bun run build",
45-
"docs:deploy": "cd docs && bun run deploy",
46-
"docs:dev": "cd docs && bun run dev",
47-
"docs:preview": "cd docs && bun run preview",
48-
"format": "bun run lint --fix",
49-
"generate:schema": "bun run scripts/generate-json-schema.ts",
10+
"build": "bun run --filter '*' build",
11+
"docs:dev": "bun run --cwd docs dev",
12+
"format": "bun run --filter '*' format",
5013
"preinstall": "npx only-allow bun",
51-
"lint": "eslint --cache .",
52-
"mcp": "bunx @modelcontextprotocol/inspector bun run start mcp",
53-
"prepack": "bun run build && bun clean-pkg-json -r scripts.preinstall",
54-
"prepare": "git config --local core.hooksPath .githooks && bun run generate:schema && ln -s ./CLAUDE.md ./AGENTS.md || true",
55-
"release": "bun lint && bun typecheck && vitest && bun run build && bumpp",
56-
"start": "bun run ./src/index.ts",
57-
"test": "TZ=UTC vitest",
58-
"test:statusline": "cat test/statusline-test.json | bun run start statusline",
59-
"test:statusline:all": "echo 'Testing Sonnet 4:' && bun run test:statusline:sonnet4 && echo 'Testing Opus 4.1:' && bun run test:statusline:opus4 && echo 'Testing Sonnet 4.1:' && bun run test:statusline:sonnet41",
60-
"test:statusline:opus4": "cat test/statusline-test-opus4.json | bun run start statusline --offline",
61-
"test:statusline:sonnet4": "cat test/statusline-test-sonnet4.json | bun run start statusline --offline",
62-
"test:statusline:sonnet41": "cat test/statusline-test-sonnet41.json | bun run start statusline --offline",
63-
"typecheck": "tsgo --noEmit"
64-
},
65-
"devDependencies": {
66-
"@antfu/utils": "^9.2.0",
67-
"@hono/mcp": "^0.1.4",
68-
"@hono/node-server": "^1.19.2",
69-
"@mizchi/lsmcp": "^0.10.0",
70-
"@modelcontextprotocol/sdk": "^1.17.3",
71-
"@oxc-project/runtime": "^0.82.3",
72-
"@praha/byethrow": "^0.6.3",
73-
"@praha/byethrow-mcp": "^0.1.2",
74-
"@ryoppippi/eslint-config": "^0.3.7",
75-
"@ryoppippi/limo": "npm:@jsr/ryoppippi__limo@^0.2.2",
76-
"@std/async": "npm:@jsr/std__async@^1.0.14",
77-
"@types/bun": "^1.2.20",
78-
"@typescript/native-preview": "^7.0.0-dev.20250821.1",
79-
"ansi-escapes": "^7.0.0",
80-
"bumpp": "^10.2.3",
81-
"clean-pkg-json": "^1.3.0",
82-
"cli-table3": "^0.6.5",
83-
"consola": "^3.4.2",
84-
"es-toolkit": "^1.39.10",
85-
"eslint": "^9.33.0",
86-
"eslint-plugin-format": "^1.0.1",
87-
"fast-sort": "^3.4.1",
88-
"fs-fixture": "^2.8.1",
89-
"get-stdin": "^9.0.0",
90-
"gunshi": "^0.26.3",
91-
"hono": "^4.9.2",
92-
"lint-staged": "^16.1.5",
93-
"nano-spawn": "^1.0.2",
94-
"p-limit": "^7.1.0",
95-
"path-type": "^6.0.0",
96-
"picocolors": "^1.1.1",
97-
"pretty-ms": "^9.2.0",
98-
"publint": "^0.3.12",
99-
"sort-package-json": "^3.4.0",
100-
"string-width": "^7.2.0",
101-
"tinyglobby": "^0.2.14",
102-
"tsdown": "^0.14.1",
103-
"type-fest": "^4.41.0",
104-
"unplugin-macros": "^0.18.0",
105-
"unplugin-unused": "^0.5.2",
106-
"vitest": "^3.2.4",
107-
"xdg-basedir": "^5.1.0",
108-
"zod": "^3.25.67"
14+
"lint": "bun run --filter '*' lint",
15+
"prepare": "git config --local core.hooksPath .githooks && (ln -s ./CLAUDE.md ./AGENTS.md || true)",
16+
"release": "bun bumpp -r"
10917
},
11018
"lint-staged": {
11119
"*": [
112-
"eslint --cache --fix",
113-
"bun run generate:schema",
114-
"bun vitest --passWithNoTests"
20+
"bun run format"
11521
],
11622
"package.json": [
117-
"sort-package-json"
23+
"bun sort-package-json"
11824
]
25+
},
26+
"devDependencies": {
27+
"bumpp": "^10.2.3",
28+
"lint-staged": "^16.1.5",
29+
"sort-package-json": "^3.4.0"
30+
},
31+
"packageManager": "[email protected]",
32+
"engines": {
33+
"node": ">=20.19.4"
11934
}
12035
}
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ import { ryoppippi } from '@ryoppippi/eslint-config';
33
export default ryoppippi({
44
type: 'lib',
55
svelte: false,
6-
typescript: {
7-
tsconfigPath: './tsconfig.json',
8-
},
96
ignores: [
107
'docs/**',
118
'.lsmcp',

0 commit comments

Comments
 (0)