@willwade/aac-processors 0.2.1 → 0.2.2
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.
|
@@ -587,15 +587,29 @@ class ObfProcessor extends BaseProcessor {
|
|
|
587
587
|
await writeTextToPath(outputPath, JSON.stringify(obfBoard, null, 2));
|
|
588
588
|
}
|
|
589
589
|
else {
|
|
590
|
+
const getPageFilename = (id) => (id.endsWith('.obf') ? id : `${id}.obf`);
|
|
590
591
|
const files = Object.values(tree.pages).map((page) => {
|
|
591
592
|
const obfBoard = this.createObfBoardFromPage(page, 'Board', tree.metadata);
|
|
592
593
|
const obfContent = JSON.stringify(obfBoard, null, 2);
|
|
593
|
-
const name = page.id
|
|
594
|
+
const name = getPageFilename(page.id);
|
|
594
595
|
return {
|
|
595
596
|
name,
|
|
596
597
|
data: new TextEncoder().encode(obfContent),
|
|
597
598
|
};
|
|
598
599
|
});
|
|
600
|
+
const manifest = {
|
|
601
|
+
format: OBF_FORMAT_VERSION,
|
|
602
|
+
root: tree.metadata.defaultHomePageId,
|
|
603
|
+
paths: {
|
|
604
|
+
boards: Object.fromEntries(Object.entries(tree.pages).map(([id, page]) => [id, getPageFilename(page.id)])),
|
|
605
|
+
images: {}, //TODO Add support for saving images as files
|
|
606
|
+
sounds: {}, //TODO Add support for saving sounds as files
|
|
607
|
+
},
|
|
608
|
+
};
|
|
609
|
+
files.push({
|
|
610
|
+
name: 'manifest.json',
|
|
611
|
+
data: new TextEncoder().encode(JSON.stringify(manifest)),
|
|
612
|
+
});
|
|
599
613
|
const fileExists = await pathExists(outputPath);
|
|
600
614
|
this.zipFile = await this.options.zipAdapter(fileExists ? outputPath : undefined, this.options.fileAdapter);
|
|
601
615
|
const zipData = await this.zipFile.writeFiles(files);
|
|
@@ -590,15 +590,29 @@ class ObfProcessor extends baseProcessor_1.BaseProcessor {
|
|
|
590
590
|
await writeTextToPath(outputPath, JSON.stringify(obfBoard, null, 2));
|
|
591
591
|
}
|
|
592
592
|
else {
|
|
593
|
+
const getPageFilename = (id) => (id.endsWith('.obf') ? id : `${id}.obf`);
|
|
593
594
|
const files = Object.values(tree.pages).map((page) => {
|
|
594
595
|
const obfBoard = this.createObfBoardFromPage(page, 'Board', tree.metadata);
|
|
595
596
|
const obfContent = JSON.stringify(obfBoard, null, 2);
|
|
596
|
-
const name = page.id
|
|
597
|
+
const name = getPageFilename(page.id);
|
|
597
598
|
return {
|
|
598
599
|
name,
|
|
599
600
|
data: new TextEncoder().encode(obfContent),
|
|
600
601
|
};
|
|
601
602
|
});
|
|
603
|
+
const manifest = {
|
|
604
|
+
format: OBF_FORMAT_VERSION,
|
|
605
|
+
root: tree.metadata.defaultHomePageId,
|
|
606
|
+
paths: {
|
|
607
|
+
boards: Object.fromEntries(Object.entries(tree.pages).map(([id, page]) => [id, getPageFilename(page.id)])),
|
|
608
|
+
images: {}, //TODO Add support for saving images as files
|
|
609
|
+
sounds: {}, //TODO Add support for saving sounds as files
|
|
610
|
+
},
|
|
611
|
+
};
|
|
612
|
+
files.push({
|
|
613
|
+
name: 'manifest.json',
|
|
614
|
+
data: new TextEncoder().encode(JSON.stringify(manifest)),
|
|
615
|
+
});
|
|
602
616
|
const fileExists = await pathExists(outputPath);
|
|
603
617
|
this.zipFile = await this.options.zipAdapter(fileExists ? outputPath : undefined, this.options.fileAdapter);
|
|
604
618
|
const zipData = await this.zipFile.writeFiles(files);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willwade/aac-processors",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "A comprehensive TypeScript library for processing AAC (Augmentative and Alternative Communication) file formats with translation support",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"browser": "dist/browser/index.browser.js",
|