@figma-export/cli
Advanced tools
Comparing version 0.0.1-alpha.6 to 0.0.1-alpha.8
@@ -1,1 +0,1 @@ | ||
{"version":"0.0.1-alpha.6","commands":{"components":{"id":"components","description":"Exports 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 (defaults to './output')","default":"output"},"config":{"name":"config","type":"option","char":"c","description":"Configuration file (defaults to './.figmaexportrc.js')","default":"./.figmaexportrc.js"},"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}]}}} | ||
{"version":"0.0.1-alpha.8","commands":{"components":{"id":"components","description":"Exports 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"},"config":{"name":"config","type":"option","char":"c","description":"Configuration file","default":".figmaexportrc.js"},"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}]}}} |
{ | ||
"name": "@figma-export/cli", | ||
"description": "Command line for @figma-export", | ||
"version": "0.0.1-alpha.6", | ||
"version": "0.0.1-alpha.8", | ||
"author": "Marco Montalbano @marcomontalbano", | ||
@@ -11,3 +11,3 @@ "bin": { | ||
"dependencies": { | ||
"@figma-export/core": "^0.0.1-alpha.6", | ||
"@figma-export/core": "^0.0.1-alpha.8", | ||
"@oclif/command": "~1.5.19", | ||
@@ -52,3 +52,3 @@ "@oclif/config": "~1.13.3", | ||
}, | ||
"gitHead": "c6a3927a3a1d7eb2a116afc134fa2492a4c251f9" | ||
"gitHead": "358ac4e5fc372091f4eae2278bae64dea2834b94" | ||
} |
@@ -8,13 +8,10 @@ | ||
Using npm: | ||
While you can install it globally on your machine, it's much better to install it **locally** project by project. | ||
```sh | ||
npm i -D @figma-export/cli | ||
npm install --save-dev @figma-export/cli | ||
``` | ||
or using yarn: | ||
> **Note:** If you do not have a `package.json`, create one before installing or run `npm init -y` to automatically create ones. | ||
```sh | ||
yarn add @figma-export/cli --dev | ||
``` | ||
@@ -26,11 +23,24 @@ ## Usage | ||
figma-export [COMMAND] | ||
npx figma-export COMMAND | ||
``` | ||
> **Note:** These instructions use the `npx` command to run the locally installed executables. You can drop it inside of an npm run script or you may instead execute with the relative path instead. `./node_modules/.bin/figma-export` | ||
## Commands | ||
### `help` | ||
```sh | ||
npx figma-export help | ||
``` | ||
### `components` | ||
Exports components from a Figma file | ||
```sh | ||
figma-export components [FILEID] | ||
npx figma-export components FILEID | ||
# help | ||
npx figma-export help components | ||
``` | ||
@@ -40,2 +50,8 @@ | ||
> `--transformer` `-T` option | ||
```sh | ||
npx figma-export components FILEID -T TRANSFORMER | ||
``` | ||
A transform function receives an SVG and turns it into something new. | ||
@@ -46,2 +62,3 @@ | ||
```js | ||
// with promise | ||
module.exports = options => { | ||
@@ -55,2 +72,3 @@ return (svg) => new Promise((resolve, reject) => { | ||
```js | ||
// with async/await | ||
module.exports = options => { | ||
@@ -63,13 +81,17 @@ return async (svg) => { | ||
```sh | ||
npm install -g @figma-export/transform-svg-with-svgo | ||
or install an official transformer: | ||
figma-export components RSzpKJcnb6uBRQ3rOfLIyUs5 -T @figma-export/transform-svg-with-svgo | ||
``` | ||
| Package | Version | | ||
|---------|---------| | ||
| [`@figma-export/transform-svg-with-svgo`](/packages/transform-svg-with-svgo) | [![npm](https://img.shields.io/npm/v/@figma-export/transform-svg-with-svgo.svg?maxAge=3600)](https://www.npmjs.com/package/@figma-export/transform-svg-with-svgo) | | ||
- [@figma-export/transform-svg-with-svgo](https://www.npmjs.com/package/@figma-export/transform-svg-with-svgo) | ||
#### outputters | ||
> `--outputter` `-O` option | ||
```sh | ||
npx figma-export components FILEID -O OUTPUTTER | ||
``` | ||
An output function receives a list of pages, in which each page contains components. | ||
@@ -88,11 +110,33 @@ | ||
Usage: | ||
or install an official outputter: | ||
| Package | Version | | ||
|---------|---------| | ||
| [`@figma-export/output-components-as-svg`](/packages/output-components-as-svg) | [![npm](https://img.shields.io/npm/v/@figma-export/output-components-as-svg.svg?maxAge=3600)](https://www.npmjs.com/package/@figma-export/output-components-as-svg) | | ||
| [`@figma-export/output-components-as-es6`](/packages/output-components-as-es6) | [![npm](https://img.shields.io/npm/v/@figma-export/output-components-as-es6.svg?maxAge=3600)](https://www.npmjs.com/package/@figma-export/output-components-as-es6) | | ||
#### .figmaexportrc.js | ||
You can create a file `.figmaexportrc.js` or use a different configuration file providing `-c` or `--config` option to `figma-export components` command. | ||
```sh | ||
npm install -g @figma-export/output-components-as-svg | ||
npx figma-export components FILEID -c .figmaexportrc.prod.js -T TRANSFORMER | ||
``` | ||
figma-export components RSzpKJcnb6uBRQ3rOfLIyUs5 -O @figma-export/output-components-as-svg | ||
This file contains the `configs` object that you can use to provide special options to `transformers` and `outputters`. | ||
```js | ||
// .figmaexportrc.js | ||
module.exports = { | ||
configs: [ | ||
['@figma-export/transform-svg-with-svgo', { | ||
plugins: [ | ||
{ removeViewBox: false }, | ||
{ removeDimensions: true } | ||
] | ||
}] | ||
] | ||
}; | ||
``` | ||
- [@figma-export/output-components-as-svg](https://www.npmjs.com/package/@figma-export/output-components-as-svg) | ||
- [@figma-export/output-components-as-es6](https://www.npmjs.com/package/@figma-export/output-components-as-es6) |
@@ -76,3 +76,3 @@ const { Command, flags: commandFlags } = require('@oclif/command'); | ||
char: 'o', | ||
description: 'Output directory (defaults to \'./output\')', | ||
description: 'Output directory', | ||
default: 'output', | ||
@@ -83,4 +83,4 @@ multiple: false, | ||
char: 'c', | ||
description: 'Configuration file (defaults to \'./.figmaexportrc.js\')', | ||
default: './.figmaexportrc.js', | ||
description: 'Configuration file', | ||
default: '.figmaexportrc.js', | ||
multiple: false, | ||
@@ -87,0 +87,0 @@ }), |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10168
136