diff --git a/package-lock.json b/package-lock.json index 1fc61f46..266837c4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,7 +30,7 @@ "brace": "^0.11.1", "buffer": "^6.0.3", "comment-json": "^4.1.1", - "deepslate": "^0.22.1", + "deepslate": "^0.22.2", "deepslate-1.18": "npm:deepslate@0.9.0-beta.9", "deepslate-1.18.2": "npm:deepslate@0.9.0", "deepslate-1.20.4": "npm:deepslate@0.20.1", @@ -1629,9 +1629,9 @@ "dev": true }, "node_modules/deepslate": { - "version": "0.22.1", - "resolved": "https://registry.npmjs.org/deepslate/-/deepslate-0.22.1.tgz", - "integrity": "sha512-3Zn4lIjyZfyHCIT1k37Eu3FAL+yI5G0a3DmA+7s+0tK13B2yS/sM1WdXVX/wUlUFo+KG74OYoeDP+mFgyZ7dpQ==", + "version": "0.22.2", + "resolved": "https://registry.npmjs.org/deepslate/-/deepslate-0.22.2.tgz", + "integrity": "sha512-CVtKWBvOIHcONjx9TzggkR1dz5NGxRbN4AZUeg1Wzuo728rEI3BTgiwGl04bATa9pYvDJnniviiwMKqMcLInWw==", "dependencies": { "gl-matrix": "^3.3.0", "md5": "^2.3.0", @@ -5465,9 +5465,9 @@ "dev": true }, "deepslate": { - "version": "0.22.1", - "resolved": "https://registry.npmjs.org/deepslate/-/deepslate-0.22.1.tgz", - "integrity": "sha512-3Zn4lIjyZfyHCIT1k37Eu3FAL+yI5G0a3DmA+7s+0tK13B2yS/sM1WdXVX/wUlUFo+KG74OYoeDP+mFgyZ7dpQ==", + "version": "0.22.2", + "resolved": "https://registry.npmjs.org/deepslate/-/deepslate-0.22.2.tgz", + "integrity": "sha512-CVtKWBvOIHcONjx9TzggkR1dz5NGxRbN4AZUeg1Wzuo728rEI3BTgiwGl04bATa9pYvDJnniviiwMKqMcLInWw==", "requires": { "gl-matrix": "^3.3.0", "md5": "^2.3.0", diff --git a/package.json b/package.json index d352ea9a..4725b032 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "deepslate-1.18": "npm:deepslate@0.9.0-beta.9", "deepslate-1.18.2": "npm:deepslate@0.9.0", "deepslate-1.20.4": "npm:deepslate@0.20.1", - "deepslate": "^0.22.1", + "deepslate": "^0.22.2", "highlight.js": "^11.5.1", "howler": "^2.2.3", "js-yaml": "^3.14.1", diff --git a/src/app/components/generator/ProjectCreation.tsx b/src/app/components/generator/ProjectCreation.tsx index 6c28f682..70259d78 100644 --- a/src/app/components/generator/ProjectCreation.tsx +++ b/src/app/components/generator/ProjectCreation.tsx @@ -50,10 +50,15 @@ export function ProjectCreation({ onClose }: Props) { try { const data = await parseSource(entry[1], 'json') project.files!.push({ ...file, data }) + return } catch (e) { - console.error(`Failed parsing ${file.type} ${file.id}: ${message(e)}`) + console.warn(`Failed parsing ${file.type} ${file.id}: ${message(e)}`) } } + if (project.unknownFiles === undefined) { + project.unknownFiles = [] + } + project.unknownFiles.push({ path: entry[0], data: entry[1] }) })) projectUpdater.current(project) onClose() diff --git a/src/app/components/generator/ProjectPanel.tsx b/src/app/components/generator/ProjectPanel.tsx index 55f8a00d..a602809d 100644 --- a/src/app/components/generator/ProjectPanel.tsx +++ b/src/app/components/generator/ProjectPanel.tsx @@ -77,6 +77,9 @@ export function ProjectPanel({ onRename, onCreate, onDeleteProject }: Props) { if (path === 'pack.mcmeta') hasPack = true return [[path, stringifySource(file.data)]] as [string, string][] }) + project.unknownFiles?.forEach(({ path, data }) => { + entries.push([path, data]) + }) if (!hasPack) { const pack_format = config.versions.find(v => v.id === version)!.pack_format entries.push(['pack.mcmeta', stringifySource({ pack: { pack_format, description: '' } })]) diff --git a/src/app/contexts/Project.tsx b/src/app/contexts/Project.tsx index bda6cdd7..df9c15e8 100644 --- a/src/app/contexts/Project.tsx +++ b/src/app/contexts/Project.tsx @@ -13,6 +13,7 @@ export type Project = { namespace?: string, version?: VersionId, files: ProjectFile[], + unknownFiles?: UnknownFile[], } export const DRAFT_PROJECT: Project = { name: 'Drafts', @@ -26,6 +27,11 @@ export type ProjectFile = { data: any, } +export type UnknownFile = { + path: string, + data: string, +} + export const FilePatterns = [ 'worldgen/[a-z_]+', 'tags/worldgen/[a-z_]+',