This is a database of airsoft guns used in the AIRSOFT SPOTTER application.
Open the following link: https://github.com/Precision-Marks/airsoft_database/issues/new/choose
Node.js: v20 (Tested by v20.8.1) npm >= 10.1.0
Run npm ci to install required packages from package-lock.json.
When adding or updating dependencies, use npm install <package> and commit both package.json and package-lock.json.
Use npm ci for normal setup and CI runs.
Use npm install only when you intentionally update dependencies.
- Create a branch for dependency updates.
- Update dependencies (prefer scoped updates):
npm install <package>@latest- or
npm update(use with care)
- Verify both files changed as expected:
package.jsonpackage-lock.json
- Run verification commands:
npm cinpm audit signaturesnpm audit --audit-level=highnpm run test-database
- Commit
package.jsonandpackage-lock.jsontogether and open a PR. - Merge only after CI checks pass (
validate-csvanddependency-review).
npm run test-database
sh build-databases.sh
If you would like to copy the DB files to AIRSOFT SPOTTER app:
sh cpdata.sh ../<app_repository>/app/src/main/assets
- By default, both Realm and SQLite databases are generated.
- You can specify the format with
--format:realm: generate only Realm databasesqlite: generate only SQLite databaseall: generate both (default)
Outputs:
- Realm:
db/realm/catalog_data.realmanddb/realm/catalog_data.realm.commitid - SQLite:
db/sqlite/catalog_data.dbanddb/sqlite/catalog_data.db.commitid - Extracted SQLite DDL:
db/sqlite/catalog_schema.sql
Examples:
- Generate both:
sh build-databases.sh
- Generate only SQLite (direct call):
npx ts-node src/index.ts --format sqlite -c <commit>
To add/modify the gun database edit ./source_data/GunCatalog.csv
To add/modify manufacturer database, edit ./source_data/ManufacturerCatalog.csv
Please refer to the Data Schema section below for details on the required fields and format for these CSV files.
If you add a manufacturer, you should also add "generic" gun data in GunCatalog.csv. The "generic" data has ID < 10000 and starts from 0,25,50,75.
And also set src/models/GunIdRange.ts. Gun ID for a manufacturer starts from n x 1000 to n x 1000 + 999.
Details about the structure and fields of the CSV source files can be found in the following documents:
- Manufacturer Catalog Schema: Describes the format of
source_data/ManufacturerCatalog.csv. See docs/ManufacturerCatalog.md. - Gun Catalog Schema: Describes the format of
source_data/GunCatalog.csv. See docs/GunCatalog.md.
- Rainbow CSV
- vscode-input-sequence: To set sequential id numbers