tokens-studio / style-dictionary-configurator

Home Page:style-dictionary-configurator.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parse error: source must be an array. See console logs for more info.

yumyo opened this issue · comments

HI, we have a "global" Tokens set and two other sets: "Dark-Thme" and "Light-Theme".

We select "Multiple Files" when exporting from the Tokens Studio plugin (pro license).
However, when trying to import in the configurator, we get a:
"Parse error: source must be an array. See console logs for more info." error.

The log shows just the same, with several:

dex.js:41470 Error: source must be an array
    at Object.extend (index.js:36439:13)
    at index.js:41460:34
    at new Promise (<anonymous>)
    at index.js:41457:11
    at Array.map (<anonymous>)
    at SdState._runStyleDictionary (index.js:41455:12)
    at SdState._prepareRunStyleDictionary (index.js:41438:14)
    at async SdState.runStyleDictionary (index.js:41413:7)
    at async saveFile (index.js:42024:5)
(anonymous) @ index.js:41470
4index.js:18644 Uncaught (in promise) TypeError: path must be a string or Buffer
    at pathToFilename (index.js:18644:19)
    at Volume.writeFileBase (index.js:19434:32)
    at index.js:19044:33
index.js:41418 

Also thene.json looks empty, while all other files have data.

From our slack conversation:

The project where the error is found

This is missing content in the $themes.json, as well as source not being %themeTokenSets% (special thing for the configurator to understand what to do).

Fixed project here

See also, how to set up themes in figma plugin

Related issue #33
We should give better warnings to the user when:

  • $themes.json is invalid
  • SD Config does not have proper source %themeTokenSets% (maybe even fix that forcefully)