在本地测试yeoman发电机

在本地测试yeoman发电机

本文介绍了在本地测试yeoman发电机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的Web项目创建一个yeoman生成器.

I'm creating a yeoman generator for my web projects.

但是我想知道如何在发布更改之前尝试对其进行测试?

But I wonder how I can try and test my changes before publishing it?

由于我已经安装了一次,所以它将不会运行我的本地开发版本,而是会运行我已安装的版本.

Since I have installed it once, it will not run my local development version, instead it runs my installed version.

关于如何测试运行我的本地开发版本的任何建议?

Any suggestions on how can test-run my local development version?

推荐答案

我终于找到了一些有关如何完成此操作的信息:

I finally found some information on how to accomplish this:

如果您希望在generators代码库上进行开发并在本地进行调试,则通常的方法是依赖npm link

if you wish to develop on the generators code base, and debug locally, a common way to do so is to rely on npm link

  1. git在本地克隆生成器存储库
  2. cd进入该存储库并运行npm link.它会使用指向您本地版本的符号链接来安装所需的依赖项并在全局范围内安装该软件包.
  3. 如果要安装子生成器,则需要在之前链接的yeoman-generator软件包的上下文中安装.将CD放入您已在本地克隆的sub generators程序包中,然后运行npm link.
  4. 我们现在在系统上具有链接和已知的所有内容,现在我们需要将子生成器回购链接到父项,在步骤1和步骤2中克隆并链接的yeoman生成器. 2.
  1. git clone the generators repo locally
  2. cd into that repository and run npm link. It'll install required dependencies and install the package globally, using a symbolic link to your local version.
  3. If you want to install sub generators, you need to do so in the context of a yeoman-generator package linked earlier. Cd into the sub generators package you have cloned locally and run npm link.
  4. We now have everything linked and known on the system, we now need to link the sub-generator repo into the parent one, yeoman-generator cloned and linked in step 1 & 2.

https://github.com/yeoman/generator/wiki/Testing-generators

信息的更新链接: https://yeoman.io/authoring/index.html

这篇关于在本地测试yeoman发电机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 04:52