Package Exports
- hops
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hops) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Hops (CLI)
This package provides a binary (hops) that can be used to create and control Hops applications.
In order to create a new Hops application, it is recommended to install this package either globally (npm install --global hops or yarn global add hops and then hops init my-hops-project) or to use npx (npx hops init my-hops-project).
When the binary is executed outside of a Hops project, it will only expose one command init - which can be used to create a new Hops application based on a pre-defined template.
When this binary is executed inside a Hops application it exposes all commands that are provided by the installed Hops dependencies.
Installation
Install it globally to create a new Hops application.
Or install it locally in an already existing Hops application.
Install it globally via npm:
npm install --global hopsOr yarn
yarn global add hopsOr use npx:
npx hops init ...Install it locally to an existing Hops application:
npm install --save hopsOr:
yarn add hopsUsage
hops init my-new-hops-project [--verbose] [--npm] [--template hops-template-*]This will create a very basic hops example project that is ready to go.
The following arguments are optional:
--verbose- to increase the verbosity of the output for debugging purposes--npm- to force usage ofnpminstead ofyarneven if yarn is available--template- to specify a different template for the intial structure. available templates:
Then cd into my-new-hops-project and execute hops --help again to see a list of supported commands.
Available Commands
hops build- initiates a project build to generate browser and server JS bundleshops develop- starts the webpack development server with hot code reloading for fast local iterationshops serve- starts a production Node.js Express server using the generated JS bundle fromhops buildhops start- if NODE_ENV is set to production, this runshops serve. Otherwisehops developgets executed
hops build accepts additional arguments: --static / -s to generate static HTML app shells for all configured hops locations.
hops only lists commands that are available through other hops packages.
So for example hops build and hops develop are only available if hops-build is installed as a dependency in your project (hops-template-react includes it by default).
The command hops serve is only available if hops-express is installed as a dependency in your project (also included in the default react template).
And the command hops start is only available if both hops-build and hops-express are installed as dependencies.
Configuration
hops is being configured through hops-config which in turn uses the npm config mechanism (read more at hops-config).
That means that while you can run hops commands independently and they will use the configuration from your package.json file, you cannot overwrite these values through npm config set ... in this mode. For that to work you need to run the hops through your package.json scripts fields.
{
"name": "my-application",
"scripts": {
"start": "hops start"
},
"config": {
"hops:": {
"port": "3000"
}
}
}npm config set my-application:hops:port 1337And now you can execute the "start" command through npm or yarn:
npm start
yarn start