mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-25 06:14:59 +00:00
code: package,nextjs,json (2 files)
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import type { PackageTemplateConfig } from './types'
|
||||
|
||||
export function buildPackageManifestJson(config: PackageTemplateConfig): string {
|
||||
const manifest = {
|
||||
scripts: config.luaScripts.map((script) => ({
|
||||
file: script.fileName,
|
||||
name: script.fileName.replace(/\.lua$/, ''),
|
||||
category: 'package',
|
||||
description: script.description,
|
||||
})),
|
||||
}
|
||||
return JSON.stringify(manifest, null, 2)
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import type { PackageTemplateConfig } from './types'
|
||||
|
||||
export function buildPackageMetadataJson(config: PackageTemplateConfig): string {
|
||||
const componentIds = config.components
|
||||
.map((component) => component.id)
|
||||
.filter((id): id is string => typeof id === 'string')
|
||||
|
||||
const metadata = {
|
||||
packageId: config.packageId,
|
||||
name: config.name,
|
||||
version: config.version,
|
||||
description: config.summary,
|
||||
author: config.author,
|
||||
category: config.category,
|
||||
dependencies: [],
|
||||
exports: {
|
||||
components: componentIds,
|
||||
},
|
||||
}
|
||||
|
||||
return JSON.stringify(metadata, null, 2)
|
||||
}
|
||||
Reference in New Issue
Block a user