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:
parent
218e01636f
commit
028e29f4c0
1 changed files with 7 additions and 3 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue