tutator-tools
v1.0.2
Published
This library generate catalogs for Tutator projects.
Maintainers
Readme
TUTATOR-TOOLS
This library provides a command-line tool to seed catalogs from an Excel file into your database. It reads the specified Excel file and populates the database with the data contained in it.
Use a prisma client to connect to your database in node.js projects.
Installation
To use this library, first install it via npm:
npm install tutator-tools --legacy-peer-depsAdd a script in your package.json to run the seed:
"scripts": {
"seed:catalogs": "tutator-tools --file=./path-to-your-file.xlsx"
}Then run the script:
npm run seed:catalogsOptions
--file: Path to the Excel file containing the catalogs data. (required)
Excel File Format
The Excel file should have the following structure: | label | value | lang | |-------------|---------------------------------|----------| | Category 1 | category-1 | en | | Category 2 | category-2 | en | | Catégorie 1 | catégorie-1 | fr | | Catégorie 2 | catégorie-2 | fr |
SHEET NAME: The name of the sheet in the Excel file is important, it is used to identify catalog code.
METADATA SHEET
The Excel file should also contain a sheet named METADATA with the following structure:
| code | name | description |
|--------------------|---------------------|---------------------------|
| catalog_code_1 | Catalog Name 1 | Description of Catalog 1 |
| catalog_code_2 | Catalog Name 2 | Description of Catalog 2 |
code: The code of the catalog, used to identify it.name: The name of the catalog.description: A brief description of the catalog.
