npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

front-cli

v0.0.1-alpha34

Published

A simple tool to automate front-end development

Downloads

8

Readme

A simple tool to automate front-end projects

Installation

Having Node.js (>= 6) installed, type the following command in the terminal:

npm install -g front-cli

After the installation the front command will be available. To confirm that, type the following command in the terminal to see a list with the available front tasks:

front

Creating the Application

Let's create our first front application! Our application will be called awesomeApp. Type the following command in the terminal to create our application:

front init awesomeApp

Answer the questions that will be made and wait while front downloads the application dependencies. After that, the application is ready to start!

Options

--template

Specifies a different template instead of the availables in Front Templates repositories:

front init awesomeApp --template github_user/github_repo

Starting the Application

Type the following command in the terminal to enter in the application folder:

cd awesomeApp

Type the following command in the terminal to start our application in development mode:

front start

Now open the address http://localhost:3000 in the browser and you'll see our application running! Change some code in the application and see the browser. The browser refresh automatically!

Options

--host (default: 0.0.0.0)

Changes the development server host:

front start --host 192.168.0.0

--port (default: 3000)

Changes the development server port:

front start --port 8080

--no-notify (default: false)

Disables Front CLI notifications:

front start --no-notify

--config (default: build/webpack.config.dev.js)

Specifies which webpack config file Front CLI should use:

front start --config some/path/some.webpack.config.js

Building the Application

When you feel that the application is done, you can prepare it for production. This reduces drastically the application size and, believe me, the users will thank you for that. To prepare the application for production, type the following command in the terminal:

front build

Wait a few seconds. Now, all we have to do is to get the dist folder and deploy to a webserver.

Options

--no-notify (default: false)

Disables Front CLI notifications:

front build --no-notify

--verbose (default: false)

Shows the full webpack compilation status:

front build --verbose

--config (default: build/webpack.config.prod.js)

Specifies which webpack config file Front CLI should use:

front build --config some/path/some.webpack.config.js

Running custom scripts

In Front CLI you can run your custom scripts (deploy, test, etc):

front run some/path/some-script.js

The only rule to be observed is that your script must export a function:

// some/path/some-script.js

module.exports = (require, argv) => {
    // script content
}

Some things are given to you as a gift when creating your scripts: require and argv:

require

The given require parameter is in Front CLI context, so you have access to all Front CLI dependencies without the need to download again, eg chalk, inquirer and fs-extra. With only these dependencies you can create powerful scripts! As expected, if you want to use dependencies outside Front CLI context, you can:

// some/path/some-script.js

// here, `require` is in NodeJS context. You need to download `fs-extra` (npm install fs-extra) to use.
let fs = require('fs-extra');

module.exports = (require, argv) => {
    // here, `require` is in Front CLI context and you can use all of its dependencies.
    let fs = require('fs-extra');
}

argv

The given argv parameter could be useful in some situations when you need to pass parameter to your script:

front run some/path/some-script.js --server="production" --clean

The script could use these parameters:

// some/path/some-script.js

module.exports = (require, argv) => {
    let server = argv.server

    // do something

    if (argv.clean) {
        // do something
    } else {
        // do something else
    }
}