Giter VIP home page Giter VIP logo

Comments (14)

leesei avatar leesei commented on June 23, 2024 1

There is no need to add NPM scripts now that npx is available, see update in original post.
I think this issue can be closed after the usage is added to the docs.

from hexo-starter.

tomap avatar tomap commented on June 23, 2024

We could make sure that this project already includes the command lines we need, and update
documentation to explain the new commands:
"scripts": {
"hexo": "hexo",
"server": "hexo server",
"build": "hexo build"
}

hexo server => npm run server
And to add parameters: https://stackoverflow.com/a/14404223/383029
hexo server -o => npm run server -- -o

I believe there are a bunch of PR/Issues here and there asking for that.
I'll try to reference them from here.
As this is a breaking change, we should first introduce the new "scripts" section in package.json, and then add a depreciation notice in the command line for all commands except init
and then only, remove old commands

from hexo-starter.

curbengh avatar curbengh commented on June 23, 2024

you could also set PATH="$PATH:./node_modules/.bin" in ~/.profile to use hexo without hexo-cli.

from hexo-starter.

tomap avatar tomap commented on June 23, 2024

Super partial solution:
https://github.com/tomap/tpi2.eu/blob/master/package.json#L28

from hexo-starter.

curbengh avatar curbengh commented on June 23, 2024

My suggestion:

  1. Remove command from https://hexo.io/docs/#Requirements and replace with Skip to [Hexo installation](#Install-Hexo).
  2. Add a "Advanced users" heading to the bottom of https://hexo.io/docs/, add npx and $PATH tips there.

from hexo-starter.

curbengh avatar curbengh commented on June 23, 2024

There is no need to add NPM scripts now that npx is available.

Just tested npx hexo s -p 3001, it works; no need -- like npm run.

from hexo-starter.

tomap avatar tomap commented on June 23, 2024

Ok. Great. So all we need is a PR on hexojs/site to explain the new way to use hexo cli, + a blog post to announce it.
Maybe preserve the old way in the doc temporarily?

from hexo-starter.

curbengh avatar curbengh commented on June 23, 2024

Currently, $ npm install -g hexo-cli is shown twice (i.e. Requirements and Install Hexo sections) under the same page.
I think the command is still more beginner-friendly than npx and $PATH, so I suggest to retain it. This also means no breaking change, just some pro-tips™ for advanced users.
I'll also add a note ...you might need $ sudo npm install...

from hexo-starter.

leesei avatar leesei commented on June 23, 2024

My suggestion:

  1. Remove command from hexo.io/docs/#Requirements and replace with Skip to [Hexo installation](#Install-Hexo).
  2. Add a "Advanced users" heading to the bottom of hexo.io/docs, add npx and $PATH tips there.

I think there are two use cases:

  1. hexo init to initialize project (which is fulfilled by hexo-cli)
  2. run hexo commands in an existing project

Actually npx also works for the first case since it will try to install hexo the if it is not found locally or globally.

from hexo-starter.

curbengh avatar curbengh commented on June 23, 2024

yeah, npx is pretty robust, npx hexo init works even when node_modules/hexo is in parent folder (current folder needs to be empty).

from hexo-starter.

curbengh avatar curbengh commented on June 23, 2024

Submitted PR hexojs/site#1017

from hexo-starter.

curbengh avatar curbengh commented on June 23, 2024

shall we also recommend user to change global installation of npm packages from /usr/local/bin to $HOME/.local/bin?
Ubuntu already add $HOME/.local/bin to $PATH by default.

This way, npm install -g doesn't need sudo or chown.

from hexo-starter.

tomap avatar tomap commented on June 23, 2024

@curbengh I do not understand the whole $PATH stuff.
It is not necessary on windows.

With just installing node 8+, you can run npx hexo init from anywhere without having to install hexo locally or globally

For this issue, I believe we can close it, can't we?

from hexo-starter.

curbengh avatar curbengh commented on June 23, 2024

Indeed, it doesn't apply to Windows.

In Linux (at least in Ubuntu), npm install -g would result in permission error in default installation as the default installation path is /usr/local/bin which requires root/sudo permission. The fix is changing the installation path.

hexo website already links to the solution provided by npmjs.com. So I guess we don't need the $PATH thing.

I'll close this after I add server and clean scripts.

from hexo-starter.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.