Reputation: 10250
I am new to nodejs and i have the following question pertaining to a blog system built in nodejs , its called hexojs , the file structure of this blogging framework in development is like the following:
As you can see the main source code is in the lib folder. For contribution purpose you have to follow the following instructions ( As can be seen HERE ) :
$ git clone https://github.com/<username>/hexo.git
$ cd hexo
$ npm install
$ git submodule update --init
But when actually building and deploying a hexo blog the file structure changes to the following:
To have a production build on your system locally , you have to run the following commands( as can be seen HERE ):
$ npm install hexo-cli -g
$ hexo init blog
$ cd blog
$ npm install
$ hexo server
My question is why the difference in folder structure in the development and in the production version of hexo ? Also in the production version , where exactly is the source code of hexo ?
Upvotes: 1
Views: 267
Reputation: 38573
Hexo is a command line utility built with node.js. It's basically a node module installed globally.
Your blog is also a node module. You can see the similarities with hexo's source code: both your blog and hexo contain package.json
and node_modules
.
However the source code for your blog is generated by hexo. This process is called scaffolding, building a basic structure for your blog that allows you to further build upon it.
This is where you make the confusion: you are mistaking your blog (generated by hexo init blog
), with a production build of hexo, which is a totally different concept. Production build in this context means a version of hexo published to npm that is ready to be used by end users in production.
The difference in folder structure can be explained by the different purposes of each module: hexo needs to perform the scaffolding, while your blog needs to display some posts. For example hexo has a test
folder, which performs unit tests on the scaffolding process, while your blog doesn't need any automated tests.
The source code of hexo can be found in the global installation folder for your npm packages: /usr/local/lib/node
or %USERPROFILE%\AppData\Roaming\npm\node_modules
depending on your platform.
Upvotes: 1