lucy-cli 2.0.0-beta.4 → 2.0.0-beta.6
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/dist/commands/checks.d.ts +2 -2
- package/dist/commands/exec.d.ts +1 -1
- package/dist/commands/git.d.ts +2 -2
- package/dist/commands/home.d.ts +2 -2
- package/dist/commands/home.js +25 -2
- package/dist/commands/home.js.map +1 -1
- package/dist/index.js +0 -0
- package/dist/init/blocks.d.ts +1 -1
- package/dist/init/cargo.d.ts +1 -1
- package/dist/init/expo.d.ts +1 -1
- package/dist/init/gitModules.d.ts +1 -1
- package/dist/init/index.d.ts +1 -2
- package/dist/init/monorepo.d.ts +1 -1
- package/dist/init/prepareVelo.d.ts +1 -1
- package/dist/init/tauri.d.ts +1 -1
- package/dist/init/templates.d.ts +1 -1
- package/dist/init/velo.d.ts +1 -1
- package/dist/tasks/index.d.ts +1 -1
- package/dist/wix-sdk/index.d.ts +1 -1
- package/dist/wix-sdk/init.d.ts +1 -1
- package/dist/wix-sdk/run.d.ts +1 -1
- package/dist/wix-sync/index.d.ts +1 -1
- package/dist/wix-sync/init.d.ts +1 -1
- package/files/templates/expo verse[D]/files/.nvmrc +1 -0
- package/files/templates/expo verse[D]/files/.prettierignore +23 -0
- package/files/templates/expo verse[D]/files/.prettierrc.js +16 -0
- package/files/templates/expo verse[D]/files/.stylelintrc.json +8 -0
- package/files/templates/expo verse[D]/files/.vscode/extensions.json +10 -0
- package/files/templates/expo verse[D]/files/.vscode/launch.json +54 -0
- package/files/templates/expo verse[D]/files/.vscode/settings.json +30 -0
- package/files/templates/expo verse[D]/files/.vscode/tasks.json +0 -0
- package/files/templates/expo verse[D]/files/.yarnrc +1 -0
- package/files/templates/expo verse[D]/files/.yarnrc.yml +8 -0
- package/files/templates/expo verse[D]/files/App.tsx +63 -0
- package/files/templates/expo verse[D]/files/DEBUGGING.md +126 -0
- package/files/templates/expo verse[D]/files/README.md +45 -0
- package/files/templates/expo verse[D]/files/android/app/build.gradle +177 -0
- package/files/templates/expo verse[D]/files/android/app/debug.keystore +0 -0
- package/files/templates/expo verse[D]/files/android/app/proguard-rules.pro +14 -0
- package/files/templates/expo verse[D]/files/android/app/src/debug/AndroidManifest.xml +7 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/AndroidManifest.xml +33 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/java/so/sunnysideup/daily_verse/MainActivity.kt +65 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/java/so/sunnysideup/daily_verse/MainApplication.kt +57 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/drawable/ic_launcher_background.xml +6 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/drawable-hdpi/splashscreen_logo.png +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/drawable-mdpi/splashscreen_logo.png +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/drawable-night-hdpi/splashscreen_logo.png +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/drawable-night-mdpi/splashscreen_logo.png +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/drawable-night-xhdpi/splashscreen_logo.png +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/drawable-night-xxhdpi/splashscreen_logo.png +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/drawable-night-xxxhdpi/splashscreen_logo.png +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/drawable-xhdpi/splashscreen_logo.png +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/drawable-xxhdpi/splashscreen_logo.png +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/drawable-xxxhdpi/splashscreen_logo.png +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +6 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +6 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/mipmap-hdpi/ic_launcher.webp +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.webp +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/mipmap-mdpi/ic_launcher.webp +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.webp +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/mipmap-xhdpi/ic_launcher.webp +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.webp +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.webp +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.webp +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp +0 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/values/colors.xml +6 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/values/strings.xml +7 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/values/styles.xml +12 -0
- package/files/templates/expo verse[D]/files/android/app/src/main/res/values-night/colors.xml +3 -0
- package/files/templates/expo verse[D]/files/android/build.gradle +37 -0
- package/files/templates/expo verse[D]/files/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/files/templates/expo verse[D]/files/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/files/templates/expo verse[D]/files/android/gradle.properties +59 -0
- package/files/templates/expo verse[D]/files/android/gradlew +251 -0
- package/files/templates/expo verse[D]/files/android/gradlew.bat +94 -0
- package/files/templates/expo verse[D]/files/android/settings.gradle +39 -0
- package/files/templates/expo verse[D]/files/app.config.ts +77 -0
- package/files/templates/expo verse[D]/files/assets/data/de.csv +949 -0
- package/files/templates/expo verse[D]/files/assets/data/en.csv +949 -0
- package/files/templates/expo verse[D]/files/assets/fonts/PlayfairDisplay-Black.ttf +0 -0
- package/files/templates/expo verse[D]/files/assets/fonts/PlayfairDisplay-BlackItalic.ttf +0 -0
- package/files/templates/expo verse[D]/files/assets/fonts/PlayfairDisplay-Bold.ttf +0 -0
- package/files/templates/expo verse[D]/files/assets/fonts/PlayfairDisplay-BoldItalic.ttf +0 -0
- package/files/templates/expo verse[D]/files/assets/fonts/PlayfairDisplay-ExtraBold.ttf +0 -0
- package/files/templates/expo verse[D]/files/assets/fonts/PlayfairDisplay-ExtraBoldItalic.ttf +0 -0
- package/files/templates/expo verse[D]/files/assets/fonts/PlayfairDisplay-Italic.ttf +0 -0
- package/files/templates/expo verse[D]/files/assets/fonts/PlayfairDisplay-Medium.ttf +0 -0
- package/files/templates/expo verse[D]/files/assets/fonts/PlayfairDisplay-MediumItalic.ttf +0 -0
- package/files/templates/expo verse[D]/files/assets/fonts/PlayfairDisplay-Regular.ttf +0 -0
- package/files/templates/expo verse[D]/files/assets/fonts/PlayfairDisplay-SemiBold.ttf +0 -0
- package/files/templates/expo verse[D]/files/assets/fonts/PlayfairDisplay-SemiBoldItalic.ttf +0 -0
- package/files/templates/expo verse[D]/files/assets/fonts/SpaceMono-Regular.ttf +0 -0
- package/files/templates/expo verse[D]/files/assets/images/andorid/background.png +0 -0
- package/files/templates/expo verse[D]/files/assets/images/android-dark.png +0 -0
- package/files/templates/expo verse[D]/files/assets/images/android-light.png +0 -0
- package/files/templates/expo verse[D]/files/assets/images/background.png +0 -0
- package/files/templates/expo verse[D]/files/assets/images/ios-dark.png +0 -0
- package/files/templates/expo verse[D]/files/assets/images/ios-light.png +0 -0
- package/files/templates/expo verse[D]/files/assets/images/ios-tinted.png +0 -0
- package/files/templates/expo verse[D]/files/assets/images/splash-icon-dark.png +0 -0
- package/files/templates/expo verse[D]/files/assets/images/splash-icon-light.png +0 -0
- package/files/templates/expo verse[D]/files/babel.config.js +10 -0
- package/files/templates/expo verse[D]/files/components/.gitkeep +0 -0
- package/files/templates/expo verse[D]/files/components/MainScreen.tsx +299 -0
- package/files/templates/expo verse[D]/files/components/Share.tsx +132 -0
- package/files/templates/expo verse[D]/files/components/ui/.gitkeep +0 -0
- package/files/templates/expo verse[D]/files/components/ui/dev.tsx +48 -0
- package/files/templates/expo verse[D]/files/constants/config.ts +30 -0
- package/files/templates/expo verse[D]/files/constants/theme.ts +18 -0
- package/files/templates/expo verse[D]/files/data/de.csv +219 -0
- package/files/templates/expo verse[D]/files/data/en.csv +219 -0
- package/files/templates/expo verse[D]/files/data/version.json +4 -0
- package/files/templates/expo verse[D]/files/eas.json +47 -0
- package/files/templates/expo verse[D]/files/eslint.config.mjs +185 -0
- package/files/templates/expo verse[D]/files/global.css +47 -0
- package/files/templates/expo verse[D]/files/hooks/useColorScheme.ts +17 -0
- package/files/templates/expo verse[D]/files/index.ts +28 -0
- package/files/templates/expo verse[D]/files/lib/content.ts +31 -0
- package/files/templates/expo verse[D]/files/lib/data.ts +180 -0
- package/files/templates/expo verse[D]/files/lib/helper.ts +54 -0
- package/files/templates/expo verse[D]/files/lib/index.ts +21 -0
- package/files/templates/expo verse[D]/files/lib/state.ts +128 -0
- package/files/templates/expo verse[D]/files/lib/storage.ts +17 -0
- package/files/templates/expo verse[D]/files/lib/taskManager/index.ts +38 -0
- package/files/templates/expo verse[D]/files/lib/taskManager/loadData.ts +14 -0
- package/files/templates/expo verse[D]/files/lib/utils/index.ts +11 -0
- package/files/templates/expo verse[D]/files/lib/utils/polyfills.ts +29 -0
- package/files/templates/expo verse[D]/files/lib/utils/screenshot.ts +77 -0
- package/files/templates/expo verse[D]/files/lucy.json +8 -0
- package/files/templates/expo verse[D]/files/metro.config.js +81 -0
- package/files/templates/expo verse[D]/files/models/index.ts +28 -0
- package/files/templates/expo verse[D]/files/nativewind-env.d.ts +1 -0
- package/files/templates/expo verse[D]/files/package.json +102 -0
- package/files/templates/expo verse[D]/files/pnpm-workspace.yaml +3 -0
- package/files/templates/expo verse[D]/files/scripts/convert-verses.ts +309 -0
- package/files/templates/expo verse[D]/files/scripts/move-artifacts.ts +83 -0
- package/files/templates/expo verse[D]/files/scripts/reset-project.ts +116 -0
- package/files/templates/expo verse[D]/files/tailwind.config.js +63 -0
- package/files/templates/expo verse[D]/files/tsconfig.json +45 -0
- package/files/templates/expo verse[D]/files/types/index.ts +4 -0
- package/files/templates/expo verse[D]/files/types/reset.d.ts +1 -0
- package/files/templates/expo verse[D]/lucy.json +86 -0
- package/files/templates/expo[D]/files/app.config.ts +69 -0
- package/files/templates/expo[D]/files/assets/fonts/SpaceMono-Regular.ttf +0 -0
- package/files/templates/expo[D]/files/scripts/reset-project.ts +0 -0
- package/old/index.ts +0 -0
- package/package.json +11 -12
- package/pnpm-workspace.yaml +6 -0
- package/src/commands/home.ts +36 -2
- package/src/index.ts +0 -0
@@ -0,0 +1,309 @@
|
|
1
|
+
import * as fs from 'fs';
|
2
|
+
import * as path from 'path';
|
3
|
+
|
4
|
+
interface CSVVerse {
|
5
|
+
Verse: string;
|
6
|
+
Reference: string;
|
7
|
+
Topic: string;
|
8
|
+
}
|
9
|
+
|
10
|
+
interface ConvertedVerse {
|
11
|
+
Verse: string;
|
12
|
+
Reference: string;
|
13
|
+
Topic: string;
|
14
|
+
}
|
15
|
+
|
16
|
+
interface FailedVerse {
|
17
|
+
Verse: string;
|
18
|
+
Reference: string;
|
19
|
+
Topic: string;
|
20
|
+
Reason: string;
|
21
|
+
}
|
22
|
+
|
23
|
+
// Function to convert Bible reference to XML format
|
24
|
+
function convertReferenceToXMLFormat(reference: string): string {
|
25
|
+
// Map common book names to their abbreviations
|
26
|
+
const bookMap: { [key: string]: string } = {
|
27
|
+
'1 Chronicles': '1CH',
|
28
|
+
'1 Corinthians': '1CO',
|
29
|
+
'1 John': '1JN',
|
30
|
+
'1 Peter': '1PE',
|
31
|
+
'1 Samuel': '1SA',
|
32
|
+
'1 Thessalonians': '1TH',
|
33
|
+
'1 Timothy': '1TI',
|
34
|
+
'2 Chronicles': '2CH',
|
35
|
+
'2 Corinthians': '2CO',
|
36
|
+
'2 John': '2JN',
|
37
|
+
'2 Peter': '2PE',
|
38
|
+
'2 Samuel': '2SA',
|
39
|
+
'2 Thessalonians': '2TH',
|
40
|
+
'2 Timothy': '2TI',
|
41
|
+
'Acts': 'ACT',
|
42
|
+
'Colossians': 'COL',
|
43
|
+
'Daniel': 'DAN',
|
44
|
+
'Deuteronomy': 'DEU',
|
45
|
+
'Ecclesiastes': 'ECC',
|
46
|
+
'Ephesians': 'EPH',
|
47
|
+
'Esther': 'EST',
|
48
|
+
'Exodus': 'EXO',
|
49
|
+
'Ezekiel': 'EZK',
|
50
|
+
'Ezra': 'EZR',
|
51
|
+
'Galatians': 'GAL',
|
52
|
+
'Genesis': 'GEN',
|
53
|
+
'Habakkuk': 'HAB',
|
54
|
+
'Haggai': 'HAG',
|
55
|
+
'Hebrews': 'HEB',
|
56
|
+
'Hosea': 'HOS',
|
57
|
+
'Isaiah': 'ISA',
|
58
|
+
'James': 'JAS',
|
59
|
+
'Jeremiah': 'JER',
|
60
|
+
'Job': 'JOB',
|
61
|
+
'Joel': 'JOE',
|
62
|
+
'John': 'JHN',
|
63
|
+
'Jonah': 'JON',
|
64
|
+
'Joshua': 'JOS',
|
65
|
+
'Jude': 'JUD',
|
66
|
+
'Judges': 'JDG',
|
67
|
+
'Lamentations': 'LAM',
|
68
|
+
'Leviticus': 'LEV',
|
69
|
+
'Luke': 'LUK',
|
70
|
+
'Malachi': 'MAL',
|
71
|
+
'Mark': 'MRK',
|
72
|
+
'Matthew': 'MAT',
|
73
|
+
'Micah': 'MIC',
|
74
|
+
'Nahum': 'NAH',
|
75
|
+
'Nehemiah': 'NEH',
|
76
|
+
'Numbers': 'NUM',
|
77
|
+
'Obadiah': 'OBA',
|
78
|
+
'Philemon': 'PHM',
|
79
|
+
'Philippians': 'PHP',
|
80
|
+
'Proverbs': 'PRO',
|
81
|
+
'Psalms': 'PSA',
|
82
|
+
'Revelation': 'REV',
|
83
|
+
'Romans': 'ROM',
|
84
|
+
'Ruth': 'RUT',
|
85
|
+
'Song of Solomon': 'SNG',
|
86
|
+
'Titus': 'TIT',
|
87
|
+
'Zechariah': 'ZEC',
|
88
|
+
'Zephaniah': 'ZEP'
|
89
|
+
};
|
90
|
+
|
91
|
+
// Extract book name and verse numbers
|
92
|
+
const match = reference.match(/^(.+?)\s+(\d+):(\d+)$/);
|
93
|
+
if (!match) {
|
94
|
+
throw new Error(`Invalid reference format: ${reference}`);
|
95
|
+
}
|
96
|
+
|
97
|
+
const bookName = match[1];
|
98
|
+
const chapter = match[2];
|
99
|
+
const verse = match[3];
|
100
|
+
|
101
|
+
const bookAbbr = bookMap[bookName];
|
102
|
+
if (!bookAbbr) {
|
103
|
+
throw new Error(`Unknown book: ${bookName}`);
|
104
|
+
}
|
105
|
+
|
106
|
+
return `${bookAbbr}.${chapter}.${verse}`;
|
107
|
+
}
|
108
|
+
|
109
|
+
// Function to add proper sentence ending
|
110
|
+
function addSentenceEnding(text: string): string {
|
111
|
+
const trimmed = text.trim();
|
112
|
+
|
113
|
+
// If it already ends with a proper sentence ending, return as is
|
114
|
+
if (trimmed.match(/[.!?;]$/)) {
|
115
|
+
return trimmed;
|
116
|
+
}
|
117
|
+
|
118
|
+
// If it ends with a comma, replace with period
|
119
|
+
if (trimmed.endsWith(',')) {
|
120
|
+
return trimmed.slice(0, -1) + '.';
|
121
|
+
}
|
122
|
+
|
123
|
+
// Otherwise, add a period
|
124
|
+
return trimmed + '.';
|
125
|
+
}
|
126
|
+
|
127
|
+
// Function to extract complete verse text from XML
|
128
|
+
function extractCompleteVerse(xmlContent: string, bcv: string): string {
|
129
|
+
// Find the verse in the XML
|
130
|
+
const versePattern = new RegExp(`<v id="[^"]*" bcv="${bcv.replace(/\./g, '\\.')}"[^>]*/>([\\s\\S]*?)(?=<v id="[^"]*" bcv="[^"]*"|<ve />|</p>)`, 'g');
|
131
|
+
const match = versePattern.exec(xmlContent);
|
132
|
+
|
133
|
+
if (!match) {
|
134
|
+
return '';
|
135
|
+
}
|
136
|
+
|
137
|
+
let verseText = match[1];
|
138
|
+
|
139
|
+
// Extract text from <w> tags
|
140
|
+
const wordPattern = /<w[^>]*>([^<]+)<\/w>/g;
|
141
|
+
let words: string[] = [];
|
142
|
+
let wordMatch;
|
143
|
+
|
144
|
+
while ((wordMatch = wordPattern.exec(verseText)) !== null) {
|
145
|
+
words.push(wordMatch[1]);
|
146
|
+
}
|
147
|
+
|
148
|
+
let completeVerse = words.join(' ').trim();
|
149
|
+
|
150
|
+
// Check if the verse ends with a comma or incomplete sentence
|
151
|
+
// If so, try to find the complete sentence by looking at the next verse
|
152
|
+
if (completeVerse.endsWith(',') || !completeVerse.match(/[.!?;]$/)) {
|
153
|
+
// Extract chapter and verse numbers
|
154
|
+
const bcvMatch = bcv.match(/^([^.]+)\.(\d+)\.(\d+)$/);
|
155
|
+
if (bcvMatch) {
|
156
|
+
const [, book, chapter, verse] = bcvMatch;
|
157
|
+
const nextVerse = parseInt(verse) + 1;
|
158
|
+
const nextBcv = `${book}.${chapter}.${nextVerse}`;
|
159
|
+
|
160
|
+
// Try to get the next verse
|
161
|
+
const nextVersePattern = new RegExp(`<v id="[^"]*" bcv="${nextBcv.replace(/\./g, '\\.')}"[^>]*/>([\\s\\S]*?)(?=<v id="[^"]*" bcv="[^"]*"|<ve />|</p>)`, 'g');
|
162
|
+
const nextMatch = nextVersePattern.exec(xmlContent);
|
163
|
+
|
164
|
+
if (nextMatch) {
|
165
|
+
let nextVerseText = nextMatch[1];
|
166
|
+
const nextWords: string[] = [];
|
167
|
+
const nextWordPattern = /<w[^>]*>([^<]+)<\/w>/g;
|
168
|
+
let nextWordMatch;
|
169
|
+
|
170
|
+
while ((nextWordMatch = nextWordPattern.exec(nextVerseText)) !== null) {
|
171
|
+
nextWords.push(nextWordMatch[1]);
|
172
|
+
}
|
173
|
+
|
174
|
+
const nextCompleteVerse = nextWords.join(' ').trim();
|
175
|
+
|
176
|
+
// Combine verses until we find a proper sentence ending
|
177
|
+
let combinedVerse = completeVerse + ' ' + nextCompleteVerse;
|
178
|
+
|
179
|
+
// If still incomplete, try one more verse
|
180
|
+
if (combinedVerse.endsWith(',') || !combinedVerse.match(/[.!?;]$/)) {
|
181
|
+
const nextNextVerse = nextVerse + 1;
|
182
|
+
const nextNextBcv = `${book}.${chapter}.${nextNextVerse}`;
|
183
|
+
const nextNextVersePattern = new RegExp(`<v id="[^"]*" bcv="${nextNextBcv.replace(/\./g, '\\.')}"[^>]*/>([\\s\\S]*?)(?=<v id="[^"]*" bcv="[^"]*"|<ve />|</p>)`, 'g');
|
184
|
+
const nextNextMatch = nextNextVersePattern.exec(xmlContent);
|
185
|
+
|
186
|
+
if (nextNextMatch) {
|
187
|
+
let nextNextVerseText = nextNextMatch[1];
|
188
|
+
const nextNextWords: string[] = [];
|
189
|
+
const nextNextWordPattern = /<w[^>]*>([^<]+)<\/w>/g;
|
190
|
+
let nextNextWordMatch;
|
191
|
+
|
192
|
+
while ((nextNextWordMatch = nextNextWordPattern.exec(nextNextVerseText)) !== null) {
|
193
|
+
nextNextWords.push(nextNextWordMatch[1]);
|
194
|
+
}
|
195
|
+
|
196
|
+
const nextNextCompleteVerse = nextNextWords.join(' ').trim();
|
197
|
+
combinedVerse = combinedVerse + ' ' + nextNextCompleteVerse;
|
198
|
+
}
|
199
|
+
}
|
200
|
+
|
201
|
+
return addSentenceEnding(combinedVerse);
|
202
|
+
}
|
203
|
+
}
|
204
|
+
}
|
205
|
+
|
206
|
+
return addSentenceEnding(completeVerse);
|
207
|
+
}
|
208
|
+
|
209
|
+
// Main conversion function
|
210
|
+
function convertVerses(): void {
|
211
|
+
try {
|
212
|
+
// Read the original CSV file
|
213
|
+
const csvPath = path.join(__dirname, '../data/en.csv');
|
214
|
+
const xmlPath = path.join(__dirname, '../data/engwebp_usfx.xml');
|
215
|
+
|
216
|
+
if (!fs.existsSync(csvPath)) {
|
217
|
+
console.error('Original CSV file not found:', csvPath);
|
218
|
+
return;
|
219
|
+
}
|
220
|
+
|
221
|
+
if (!fs.existsSync(xmlPath)) {
|
222
|
+
console.error('XML file not found:', xmlPath);
|
223
|
+
return;
|
224
|
+
}
|
225
|
+
|
226
|
+
console.log('Reading CSV file...');
|
227
|
+
const csvContent = fs.readFileSync(csvPath, 'utf-8');
|
228
|
+
const lines = csvContent.split('\n');
|
229
|
+
|
230
|
+
console.log('Reading XML file...');
|
231
|
+
const xmlContent = fs.readFileSync(xmlPath, 'utf-8');
|
232
|
+
|
233
|
+
const convertedVerses: ConvertedVerse[] = [];
|
234
|
+
const failedVerses: FailedVerse[] = [];
|
235
|
+
|
236
|
+
console.log('Processing verses...');
|
237
|
+
|
238
|
+
// Skip header line
|
239
|
+
for (let i = 1; i < lines.length; i++) {
|
240
|
+
const line = lines[i].trim();
|
241
|
+
if (!line) continue;
|
242
|
+
|
243
|
+
// Parse CSV line (simple parsing, assumes no commas in content)
|
244
|
+
const parts = line.split(',');
|
245
|
+
if (parts.length < 3) continue;
|
246
|
+
|
247
|
+
const verse = parts[0];
|
248
|
+
const reference = parts[1];
|
249
|
+
const topic = parts[2];
|
250
|
+
|
251
|
+
try {
|
252
|
+
const bcv = convertReferenceToXMLFormat(reference);
|
253
|
+
const convertedVerse = extractCompleteVerse(xmlContent, bcv);
|
254
|
+
|
255
|
+
if (convertedVerse && convertedVerse.trim()) {
|
256
|
+
convertedVerses.push({
|
257
|
+
Verse: convertedVerse.trim(),
|
258
|
+
Reference: reference,
|
259
|
+
Topic: topic
|
260
|
+
});
|
261
|
+
} else {
|
262
|
+
failedVerses.push({
|
263
|
+
Verse: verse,
|
264
|
+
Reference: reference,
|
265
|
+
Topic: topic,
|
266
|
+
Reason: 'Could not find verse in XML'
|
267
|
+
});
|
268
|
+
}
|
269
|
+
} catch (error) {
|
270
|
+
failedVerses.push({
|
271
|
+
Verse: verse,
|
272
|
+
Reference: reference,
|
273
|
+
Topic: topic,
|
274
|
+
Reason: `Error: ${error instanceof Error ? error.message : 'Unknown error'}`
|
275
|
+
});
|
276
|
+
}
|
277
|
+
}
|
278
|
+
|
279
|
+
// Write converted verses to CSV
|
280
|
+
const convertedPath = path.join(__dirname, '../data/en_converted.csv');
|
281
|
+
let convertedCsv = 'Verse,Reference,Topic\n';
|
282
|
+
convertedVerses.forEach(v => {
|
283
|
+
convertedCsv += `${v.Verse},${v.Reference},${v.Topic}\n`;
|
284
|
+
});
|
285
|
+
fs.writeFileSync(convertedPath, convertedCsv);
|
286
|
+
|
287
|
+
// Write failed verses to CSV
|
288
|
+
const failedPath = path.join(__dirname, '../data/en_failed.csv');
|
289
|
+
let failedCsv = 'Verse,Reference,Topic,Reason\n';
|
290
|
+
failedVerses.forEach(v => {
|
291
|
+
failedCsv += `${v.Verse},${v.Reference},${v.Topic},${v.Reason}\n`;
|
292
|
+
});
|
293
|
+
fs.writeFileSync(failedPath, failedCsv);
|
294
|
+
|
295
|
+
console.log(`\nConversion complete!`);
|
296
|
+
console.log(`Successfully converted: ${convertedVerses.length} verses`);
|
297
|
+
console.log(`Failed to convert: ${failedVerses.length} verses`);
|
298
|
+
console.log(`Total processed: ${convertedVerses.length + failedVerses.length} verses`);
|
299
|
+
console.log(`\nFiles created:`);
|
300
|
+
console.log(`- ${convertedPath} (${convertedVerses.length + 1} lines)`);
|
301
|
+
console.log(`- ${failedPath} (${failedVerses.length + 1} lines)`);
|
302
|
+
|
303
|
+
} catch (error) {
|
304
|
+
console.error('Error during conversion:', error);
|
305
|
+
}
|
306
|
+
}
|
307
|
+
|
308
|
+
// Run the conversion
|
309
|
+
convertVerses();
|
@@ -0,0 +1,83 @@
|
|
1
|
+
import fs, { type Dirent } from 'fs';
|
2
|
+
import path from 'path';
|
3
|
+
|
4
|
+
const ROOT_DIR: string = path.resolve(__dirname, '..');
|
5
|
+
const BUILD_DIR: string = path.join(ROOT_DIR, 'build');
|
6
|
+
const EXTENSIONS: Set<string> = new Set(['.ipa', '.aab', '.apk', '.tar']);
|
7
|
+
const RECENT_WINDOW_MS: number = 30 * 60 * 1000; // 30 minutes
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Ensure build directory exists.
|
11
|
+
*/
|
12
|
+
function ensureBuildDir(): void {
|
13
|
+
if (!fs.existsSync(BUILD_DIR)) {
|
14
|
+
fs.mkdirSync(BUILD_DIR, { recursive: true });
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
/**
|
19
|
+
* Determine if a file name represents an artifact we want to move.
|
20
|
+
* @param fileName The file name to check.
|
21
|
+
* @returns True if file is an artifact.
|
22
|
+
*/
|
23
|
+
function isArtifact(fileName: string): boolean {
|
24
|
+
const lower = fileName.toLowerCase();
|
25
|
+
if (lower.endsWith('.tar.gz')) {
|
26
|
+
|
27
|
+
return true;
|
28
|
+
}
|
29
|
+
const ext = path.extname(lower);
|
30
|
+
|
31
|
+
return EXTENSIONS.has(ext);
|
32
|
+
}
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Move artifacts modified within a recent time window into build/.
|
36
|
+
*/
|
37
|
+
function moveRecentArtifacts(): void {
|
38
|
+
const now = Date.now();
|
39
|
+
const entries = fs.readdirSync(ROOT_DIR, { withFileTypes: true });
|
40
|
+
const candidates = entries
|
41
|
+
.filter((d: Dirent) => d.isFile() && isArtifact(d.name))
|
42
|
+
.map((d: Dirent) => path.join(ROOT_DIR, d.name))
|
43
|
+
.filter((full: string) => {
|
44
|
+
try {
|
45
|
+
const stat = fs.statSync(full);
|
46
|
+
|
47
|
+
return now - stat.mtimeMs <= RECENT_WINDOW_MS;
|
48
|
+
} catch {
|
49
|
+
|
50
|
+
return false;
|
51
|
+
}
|
52
|
+
});
|
53
|
+
|
54
|
+
if (candidates.length === 0) {
|
55
|
+
// eslint-disable-next-line no-console
|
56
|
+
console.log('No recent artifacts to move.');
|
57
|
+
|
58
|
+
return;
|
59
|
+
}
|
60
|
+
|
61
|
+
for (const src of candidates) {
|
62
|
+
const dest = path.join(BUILD_DIR, path.basename(src));
|
63
|
+
try {
|
64
|
+
fs.renameSync(src, dest);
|
65
|
+
// eslint-disable-next-line no-console
|
66
|
+
console.log(`Moved: ${path.basename(src)} -> build/${path.basename(dest)}`);
|
67
|
+
} catch (err) {
|
68
|
+
const message = err && typeof err === 'object' && 'message' in err ? String((err as Error).message) : String(err);
|
69
|
+
// eslint-disable-next-line no-console
|
70
|
+
console.warn(`Failed to move ${src}:`, message);
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
/**
|
76
|
+
* Entrypoint.
|
77
|
+
*/
|
78
|
+
function main(): void {
|
79
|
+
ensureBuildDir();
|
80
|
+
moveRecentArtifacts();
|
81
|
+
}
|
82
|
+
|
83
|
+
main();
|
@@ -0,0 +1,116 @@
|
|
1
|
+
#!/usr/bin/env ts-node
|
2
|
+
/* eslint-disable no-console */
|
3
|
+
|
4
|
+
/**
|
5
|
+
* This script is used to reset the project to a blank state.
|
6
|
+
* It deletes or moves the /app, /components, /hooks, /scripts, and /constants directories to /app-example based on user input and creates a new /app directory with an index.tsx and _layout.tsx file.
|
7
|
+
* You can remove the `reset-project` script from package.json and safely delete this file after running it.
|
8
|
+
*/
|
9
|
+
|
10
|
+
import fs from 'fs';
|
11
|
+
import path from 'path';
|
12
|
+
import { createInterface } from 'readline/promises';
|
13
|
+
|
14
|
+
const root = process.cwd();
|
15
|
+
const oldDirs = ['app', 'components', 'hooks', 'constants', 'scripts'];
|
16
|
+
const exampleDir = 'app-example';
|
17
|
+
const newAppDir = 'app';
|
18
|
+
const exampleDirPath = path.join(root, exampleDir);
|
19
|
+
|
20
|
+
const indexContent = `import { Text, View } from "react-native";
|
21
|
+
|
22
|
+
export default function Index() {
|
23
|
+
return (
|
24
|
+
<View
|
25
|
+
style={{
|
26
|
+
flex: 1,
|
27
|
+
justifyContent: "center",
|
28
|
+
alignItems: "center",
|
29
|
+
}}
|
30
|
+
>
|
31
|
+
<Text>Edit app/index.tsx to edit this screen.</Text>
|
32
|
+
</View>
|
33
|
+
);
|
34
|
+
}
|
35
|
+
`;
|
36
|
+
|
37
|
+
const layoutContent = `import { Stack } from "expo-router";
|
38
|
+
|
39
|
+
export default function RootLayout() {
|
40
|
+
return <Stack />;
|
41
|
+
}
|
42
|
+
`;
|
43
|
+
|
44
|
+
const moveDirectories = async (userInput: string) => {
|
45
|
+
if (userInput === 'y') {
|
46
|
+
// Create the app-example directory
|
47
|
+
await fs.promises.mkdir(exampleDirPath, { recursive: true });
|
48
|
+
console.log(`📁 /${exampleDir} directory created.`);
|
49
|
+
}
|
50
|
+
|
51
|
+
// Move old directories to new app-example directory or delete them
|
52
|
+
for (const dir of oldDirs) {
|
53
|
+
const oldDirPath = path.join(root, dir);
|
54
|
+
if (fs.existsSync(oldDirPath)) {
|
55
|
+
if (userInput === 'y') {
|
56
|
+
const newDirPath = path.join(root, exampleDir, dir);
|
57
|
+
await fs.promises.rename(oldDirPath, newDirPath);
|
58
|
+
console.log(`➡️ /${dir} moved to /${exampleDir}/${dir}.`);
|
59
|
+
} else {
|
60
|
+
await fs.promises.rm(oldDirPath, { recursive: true, force: true });
|
61
|
+
console.log(`❌ /${dir} deleted.`);
|
62
|
+
}
|
63
|
+
} else {
|
64
|
+
console.log(`➡️ /${dir} does not exist, skipping.`);
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
// Create new /app directory
|
69
|
+
const newAppDirPath = path.join(root, newAppDir);
|
70
|
+
await fs.promises.mkdir(newAppDirPath, { recursive: true });
|
71
|
+
console.log('\n📁 New /app directory created.');
|
72
|
+
|
73
|
+
// Create index.tsx
|
74
|
+
const indexPath = path.join(newAppDirPath, 'index.tsx');
|
75
|
+
await fs.promises.writeFile(indexPath, indexContent);
|
76
|
+
console.log('📄 app/index.tsx created.');
|
77
|
+
|
78
|
+
// Create _layout.tsx
|
79
|
+
const layoutPath = path.join(newAppDirPath, '_layout.tsx');
|
80
|
+
await fs.promises.writeFile(layoutPath, layoutContent);
|
81
|
+
console.log('📄 app/_layout.tsx created.');
|
82
|
+
|
83
|
+
console.log('\n✅ Project reset complete. Next steps:');
|
84
|
+
console.log(
|
85
|
+
`1. Run \`npx expo start\` to start a development server.\n2. Edit app/index.tsx to edit the main screen.${
|
86
|
+
userInput === 'y'
|
87
|
+
? `\n3. Delete the /${exampleDir} directory when you're done referencing it.`
|
88
|
+
: ''
|
89
|
+
}`
|
90
|
+
);
|
91
|
+
};
|
92
|
+
|
93
|
+
const main = async () => {
|
94
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
95
|
+
try {
|
96
|
+
const answer = await rl.question('Do you want to move existing files to /app-example instead of deleting them? (Y/n): ');
|
97
|
+
const userInput = answer.trim().toLowerCase() || 'y';
|
98
|
+
if (userInput === 'y' || userInput === 'n') {
|
99
|
+
await moveDirectories(userInput);
|
100
|
+
} else {
|
101
|
+
console.log("❌ Invalid input. Please enter 'Y' or 'N'.");
|
102
|
+
process.exit(1);
|
103
|
+
}
|
104
|
+
} catch (error) {
|
105
|
+
if (error instanceof Error) {
|
106
|
+
console.error(`❌ Error during script execution: ${error.message}`);
|
107
|
+
} else {
|
108
|
+
console.error('❌ An unexpected error occurred:', error);
|
109
|
+
}
|
110
|
+
process.exit(1);
|
111
|
+
} finally {
|
112
|
+
rl.close();
|
113
|
+
}
|
114
|
+
};
|
115
|
+
|
116
|
+
void main();
|
@@ -0,0 +1,63 @@
|
|
1
|
+
import { hairlineWidth } from 'nativewind/theme';
|
2
|
+
|
3
|
+
export const darkMode = 'class';
|
4
|
+
export const content = ['./app/**/*.{ts,tsx}', './components/**/*.{ts,tsx}'];
|
5
|
+
export const presets = [require('nativewind/preset')];
|
6
|
+
|
7
|
+
export const theme = {
|
8
|
+
extend: {
|
9
|
+
colors: {
|
10
|
+
border: 'hsl(var(--border))',
|
11
|
+
input: 'hsl(var(--input))',
|
12
|
+
ring: 'hsl(var(--ring))',
|
13
|
+
background: 'hsl(var(--background))',
|
14
|
+
foreground: 'hsl(var(--foreground))',
|
15
|
+
primary: {
|
16
|
+
DEFAULT: 'hsl(var(--primary))',
|
17
|
+
foreground: 'hsl(var(--primary-foreground))',
|
18
|
+
},
|
19
|
+
secondary: {
|
20
|
+
DEFAULT: 'hsl(var(--secondary))',
|
21
|
+
foreground: 'hsl(var(--secondary-foreground))',
|
22
|
+
},
|
23
|
+
destructive: {
|
24
|
+
DEFAULT: 'hsl(var(--destructive))',
|
25
|
+
foreground: 'hsl(var(--destructive-foreground))',
|
26
|
+
},
|
27
|
+
muted: {
|
28
|
+
DEFAULT: 'hsl(var(--muted))',
|
29
|
+
foreground: 'hsl(var(--muted-foreground))',
|
30
|
+
},
|
31
|
+
accent: {
|
32
|
+
DEFAULT: 'hsl(var(--accent))',
|
33
|
+
foreground: 'hsl(var(--accent-foreground))',
|
34
|
+
},
|
35
|
+
popover: {
|
36
|
+
DEFAULT: 'hsl(var(--popover))',
|
37
|
+
foreground: 'hsl(var(--popover-foreground))',
|
38
|
+
},
|
39
|
+
card: {
|
40
|
+
DEFAULT: 'hsl(var(--card))',
|
41
|
+
foreground: 'hsl(var(--card-foreground))',
|
42
|
+
},
|
43
|
+
},
|
44
|
+
borderWidth: {
|
45
|
+
hairline: hairlineWidth(),
|
46
|
+
},
|
47
|
+
keyframes: {
|
48
|
+
'accordion-down': {
|
49
|
+
from: { height: '0' },
|
50
|
+
to: { height: 'var(--radix-accordion-content-height)' },
|
51
|
+
},
|
52
|
+
'accordion-up': {
|
53
|
+
from: { height: 'var(--radix-accordion-content-height)' },
|
54
|
+
to: { height: '0' },
|
55
|
+
},
|
56
|
+
},
|
57
|
+
animation: {
|
58
|
+
'accordion-down': 'accordion-down 0.2s ease-out',
|
59
|
+
'accordion-up': 'accordion-up 0.2s ease-out',
|
60
|
+
},
|
61
|
+
},
|
62
|
+
};
|
63
|
+
export const plugins = [require('tailwindcss-animate')];
|
@@ -0,0 +1,45 @@
|
|
1
|
+
{
|
2
|
+
"extends": "expo/tsconfig.base",
|
3
|
+
"compilerOptions": {
|
4
|
+
"strict": true,
|
5
|
+
"allowSyntheticDefaultImports": true,
|
6
|
+
"skipLibCheck": true,
|
7
|
+
"forceConsistentCasingInFileNames": true,
|
8
|
+
"alwaysStrict": false,
|
9
|
+
"noImplicitAny": true,
|
10
|
+
"noImplicitReturns": true,
|
11
|
+
"noImplicitThis": true,
|
12
|
+
"strictNullChecks": true,
|
13
|
+
"exactOptionalPropertyTypes": true,
|
14
|
+
"strictBindCallApply": true,
|
15
|
+
"strictFunctionTypes": true,
|
16
|
+
"strictPropertyInitialization": true,
|
17
|
+
"preserveConstEnums": true,
|
18
|
+
"sourceMap": true,
|
19
|
+
"inlineSourceMap": false,
|
20
|
+
"plugins": [
|
21
|
+
{
|
22
|
+
"name": "@styled/typescript-styled-plugin"
|
23
|
+
},
|
24
|
+
{
|
25
|
+
"name": "typescript-eslint-language-service"
|
26
|
+
}
|
27
|
+
],
|
28
|
+
"paths": {
|
29
|
+
"@/*": [
|
30
|
+
"./*"
|
31
|
+
]
|
32
|
+
},
|
33
|
+
"resolveJsonModule": true
|
34
|
+
},
|
35
|
+
"include": [
|
36
|
+
"**/*.ts",
|
37
|
+
"**/*.tsx",
|
38
|
+
"nativewind-env.d.ts",
|
39
|
+
"metro.config.js",
|
40
|
+
"eslint.config.mjs",
|
41
|
+
"tailwind.config.js",
|
42
|
+
"babel.config.js",
|
43
|
+
".prettierrc.js"
|
44
|
+
]
|
45
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
import '@total-typescript/ts-reset';
|