All Projects → DAB0mB → Appfairy

DAB0mB / Appfairy

Licence: mit
A CLI tool to Migrate a Webflow project into a React app

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Appfairy

Semana Js Expert30
Aulas da Semana JS Expert 3.0 - Construindo um chat multiplataforma usando linha de comando e JavaScript Avançado
Stars: ✭ 238 (+30.05%)
Mutual labels:  cli, design
Sultan
Sultan: Command and Rule over your Shell
Stars: ✭ 625 (+241.53%)
Mutual labels:  cli, compiler
Pkg
Package your Node.js project into an executable
Stars: ✭ 19,349 (+10473.22%)
Mutual labels:  cli, compiler
Awesome Web Desktops
Websites, web apps, portfolios which look like desktop graphical user interfaces
Stars: ✭ 420 (+129.51%)
Mutual labels:  design, webdesign
Cjstoesm
A tool that can transform CommonJS to ESM
Stars: ✭ 109 (-40.44%)
Mutual labels:  cli, compiler
Xcolor
Lightweight color picker for X11
Stars: ✭ 209 (+14.21%)
Mutual labels:  cli, design
Gscript
framework to rapidly implement custom droppers for all three major operating systems
Stars: ✭ 547 (+198.91%)
Mutual labels:  cli, compiler
Argon Design System
Argon - Design System for Bootstrap 4 by Creative Tim
Stars: ✭ 2,307 (+1160.66%)
Mutual labels:  design, webdesign
Iotz
compile things easy 🚀
Stars: ✭ 39 (-78.69%)
Mutual labels:  cli, compiler
Silex
Silex is a static website builder in the cloud.
Stars: ✭ 958 (+423.5%)
Mutual labels:  design, webdesign
Fluddy
🤝 A dependency-free command line utility for managing, updating, creating and launching Flask Apps.
Stars: ✭ 23 (-87.43%)
Mutual labels:  cli, webdesign
Awesome Web Design
🎨 A curated list of awesome resources for digital designers.
Stars: ✭ 1,905 (+940.98%)
Mutual labels:  design, webdesign
Mcscript
A programming language for Minecraft Vanilla
Stars: ✭ 124 (-32.24%)
Mutual labels:  cli, compiler
C
Compile and execute C "scripts" in one go!
Stars: ✭ 1,920 (+949.18%)
Mutual labels:  cli, compiler
Snapdragon
snapdragon is an extremely pluggable, powerful and easy-to-use parser-renderer factory.
Stars: ✭ 180 (-1.64%)
Mutual labels:  compiler
Nodejs Master Class
🛠 This repository contains the homework assignment for Node.js Master Class that is focused on building a RESTful API, web app GUI, and a CLI in plain Node JS with no NPM or 3rd-party libraries
Stars: ✭ 182 (-0.55%)
Mutual labels:  cli
Piano Rs
A multiplayer piano using UDP sockets that can be played using computer keyboard, in the terminal
Stars: ✭ 180 (-1.64%)
Mutual labels:  cli
Tusk
The modern task runner
Stars: ✭ 181 (-1.09%)
Mutual labels:  cli
Veriloggen
Veriloggen: A Mixed-Paradigm Hardware Construction Framework
Stars: ✭ 182 (-0.55%)
Mutual labels:  compiler
Philip2
An Elm to OCaml compiler
Stars: ✭ 182 (-0.55%)
Mutual labels:  compiler

Appfairy

appfairy

I'm just tired going through a design and translating it into React components. Appfairy is a CLI tool that does that for you - by running a single command the design will be transpiled into React components. As for now Appfairy works with Webflow only for web React apps, but the near future plans are to have that compatible with Sketch and React Native.

Methodology

Since machine generated assets aren't very easy to maintain due to their complexity, Appfairy takes on an old school approach where a single component is made out of a view and a controller. The view is automatically generated by Appfairy and shouldn't be changed, we treat it as a black box. The controller however is user defined. Every element within the controller is a proxy to an element within the view.

Here's an example of a possible controller:

import React from 'react'
import ConsultFormView from '../views/ConsultFormView'

class ConsultFormController extends React.Component {
  state = {}

  render() {
    return (
      <ConsultFormView>
        <name onChange={this.setName} />
        <phone onChange={this.setPhone} />
        <email onChange={this.setEmail} />
        <description onChange={this.setDescription} />
        <submit onClick={this.submit} />
      </ConsultFormView>
    )
  }

  setName = (e) => {
    this.setState({
      name: e.target.value
    })
  }
  setPhone = (e) => {
    this.setState({
      phone: e.target.value
    })
  }

  setEmail = (e) => {
    this.setState({
      email: e.target.value
    })
  }

  setDescription = (e) => {
    this.setState({
      description: e.target.value
    })
  }

  submit = () => {
    alert(`
      ${this.name}
      ${this.phone}
      ${this.email}
      ${this.description}
    `)
  }
}

export default ConsultFormController

This way the view can be changed without us worrying about re-binding the event listeners and props.

For an in-depth explanation regards Appfairy be sure to check-out the following:

  • Medium blog post - An introduction to Appfairy and the motives behind it.

  • YouTube video - I walk through Appfairy and an implementation of an example app.

  • Example app - An example for a simple app which uses Appfairy.

Docs

Appfairy is a CLI tool that can be installed using NPM:

$ npm install appfairy -g

After exporting your Webflow project into a zip file, simply unzip it into a directory called .appfairy in the root of your project and run $ appfairy. Be sure to stash all your git changes as beforehand as Appfairy uses git as a version control. After doing so you'll notice that a new git-commit has been created saying appfairy: Migrate. This commit include all the changes that Appfairy has made, and shouldn't be edited or reworded.

The commit consists of the following files (regardless if they were added, modified or deleted):

  • public/ (public assets which should be served by our app's server)

    • images/

    • fonts/

    • css/

  • src/

    • scripts/ (scripts that should be imported in index.js)

    • styles/ (css files that should be imported in index.js)

    • views/ (contains ConsultFormView - further explanation below)

The output can be controlled using a config file named af_config.js which should be located in the root of the project. The config file may (or may not) include some of the following options:

  • prefetch (boolean) - Prefetch the styles and scripts which are necessary for the design to work. If not specified, the scripts and styles will be fetched during runtime. An example app with prefetching enabled can be found here.

  • source (source) - Can either be set to webflow, sketch and represents the studio name that generated the basic CSS and HTML assets. If not set there will be little to no difference in the transpilation process but it will however make the CSS encapsulation more accurate. Examples for Webflow and Sketch apps can be found here.

  • input (string) - The input dir for the Webflow exported files. Defaults to .appfairy dir in the root of the project.

  • output (string/object) - If a string was provided, the output will be mapped to the specified dir. If an object, each key in the object will map its asset type to the specified dir in the value. The object has the following schema:

    • public (string) - Public dir. Defaults to public.

    • src (string/object) - Source dir. If a string is provided, all its content will be mapped to the specified dir, otherwise the mapping will be done according to the following object:

      • scripts (string) - Scripts dir. Defaults to src/scripts.

      • styles (string) - Scripts dir. Defaults to src/styles.

      • views (string) - Scripts dir. Defaults to src/views.

Alternatively, you may provide (extra) options through the command line like the following:

$ appfairy [...options]

The CLI tool supports the following options:

  • --prefetch

  • --source/--src

  • --input/--in

  • --output/--out

  • --config

The behavior of Appfairy will change according to the specified options as detailed above, and the rest is self explanatory.

LICENSE

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].