-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix-xlsform-imports.js
More file actions
37 lines (30 loc) · 1.3 KB
/
fix-xlsform-imports.js
File metadata and controls
37 lines (30 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { readFileSync, writeFileSync } from 'fs';
import { resolve } from 'path';
// Fix the specific import issue in index.js
const indexPath = resolve('./node_modules/xlsform2lstsv/dist/index.js');
let indexContent = readFileSync(indexPath, 'utf8');
// Fix the xlsformConverter import by adding .js extension
const fixedIndexContent = indexContent.replace(
/export { XLSFormToTSVConverter } from '\.\/xlsformConverter';/,
"export { XLSFormToTSVConverter } from './xlsformConverter.js';"
);
if (fixedIndexContent !== indexContent) {
writeFileSync(indexPath, fixedIndexContent);
console.log('Fixed index.js import');
} else {
console.log('index.js already has correct import');
}
// Also fix the ConfigManager import issue
const configManagerPath = resolve('./node_modules/xlsform2lstsv/dist/config/ConfigManager.js');
let configContent = readFileSync(configManagerPath, 'utf8');
const fixedConfigContent = configContent.replace(
/import { deepMerge } from '\.\.\/utils\/helpers';/,
"import { deepMerge } from '../utils/helpers.js';"
);
if (fixedConfigContent !== configContent) {
writeFileSync(configManagerPath, fixedConfigContent);
console.log('Fixed ConfigManager.js import');
} else {
console.log('ConfigManager.js already has correct import');
}
console.log('Import fixes applied');