Skip to content

Commit 6efd98b

Browse files
committed
Fix missing config during initial conversion run
1 parent 9fd34bb commit 6efd98b

3 files changed

Lines changed: 8 additions & 16 deletions

File tree

convert/convertConfig.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { existsSync, readdirSync, readFileSync, type PathLike } from 'fs';
1+
import { existsSync, mkdirSync, readdirSync, readFileSync, type PathLike } from 'fs';
22
import path, { basename, extname, join } from 'path';
33
import type {
44
AppConfig,
@@ -219,6 +219,10 @@ function isDictionaryConfig(data: ScriptureConfig | DictionaryConfig): data is D
219219
}
220220

221221
function convertConfig(dataDir: string, verbose: number) {
222+
const genAssets = path.join('src/gen-assets');
223+
if (!existsSync(genAssets)) {
224+
mkdirSync(genAssets, { recursive: true });
225+
}
222226
const dom = new jsdom.JSDOM(readFileSync(path.join(dataDir, 'appdef.xml')).toString(), {
223227
contentType: 'text/xml'
224228
});

convert/index.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { writeFile } from 'fs';
1+
import { writeFile } from 'fs/promises';
22
import path from 'path';
33
import { watch } from 'chokidar';
44
import { ConvertAbout } from './convertAbout';
@@ -87,14 +87,7 @@ async function fullConvert(printDetails: boolean): Promise<boolean> {
8787
// step may be async, in which case it should be awaited
8888
const out = await step.run(verbose, outputs, step.triggerFiles);
8989
outputs.set(step.constructor.name, out);
90-
await Promise.all(
91-
out.files.map(
92-
(f) =>
93-
new Promise((r) => {
94-
writeFile(f.path, f.content, r);
95-
})
96-
)
97-
);
90+
await Promise.all(out.files.map((f) => writeFile(f.path, f.content)));
9891
} catch (e) {
9992
oldConsoleLog(lastStepOutput);
10093
oldConsoleLog(e);
@@ -157,11 +150,7 @@ if (process.argv.includes('--watch')) {
157150
outputs.set(step.constructor.name, out);
158151
// Write all files to disk
159152
/*await*/ // We don't need to await the file writes; next steps can continue running while writes occur
160-
Promise.all(
161-
out.files.map((f) => {
162-
new Promise((r) => writeFile(f.path, f.content, r));
163-
})
164-
);
153+
Promise.all(out.files.map((f) => writeFile(f.path, f.content)));
165154
} catch (e) {
166155
oldConsoleLog(lastStepOutput);
167156
oldConsoleLog(e);

eslint.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ export default ts.config(
7373
'.env.*',
7474
'!env.example',
7575
'data',
76-
'src/config.js',
7776
'static',
7877
'example_data',
7978
'test_data',

0 commit comments

Comments
 (0)