sholawat-json 0.3.0 → 0.3.2

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/PUBLISHING.md ADDED
@@ -0,0 +1,190 @@
1
+ # Publishing Guide
2
+
3
+ ## How Publishing Works
4
+
5
+ This project automatically publishes to **npm** when you create a GitHub release. Once published to npm, **jsDelivr** automatically mirrors the package within minutes.
6
+
7
+ ### Distribution Chain
8
+ ```
9
+ GitHub Release → npm → jsDelivr CDN
10
+ ```
11
+
12
+ ## Quick Start: Publishing a New Version
13
+
14
+ 1. **Make your changes** and ensure they pass validation
15
+ 2. **Create a GitHub release**:
16
+ - Go to https://github.com/afaf-tech/sholawat-json/releases/new
17
+ - Choose a version tag (e.g., `v0.3.2` or `0.3.2`)
18
+ - Write release notes
19
+ - Click "Publish release"
20
+ 3. **Automated workflow runs**:
21
+ - ✅ Validates all JSON files
22
+ - ✅ Updates `package.json` version
23
+ - ✅ Publishes to npm
24
+ 4. **Wait ~5 minutes** for jsDelivr to pick up the new version
25
+
26
+ ## Prerequisites (One-Time Setup)
27
+
28
+ ### 1. Create npm Account
29
+ If you don't have one: https://www.npmjs.com/signup
30
+
31
+ ### 2. Get npm Access Token
32
+ 1. Log in to npm: https://www.npmjs.com/
33
+ 2. Click your profile → "Access Tokens"
34
+ 3. Click "Generate New Token" → "Classic Token"
35
+ 4. Select **Automation** type
36
+ 5. Copy the token (starts with `npm_...`)
37
+
38
+ ### 3. Add Token to GitHub
39
+ 1. Go to: https://github.com/afaf-tech/sholawat-json/settings/secrets/actions
40
+ 2. Click "New repository secret"
41
+ 3. Name: `NPM_TOKEN`
42
+ 4. Value: Paste your npm token
43
+ 5. Click "Add secret"
44
+
45
+ ## Version Numbering
46
+
47
+ Follow [Semantic Versioning](https://semver.org/):
48
+
49
+ - **Patch** (e.g., `0.3.1` → `0.3.2`): Bug fixes, typo corrections
50
+ - **Minor** (e.g., `0.3.1` → `0.4.0`): New content, new translations, backwards-compatible
51
+ - **Major** (e.g., `0.3.1` → `1.0.0`): Breaking changes to JSON structure/schema
52
+
53
+ ## Creating a Release
54
+
55
+ ### Via GitHub Web Interface
56
+
57
+ 1. Go to: https://github.com/afaf-tech/sholawat-json/releases/new
58
+ 2. **Tag version**: Enter version (e.g., `v0.3.2` or `0.3.2`)
59
+ 3. **Target**: Keep as `master`
60
+ 4. **Release title**: Same as tag (e.g., `v0.3.2`)
61
+ 5. **Description**: Summarize changes:
62
+ ```markdown
63
+ ## What's New
64
+ - Added Indonesian translation for Burdah Fasl 10
65
+ - Fixed typo in Simtudduror Fasl 5
66
+
67
+ ## Files Changed
68
+ - sholawat/burdah/nu_online/fasl/10.json
69
+ - sholawat/simtudduror/nu_online/fasl/5.json
70
+ ```
71
+ 6. Click **"Publish release"**
72
+
73
+ ### Via Command Line (Alternative)
74
+
75
+ ```bash
76
+ # Tag the current commit
77
+ git tag v0.3.2
78
+
79
+ # Push the tag
80
+ git push origin v0.3.2
81
+
82
+ # Then create release on GitHub using the tag
83
+ ```
84
+
85
+ ## What Happens During Publish
86
+
87
+ 1. **GitHub Actions triggers** (`.github/workflows/publish.yml`)
88
+ 2. **Validation runs** using Go validator
89
+ - If validation fails, publish stops
90
+ 3. **Version updated** in `package.json` based on release tag
91
+ 4. **Published to npm** with provenance attestation
92
+ 5. **jsDelivr mirrors** automatically within 5-10 minutes
93
+
94
+ ## Verifying Publication
95
+
96
+ ### Check npm
97
+ ```bash
98
+ npm view sholawat-json version
99
+ ```
100
+
101
+ Or visit: https://www.npmjs.com/package/sholawat-json
102
+
103
+ ### Check jsDelivr
104
+ - Latest version: https://cdn.jsdelivr.net/npm/sholawat-json@latest/sholawat/sholawat.json
105
+ - Specific version: https://cdn.jsdelivr.net/npm/sholawat-json@0.3.2/sholawat/sholawat.json
106
+ - Purge cache: https://www.jsdelivr.com/tools/purge
107
+
108
+ ## Manual Publishing (Fallback)
109
+
110
+ If automated workflow fails:
111
+
112
+ ```bash
113
+ # 1. Validate locally
114
+ cd validator
115
+ go run main.go
116
+
117
+ # 2. Update version in package.json
118
+ npm version patch # or minor, major
119
+
120
+ # 3. Login to npm (one time)
121
+ npm login
122
+
123
+ # 4. Publish
124
+ npm publish --access public
125
+ ```
126
+
127
+ ## Continuous Integration
128
+
129
+ ### Validation Workflow (`.github/workflows/validate.yml`)
130
+
131
+ Runs on every push/PR to master that modifies JSON files:
132
+ - ✅ Validates all JSON against schemas
133
+ - ✅ Prevents invalid data from being merged
134
+ - ✅ Ensures data integrity before release
135
+
136
+ ### When Validation Fails
137
+
138
+ 1. Check the Actions tab: https://github.com/afaf-tech/sholawat-json/actions
139
+ 2. Click the failed workflow run
140
+ 3. Read the error messages from validator
141
+ 4. Fix the JSON files
142
+ 5. Commit and push fixes
143
+
144
+ ## Best Practices
145
+
146
+ 1. **Always validate locally** before pushing:
147
+ ```bash
148
+ cd validator && go run main.go
149
+ ```
150
+
151
+ 2. **Test changes** in a branch before merging to master
152
+
153
+ 3. **Write clear release notes** describing what changed
154
+
155
+ 4. **Use semantic versioning** consistently
156
+
157
+ 5. **Don't delete releases** - users may depend on specific versions
158
+
159
+ 6. **Update sholawat.json** when adding new files or sources
160
+
161
+ ## Troubleshooting
162
+
163
+ ### "NPM_TOKEN not found"
164
+ - Ensure the secret is added in repository settings
165
+ - Name must be exactly `NPM_TOKEN`
166
+
167
+ ### "Validation failed"
168
+ - Run `cd validator && go run main.go` locally
169
+ - Fix reported schema violations
170
+ - Commit fixes and re-release
171
+
172
+ ### "Permission denied" when publishing
173
+ - Verify npm token has correct permissions
174
+ - Ensure you're a maintainer on npm package
175
+
176
+ ### jsDelivr shows old version
177
+ - Wait 5-10 minutes for CDN propagation
178
+ - Force purge: https://www.jsdelivr.com/tools/purge
179
+ - Use specific version URL instead of `@latest`
180
+
181
+ ## Resources
182
+
183
+ - npm package: https://www.npmjs.com/package/sholawat-json
184
+ - jsDelivr CDN: https://www.jsdelivr.com/package/npm/sholawat-json
185
+ - GitHub Actions: https://github.com/afaf-tech/sholawat-json/actions
186
+ - Semantic Versioning: https://semver.org/
187
+
188
+ ## Questions?
189
+
190
+ Open an issue: https://github.com/afaf-tech/sholawat-json/issues
package/README.md CHANGED
@@ -25,6 +25,16 @@ For Example:
25
25
 
26
26
  - Sholawat Diba from nu online fasl 1: `https://cdn.jsdelivr.net/npm/sholawat-json@latest/sholawat/diba/nu_online/fasl/10.json`
27
27
 
28
+ Get a Schema
29
+ You can access the JSON schema for each fasl in the schemas folder. These schemas ensure the data structure remains consistent and reliable. Use the following link to get the schema:
30
+
31
+ ```bash
32
+ https://cdn.jsdelivr.net/npm/sholawat-json@latest/schemas/{schema_name}.schema.json
33
+ ```
34
+ For example:
35
+
36
+ Burdah Fasl Schema (v1.0):
37
+ https://cdn.jsdelivr.net/npm/sholawat-json@latest/schemas/burdah_fasl_v1.0.schema.json
28
38
 
29
39
  ## Data Sources
30
40
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sholawat-json",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "All praise is due to Allah SWT for His countless blessings. May blessings and peace always be upon our beloved Prophet Muhammad SAW.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -15,7 +15,10 @@
15
15
  "various-sources",
16
16
  "sholawat",
17
17
  "sholawat-json",
18
- "diba", "burdah", "simtudduror"
18
+ "majlis",
19
+ "diba",
20
+ "burdah",
21
+ "simtudduror"
19
22
  ],
20
23
  "author": "afaf-tech",
21
24
  "license": "MIT",
@@ -0,0 +1,101 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "Sholawat Tunggal Schema",
4
+ "version": "1.0",
5
+ "type": "object",
6
+ "properties": {
7
+ "source": {
8
+ "type": "string",
9
+ "description": "The source of the text."
10
+ },
11
+ "name": {
12
+ "type": "string",
13
+ "description": "The Arabic name of the sholawat."
14
+ },
15
+ "latin": {
16
+ "type": [
17
+ "string",
18
+ "null"
19
+ ],
20
+ "description": "The transliteration of the sholawat name."
21
+ },
22
+ "text": {
23
+ "type": "object",
24
+ "description": "Contains the Arabic text and its transliteration.",
25
+ "patternProperties": {
26
+ "^[0-9]+$": {
27
+ "type": "object",
28
+ "properties": {
29
+ "arabic": {
30
+ "type": "string",
31
+ "description": "The Arabic text of the verse."
32
+ },
33
+ "latin": {
34
+ "type": [
35
+ "string",
36
+ "null"
37
+ ],
38
+ "description": "The transliteration of the Arabic text."
39
+ }
40
+ },
41
+ "required": [
42
+ "arabic"
43
+ ],
44
+ "additionalProperties": false
45
+ }
46
+ },
47
+ "additionalProperties": false
48
+ },
49
+ "translations": {
50
+ "type": [
51
+ "object",
52
+ "null"
53
+ ],
54
+ "description": "Translations in various languages.",
55
+ "patternProperties": {
56
+ "^[a-z]{2}$": {
57
+ "type": "object",
58
+ "description": "The key representing the language code using a two-letter ISO 639-1 code (e.g., 'en' for English, 'id' for Indonesian).",
59
+ "properties": {
60
+ "name": {
61
+ "type": "string",
62
+ "description": "The translated name of the sholawat in the specified language."
63
+ },
64
+ "translator": {
65
+ "type": "string",
66
+ "description": "Translator of the sholawat."
67
+ },
68
+ "text": {
69
+ "type": "object",
70
+ "description": "Translated text for each verse in the specified language.",
71
+ "patternProperties": {
72
+ "^[0-9]+$": {
73
+ "type": "string",
74
+ "description": "Translated text of the verse in the specified language."
75
+ }
76
+ },
77
+ "additionalProperties": false
78
+ }
79
+ },
80
+ "required": [
81
+ "name",
82
+ "text"
83
+ ],
84
+ "additionalProperties": false
85
+ }
86
+ },
87
+ "additionalProperties": false
88
+ },
89
+ "last_updated": {
90
+ "type": "string",
91
+ "format": "date",
92
+ "pattern": "^(\\d{4})-(\\d{2})-(\\d{2})$",
93
+ "description": "The date when the content was last updated, in YYYY-MM-DD format."
94
+ }
95
+ },
96
+ "required": [
97
+ "name",
98
+ "text"
99
+ ],
100
+ "additionalProperties": false
101
+ }
@@ -0,0 +1,118 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "Sholawat Tunggal Schema",
4
+ "version": "1.1",
5
+ "type": "object",
6
+ "properties": {
7
+ "source": {
8
+ "type": [
9
+ "string",
10
+ "null"
11
+ ],
12
+ "description": "The source of the text."
13
+ },
14
+ "author": {
15
+ "type": [
16
+ "string",
17
+ "null"
18
+ ],
19
+ "description": "The author of the sholawat."
20
+ },
21
+ "transmitter": {
22
+ "type": [
23
+ "string",
24
+ "null"
25
+ ],
26
+ "description": "The transmitter or narrator of the sholawat."
27
+ },
28
+ "name": {
29
+ "type": "string",
30
+ "description": "The Arabic name of the sholawat."
31
+ },
32
+ "latin": {
33
+ "type": [
34
+ "string",
35
+ "null"
36
+ ],
37
+ "description": "The transliteration of the sholawat name."
38
+ },
39
+ "text": {
40
+ "type": "object",
41
+ "description": "Contains the Arabic text and its transliteration.",
42
+ "patternProperties": {
43
+ "^[0-9]+$": {
44
+ "type": "object",
45
+ "properties": {
46
+ "arabic": {
47
+ "type": "string",
48
+ "description": "The Arabic text of the verse."
49
+ },
50
+ "latin": {
51
+ "type": [
52
+ "string",
53
+ "null"
54
+ ],
55
+ "description": "The transliteration of the Arabic text."
56
+ }
57
+ },
58
+ "required": [
59
+ "arabic"
60
+ ],
61
+ "additionalProperties": false
62
+ }
63
+ },
64
+ "additionalProperties": false
65
+ },
66
+ "translations": {
67
+ "type": [
68
+ "object",
69
+ "null"
70
+ ],
71
+ "description": "Translations in various languages.",
72
+ "patternProperties": {
73
+ "^[a-z]{2}$": {
74
+ "type": "object",
75
+ "description": "The key representing the language code using a two-letter ISO 639-1 code (e.g., 'en' for English, 'id' for Indonesian).",
76
+ "properties": {
77
+ "name": {
78
+ "type": "string",
79
+ "description": "The translated name of the sholawat in the specified language."
80
+ },
81
+ "translator": {
82
+ "type": "string",
83
+ "description": "Translator of the sholawat."
84
+ },
85
+ "text": {
86
+ "type": "object",
87
+ "description": "Translated text for each verse in the specified language.",
88
+ "patternProperties": {
89
+ "^[0-9]+$": {
90
+ "type": "string",
91
+ "description": "Translated text of the verse in the specified language."
92
+ }
93
+ },
94
+ "additionalProperties": false
95
+ }
96
+ },
97
+ "required": [
98
+ "name",
99
+ "text"
100
+ ],
101
+ "additionalProperties": false
102
+ }
103
+ },
104
+ "additionalProperties": false
105
+ },
106
+ "last_updated": {
107
+ "type": "string",
108
+ "format": "date",
109
+ "pattern": "^(\\d{4})-(\\d{2})-(\\d{2})$",
110
+ "description": "The date when the content was last updated, in YYYY-MM-DD format."
111
+ }
112
+ },
113
+ "required": [
114
+ "name",
115
+ "text"
116
+ ],
117
+ "additionalProperties": false
118
+ }
@@ -0,0 +1,101 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "Suluk Schema",
4
+ "version": "1.0",
5
+ "type": "object",
6
+ "properties": {
7
+ "source": {
8
+ "type": "string",
9
+ "description": "The source of the text."
10
+ },
11
+ "name": {
12
+ "type": "string",
13
+ "description": "The Arabic name of the suluk."
14
+ },
15
+ "latin": {
16
+ "type": [
17
+ "string",
18
+ "null"
19
+ ],
20
+ "description": "The transliteration of the suluk name."
21
+ },
22
+ "text": {
23
+ "type": "object",
24
+ "description": "Contains the Arabic text and its transliteration.",
25
+ "patternProperties": {
26
+ "^[0-9]+$": {
27
+ "type": "object",
28
+ "properties": {
29
+ "arabic": {
30
+ "type": "string",
31
+ "description": "The Arabic text of the verse."
32
+ },
33
+ "latin": {
34
+ "type": [
35
+ "string",
36
+ "null"
37
+ ],
38
+ "description": "The transliteration of the Arabic text."
39
+ }
40
+ },
41
+ "required": [
42
+ "arabic"
43
+ ],
44
+ "additionalProperties": false
45
+ }
46
+ },
47
+ "additionalProperties": false
48
+ },
49
+ "translations": {
50
+ "type": [
51
+ "object",
52
+ "null"
53
+ ],
54
+ "description": "Translations in various languages.",
55
+ "patternProperties": {
56
+ "^[a-z]{2}$": {
57
+ "type": "object",
58
+ "description": "The key representing the language code using a two-letter ISO 639-1 code (e.g., 'en' for English, 'id' for Indonesian).",
59
+ "properties": {
60
+ "name": {
61
+ "type": "string",
62
+ "description": "The translated name of the suluk in the specified language."
63
+ },
64
+ "translator": {
65
+ "type": "string",
66
+ "description": "Translator of the suluk."
67
+ },
68
+ "text": {
69
+ "type": "object",
70
+ "description": "Translated text for each verse in the specified language.",
71
+ "patternProperties": {
72
+ "^[0-9]+$": {
73
+ "type": "string",
74
+ "description": "Translated text of the verse in the specified language."
75
+ }
76
+ },
77
+ "additionalProperties": false
78
+ }
79
+ },
80
+ "required": [
81
+ "name",
82
+ "text"
83
+ ],
84
+ "additionalProperties": false
85
+ }
86
+ },
87
+ "additionalProperties": false
88
+ },
89
+ "last_updated": {
90
+ "type": "string",
91
+ "format": "date",
92
+ "pattern": "^(\\d{4})-(\\d{2})-(\\d{2})$",
93
+ "description": "The date when the content was last updated, in YYYY-MM-DD format."
94
+ }
95
+ },
96
+ "required": [
97
+ "name",
98
+ "text"
99
+ ],
100
+ "additionalProperties": false
101
+ }
@@ -0,0 +1,118 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "Suluk Schema",
4
+ "version": "1.1",
5
+ "type": "object",
6
+ "properties": {
7
+ "source": {
8
+ "type": [
9
+ "string",
10
+ "null"
11
+ ],
12
+ "description": "The source of the text."
13
+ },
14
+ "author": {
15
+ "type": [
16
+ "string",
17
+ "null"
18
+ ],
19
+ "description": "The author of the suluk."
20
+ },
21
+ "transmitter": {
22
+ "type": [
23
+ "string",
24
+ "null"
25
+ ],
26
+ "description": "The transmitter or narrator of the suluk."
27
+ },
28
+ "name": {
29
+ "type": "string",
30
+ "description": "The Arabic name of the suluk."
31
+ },
32
+ "latin": {
33
+ "type": [
34
+ "string",
35
+ "null"
36
+ ],
37
+ "description": "The transliteration of the suluk name."
38
+ },
39
+ "text": {
40
+ "type": "object",
41
+ "description": "Contains the Arabic text and its transliteration.",
42
+ "patternProperties": {
43
+ "^[0-9]+$": {
44
+ "type": "object",
45
+ "properties": {
46
+ "arabic": {
47
+ "type": "string",
48
+ "description": "The Arabic text of the verse."
49
+ },
50
+ "latin": {
51
+ "type": [
52
+ "string",
53
+ "null"
54
+ ],
55
+ "description": "The transliteration of the Arabic text."
56
+ }
57
+ },
58
+ "required": [
59
+ "arabic"
60
+ ],
61
+ "additionalProperties": false
62
+ }
63
+ },
64
+ "additionalProperties": false
65
+ },
66
+ "translations": {
67
+ "type": [
68
+ "object",
69
+ "null"
70
+ ],
71
+ "description": "Translations in various languages.",
72
+ "patternProperties": {
73
+ "^[a-z]{2}$": {
74
+ "type": "object",
75
+ "description": "The key representing the language code using a two-letter ISO 639-1 code (e.g., 'en' for English, 'id' for Indonesian).",
76
+ "properties": {
77
+ "name": {
78
+ "type": "string",
79
+ "description": "The translated name of the suluk in the specified language."
80
+ },
81
+ "translator": {
82
+ "type": "string",
83
+ "description": "Translator of the suluk."
84
+ },
85
+ "text": {
86
+ "type": "object",
87
+ "description": "Translated text for each verse in the specified language.",
88
+ "patternProperties": {
89
+ "^[0-9]+$": {
90
+ "type": "string",
91
+ "description": "Translated text of the verse in the specified language."
92
+ }
93
+ },
94
+ "additionalProperties": false
95
+ }
96
+ },
97
+ "required": [
98
+ "name",
99
+ "text"
100
+ ],
101
+ "additionalProperties": false
102
+ }
103
+ },
104
+ "additionalProperties": false
105
+ },
106
+ "last_updated": {
107
+ "type": "string",
108
+ "format": "date",
109
+ "pattern": "^(\\d{4})-(\\d{2})-(\\d{2})$",
110
+ "description": "The date when the content was last updated, in YYYY-MM-DD format."
111
+ }
112
+ },
113
+ "required": [
114
+ "name",
115
+ "text"
116
+ ],
117
+ "additionalProperties": false
118
+ }