1

Hexo [ https://hexo.io/]を使用して github に静的なブログをデプロイする場合、最初に「hexo init」を実行して hexo フォルダーを初期化し、次のようなファイルとフォルダーを生成します。

.
├── _config.yml
├── package.json
├── 足場
├── ソース
| ├──_ドラフト
| └── _posts
└── テーマ

ただし、コマンド「hexo init」を実行すると、実際に git コマンドが実行されることがわかります。

  [root@localhost buwei]# hexo init blog
  INFO  Cloning hexo-starter to /home/buwei/blog
  Cloning into '/home/buwei/blog'...
  remote: Counting objects: 53, done.
  remote: Total 53 (delta 0), reused 0 (delta 0), pack-reused 53
  Unpacking objects: 100% (53/53), done.
  Submodule 'themes/landscape' (https://github.com/hexojs/hexo-theme-      landscape.git) registered for path 'themes/landscape'
  ....

それで、「hexo init」が実行するgitコマンドを知りたいですか?

4

2 に答える 2

2

からhexojs/hexo-cli/lib/console/init.js#initConsole()、主に実行しgit cloneます:

  if (args.clone) {
    promise = spawn('git', ['clone', '--recursive', GIT_REPO_URL, target], {
      stdio: 'inherit'
    });
  } else {
    promise = copyAsset(target);
}

次に、git dir ( .git) とモジュール ( ) を.gitmodules削除します。

  return promise.catch(function() {
    log.warn('git clone failed. Copying data instead');

    return copyAsset(target);
  }).then(function() {
    return Promise.all([
      removeGitDir(target),
      removeGitModules(target)
    ]);
  }).then(function() {
    if (!args.install) return;

    log.info('Install dependencies');

    return spawn('npm', ['install', '--production'], {
      cwd: target,
      stdio: 'inherit'
});
于 2016-07-14T04:57:28.527 に答える
0

hexo initブログの主な構造を提供するためにここにあります。git コマンドが利用可能な場合はgit clone、 hexo - starterリポジトリを実行します。それ以外の場合は、hexo-cli がそのサブモジュールのコピーを作成ます。

于 2016-07-15T08:25:45.037 に答える