0
Fork 0
mirror of https://github.com/penpot/penpot-export.git synced 2025-03-11 23:11:17 -05:00

chore(cli): avoid creating a static array instance for base config

The `pages` property is overwritten at `validateAndNormalizePenpotExportConfig` to avoid an infinite loop. Remove that possibility altogether.
This commit is contained in:
Roberto Redradix 2023-08-22 17:48:08 +02:00
parent 218e01636f
commit 028e29f4c0

View file

@ -1,8 +1,7 @@
import { Config, PagesConfig } from './types'
const CONFIG: Config = {
const BASE_CONFIG: Omit<Config, 'pages'> = {
accessToken: '',
pages: [],
}
const PAGES_CONFIG: PagesConfig = {
@ -40,7 +39,12 @@ export function validateAndNormalizePenpotExportConfig(config: Config): Config {
throw new MissingAccessTokenError()
}
let normalizedConfig: Config = { ...CONFIG, ...config, pages: [] }
let normalizedConfig: Config = {
...BASE_CONFIG,
...config,
pages: [],
}
for (const [index, page] of config.pages.entries()) {
if (!page.output) {