refactor: Move downloaded resources from assets/ to assets_downloaded/

- Changed default download location to assets_downloaded/schematron
- Updated all references in SchematronDownloader, integration, and validator
- Updated postinstall scripts to use new location
- assets_downloaded/ is already in .gitignore to exclude downloaded files from git
- Moved existing downloaded files to new location
- All functionality tested and working correctly
This commit is contained in:
2025-08-12 05:25:50 +00:00
parent b89da0ec3f
commit 58506e287d
6 changed files with 15 additions and 15 deletions

2
.gitignore vendored
View File

@@ -20,4 +20,4 @@ dist_*/
# custom
test/output
.serena
assets/schematron
assets_downloaded/

View File

@@ -81,7 +81,7 @@ export class SchematronDownloader {
private cacheDir: string;
private smartfile: any;
constructor(cacheDir: string = 'assets/schematron') {
constructor(cacheDir: string = 'assets_downloaded/schematron') {
this.cacheDir = cacheDir;
}
@@ -278,7 +278,7 @@ export const ISO_SCHEMATRON_SKELETONS = {
/**
* Download ISO Schematron skeleton files
*/
export async function downloadISOSkeletons(targetDir: string = 'assets/schematron/iso'): Promise<void> {
export async function downloadISOSkeletons(targetDir: string = 'assets_downloaded/schematron/iso'): Promise<void> {
await fs.mkdir(targetDir, { recursive: true });
console.log('Downloading ISO Schematron skeleton files...');

View File

@@ -75,7 +75,7 @@ export class IntegratedValidator {
standard: 'EN16931' | 'PEPPOL' | 'XRECHNUNG',
format: 'UBL' | 'CII'
): Promise<string | null> {
const basePath = 'assets/schematron';
const basePath = 'assets_downloaded/schematron';
// Map standard and format to file pattern
const patterns: Record<string, Record<string, string>> = {

View File

@@ -272,19 +272,19 @@ export async function createStandardValidator(
switch (standard) {
case 'EN16931':
// Would load from ConnectingEurope/eInvoicing-EN16931
await validator.loadSchematron('assets/schematron/en16931/EN16931-UBL-validation.sch');
await validator.loadSchematron('assets_downloaded/schematron/en16931/EN16931-UBL-validation.sch');
break;
case 'XRECHNUNG':
// Would load from itplr-kosit/xrechnung-schematron
await validator.loadSchematron('assets/schematron/xrechnung/XRechnung-UBL-validation.sch');
await validator.loadSchematron('assets_downloaded/schematron/xrechnung/XRechnung-UBL-validation.sch');
break;
case 'PEPPOL':
// Would load from OpenPEPPOL/peppol-bis-invoice-3
await validator.loadSchematron('assets/schematron/peppol/PEPPOL-EN16931-UBL.sch');
await validator.loadSchematron('assets_downloaded/schematron/peppol/PEPPOL-EN16931-UBL.sch');
break;
case 'FACTURX':
// Would load from Factur-X specific Schematron
await validator.loadSchematron('assets/schematron/facturx/Factur-X-EN16931-validation.sch');
await validator.loadSchematron('assets_downloaded/schematron/facturx/Factur-X-EN16931-validation.sch');
break;
}

View File

@@ -9,7 +9,7 @@ import { SchematronDownloader } from '../dist_ts/formats/validation/schematron.d
async function main() {
console.log('📥 Starting Schematron download...\n');
const downloader = new SchematronDownloader('assets/schematron');
const downloader = new SchematronDownloader('assets_downloaded/schematron');
await downloader.initialize();
// Download EN16931 Schematron files

View File

@@ -49,7 +49,7 @@ function getFileChecksum(filePath: string): string | null {
* Check if resources are already downloaded and valid
*/
function checkExistingResources(): boolean {
const versionFile = path.join('assets', 'schematron', '.version');
const versionFile = path.join('assets_downloaded', 'schematron', '.version');
try {
if (!fs.existsSync(versionFile)) return false;
@@ -62,9 +62,9 @@ function checkExistingResources(): boolean {
// Check if key files exist
const keyFiles = [
'assets/schematron/EN16931-UBL-v1.3.14.sch',
'assets/schematron/EN16931-CII-v1.3.14.sch',
'assets/schematron/PEPPOL-EN16931-UBL-v3.0.17.sch'
'assets_downloaded/schematron/EN16931-UBL-v1.3.14.sch',
'assets_downloaded/schematron/EN16931-CII-v1.3.14.sch',
'assets_downloaded/schematron/PEPPOL-EN16931-UBL-v3.0.17.sch'
];
for (const file of keyFiles) {
@@ -84,7 +84,7 @@ function checkExistingResources(): boolean {
* Save version file after successful download
*/
function saveVersionFile(): void {
const versionFile = path.join('assets', 'schematron', '.version');
const versionFile = path.join('assets_downloaded', 'schematron', '.version');
try {
fs.mkdirSync(path.dirname(versionFile), { recursive: true });
fs.writeFileSync(versionFile, RESOURCES_VERSION);
@@ -96,7 +96,7 @@ function saveVersionFile(): void {
async function downloadSchematron() {
console.log('📥 Downloading Schematron validation files...\n');
const downloader = new SchematronDownloader('assets/schematron');
const downloader = new SchematronDownloader('assets_downloaded/schematron');
await downloader.initialize();
let successCount = 0;