Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 7 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"files": {
"ignore": ["node_modules", "dist", ".piv-loop", "bun.lock"]
"ignore": [
"node_modules",
"dist",
".piv-loop",
"bun.lock",
"adhd-ai.local.config.ts"
]
},
"formatter": {
"enabled": true
Expand Down
2 changes: 1 addition & 1 deletion bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "adhd.ai",
"version": "0.1.0",
"name": "adhdai",
"version": "0.0.1",
"license": "MIT",
"private": true,
"private": false,
"type": "module",
"files": ["dist", "README.md", "LICENSE"],
"bin": {
"adhd-ai": "./src/index.ts"
"adhd-ai": "./dist/index.js"
},
"scripts": {
"build": "bun build ./src/index.ts --target bun --outdir dist",
Expand All @@ -17,6 +18,7 @@
"lint": "biome lint .",
"check": "biome check .",
"check:write": "biome check --write .",
"prepare:publish": "bun run check && bun run typecheck && bun test && bun run build && npm pack --dry-run --ignore-scripts",
"prepare": "husky"
},
"devDependencies": {
Expand Down
24 changes: 24 additions & 0 deletions tests/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,18 @@ describe("loadConfig", () => {
process.env.RESEND_API_KEY = "re_test_key";
process.env.RESEND_FROM = "ADHD.ai <ops@example.com>";
process.env.RESEND_TO = "a@example.com,b@example.com";
await writeFile(
path.join(tempDir, "adhd-ai.config.ts"),
[
"export default {",
" projects: [",
" { id: 'default' }",
" ]",
"};",
"",
].join("\n"),
);

try {
const config = await loadConfig(tempDir);
expect(config.notifications.email.enabled).toBe(true);
Expand Down Expand Up @@ -327,6 +339,18 @@ describe("loadConfig", () => {
process.env.RESEND_API_KEY = "re_test_key";
process.env.RESEND_FROM = "";
process.env.RESEND_TO = "a@example.com";
await writeFile(
path.join(tempDir, "adhd-ai.config.ts"),
[
"export default {",
" projects: [",
" { id: 'default' }",
" ]",
"};",
"",
].join("\n"),
);

try {
await expect(loadConfig(tempDir)).rejects.toThrow(
"notifications.email.from (or RESEND_FROM) is required when email notifications are enabled",
Expand Down
29 changes: 29 additions & 0 deletions tests/package-metadata.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { describe, expect, it } from "bun:test";
import { readFile } from "node:fs/promises";
import path from "node:path";

describe("package metadata for npm publish prep", () => {
it("matches publish preparation contract", async () => {
const packageJsonPath = path.join(process.cwd(), "package.json");
const packageJsonRaw = await readFile(packageJsonPath, "utf8");
const packageJson = JSON.parse(packageJsonRaw) as {
name?: string;
version?: string;
private?: boolean;
scripts?: Record<string, string>;
};

expect(packageJson.name).toBe("adhdai");
expect(packageJson.version).toBe("0.0.1");
expect(packageJson.private).toBe(false);
expect(packageJson.scripts?.["prepare:publish"]).toContain("bun run check");
expect(packageJson.scripts?.["prepare:publish"]).toContain(
"bun run typecheck",
);
expect(packageJson.scripts?.["prepare:publish"]).toContain("bun test");
expect(packageJson.scripts?.["prepare:publish"]).toContain("bun run build");
expect(packageJson.scripts?.["prepare:publish"]).toContain(
"npm pack --dry-run --ignore-scripts",
);
});
});
Loading