@hobenakicoffee/libraries 0.0.1
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.
- package/.github/workflows/publish.yml +40 -0
- package/README.md +58 -0
- package/bun.lock +25 -0
- package/package.json +22 -0
- package/src/constants/index.test.ts +114 -0
- package/src/constants/index.ts +35 -0
- package/src/index.ts +1 -0
- package/tsconfig.json +29 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: Publish to npm
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Setup Bun
|
|
18
|
+
uses: oven-sh/setup-bun@v1
|
|
19
|
+
with:
|
|
20
|
+
bun-version: latest
|
|
21
|
+
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: bun install
|
|
24
|
+
|
|
25
|
+
- name: Run tests
|
|
26
|
+
run: bun run test
|
|
27
|
+
|
|
28
|
+
- name: Build
|
|
29
|
+
run: bun run build
|
|
30
|
+
|
|
31
|
+
- name: Setup Node.js for npm publish
|
|
32
|
+
uses: actions/setup-node@v4
|
|
33
|
+
with:
|
|
34
|
+
node-version: 20
|
|
35
|
+
registry-url: https://registry.npmjs.org/
|
|
36
|
+
|
|
37
|
+
- name: Publish
|
|
38
|
+
run: npm publish --access public
|
|
39
|
+
env:
|
|
40
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# @hobenakicoffee/libraries
|
|
2
|
+
|
|
3
|
+
Necessary public libraries for "হবে নাকি Coffee?" projects. Framework-agnostic and reusable.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun install
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Development
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Run in watch mode during development
|
|
15
|
+
bun run dev
|
|
16
|
+
|
|
17
|
+
# Run type checking
|
|
18
|
+
bun run typecheck
|
|
19
|
+
|
|
20
|
+
# Run tests
|
|
21
|
+
bun run test
|
|
22
|
+
|
|
23
|
+
# Run tests in watch mode
|
|
24
|
+
bun run test:watch
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Building
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Build the library
|
|
31
|
+
bun run build
|
|
32
|
+
|
|
33
|
+
# Clean build artifacts
|
|
34
|
+
bun run clean
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Publishing
|
|
38
|
+
|
|
39
|
+
The library will automatically build before publishing:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm publish
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Project Structure
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
src/
|
|
49
|
+
index.ts # Main entry point
|
|
50
|
+
constants/ # Shared constants
|
|
51
|
+
index.ts
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
This project was created using `bun init` in bun v1.2.15. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
|
|
55
|
+
|
|
56
|
+
## Resources
|
|
57
|
+
|
|
58
|
+
To generate supabase types, [follow this documentation](https://supabase.com/docs/guides/api/rest/generating-types)
|
package/bun.lock
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lockfileVersion": 1,
|
|
3
|
+
"workspaces": {
|
|
4
|
+
"": {
|
|
5
|
+
"name": "libraries",
|
|
6
|
+
"devDependencies": {
|
|
7
|
+
"@types/bun": "latest",
|
|
8
|
+
},
|
|
9
|
+
"peerDependencies": {
|
|
10
|
+
"typescript": "^5",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
"packages": {
|
|
15
|
+
"@types/bun": ["@types/bun@1.3.6", "", { "dependencies": { "bun-types": "1.3.6" } }, "sha512-uWCv6FO/8LcpREhenN1d1b6fcspAB+cefwD7uti8C8VffIv0Um08TKMn98FynpTiU38+y2dUO55T11NgDt8VAA=="],
|
|
16
|
+
|
|
17
|
+
"@types/node": ["@types/node@25.0.10", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-zWW5KPngR/yvakJgGOmZ5vTBemDoSqF3AcV/LrO5u5wTWyEAVVh+IT39G4gtyAkh3CtTZs8aX/yRM82OfzHJRg=="],
|
|
18
|
+
|
|
19
|
+
"bun-types": ["bun-types@1.3.6", "", { "dependencies": { "@types/node": "*" } }, "sha512-OlFwHcnNV99r//9v5IIOgQ9Uk37gZqrNMCcqEaExdkVq3Avwqok1bJFmvGMCkCE0FqzdY8VMOZpfpR3lwI+CsQ=="],
|
|
20
|
+
|
|
21
|
+
"typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
|
|
22
|
+
|
|
23
|
+
"undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
|
|
24
|
+
}
|
|
25
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hobenakicoffee/libraries",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"module": "src/index.ts",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "bun build src/index.ts --outdir dist --target node",
|
|
8
|
+
"dev": "bun --watch src/index.ts",
|
|
9
|
+
"test": "bun test",
|
|
10
|
+
"test:watch": "bun test --watch",
|
|
11
|
+
"typecheck": "tsc --noEmit",
|
|
12
|
+
"lint": "bun run typecheck",
|
|
13
|
+
"clean": "rm -rf dist",
|
|
14
|
+
"prepublishOnly": "bun run test && bun run clean && bun run build"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@types/bun": "latest"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"typescript": "^5"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { SupporterPlatforms, PaymentStatuses } from "./index";
|
|
3
|
+
import type { SupporterPlatform, PaymentStatus } from "./index";
|
|
4
|
+
|
|
5
|
+
describe("SupporterPlatforms", () => {
|
|
6
|
+
test("should contain all expected platform keys", () => {
|
|
7
|
+
const expectedKeys = [
|
|
8
|
+
"FACEBOOK",
|
|
9
|
+
"X",
|
|
10
|
+
"INSTAGRAM",
|
|
11
|
+
"YOUTUBE",
|
|
12
|
+
"GITHUB",
|
|
13
|
+
"LINKEDIN",
|
|
14
|
+
"TWITCH",
|
|
15
|
+
"TIKTOK",
|
|
16
|
+
"THREADS",
|
|
17
|
+
"WHATSAPP",
|
|
18
|
+
"TELEGRAM",
|
|
19
|
+
"DISCORD",
|
|
20
|
+
"REDDIT",
|
|
21
|
+
"PINTEREST",
|
|
22
|
+
"MEDIUM",
|
|
23
|
+
"DEVTO",
|
|
24
|
+
"BEHANCE",
|
|
25
|
+
"DRIBBBLE",
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
expect(Object.keys(SupporterPlatforms)).toEqual(expectedKeys);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test("should have correct values for each platform", () => {
|
|
32
|
+
expect(SupporterPlatforms.FACEBOOK).toBe("facebook");
|
|
33
|
+
expect(SupporterPlatforms.X).toBe("x");
|
|
34
|
+
expect(SupporterPlatforms.INSTAGRAM).toBe("instagram");
|
|
35
|
+
expect(SupporterPlatforms.YOUTUBE).toBe("youtube");
|
|
36
|
+
expect(SupporterPlatforms.GITHUB).toBe("github");
|
|
37
|
+
expect(SupporterPlatforms.LINKEDIN).toBe("linkedin");
|
|
38
|
+
expect(SupporterPlatforms.TWITCH).toBe("twitch");
|
|
39
|
+
expect(SupporterPlatforms.TIKTOK).toBe("tiktok");
|
|
40
|
+
expect(SupporterPlatforms.THREADS).toBe("threads");
|
|
41
|
+
expect(SupporterPlatforms.WHATSAPP).toBe("whatsapp");
|
|
42
|
+
expect(SupporterPlatforms.TELEGRAM).toBe("telegram");
|
|
43
|
+
expect(SupporterPlatforms.DISCORD).toBe("discord");
|
|
44
|
+
expect(SupporterPlatforms.REDDIT).toBe("reddit");
|
|
45
|
+
expect(SupporterPlatforms.PINTEREST).toBe("pinterest");
|
|
46
|
+
expect(SupporterPlatforms.MEDIUM).toBe("medium");
|
|
47
|
+
expect(SupporterPlatforms.DEVTO).toBe("devto");
|
|
48
|
+
expect(SupporterPlatforms.BEHANCE).toBe("behance");
|
|
49
|
+
expect(SupporterPlatforms.DRIBBBLE).toBe("dribbble");
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test("should be read-only at compile time", () => {
|
|
53
|
+
// TypeScript prevents modification at compile time with 'as const'
|
|
54
|
+
// This test verifies the structure is correct
|
|
55
|
+
expect(Object.isFrozen(SupporterPlatforms)).toBe(false);
|
|
56
|
+
expect(typeof SupporterPlatforms).toBe("object");
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test("SupporterPlatform type should accept valid platform values", () => {
|
|
60
|
+
const validPlatform: SupporterPlatform = "facebook";
|
|
61
|
+
expect(validPlatform).toBe("facebook");
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test("should have 18 platforms", () => {
|
|
65
|
+
expect(Object.keys(SupporterPlatforms).length).toBe(18);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
describe("PaymentStatuses", () => {
|
|
70
|
+
test("should contain all expected status keys", () => {
|
|
71
|
+
const expectedKeys = [
|
|
72
|
+
"PENDING",
|
|
73
|
+
"COMPLETED",
|
|
74
|
+
"FAILED",
|
|
75
|
+
"CANCELLED",
|
|
76
|
+
"REFUNDED",
|
|
77
|
+
"REVIEWING",
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
expect(Object.keys(PaymentStatuses)).toEqual(expectedKeys);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test("should have correct values for each status", () => {
|
|
84
|
+
expect(PaymentStatuses.PENDING).toBe("pending");
|
|
85
|
+
expect(PaymentStatuses.COMPLETED).toBe("completed");
|
|
86
|
+
expect(PaymentStatuses.FAILED).toBe("failed");
|
|
87
|
+
expect(PaymentStatuses.CANCELLED).toBe("cancelled");
|
|
88
|
+
expect(PaymentStatuses.REFUNDED).toBe("refunded");
|
|
89
|
+
expect(PaymentStatuses.REVIEWING).toBe("reviewing");
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
test("should be read-only at compile time", () => {
|
|
93
|
+
// TypeScript prevents modification at compile time with 'as const'
|
|
94
|
+
// This test verifies the structure is correct
|
|
95
|
+
expect(Object.isFrozen(PaymentStatuses)).toBe(false);
|
|
96
|
+
expect(typeof PaymentStatuses).toBe("object");
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
test("PaymentStatus type should accept valid status values", () => {
|
|
100
|
+
const validStatus: PaymentStatus = "completed";
|
|
101
|
+
expect(validStatus).toBe("completed");
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
test("should have 6 payment statuses", () => {
|
|
105
|
+
expect(Object.keys(PaymentStatuses).length).toBe(6);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
test("all values should be lowercase strings", () => {
|
|
109
|
+
Object.values(PaymentStatuses).forEach((status) => {
|
|
110
|
+
expect(status).toBe(status.toLowerCase() as PaymentStatus);
|
|
111
|
+
expect(typeof status).toBe("string");
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export const SupporterPlatforms = {
|
|
2
|
+
FACEBOOK: "facebook",
|
|
3
|
+
X: "x",
|
|
4
|
+
INSTAGRAM: "instagram",
|
|
5
|
+
YOUTUBE: "youtube",
|
|
6
|
+
GITHUB: "github",
|
|
7
|
+
LINKEDIN: "linkedin",
|
|
8
|
+
TWITCH: "twitch",
|
|
9
|
+
TIKTOK: "tiktok",
|
|
10
|
+
THREADS: "threads",
|
|
11
|
+
WHATSAPP: "whatsapp",
|
|
12
|
+
TELEGRAM: "telegram",
|
|
13
|
+
DISCORD: "discord",
|
|
14
|
+
REDDIT: "reddit",
|
|
15
|
+
PINTEREST: "pinterest",
|
|
16
|
+
MEDIUM: "medium",
|
|
17
|
+
DEVTO: "devto",
|
|
18
|
+
BEHANCE: "behance",
|
|
19
|
+
DRIBBBLE: "dribbble",
|
|
20
|
+
} as const;
|
|
21
|
+
|
|
22
|
+
export type SupporterPlatform =
|
|
23
|
+
(typeof SupporterPlatforms)[keyof typeof SupporterPlatforms];
|
|
24
|
+
|
|
25
|
+
export const PaymentStatuses = {
|
|
26
|
+
PENDING: "pending",
|
|
27
|
+
COMPLETED: "completed",
|
|
28
|
+
FAILED: "failed",
|
|
29
|
+
CANCELLED: "cancelled",
|
|
30
|
+
REFUNDED: "refunded",
|
|
31
|
+
REVIEWING: "reviewing",
|
|
32
|
+
} as const;
|
|
33
|
+
|
|
34
|
+
export type PaymentStatus =
|
|
35
|
+
(typeof PaymentStatuses)[keyof typeof PaymentStatuses];
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./constants";
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// Environment setup & latest features
|
|
4
|
+
"lib": ["ESNext"],
|
|
5
|
+
"target": "ESNext",
|
|
6
|
+
"module": "Preserve",
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"jsx": "react-jsx",
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
|
|
11
|
+
// Bundler mode
|
|
12
|
+
"moduleResolution": "bundler",
|
|
13
|
+
"allowImportingTsExtensions": true,
|
|
14
|
+
"verbatimModuleSyntax": true,
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
|
|
17
|
+
// Best practices
|
|
18
|
+
"strict": true,
|
|
19
|
+
"skipLibCheck": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
|
21
|
+
"noUncheckedIndexedAccess": true,
|
|
22
|
+
"noImplicitOverride": true,
|
|
23
|
+
|
|
24
|
+
// Some stricter flags (disabled by default)
|
|
25
|
+
"noUnusedLocals": false,
|
|
26
|
+
"noUnusedParameters": false,
|
|
27
|
+
"noPropertyAccessFromIndexSignature": false
|
|
28
|
+
}
|
|
29
|
+
}
|