@hobenakicoffee/libraries 0.0.2 → 0.0.4

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/README.md CHANGED
@@ -1,14 +1,36 @@
1
1
  # @hobenakicoffee/libraries
2
2
 
3
- Necessary public libraries for "হবে নাকি Coffee?" projects. Framework-agnostic and reusable.
3
+ Framework-agnostic shared libraries for “হবে নাকি Coffee?” projects.
4
4
 
5
- ## Installation
5
+ ## Quick start
6
+
7
+ Install the package from npm:
8
+
9
+ ```bash
10
+ npm install @hobenakicoffee/libraries
11
+ # or
12
+ pnpm add @hobenakicoffee/libraries
13
+ # or
14
+ yarn add @hobenakicoffee/libraries
15
+ # or
16
+ bun add @hobenakicoffee/libraries
17
+ ```
18
+
19
+ Use it in your app:
20
+
21
+ ```ts
22
+ import { SOME_CONSTANT } from "@hobenakicoffee/libraries";
23
+ ```
24
+
25
+ ## Local development
26
+
27
+ Install dependencies:
6
28
 
7
29
  ```bash
8
30
  bun install
9
31
  ```
10
32
 
11
- ## Development
33
+ Common tasks:
12
34
 
13
35
  ```bash
14
36
  # Run in watch mode during development
@@ -24,7 +46,7 @@ bun run test
24
46
  bun run test:watch
25
47
  ```
26
48
 
27
- ## Building
49
+ Build artifacts:
28
50
 
29
51
  ```bash
30
52
  # Build the library
@@ -34,15 +56,7 @@ bun run build
34
56
  bun run clean
35
57
  ```
36
58
 
37
- ## Publishing
38
-
39
- The library will automatically build before publishing:
40
-
41
- ```bash
42
- npm publish
43
- ```
44
-
45
- ## Project Structure
59
+ ## Project structure
46
60
 
47
61
  ```
48
62
  src/
@@ -51,8 +65,20 @@ src/
51
65
  index.ts
52
66
  ```
53
67
 
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.
68
+ ## Release & publish
69
+
70
+ Publishing is automated on push to the `main` branch via GitHub Actions. Ensure:
71
+
72
+ - `package.json` version is updated.
73
+ - `NPM_TOKEN` secret is set in the repo with publish permissions.
74
+
75
+ For local publish (if needed):
76
+
77
+ ```bash
78
+ npm publish --access public
79
+ ```
55
80
 
56
- ## Resources
81
+ ## Notes
57
82
 
58
- To generate supabase types, [follow this documentation](https://supabase.com/docs/guides/api/rest/generating-types)
83
+ - This project uses Bun for development and builds.
84
+ - To generate supabase types, follow https://supabase.com/docs/guides/api/rest/generating-types
@@ -1,4 +1,5 @@
1
- export const SupporterPlatforms = {
1
+ // src/constants/index.ts
2
+ var SupporterPlatforms = {
2
3
  FACEBOOK: "facebook",
3
4
  X: "x",
4
5
  INSTAGRAM: "instagram",
@@ -16,20 +17,17 @@ export const SupporterPlatforms = {
16
17
  MEDIUM: "medium",
17
18
  DEVTO: "devto",
18
19
  BEHANCE: "behance",
19
- DRIBBBLE: "dribbble",
20
- } as const;
21
-
22
- export type SupporterPlatform =
23
- (typeof SupporterPlatforms)[keyof typeof SupporterPlatforms];
24
-
25
- export const PaymentStatuses = {
20
+ DRIBBBLE: "dribbble"
21
+ };
22
+ var PaymentStatuses = {
26
23
  PENDING: "pending",
27
24
  COMPLETED: "completed",
28
25
  FAILED: "failed",
29
26
  CANCELLED: "cancelled",
30
27
  REFUNDED: "refunded",
31
- REVIEWING: "reviewing",
32
- } as const;
33
-
34
- export type PaymentStatus =
35
- (typeof PaymentStatuses)[keyof typeof PaymentStatuses];
28
+ REVIEWING: "reviewing"
29
+ };
30
+ export {
31
+ SupporterPlatforms,
32
+ PaymentStatuses
33
+ };
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@hobenakicoffee/libraries",
3
- "version": "0.0.2",
4
- "module": "src/index.ts",
3
+ "version": "0.0.4",
4
+ "main": "dist/index.js",
5
+ "module": "dist/index.js",
5
6
  "type": "module",
7
+ "files": [
8
+ "dist"
9
+ ],
6
10
  "scripts": {
7
11
  "build": "bun build src/index.ts --outdir dist --target node",
8
12
  "dev": "bun --watch src/index.ts",
@@ -18,5 +22,8 @@
18
22
  },
19
23
  "peerDependencies": {
20
24
  "typescript": "^5"
25
+ },
26
+ "publishConfig": {
27
+ "access": "public"
21
28
  }
22
29
  }
@@ -1,39 +0,0 @@
1
- name: Publish to npm
2
-
3
- on:
4
- push:
5
- tags:
6
- - "v*.*.*"
7
-
8
- jobs:
9
- publish:
10
- runs-on: ubuntu-latest
11
- permissions:
12
- contents: read
13
- id-token: write
14
- steps:
15
- - name: Checkout
16
- uses: actions/checkout@v4
17
-
18
- - name: Setup Bun
19
- uses: oven-sh/setup-bun@v1
20
- with:
21
- bun-version: latest
22
-
23
- - name: Install dependencies
24
- run: bun install
25
-
26
- - name: Run tests
27
- run: bun run test
28
-
29
- - name: Build
30
- run: bun run build
31
-
32
- - name: Setup Node.js for npm publish
33
- uses: actions/setup-node@v4
34
- with:
35
- node-version: 20
36
- registry-url: https://registry.npmjs.org/
37
-
38
- - name: Publish
39
- run: npm publish --access public
package/bun.lock DELETED
@@ -1,25 +0,0 @@
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
- }
@@ -1,114 +0,0 @@
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
- });
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./constants";
package/tsconfig.json DELETED
@@ -1,29 +0,0 @@
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
- }