itqan-cli 0.1.3__tar.gz → 0.3.0__tar.gz
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.
- itqan_cli-0.3.0/CHANGELOG.md +101 -0
- itqan_cli-0.3.0/PKG-INFO +503 -0
- itqan_cli-0.3.0/README.md +472 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/RELEASING.md +27 -4
- itqan_cli-0.3.0/dart/.gitignore +2 -0
- itqan_cli-0.3.0/dart/README.md +27 -0
- itqan_cli-0.3.0/dart/analysis_options.yaml +9 -0
- itqan_cli-0.3.0/dart/bin/itqan.dart +5 -0
- itqan_cli-0.3.0/dart/lib/itqan_cli.dart +5 -0
- itqan_cli-0.3.0/dart/lib/src/launcher.dart +172 -0
- itqan_cli-0.3.0/dart/lib/src/version.dart +3 -0
- itqan_cli-0.3.0/dart/pubspec.yaml +27 -0
- itqan_cli-0.3.0/dart/test/launcher_test.dart +143 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/pyproject.toml +1 -1
- itqan_cli-0.3.0/scripts/dart_package.py +49 -0
- itqan_cli-0.3.0/src/itqan_cli/add.py +96 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/src/itqan_cli/browse.py +3 -1
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/src/itqan_cli/client.py +17 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/src/itqan_cli/downloader.py +28 -9
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/src/itqan_cli/exceptions.py +4 -0
- itqan_cli-0.3.0/src/itqan_cli/flutter.py +184 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/src/itqan_cli/init_template.py +39 -10
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/src/itqan_cli/main.py +309 -17
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/src/itqan_cli/manifest.py +5 -1
- itqan_cli-0.3.0/src/itqan_cli/updates.py +87 -0
- itqan_cli-0.3.0/tests/test_add.py +259 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/tests/test_cli_integration.py +80 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/tests/test_client.py +76 -0
- itqan_cli-0.3.0/tests/test_dart_package.py +40 -0
- itqan_cli-0.3.0/tests/test_downloader.py +154 -0
- itqan_cli-0.3.0/tests/test_flutter.py +355 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/tests/test_init.py +67 -4
- itqan_cli-0.3.0/tests/test_updates.py +226 -0
- itqan_cli-0.1.3/CHANGELOG.md +0 -55
- itqan_cli-0.1.3/PKG-INFO +0 -174
- itqan_cli-0.1.3/README.md +0 -143
- itqan_cli-0.1.3/tests/test_downloader.py +0 -76
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/.gitignore +0 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/LICENSE +0 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/npm/README.md +0 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/npm/bin/itqan.js +0 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/scripts/homebrew_formula.py +0 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/scripts/npm_packages.py +0 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/src/itqan_cli/__init__.py +0 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/src/itqan_cli/__main__.py +0 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/src/itqan_cli/credentials.py +0 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/src/itqan_cli/lockfile.py +0 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/src/itqan_cli/semver.py +0 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/tests/__init__.py +0 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/tests/conftest.py +0 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/tests/test_access.py +0 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/tests/test_assets_dir.py +0 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/tests/test_browse.py +0 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/tests/test_entry_points.py +0 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/tests/test_homebrew_formula.py +0 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/tests/test_languages.py +0 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/tests/test_lockfile.py +0 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/tests/test_login.py +0 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/tests/test_manifest.py +0 -0
- {itqan_cli-0.1.3 → itqan_cli-0.3.0}/tests/test_npm_packages.py +0 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
## v0.3.0 (2026-10-18)
|
|
2
|
+
|
|
3
|
+
### Feat
|
|
4
|
+
|
|
5
|
+
- `itqan add ASSET[@RANGE]...` adds assets to `itqan-assets.yaml` (creating it if missing) and
|
|
6
|
+
installs them. Without a range it accepts the newest version (`^`); `--language` picks another
|
|
7
|
+
language and `--no-install` only edits the manifest. Unknown assets, assets you don't have access
|
|
8
|
+
to and unavailable languages fail before anything is written.
|
|
9
|
+
- `itqan install` says when your locked assets have newer versions, split into those your range
|
|
10
|
+
allows (`itqan install --force`) and those it doesn't. `ITQAN_NO_UPDATE_NOTICE=1` turns it off.
|
|
11
|
+
The new `itqan outdated` command lists them, or prints them as JSON with `--json`.
|
|
12
|
+
- warn when a locked version was withdrawn by its publisher: `itqan install` still installs it and
|
|
13
|
+
shows the publisher's reason and how to move off it. A version removed by an Itqan admin fails
|
|
14
|
+
with an explanation and suggests `itqan install --force`.
|
|
15
|
+
- **init**: `itqan init` writes the example assets commented out instead of installing them right
|
|
16
|
+
away, and suggests `itqan browse` to find assets.
|
|
17
|
+
|
|
18
|
+
### Fix
|
|
19
|
+
|
|
20
|
+
- **cli**: `itqan --help` shows each command's full description instead of cutting it off with
|
|
21
|
+
`...`.
|
|
22
|
+
|
|
23
|
+
## v0.2.0 (2026-10-12)
|
|
24
|
+
|
|
25
|
+
### Feat
|
|
26
|
+
|
|
27
|
+
- publish to pub.dev as `itqan_cli`: `dart pub global activate itqan_cli` installs `itqan` without
|
|
28
|
+
Python. It downloads the program for your computer on first use, checks it against the
|
|
29
|
+
release's `SHA256SUMS`, and keeps it for later runs.
|
|
30
|
+
- **flutter**: `itqan install --flutter` lists the installed asset folders under `flutter: assets:`
|
|
31
|
+
in `pubspec.yaml`, inside an `# itqan:start` / `# itqan:end` block. Later installs keep the block
|
|
32
|
+
in sync without the flag, and the rest of the file is never changed.
|
|
33
|
+
- **ci**: the [setup-itqan](https://github.com/Itqan-community/setup-itqan) GitHub Action installs
|
|
34
|
+
`itqan` on Linux, macOS and Windows runners: `uses: itqan-community/setup-itqan@v1`.
|
|
35
|
+
|
|
36
|
+
### Fix
|
|
37
|
+
|
|
38
|
+
- keep version markers out of the asset folders, where Flutter bundled them into apps. They now
|
|
39
|
+
live in `<assets_dir>/.itqan/`. Existing installs are moved over on the next `itqan install`
|
|
40
|
+
without downloading again.
|
|
41
|
+
|
|
42
|
+
### Docs
|
|
43
|
+
|
|
44
|
+
- rewrite the README around what you want to do: pick an install method for your project, get
|
|
45
|
+
started, use the assets in a web or Flutter app, update them, and set up CI.
|
|
46
|
+
|
|
47
|
+
## v0.1.3 (2026-10-11)
|
|
48
|
+
|
|
49
|
+
### Fix
|
|
50
|
+
|
|
51
|
+
- **release**: publish npm tarballs by ./ path
|
|
52
|
+
|
|
53
|
+
## v0.1.2 (2026-10-11)
|
|
54
|
+
|
|
55
|
+
### Feat
|
|
56
|
+
|
|
57
|
+
- publish to npm as itqan-cli
|
|
58
|
+
|
|
59
|
+
## v0.1.1 (2026-10-11)
|
|
60
|
+
|
|
61
|
+
### Feat
|
|
62
|
+
|
|
63
|
+
- publish a Homebrew formula on each release
|
|
64
|
+
|
|
65
|
+
### Fix
|
|
66
|
+
|
|
67
|
+
- **browse**: say when an asset has no published version yet
|
|
68
|
+
|
|
69
|
+
## v0.1.0 (2026-10-11)
|
|
70
|
+
|
|
71
|
+
### Feat
|
|
72
|
+
|
|
73
|
+
- attach standalone binaries to each GitHub Release
|
|
74
|
+
- show which gated assets need access and where to request it
|
|
75
|
+
- add `itqan login` / `logout` to save an API key
|
|
76
|
+
- also install the CLI as `itqan-cli`
|
|
77
|
+
- add `itqan browse` to search the catalog and add assets
|
|
78
|
+
|
|
79
|
+
### Fix
|
|
80
|
+
|
|
81
|
+
- **browse**: Enter adds the highlighted asset when none is selected
|
|
82
|
+
- **browse**: fit picker rows to the terminal and summarize the picks
|
|
83
|
+
|
|
84
|
+
## v0.1.0rc1 (2026-10-08)
|
|
85
|
+
|
|
86
|
+
### Feat
|
|
87
|
+
|
|
88
|
+
- **package-manager**: add `itqan init` to create a starter manifest
|
|
89
|
+
- **package-manager**: let the manifest choose the assets folder
|
|
90
|
+
- **package-manager**: resolve per language and generate missing files on download
|
|
91
|
+
- **package-manager**: add itqan install CLI (ITQ-22) (#503)
|
|
92
|
+
|
|
93
|
+
### Fix
|
|
94
|
+
|
|
95
|
+
- default to the public API host, api.cms.itqan.dev
|
|
96
|
+
- report the real CLI version in the User-Agent
|
|
97
|
+
- **package-manager**: default the CLI to the production registry
|
|
98
|
+
|
|
99
|
+
### Refactor
|
|
100
|
+
|
|
101
|
+
- **package-manager**: move the itqan CLI into a standalone package
|
itqan_cli-0.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: itqan-cli
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Itqan Quranic Asset Manager: install and pin Itqan Quranic assets in your project.
|
|
5
|
+
Project-URL: Homepage, https://github.com/Itqan-community/itqan-cli
|
|
6
|
+
Project-URL: Repository, https://github.com/Itqan-community/itqan-cli
|
|
7
|
+
Project-URL: Issues, https://github.com/Itqan-community/itqan-cli/issues
|
|
8
|
+
Project-URL: Manifest format, https://github.com/Itqan-community/cms-backend/blob/main/docs/ASSET_MANIFEST.md
|
|
9
|
+
Author: Itqan
|
|
10
|
+
Author-email: Hassaan Alansary <hassaanalansary@yahoo.com>
|
|
11
|
+
License-Expression: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: assets,cli,itqan,mushaf,package-manager,quran,quranic,tafsir
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Environment :: Console
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: Religion
|
|
24
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
25
|
+
Requires-Python: >=3.11
|
|
26
|
+
Requires-Dist: click>=8.1
|
|
27
|
+
Requires-Dist: pyyaml>=6.0
|
|
28
|
+
Requires-Dist: questionary>=2.1
|
|
29
|
+
Requires-Dist: requests>=2.31
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# itqan-cli
|
|
33
|
+
|
|
34
|
+
[](https://github.com/Itqan-community/itqan-cli/actions/workflows/ci.yml)
|
|
35
|
+
[](https://github.com/Itqan-community/itqan-cli/releases/latest)
|
|
36
|
+
[](https://pypi.org/project/itqan-cli/)
|
|
37
|
+
[](https://pypi.org/project/itqan-cli/)
|
|
38
|
+
[](https://www.npmjs.com/package/itqan-cli)
|
|
39
|
+
[](https://pub.dev/packages/itqan_cli)
|
|
40
|
+
[](https://github.com/Itqan-community/homebrew-tap)
|
|
41
|
+
[](https://github.com/Itqan-community/setup-itqan)
|
|
42
|
+
[](https://www.npmjs.com/package/itqan-cli)
|
|
43
|
+
[](https://pypi.org/project/itqan-cli/)
|
|
44
|
+
[](LICENSE)
|
|
45
|
+
|
|
46
|
+
**Itqan Quranic Asset Manager**
|
|
47
|
+
|
|
48
|
+
`itqan` adds [Itqan](https://cms.itqan.dev) Quranic data, such as mushafs, tafsirs,
|
|
49
|
+
translations and fonts, to your app's project, the way npm or pub adds code libraries.
|
|
50
|
+
|
|
51
|
+
1. You list the assets you want, and which versions you accept, in `itqan-assets.yaml`.
|
|
52
|
+
2. `itqan install` downloads them into a folder in your project.
|
|
53
|
+
3. It records the exact versions it installed in `itqan-assets.lock`, so your teammates and your
|
|
54
|
+
CI get exactly the same files.
|
|
55
|
+
|
|
56
|
+
It works for any kind of project (web, React Native, Flutter, Python or anything else) on macOS,
|
|
57
|
+
Linux and Windows.
|
|
58
|
+
|
|
59
|
+
**Contents:** [Install](#install) · [Quick start](#quick-start) ·
|
|
60
|
+
[Use the assets in your app](#use-the-assets-in-your-app) · [The manifest](#the-manifest) ·
|
|
61
|
+
[Updating assets](#updating-assets) · [Assets that need access approval](#assets-that-need-access-approval) ·
|
|
62
|
+
[CI](#ci) · [Commands](#commands) · [Configuration](#configuration) ·
|
|
63
|
+
[Troubleshooting](#troubleshooting)
|
|
64
|
+
|
|
65
|
+
## Install
|
|
66
|
+
|
|
67
|
+
Pick the line for the tools you already have. Each one gives you the same `itqan` command.
|
|
68
|
+
|
|
69
|
+
| You work with | Install | Needs Python? |
|
|
70
|
+
|---|---|---|
|
|
71
|
+
| JavaScript, TypeScript, React Native | `npm install --save-dev itqan-cli` (or just `npx itqan-cli ...`) | No |
|
|
72
|
+
| Dart or Flutter | `dart pub global activate itqan_cli` | No |
|
|
73
|
+
| macOS or Linux, with Homebrew | `brew install itqan-community/tap/itqan` | No |
|
|
74
|
+
| Python 3.11 or newer | `pipx install itqan-cli` or `uv tool install itqan-cli` | Yes |
|
|
75
|
+
| GitHub Actions | `uses: itqan-community/setup-itqan@v1` (see [CI](#ci)) | No |
|
|
76
|
+
| None of these | [Download the program](#download-the-program-directly) | No |
|
|
77
|
+
|
|
78
|
+
Check that it works:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
itqan --version
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The options that don't need Python run a ready-made `itqan` program for your computer. It exists
|
|
85
|
+
for macOS (Apple Silicon and Intel), Linux (x86_64 and arm64, with glibc) and Windows (x86_64).
|
|
86
|
+
On any other system, such as Windows on ARM or Alpine Linux, install with Python.
|
|
87
|
+
|
|
88
|
+
### npm
|
|
89
|
+
|
|
90
|
+
Add it to your project, so everyone on the team gets the same version:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
npm install --save-dev itqan-cli
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Then run it with `npx itqan ...`, or from a script in `package.json`:
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"scripts": {
|
|
101
|
+
"assets": "itqan install"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
To try it without installing anything, use `npx itqan-cli init` and `npx itqan-cli install`.
|
|
107
|
+
|
|
108
|
+
### Dart and Flutter
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
dart pub global activate itqan_cli
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
If `itqan` isn't found afterwards, add pub's folder to your `PATH`. `dart pub global activate`
|
|
115
|
+
prints the folder to add.
|
|
116
|
+
|
|
117
|
+
The package version is the CLI version: `dart pub global activate itqan_cli 0.2.0` gives you
|
|
118
|
+
itqan 0.2.0. The first time you run `itqan`, it downloads the program for your computer from the
|
|
119
|
+
[GitHub Release](https://github.com/Itqan-community/itqan-cli/releases), checks it against the
|
|
120
|
+
release's `SHA256SUMS` file, and keeps it for later runs.
|
|
121
|
+
|
|
122
|
+
### Homebrew
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
brew install itqan-community/tap/itqan
|
|
126
|
+
brew upgrade itqan # later, to update
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Python
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
pipx install itqan-cli # or: uv tool install itqan-cli
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
This installs `itqan`, and the same command again under the name `itqan-cli`.
|
|
136
|
+
|
|
137
|
+
### Download the program directly
|
|
138
|
+
|
|
139
|
+
Each [GitHub Release](https://github.com/Itqan-community/itqan-cli/releases) has the program for
|
|
140
|
+
each system, named `itqan-<version>-<os>-<arch>` (with `.exe` on Windows), and a `SHA256SUMS`
|
|
141
|
+
file to check it with. Download yours, check it, and put it on your `PATH` as `itqan`. On an Apple
|
|
142
|
+
Silicon Mac, for example:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
v=0.2.0 # the release you want
|
|
146
|
+
curl -fLO "https://github.com/Itqan-community/itqan-cli/releases/download/v$v/itqan-$v-macos-arm64"
|
|
147
|
+
curl -fLO "https://github.com/Itqan-community/itqan-cli/releases/download/v$v/SHA256SUMS"
|
|
148
|
+
shasum -a 256 --check --ignore-missing SHA256SUMS # Linux: sha256sum --check --ignore-missing SHA256SUMS
|
|
149
|
+
chmod +x "itqan-$v-macos-arm64"
|
|
150
|
+
sudo mv "itqan-$v-macos-arm64" /usr/local/bin/itqan
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
On Windows, download `itqan-<version>-windows-x86_64.exe`, rename it to `itqan.exe`, and put it in
|
|
154
|
+
a folder on your `PATH`.
|
|
155
|
+
|
|
156
|
+
## Quick start
|
|
157
|
+
|
|
158
|
+
Run these in your project's folder:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
itqan init # 1. create itqan-assets.yaml, with commented-out example assets
|
|
162
|
+
itqan browse # 2. search the catalog and add the assets you want (or uncomment the examples)
|
|
163
|
+
itqan install # 3. download them and write itqan-assets.lock
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
You now have:
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
your-project/
|
|
170
|
+
├── itqan-assets.yaml # what you asked for: edit this, and commit it
|
|
171
|
+
├── itqan-assets.lock # what was installed: don't edit it, but commit it
|
|
172
|
+
└── assets/
|
|
173
|
+
├── english-translation/
|
|
174
|
+
│ └── tr-ab-en_hilali.csv
|
|
175
|
+
├── tafsir-jalalayn/
|
|
176
|
+
│ └── ...
|
|
177
|
+
└── .itqan/ # the CLI's own bookkeeping, not part of any asset
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Commit `itqan-assets.yaml` and `itqan-assets.lock`. You can commit the `assets/` folder too, or
|
|
181
|
+
add it to `.gitignore` and run `itqan install` after cloning (and in CI), which downloads exactly
|
|
182
|
+
the versions in the lockfile.
|
|
183
|
+
|
|
184
|
+
Already know the asset you want? `itqan add` puts it in the manifest and installs it in one step,
|
|
185
|
+
like `uv add` or `npm install <package>`:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
itqan add tafsir-jalalayn # the source language, accepting ^ the newest version
|
|
189
|
+
itqan add tafsir-jalalayn --language en # another language of the same asset
|
|
190
|
+
itqan add tafsir-jalalayn@~2.1 # your own version range
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
The asset's name is the one `itqan browse` and each asset's page in the
|
|
194
|
+
[asset library](https://cms.itqan.dev) show. `--no-install` only edits the manifest.
|
|
195
|
+
|
|
196
|
+
In `itqan browse`, type to filter the list, press Enter to add the highlighted asset, or press
|
|
197
|
+
Space on several and then Enter. `itqan browse tafsir` starts with a search, and
|
|
198
|
+
`itqan browse --category translation` shows one kind of asset.
|
|
199
|
+
|
|
200
|
+
## Use the assets in your app
|
|
201
|
+
|
|
202
|
+
Each asset goes into its own folder, `<assets_dir>/<entry name>/`. `assets_dir` is `assets` unless
|
|
203
|
+
your manifest says otherwise (see [The manifest](#the-manifest)). Point it at the folder your
|
|
204
|
+
framework already serves or bundles.
|
|
205
|
+
|
|
206
|
+
### Web apps (Vite, Next.js, Create React App, and others)
|
|
207
|
+
|
|
208
|
+
Install into the `public/` folder, which these tools serve as-is:
|
|
209
|
+
|
|
210
|
+
```yaml
|
|
211
|
+
# itqan-assets.yaml
|
|
212
|
+
assets_dir: "public/quran"
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
The files are then served from `/quran/`:
|
|
216
|
+
|
|
217
|
+
```js
|
|
218
|
+
const csv = await fetch("/quran/english-translation/tr-ab-en_hilali.csv").then((r) => r.text());
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Flutter
|
|
222
|
+
|
|
223
|
+
Flutter only bundles the folders listed in `pubspec.yaml`, and listing a folder doesn't include
|
|
224
|
+
its subfolders. `itqan` can keep that list for you. Put `itqan-assets.yaml` next to
|
|
225
|
+
`pubspec.yaml`, and install once with `--flutter`:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
itqan install --flutter
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
This adds every folder with installed files to `flutter: assets:`, inside a block that `itqan`
|
|
232
|
+
manages:
|
|
233
|
+
|
|
234
|
+
```yaml
|
|
235
|
+
flutter:
|
|
236
|
+
assets:
|
|
237
|
+
- images/ # your own entries are left alone
|
|
238
|
+
# itqan:start (managed by `itqan install`, do not edit)
|
|
239
|
+
- assets/english-translation/
|
|
240
|
+
- assets/tafsir-jalalayn/
|
|
241
|
+
# itqan:end
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Commit `pubspec.yaml` with the block. From then on, every `itqan install` (yours, a teammate's,
|
|
245
|
+
CI's) keeps the block in step with the manifest, with no flag needed. Nothing else in
|
|
246
|
+
`pubspec.yaml` is changed, and the file isn't touched at all when nothing changed. Load the files
|
|
247
|
+
with `rootBundle`:
|
|
248
|
+
|
|
249
|
+
```dart
|
|
250
|
+
import 'package:flutter/services.dart';
|
|
251
|
+
|
|
252
|
+
final csv = await rootBundle.loadString('assets/english-translation/tr-ab-en_hilali.csv');
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
To stop, delete the block, including both marker lines. To skip it for one run, pass
|
|
256
|
+
`--no-flutter`.
|
|
257
|
+
|
|
258
|
+
### React Native, Python and everything else
|
|
259
|
+
|
|
260
|
+
The assets are plain files in `<assets_dir>/<entry name>/`. Read them, bundle them or copy them
|
|
261
|
+
the way your platform handles any other data file.
|
|
262
|
+
|
|
263
|
+
## The manifest
|
|
264
|
+
|
|
265
|
+
`itqan-assets.yaml` lists the assets you want. `itqan init` writes one for you, with comments
|
|
266
|
+
explaining each part and a few real assets from the catalog as commented-out examples, one of
|
|
267
|
+
them with a `language:`. A fuller example:
|
|
268
|
+
|
|
269
|
+
```yaml
|
|
270
|
+
schema_version: 1
|
|
271
|
+
|
|
272
|
+
# Where to download the assets, relative to this file. Optional, defaults to "assets".
|
|
273
|
+
assets_dir: "public/quran"
|
|
274
|
+
|
|
275
|
+
assets:
|
|
276
|
+
# The entry's name is the asset's name in the catalog (as `itqan browse` shows it).
|
|
277
|
+
tafsir-jalalayn:
|
|
278
|
+
version: "^2.0.0"
|
|
279
|
+
|
|
280
|
+
# The same asset in English. Each language is its own entry with its own folder, so it needs its
|
|
281
|
+
# own name and has to say which asset it is.
|
|
282
|
+
tafsir-jalalayn-en:
|
|
283
|
+
asset: tafsir-jalalayn
|
|
284
|
+
language: en
|
|
285
|
+
version: "~1.3"
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
Which versions an entry accepts:
|
|
289
|
+
|
|
290
|
+
| `version:` | Accepts | Example |
|
|
291
|
+
|---|---|---|
|
|
292
|
+
| `"^2.1.0"` | any newer version that keeps the same first number | 2.1.0, 2.4.3, not 3.0.0 |
|
|
293
|
+
| `"~2.1"` | only fixes to 2.1 | 2.1.0, 2.1.7, not 2.2.0 |
|
|
294
|
+
| `"2.1.0"` | exactly this version | 2.1.0 only |
|
|
295
|
+
|
|
296
|
+
Use `^` unless you have a reason not to. A publisher changes the first number when an update
|
|
297
|
+
could break apps that use the asset. Below 1.0 the second number plays that role, so `"^0.3.0"`
|
|
298
|
+
accepts 0.3.x only.
|
|
299
|
+
|
|
300
|
+
Each language of an asset has its own version history. That's why `tafsir-jalalayn` above is on
|
|
301
|
+
2.x while its English translation is on 1.3.x. Leave out `language` to get the asset's original
|
|
302
|
+
language.
|
|
303
|
+
|
|
304
|
+
The full format, including every rule and error, is specified in
|
|
305
|
+
[ASSET_MANIFEST.md](https://github.com/Itqan-community/cms-backend/blob/main/docs/ASSET_MANIFEST.md).
|
|
306
|
+
|
|
307
|
+
## Updating assets
|
|
308
|
+
|
|
309
|
+
- **Add an asset:** `itqan add <asset>`, or `itqan browse` to search for one.
|
|
310
|
+
- **Add or remove an asset, or change a `version:` range:** edit `itqan-assets.yaml` and run
|
|
311
|
+
`itqan install`. It sees that the lockfile no longer matches the manifest, picks the newest
|
|
312
|
+
versions the manifest allows, and rewrites the lockfile.
|
|
313
|
+
- **Get newer versions within the ranges you already have:** `itqan install --force`.
|
|
314
|
+
- **Install what the lockfile says, for example after cloning or in CI:** `itqan install`.
|
|
315
|
+
- **See which assets have newer versions:** `itqan outdated`. It lists each locked asset that has a
|
|
316
|
+
newer version, with the newest one your manifest's range allows ("In range", what
|
|
317
|
+
`itqan install --force` gets) and the newest one overall ("Latest", which needs a range change
|
|
318
|
+
when it's outside the range). `--json` prints the same list as JSON. It downloads nothing.
|
|
319
|
+
|
|
320
|
+
`itqan install` also ends with a line saying how many assets have newer versions, if any. Set
|
|
321
|
+
`ITQAN_NO_UPDATE_NOTICE=1` to turn it off.
|
|
322
|
+
|
|
323
|
+
`itqan install` writes the lockfile only after every download succeeded, so a failed install
|
|
324
|
+
never leaves a lockfile that doesn't match your files.
|
|
325
|
+
|
|
326
|
+
## Assets that need access approval
|
|
327
|
+
|
|
328
|
+
Some publishers approve each developer before their assets can be downloaded.
|
|
329
|
+
|
|
330
|
+
1. `itqan browse` lists these assets too, marked `request access`, `access pending` or
|
|
331
|
+
`access rejected`, with a link to the asset's page on cms.itqan.dev. Request access there.
|
|
332
|
+
2. Once you're approved, create an API key at
|
|
333
|
+
[cms.itqan.dev/account/api-keys](https://cms.itqan.dev/account/api-keys) and save it:
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
itqan login
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
3. The asset now shows as `granted` in `itqan browse`, and `itqan install` can download it.
|
|
340
|
+
|
|
341
|
+
If `itqan install` hits an asset you can't download yet, it says which one and where to request
|
|
342
|
+
access. In CI, pass the key in the `ITQAN_API_KEY` environment variable instead of
|
|
343
|
+
`itqan login`.
|
|
344
|
+
|
|
345
|
+
## CI
|
|
346
|
+
|
|
347
|
+
Run `itqan install` in CI to download the exact versions in `itqan-assets.lock`. On a pull
|
|
348
|
+
request that updates an asset, this also checks that the new version installs.
|
|
349
|
+
|
|
350
|
+
### GitHub Actions
|
|
351
|
+
|
|
352
|
+
The [setup-itqan](https://github.com/Itqan-community/setup-itqan) action installs `itqan` on
|
|
353
|
+
Linux, macOS and Windows runners:
|
|
354
|
+
|
|
355
|
+
```yaml
|
|
356
|
+
steps:
|
|
357
|
+
- uses: actions/checkout@v7
|
|
358
|
+
- uses: itqan-community/setup-itqan@v1
|
|
359
|
+
with:
|
|
360
|
+
version: latest # or a fixed version, such as 0.2.0
|
|
361
|
+
- run: itqan install
|
|
362
|
+
env:
|
|
363
|
+
ITQAN_API_KEY: ${{ secrets.ITQAN_API_KEY }} # only needed for assets that need access approval
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
Pass `install: true` to have the action run `itqan install` itself. The
|
|
367
|
+
[action's README](https://github.com/Itqan-community/setup-itqan#readme) lists all its options.
|
|
368
|
+
|
|
369
|
+
### Get a pull request when assets have new versions
|
|
370
|
+
|
|
371
|
+
Dependabot and similar tools don't read `itqan-assets.yaml`. To get the same kind of pull request,
|
|
372
|
+
add a workflow that runs `itqan install --force` on a schedule. It picks the newest versions your
|
|
373
|
+
manifest allows, and when that changes the lockfile, it opens a pull request (or updates the open
|
|
374
|
+
one):
|
|
375
|
+
|
|
376
|
+
```yaml
|
|
377
|
+
# .github/workflows/update-itqan-assets.yml
|
|
378
|
+
name: Update Itqan assets
|
|
379
|
+
|
|
380
|
+
on:
|
|
381
|
+
schedule:
|
|
382
|
+
- cron: "0 6 * * 1" # every Monday at 06:00 UTC
|
|
383
|
+
workflow_dispatch: # and whenever you run it by hand
|
|
384
|
+
|
|
385
|
+
permissions:
|
|
386
|
+
contents: write
|
|
387
|
+
pull-requests: write
|
|
388
|
+
|
|
389
|
+
jobs:
|
|
390
|
+
update:
|
|
391
|
+
runs-on: ubuntu-latest
|
|
392
|
+
steps:
|
|
393
|
+
- uses: actions/checkout@v7
|
|
394
|
+
- uses: itqan-community/setup-itqan@v1
|
|
395
|
+
- run: itqan install --force
|
|
396
|
+
env:
|
|
397
|
+
ITQAN_API_KEY: ${{ secrets.ITQAN_API_KEY }} # only needed for assets that need access approval
|
|
398
|
+
- uses: peter-evans/create-pull-request@v8
|
|
399
|
+
with:
|
|
400
|
+
branch: itqan/update-assets
|
|
401
|
+
commit-message: "chore: update Itqan assets"
|
|
402
|
+
title: "Update Itqan assets"
|
|
403
|
+
body: "`itqan install --force` found newer versions allowed by `itqan-assets.yaml`."
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
The pull request includes `itqan-assets.lock`, and the asset files too if you commit them. Add
|
|
407
|
+
`--flutter` to the install if you use [Flutter](#flutter), so `pubspec.yaml` stays in step.
|
|
408
|
+
|
|
409
|
+
Two GitHub settings to know about:
|
|
410
|
+
|
|
411
|
+
- Turn on **Settings > Actions > General > Allow GitHub Actions to create and approve pull
|
|
412
|
+
requests**, or the last step fails.
|
|
413
|
+
- Pull requests opened with the default `GITHUB_TOKEN` don't start your other workflows, so CI
|
|
414
|
+
won't run on them by itself. To have it run, give the step a `token:` from a GitHub App or a
|
|
415
|
+
personal access token, or close and reopen the pull request.
|
|
416
|
+
|
|
417
|
+
It only moves within the ranges in your manifest. To go to a new major version, change the
|
|
418
|
+
`version:` range yourself.
|
|
419
|
+
|
|
420
|
+
### Other CI systems
|
|
421
|
+
|
|
422
|
+
Install `itqan` with whichever method from [Install](#install) suits your build image. For
|
|
423
|
+
example, `npm ci` for a project with `itqan-cli` in its `devDependencies`, or
|
|
424
|
+
`pipx install itqan-cli`. Then run `itqan install`, with `ITQAN_API_KEY` set if you need it.
|
|
425
|
+
|
|
426
|
+
## Commands
|
|
427
|
+
|
|
428
|
+
| Command | What it does |
|
|
429
|
+
|---|---|
|
|
430
|
+
| `itqan init` | Create `itqan-assets.yaml` with a few assets from the catalog as commented-out examples (placeholder examples when offline). `--assets-dir` sets where assets go; `--force` overwrites an existing manifest. |
|
|
431
|
+
| `itqan browse [SEARCH]` | Search the catalog, pick assets, add them to `itqan-assets.yaml` (created if missing), and optionally install them. `--category` limits it to one kind of asset; `--no-interactive` prints a table (the default when not in a terminal); `--json` prints JSON. |
|
|
432
|
+
| `itqan add ASSET[@RANGE]...` | Add assets to `itqan-assets.yaml` (created if missing) and install them. Without `@RANGE` an entry accepts `^` the newest version; an asset already in the manifest gets the new range. `--language` picks a language other than the source; `--no-install` only edits the manifest. |
|
|
433
|
+
| `itqan install` | Download the assets and write `itqan-assets.lock`. Uses the lockfile's exact versions while it matches the manifest. `--force` picks the newest allowed versions and downloads again. `--flutter` keeps `pubspec.yaml` up to date (see [Flutter](#flutter)). `--assets-dir` overrides the manifest's folder for one run. |
|
|
434
|
+
| `itqan sync` | Same as `itqan install`. |
|
|
435
|
+
| `itqan outdated` | List the locked assets that have newer versions: the newest your range allows and the newest overall. `--json` prints JSON. |
|
|
436
|
+
| `itqan login` | Save your API key for the registry, after checking it. `--api-key` passes the key without the prompt. |
|
|
437
|
+
| `itqan logout` | Remove the saved key. |
|
|
438
|
+
| `itqan --version` | Print the CLI version. |
|
|
439
|
+
|
|
440
|
+
Add `--help` to any command for all its options. `install` and `browse` read the manifest from
|
|
441
|
+
`itqan-assets.yaml` in the current folder; `--manifest` (or `-m`) points them elsewhere.
|
|
442
|
+
|
|
443
|
+
## Configuration
|
|
444
|
+
|
|
445
|
+
| Option | Environment variable | Default |
|
|
446
|
+
|---|---|---|
|
|
447
|
+
| `--api-key` | `ITQAN_API_KEY` | The key saved by `itqan login`, if any. |
|
|
448
|
+
| `--registry-url` | `ITQAN_REGISTRY_URL` | `https://api.cms.itqan.dev`, the public registry. |
|
|
449
|
+
| | `ITQAN_NO_UPDATE_NOTICE` | Set to `1` to stop `itqan install` saying that newer versions exist. |
|
|
450
|
+
| | `ITQAN_CONFIG_DIR` | Where `itqan login` saves keys: `~/.config/itqan` (`%APPDATA%\itqan` on Windows). |
|
|
451
|
+
| | `ITQAN_CACHE_DIR` | Dart package only. Where the downloaded program is kept: `~/Library/Caches/itqan` (macOS), `~/.cache/itqan` (Linux), `%LOCALAPPDATA%\itqan` (Windows). |
|
|
452
|
+
| | `ITQAN_CLI_DOWNLOAD_URL` | Dart package only. A folder (`https://` or `file://`) with a release's programs and `SHA256SUMS`, such as a mirror, used instead of the GitHub Release. |
|
|
453
|
+
|
|
454
|
+
A key passed with `--api-key` or `ITQAN_API_KEY` is used instead of the saved one. The saved key
|
|
455
|
+
file is readable only by you.
|
|
456
|
+
|
|
457
|
+
## Troubleshooting
|
|
458
|
+
|
|
459
|
+
**"command not found: itqan".** The folder `itqan` was installed into isn't on your `PATH`. For
|
|
460
|
+
pipx, run `pipx ensurepath`. For Dart, add the folder `dart pub global activate` printed. For npm,
|
|
461
|
+
run it through `npx itqan`.
|
|
462
|
+
|
|
463
|
+
**macOS says the program can't be opened.** Programs downloaded with a browser are blocked
|
|
464
|
+
because they aren't notarized by Apple. Allow it with
|
|
465
|
+
`xattr -d com.apple.quarantine /usr/local/bin/itqan`. Downloads made with `curl`, Homebrew, npm
|
|
466
|
+
or Dart aren't affected.
|
|
467
|
+
|
|
468
|
+
**npm: "@itqan-community/cli-... is not installed".** npm installs the program for your computer
|
|
469
|
+
as an optional dependency of `itqan-cli`. Reinstall without `--omit=optional` or
|
|
470
|
+
`--no-optional`.
|
|
471
|
+
|
|
472
|
+
**"There is no itqan binary for ..." or "no prebuilt binary".** Your system isn't one of those
|
|
473
|
+
listed under [Install](#install). Install with Python instead: `pipx install itqan-cli`.
|
|
474
|
+
|
|
475
|
+
**`itqan install` says an asset needs access, or returns 401 or 403.** See
|
|
476
|
+
[Assets that need access approval](#assets-that-need-access-approval). In CI, check that
|
|
477
|
+
`ITQAN_API_KEY` is set.
|
|
478
|
+
|
|
479
|
+
**"Warning: ... was withdrawn by its publisher".** Your lockfile pins a version the publisher
|
|
480
|
+
has since withdrawn by going back to an earlier version, usually because of a mistake in it; the
|
|
481
|
+
warning shows the reason they gave. It still installs, so your build
|
|
482
|
+
keeps working, but new installs no longer get it. Run `itqan install --force` to move to the
|
|
483
|
+
newest supported version in your range, or change the version in `itqan-assets.yaml` if you
|
|
484
|
+
pinned it there.
|
|
485
|
+
|
|
486
|
+
**"Version removed from the registry" (410).** Itqan removed that version, for example because
|
|
487
|
+
its licence was revoked, and it can't be downloaded any more. Run `itqan install --force` to
|
|
488
|
+
resolve another version, or change the version in `itqan-assets.yaml`.
|
|
489
|
+
|
|
490
|
+
**Flutter: "Unable to load asset".** Make sure the manifest sits next to `pubspec.yaml`, run
|
|
491
|
+
`itqan install --flutter`, and then restart the app fully. Hot reload doesn't pick up new assets.
|
|
492
|
+
|
|
493
|
+
## Development
|
|
494
|
+
|
|
495
|
+
```bash
|
|
496
|
+
uv sync
|
|
497
|
+
uv run pytest
|
|
498
|
+
uv build
|
|
499
|
+
uv run --group binary pyinstaller --onefile --name itqan --copy-metadata itqan-cli --specpath build src/itqan_cli/__main__.py # dist/itqan
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
The npm package is built from [npm/](npm) and the pub.dev package lives in [dart/](dart) (tested
|
|
503
|
+
with `dart test`). Releases are published from version tags; see [RELEASING.md](RELEASING.md).
|