hazo_config 2.1.0 → 2.1.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/CHANGE_LOG.md ADDED
@@ -0,0 +1,47 @@
1
+ # Changelog
2
+
3
+ ## 2.1.1
4
+ - chore: add `engines` field (`node >= 18.0.0`) and `prepublishOnly` script
5
+ - chore: widen React peer deps to support React 18 and 19
6
+ - chore: add CHANGE_LOG.md, SETUP_CHECKLIST.md, AGENTS.md, config/ sample, design/ architecture
7
+ - chore: clean up test-app duplicate transitive dependencies
8
+ - chore: update .npmignore for new dev files
9
+
10
+ ## 2.1.0
11
+ - feat: add JSON import/export to AppConfigListEditor
12
+ - Export utility functions: `validate_import_data`, `merge_items`, `export_items_to_json`, `generate_export_filename`
13
+
14
+ ## 2.0.2
15
+ - feat: add AppConfigListEditor component with shadcn/ui
16
+ - Generic CRUD list editor for arrays of structured objects (tags, document types, etc.)
17
+ - Supports field types: text, textarea, color_swatch, select, number, toggle
18
+
19
+ ## 2.0.1
20
+ - chore: add test-app build artifacts to .gitignore
21
+
22
+ ## 2.0.0
23
+ - **BREAKING**: Renamed `org_id` to `scope_id` in `AppConfigItem` and `AppConfigContext`
24
+ - **BREAKING**: Split `config_value` into `config_value_text` and `config_value_json`
25
+ - **BREAKING**: Added `config_type` field (`'general'` | `'json'`)
26
+ - feat: add database-backed AppConfig component with JSON editing support
27
+ - feat: add `useAppConfig` hook for async database operations
28
+ - See `MIGRATION_V2.md` for upgrade guide
29
+
30
+ ## 1.4.2
31
+ - fix: separate server/client exports to prevent Next.js bundling errors
32
+ - Added `hazo_config/server` entry point with `server-only` guard
33
+
34
+ ## 1.4.1
35
+ - fix: update JS output issues
36
+
37
+ ## 1.4.0
38
+ - fix: add missing files to package.json
39
+ - fix: ES module exports with explicit .js extensions
40
+ - Added package development rules
41
+
42
+ ## 1.0.0
43
+ - Initial release
44
+ - HazoConfig class with INI file support, TTL-based caching
45
+ - ConfigViewer and ConfigEditor React components
46
+ - MockConfigProvider for testing
47
+ - Sensitive field masking (auto-detection of passwords, tokens, keys)
@@ -0,0 +1,132 @@
1
+ # Setup Checklist
2
+
3
+ Step-by-step setup for consuming apps using hazo_config.
4
+
5
+ ## 1. Install
6
+
7
+ ```bash
8
+ npm install hazo_config
9
+ ```
10
+
11
+ ## 2. Tailwind CSS Setup
12
+
13
+ ### Tailwind v4
14
+ Add `@source` directive in your globals.css to ensure Tailwind compiles classes from the package:
15
+
16
+ ```css
17
+ @import "tailwindcss";
18
+ @source "../node_modules/hazo_config/dist";
19
+ ```
20
+
21
+ ### Tailwind v3
22
+ Add the dist directory to your `tailwind.config.js` content array:
23
+
24
+ ```js
25
+ module.exports = {
26
+ content: [
27
+ './src/**/*.{js,ts,jsx,tsx}',
28
+ './node_modules/hazo_config/dist/**/*.{js,ts,jsx,tsx}',
29
+ ],
30
+ }
31
+ ```
32
+
33
+ ## 3. CSS Custom Properties (Optional)
34
+
35
+ Add these CSS variables if you want themed styling:
36
+
37
+ ```css
38
+ :root {
39
+ --hazo-config-bg: #ffffff;
40
+ --hazo-config-border: #e2e8f0;
41
+ --hazo-config-text: #1a202c;
42
+ --hazo-config-muted: #718096;
43
+ }
44
+ ```
45
+
46
+ ## 4. Import Components
47
+
48
+ ### Client-side (components, browser)
49
+ ```typescript
50
+ import { ConfigViewer, ConfigEditor, AppConfig, MockConfigProvider } from 'hazo_config'
51
+ ```
52
+
53
+ ### Server-side (API routes, server components)
54
+ ```typescript
55
+ import { HazoConfig } from 'hazo_config/server'
56
+ ```
57
+
58
+ ## 5. INI File Config (if using HazoConfig)
59
+
60
+ Create your config file:
61
+ ```ini
62
+ [database]
63
+ host = localhost
64
+ port = 5432
65
+
66
+ [app]
67
+ name = My Application
68
+ debug = false
69
+ ```
70
+
71
+ Initialize in server code:
72
+ ```typescript
73
+ import { HazoConfig } from 'hazo_config/server'
74
+
75
+ const config = new HazoConfig({
76
+ filePath: './config/app_config.ini',
77
+ create_if_missing: true,
78
+ cache_ttl_ms: 5000,
79
+ })
80
+ ```
81
+
82
+ ## 6. Database Config (if using AppConfig)
83
+
84
+ Create the `hazo_app_config` table in your database:
85
+
86
+ ### PostgreSQL
87
+ ```sql
88
+ CREATE TABLE IF NOT EXISTS hazo_app_config (
89
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
90
+ scope_id UUID,
91
+ user_id UUID,
92
+ config_section TEXT NOT NULL,
93
+ config_name TEXT NOT NULL,
94
+ config_value_text TEXT DEFAULT '',
95
+ config_value_json JSONB DEFAULT '{}',
96
+ config_type TEXT NOT NULL DEFAULT 'general',
97
+ created_at TIMESTAMPTZ DEFAULT NOW(),
98
+ changed_at TIMESTAMPTZ DEFAULT NOW()
99
+ );
100
+ ```
101
+
102
+ ### SQLite
103
+ ```sql
104
+ CREATE TABLE IF NOT EXISTS hazo_app_config (
105
+ id TEXT PRIMARY KEY,
106
+ scope_id TEXT,
107
+ user_id TEXT,
108
+ config_section TEXT NOT NULL,
109
+ config_name TEXT NOT NULL,
110
+ config_value_text TEXT DEFAULT '',
111
+ config_value_json TEXT DEFAULT '{}',
112
+ config_type TEXT NOT NULL DEFAULT 'general',
113
+ created_at TEXT DEFAULT (datetime('now')),
114
+ changed_at TEXT DEFAULT (datetime('now'))
115
+ );
116
+ ```
117
+
118
+ ## 7. Next.js Configuration
119
+
120
+ Add to `next.config.js`:
121
+ ```javascript
122
+ const nextConfig = {
123
+ transpilePackages: ['hazo_config'],
124
+ }
125
+ ```
126
+
127
+ ## 8. Verify
128
+
129
+ - [ ] `import { ConfigViewer } from 'hazo_config'` resolves without errors
130
+ - [ ] `import { HazoConfig } from 'hazo_config/server'` works in server code
131
+ - [ ] Tailwind classes from hazo_config render correctly (check backgrounds, borders)
132
+ - [ ] Sensitive fields are masked in ConfigViewer/ConfigEditor
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "hazo_config",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Config wrapper with error handling",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "files": [
9
- "dist"
9
+ "dist",
10
+ "CHANGE_LOG.md",
11
+ "SETUP_CHECKLIST.md"
10
12
  ],
11
13
  "exports": {
12
14
  ".": {
@@ -28,6 +30,7 @@
28
30
  },
29
31
  "scripts": {
30
32
  "build": "tsc -p tsconfig.build.json",
33
+ "prepublishOnly": "npm run build",
31
34
  "storybook": "npx storybook dev -p 6006",
32
35
  "build-storybook": "npx storybook build",
33
36
  "test": "vitest run",
@@ -54,6 +57,9 @@
54
57
  "url": "https://github.com/pub12/hazo_config/issues"
55
58
  },
56
59
  "homepage": "https://github.com/pub12/hazo_config#readme",
60
+ "engines": {
61
+ "node": ">=18.0.0"
62
+ },
57
63
  "dependencies": {
58
64
  "@radix-ui/react-alert-dialog": "^1.1.15",
59
65
  "@radix-ui/react-dialog": "^1.1.15",
@@ -92,8 +98,8 @@
92
98
  "vitest": "^1.6.1"
93
99
  },
94
100
  "peerDependencies": {
95
- "react": "^18.2.0",
96
- "react-dom": "^18.2.0",
101
+ "react": "^18.0.0 || ^19.0.0",
102
+ "react-dom": "^18.0.0 || ^19.0.0",
97
103
  "tailwindcss": "^3.0.0"
98
104
  },
99
105
  "peerDependenciesMeta": {