Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@framerjs/component-importer

Package Overview
Dependencies
Maintainers
35
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@framerjs/component-importer

Example utility that helps importing React components into Framer with basic support for TypeScript and Flow.

  • 0.0.2
  • unpublished
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
35
Weekly downloads
 
Created
Source

ComponentImporter

Example utility that helps importing React components into Framer with basic support for TypeScript and Flow.

Build

yarn build

CLI Usage

yarn cli [src-dir] [out-dir] [--lang [typescript/flow]] [--pattern '**/*.{tsx,ts,js,jsx}']

Example

yarn cli ../my-project/src ../my-project/framer

API Usage

  • Build the project
  • Run yarn link in the project folder
  • Create a new project
  • Run yarn link component-importer in the new project
  • Add and run the following code:
import { analyze, convert, generate, makePrettier } from "component-importer"

async function main() {
    const files = ["a.tsx", "b.tsx"]
    const processedFiles = await analyze(files, "typescript") // parses source files, analyzes components and type information
    for (const processedFile of processedFiles) {
        for (const component of processedFile.components) {
            convert(component)                                // Adds Framer X component info (property controls)
            // Optional: customize the components before generating the code
            const code = generate(component)                  // Generates the code
            const prettyCode = await makePrettier(code)       // Formats the code
            console.log(prettyCode)
            // Save the code to a file
        }
    }
}

main()

Another example can be found in src/cli.ts

FAQs

Package last updated on 25 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc