Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

@fizzmod/devserver

0.0.32 • Public • Published

VTEX Flash

Author: Marcos Casagrande marcoscvp90@gmail.com
Copyright: Copyright (C) Marcos Casagrande - All Rights Reserved | Todos los derechos reservados

VTEX Flash server, reverse proxy, include files, custom IFs!

Install

After download uncompress the folder.

Enter the folder and run:

:::bash
sudo ./configure

You can change the configuration later on in vf.ini file (See command below)

:::json
{  
   "root": "/var/www/html/",
   "host": "develop-{{environment}}.vtexcommercebeta.com.br",
   "liveReload": true,
   "mappings": {
      "myenvironment": "myenvironmentfolder"
   },
   "websites": {}
}
  • root: The root directory where your environments are. VF will retrieve the local files from there.
  • host (optional): The host that will be use as reverse proxy. By default {{environment}}.vtexcommercestable.com.br is used. ({{environment}} is a variable, and you should NOT replace it).
  • liveReload (optional): [Default: false] Whether to activate CSS Live Reload or not.
  • mappings (optional): By default VTEX Flash will serve files from folders that are the same as the environment, if your environment is example, VF will go to /var/www/html/example if you want it to search in other location, you should map it!

Quick Start

Run this command: (If you reboot your computer/server, it should start automatically)

:::bash
sudo service vtexflash start

Edit your hosts file.

:::bash
sudo nano /etc/hosts

And add the following:

:::bash
#If your are running VTEX Flash in a server, replace 127.0.0.1 with the server IP address
127.0.0.1   example.vtexlocal.com.br  example.vtex.com.br

Now enter: http://example.vtexlocal.com.br and done!

VTEX Flash will serve CSS & JS files from /var/www/html/example/src/styles && /var/www/html/example/src/js in your local machine / server. You may change the root path or map the environment in vf.ini as explained above

If the file doesn't exist in your server, it will use the one from VTEX if it exists.

Commands

Stop the server

:::bash
sudo service vtexflash stop

Start the server

:::bash
sudo service vtexflash start

Restart the server

:::bash
sudo service vtexflash restart

Check status

:::bash
sudo service vtexflash status

Update

:::bash
sudo vtexflash update

Show errors

:::bash
#sudo vtexflash -l <lines> | default lines: 10
sudo vtexflash -l

or

:::bash
#sudo vtexflash --log <lines> | default lines: 10
sudo vtexflash --log 50

Edit vf.ini

:::bash
sudo vtexflash -e

or

:::bash
sudo vtexflash --edit

To create new environment, with presets

:::bash
sudo vtexflash install -e environmentname
cd environmentname

or

:::bash
sudo vtexflash install --env=environmentname
cd environmentname

Features

Currently supported:

  • Custom IF syntax for environments:

      :::javascript
      [IF example-brasil] 
          console.log("This is example-brasil.vtexlocal.com.br!");
      [/IF]
      
      console.log("This is a global message!");
    
      [IF example-argentina] 
         console.log("This is example-argentina.vtexlocal.com.br!");
      [/IF]
      
      console.log("Es magicoooo!");         
    
  • Custom include syntax:

      :::javascript
      [include '/js/my-js.js']
    
      someFunctionInMyJsFile();
    
      //... rest of code  
    

If you have any trouble setting up VTEX flash email me: marcoscvp90@gmail.com

Keywords

none

install

npm i @fizzmod/devserver

Downloadsweekly downloads

96

version

0.0.32

license

none

last publish

collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar