Comments (14)
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.
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.
you could also set PATH="$PATH:./node_modules/.bin"
in ~/.profile to use hexo without hexo-cli.
from hexo-starter.
Super partial solution:
https://github.com/tomap/tpi2.eu/blob/master/package.json#L28
from hexo-starter.
My suggestion:
- Remove command from https://hexo.io/docs/#Requirements and replace with
Skip to [Hexo installation](#Install-Hexo)
. - Add a "Advanced users" heading to the bottom of https://hexo.io/docs/, add npx and $PATH tips there.
from hexo-starter.
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.
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.
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.
My suggestion:
- Remove command from hexo.io/docs/#Requirements and replace with
Skip to [Hexo installation](#Install-Hexo)
.- 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:
hexo init
to initialize project (which is fulfilled byhexo-cli
)- 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.
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.
Submitted PR hexojs/site#1017
from hexo-starter.
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.
@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.
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)
- Vulnerability found while doing hexo-init ( Hexo-cli v2.0.0 ) HOT 4
- Add space to after tags field is better when create new post HOT 12
- Use SCSS as default style sheet language HOT 2
- Need to update theme submodule HOT 1
- hexo init 卡住了 HOT 5
- hello-world.md lacks a date HOT 6
- TypeError: Object.fromEntries is not a function HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hexo-starter.