@@ -17,10 +17,10 @@ const data_folder = path.join(process.cwd(), 'databases', 'catdat', 'data_yaml')
1717seed ( )
1818
1919/**
20- * Seeds the data recorded in yaml files into the database.
20+ * Seeds the data recorded in YAML files into the database.
2121 */
2222function seed ( ) {
23- console . info ( '\n--- Seed CatDat database (YAML) ---' )
23+ console . info ( '\n--- Seed CatDat database ---' )
2424
2525 clear_all_data ( )
2626
@@ -36,6 +36,7 @@ function seed() {
3636}
3737
3838function clear_all_data ( ) {
39+ console . info ( `\nClear all tables ...` )
3940 db . transaction ( ( ) => {
4041 db . pragma ( 'foreign_keys = OFF' )
4142
@@ -79,8 +80,12 @@ function clear_all_data() {
7980}
8081
8182function seed_config ( ) {
82- const config_file = path . join ( data_folder , 'config.yaml' )
83- const config_file_content = fs . readFileSync ( config_file , 'utf8' )
83+ console . info ( `\nSeed config...` )
84+
85+ const config_file_content = fs . readFileSync (
86+ path . join ( data_folder , 'config.yaml' ) ,
87+ 'utf8' ,
88+ )
8489 const config = YAML . parse ( config_file_content ) as ConfigYaml
8590
8691 const tag_insert = db . prepare ( `INSERT INTO tags (tag) VALUES (?)` )
@@ -119,6 +124,7 @@ function seed_config() {
119124}
120125
121126function seed_categories ( ) {
127+ console . info ( `\nSeed categories ...` )
122128 const categories_folder = path . join ( data_folder , 'categories' )
123129
124130 const category_files = fs
@@ -168,6 +174,7 @@ function seed_categories() {
168174 db . pragma ( 'defer_foreign_keys = ON' )
169175
170176 for ( const category_file of category_files ) {
177+ console . info ( `Seed: ${ category_file } ` )
171178 const content = fs . readFileSync (
172179 path . join ( categories_folder , category_file ) ,
173180 'utf8' ,
@@ -244,6 +251,7 @@ function seed_categories() {
244251}
245252
246253function seed_category_properties ( ) {
254+ console . info ( `\nSeed category properties ...` )
247255 const property_folder = path . join ( data_folder , 'category-properties' )
248256
249257 const property_files = fs
@@ -265,6 +273,7 @@ function seed_category_properties() {
265273 db . pragma ( 'defer_foreign_keys = ON' )
266274
267275 for ( const property_file of property_files ) {
276+ console . info ( `Seed: ${ property_file } ` )
268277 const content = fs . readFileSync (
269278 path . join ( property_folder , property_file ) ,
270279 'utf8' ,
@@ -288,6 +297,7 @@ function seed_category_properties() {
288297}
289298
290299function seed_lemmas ( ) {
300+ console . info ( `\nSeed lemmas ...` )
291301 const lemma_folder = path . join ( data_folder , 'lemmas' )
292302
293303 const lemma_files = fs
@@ -301,6 +311,7 @@ function seed_lemmas() {
301311
302312 db . transaction ( ( ) => {
303313 for ( const lemma_file of lemma_files ) {
314+ console . info ( `Seed: ${ lemma_file } ` )
304315 const content = fs . readFileSync ( path . join ( lemma_folder , lemma_file ) , 'utf8' )
305316 const lemma = YAML . parse ( content ) as LemmaYaml
306317
@@ -310,6 +321,7 @@ function seed_lemmas() {
310321}
311322
312323function seed_category_implications ( ) {
324+ console . info ( `\nSeed category implications ...` )
313325 const implications_folder = path . join ( data_folder , 'category-implications' )
314326
315327 const implication_files = fs
@@ -336,9 +348,11 @@ function seed_category_implications() {
336348 )
337349
338350 db . transaction ( ( ) => {
339- for ( const implication_file of implication_files ) {
351+ for ( const implications_file of implication_files ) {
352+ console . info ( `Seed: ${ implications_file } ` )
353+
340354 const content = fs . readFileSync (
341- path . join ( implications_folder , implication_file ) ,
355+ path . join ( implications_folder , implications_file ) ,
342356 'utf8' ,
343357 )
344358 const implications = YAML . parse ( content ) as CategoryImplicationYaml [ ]
0 commit comments