
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
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.
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.
In case you are going to implement a project with React, you need to install further packages:
npm install --save react react-dom react-helmet react-router react-router-dom hops-react
The following commands are provided by hops-cli:
hops build
- initiates a project buildhops develop
- starts a Webpack development serverhops serve
- initiates a project build, stores the build artifacts in the file system and starts a production (Express) serverhops start
- if NODE_ENV is set to production, this runs hops serve
. Otherwise, hops develop
gets executedPlease note that hops-cli is not meant to be called directly, but rather to be added to your project's package.json file and then called indirectly by using npm or yarn (see below).
To actually use the hops-cli commands, you have to add them to the scripts section of your project's package.json. Hops is designed to leverage npm/yarn features, so it does not make much sense to call the hops executable directly.
"scripts": {
"build": "hops build",
"develop": "hops develop",
"serve": "hops serve",
"start": "hops start"
},
"config": {
"hops": {}
}
However, for simple projects, it should be sufficient to just add "start": "hops start"
here.
To learn what configuration options are supported, please see the hops-config
docs.
hops-cli can be used as a static site generator, too. To enable static mode, pass --static
or -s
to the above commands and configure a locations
array to your package.json file.
"scripts": {
"start": "hops start --static"
},
"config": {
"hops": {
"locations": ["/"]
}
}
After that, you can execute them via npm like so:
npm run build
npm run develop
npm run serve
npm start
npm start --production
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
Global CLI module to initialize new hops projects
The npm package hops-cli receives a total of 0 weekly downloads. As such, hops-cli popularity was classified as not popular.
We found that hops-cli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.