-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(ArxMap): generate metadata in one go when saving to disk
- Loading branch information
1 parent
11a930c
commit 35a9956
Showing
7 changed files
with
58 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,37 @@ | ||
export class MetaData { | ||
name = '' | ||
description = '' | ||
version = '' | ||
author = '' | ||
url = '' | ||
generator = '' | ||
generatorUrl = '' | ||
generatorVersion = '' | ||
seed = '' | ||
import { Settings, Variant } from './Settings.js' | ||
import { getGeneratorPackageJSON, getProjectPackageJSON } from './helpers.js' | ||
|
||
toData() { | ||
return { | ||
name: this.name, | ||
description: this.description, | ||
version: this.version, | ||
author: this.author, | ||
url: this.url, | ||
generator: this.generator, | ||
generatorVersion: this.generatorVersion, | ||
generatorUrl: this.generatorUrl, | ||
seed: this.seed, | ||
} | ||
export type MetaData = { | ||
seed: string | ||
variant: Variant | ||
|
||
generator: string | ||
generatorVersion: string | ||
generatorUrl: string | ||
|
||
name: string | ||
version: string | ||
description: string | ||
author: string | ||
url: string | ||
} | ||
|
||
export const generateMetadata = async (settings: Settings): Promise<MetaData> => { | ||
const generator = await getGeneratorPackageJSON() | ||
const project = await getProjectPackageJSON() | ||
|
||
return { | ||
seed: settings.seed, | ||
variant: settings.variant, | ||
|
||
generator: generator.name, | ||
generatorVersion: generator.version, | ||
generatorUrl: generator.homepage, | ||
|
||
name: project.name, | ||
version: project.version, | ||
description: project.description, | ||
author: project.author, | ||
url: project.homepage, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters