jacobtyq / export-figma-svg

Export SVGs from your Figma project via CLI.
MIT License
42 stars 11 forks source link

Publish to npm #150

Open TheJaredWilcurt opened 2 months ago

TheJaredWilcurt commented 2 months ago

Hey, this project would be much more helpful if it could be npm install'd and exported some sort of function that could be called.

Then usage would be:

  1. Run: npm install --save-dev export-figma-svg
  2. Create a node script like this:
    
    import path from 'node:path';
    import exportFigmaSvg from 'export-figma-svg';
    const __dirname = import.meta.dirname;

exportFigmaSvg({ figmaBaseUrl: 'https://api.figma.com/v1/', figmaProjectId: 'ABCdEfg0HIJkLmN12OpqrS', figmaProjectNodeId: '123:456', devAccessToken: process.env.FIGMA_API_TOKEN, filterPrivateComponents: false, output: path.resolve(__dirname, 'icons') });



That would mean that this repo no longer needs to deal with environment variables at all, pushing that on to the end-users to determine how they want to store API keys.

You'd just need to set up a TS-to-JS build to make a `dist` folder, then point to it in your `package.json` and run `npm publish` after each release.
github-actions[bot] commented 2 months ago

Message that will be displayed on users' first issue