@figma-export/cli
Advanced tools
Comparing version 3.0.0-alpha.0 to 3.0.0-alpha.1
@@ -44,19 +44,22 @@ "use strict"; | ||
const { commands = [] } = fs.existsSync(configPath) ? require(configPath) : {}; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const handlePromise = (figmaExporter, options) => { | ||
return figmaExporter(Object.assign(Object.assign({ token: process.env.FIGMA_TOKEN || '', fileId: '' }, options), { log: (message) => { spinner.text = message; } })).then(() => { | ||
spinner.stop(); | ||
}).catch((err) => { | ||
spinner.stop(); | ||
this.error(err, { exit: 1 }); | ||
}); | ||
}; | ||
Promise.all(commands.map((command) => { | ||
const [commandName, options] = command; | ||
spinner.start(); | ||
let figmaExporter; | ||
switch (commandName) { | ||
case 'components': | ||
figmaExporter = figmaExport.components; | ||
break; | ||
return handlePromise(figmaExport.components, options); | ||
case 'styles': | ||
return handlePromise(figmaExport.styles, options); | ||
default: | ||
throw new Error(`Command ${commandName} is not found.`); | ||
} | ||
return figmaExporter(Object.assign(Object.assign({ token: process.env.FIGMA_TOKEN || '', fileId: '' }, options), { log: (message) => { spinner.text = message; } })).then(() => { | ||
spinner.stop(); | ||
}).catch((err) => { | ||
spinner.stop(); | ||
this.error(err, { exit: 1 }); | ||
}); | ||
})); | ||
@@ -63,0 +66,0 @@ }); |
@@ -1,1 +0,1 @@ | ||
{"version":"3.0.0-alpha.0","commands":{"components":{"id":"components","description":"export components from a Figma file\n","pluginName":"@figma-export/cli","pluginType":"core","aliases":[],"flags":{"page":{"name":"page","type":"option","char":"p","description":"Figma page names (defaults to 'all pages')"},"output":{"name":"output","type":"option","char":"o","description":"Output directory","default":"output"},"outputter":{"name":"outputter","type":"option","char":"O","description":"Outputter module or path"},"transformer":{"name":"transformer","type":"option","char":"T","description":"Transformer module or path"}},"args":[{"name":"fileId","required":true}]},"use-config":{"id":"use-config","description":"export using a configuration file\n","pluginName":"@figma-export/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"config","required":true,"default":".figmaexportrc.js"}]}}} | ||
{"version":"3.0.0-alpha.1","commands":{"components":{"id":"components","description":"export components from a Figma file\n","pluginName":"@figma-export/cli","pluginType":"core","aliases":[],"flags":{"page":{"name":"page","type":"option","char":"p","description":"Figma page names (defaults to 'all pages')"},"output":{"name":"output","type":"option","char":"o","description":"Output directory","default":"output"},"outputter":{"name":"outputter","type":"option","char":"O","description":"Outputter module or path"},"transformer":{"name":"transformer","type":"option","char":"T","description":"Transformer module or path"}},"args":[{"name":"fileId","required":true}]},"use-config":{"id":"use-config","description":"export using a configuration file\n","pluginName":"@figma-export/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"config","required":true,"default":".figmaexportrc.js"}]}}} |
{ | ||
"name": "@figma-export/cli", | ||
"description": "Command line for @figma-export", | ||
"version": "3.0.0-alpha.0", | ||
"version": "3.0.0-alpha.1", | ||
"main": "dist/index.js", | ||
@@ -13,4 +13,4 @@ "types": "dist/index.d.ts", | ||
"dependencies": { | ||
"@figma-export/core": "^3.0.0-alpha.0", | ||
"@figma-export/types": "^3.0.0-alpha.0", | ||
"@figma-export/core": "^3.0.0-alpha.1", | ||
"@figma-export/types": "^3.0.0-alpha.1", | ||
"@oclif/command": "~1.8.0", | ||
@@ -58,3 +58,3 @@ "@oclif/config": "~1.17.0", | ||
}, | ||
"gitHead": "05a70e69f8758f8566896d5bb492007aaf423e58" | ||
"gitHead": "37315218c189d05ad1ca8ef48625c114a06f5795" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
20103
188