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

hops-cli

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hops-cli

hops-cli provides a small set of commands to manage your hops project. Installing hops-cli is the minimum requirement for being able to start working with Hops.

  • 6.0.0-beta.g20
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
50
increased by900%
Maintainers
1
Weekly downloads
 
Created
Source

Hops CLI

hops-cli provides a small set of commands to manage your hops project. Installing hops-cli is the minimum requirement for being able to start working with Hops.

Installation

Minimum installation for any project

We assume that you already created a folder for your project and initialized it with npm init -y. Go to the root folder of your project and install hops-cli. This installs hops-config and hops-server as dependencies as well:

npm install --save hops-cli

That's it - at least this is sufficient to get you started with a very basic setup.

Additional setup for a React project

In case you are going to implement a project with React, you need to install further packages:

npm install --save react react-router-dom hops-react

Usage

Available commands

The following commands are provided by hops-cli:

  • hops build - initiates a project build
  • hops develop - starts a Webpack development server
  • hops serve - initiates a project build, stores the build artifacts in the file system and starts a production (Express) server
  • hops start - if NODE_ENV is set to production, this runs hops serve. Otherwise, hops develop gets executed
  • hops start --production - this overrides the NODE_ENV setting and runs hops serve

Configure package.json

To actually use the hops-cli commands, you have to add them to the scripts section of your project's package.json:

"scripts": {
    "build": "hops build",
    "develop": "hops develop",
    "serve": "hops serve",
    "start": "hops start"
  }

However, for most projects, it should be sufficient to just add "start": "hops start" here.

Use via npm

After that, you can execute them via npm like so:

npm run build
npm run develop
npm run serve
npm start
npm start --production 

Very basic example app

To try out the minimum installation described above, create an index.js file in the root folder of your project and put the following code in there:

export default function (req, res, next) {
  if (req) {
    console.log('server');
    if (req.path === '/') {
      res.set('Content-Type', 'text/html');
      res.send('<script src="/main.js"></script>');
    } else {
      next();
    }
  } else {
    console.log('browser');
  }
}

Don't forget to configure the scripts section of your package.json. And you're done!

FAQs

Package last updated on 05 Jul 2017

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