Angular6:如何从命令行生成默认的angular.json文件 [英] Angular6: How can I generate a default angular.json file from command line

查看:276
本文介绍了Angular6:如何从命令行生成默认的angular.json文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用angular 6创建了一个新模块,它将用作在另一个项目中使用的程序包.

I create a new module using angular 6, that will serve as a package to use in another project.

现在,我正在尝试配置业力和茉莉花,以便可以在其上创建单元测试.问题是我发现该项目没有任何angular.json文件.

Now, I'm trying to configure the karma and jasmine so I could create unit tests on it. The problem is that I found out that the project does not have any angular.json file.

是否可以从命令行生成默认的angular.json文件?

It is possible to generate a default angular.json file from the command line?

推荐答案

您最好的选择是按照danday74的建议进行操作,并生成一个新项目,并从该生成的项目中复制angular.json文件:

Your best bet is to do as danday74 suggested and generate a new project and copy the angular.json file from that generated project:

ng new project-name

快速检查"ng"命令行选项不会显示任何用于独立生成新的angular.json的选项:

A quick inspection of the "ng" command line options doesn't reveal any options for generating a new angular.json independently:

 ng -h

Available Commands:
  add Add support for a library to your project.
  new Creates a new directory and a new Angular app.
  generate Generates and/or modifies files based on a schematic.
  update Updates your application and its dependencies.
  build Builds your app and places it into the output path (dist/ by default).
  serve Builds and serves your app, rebuilding on file changes.
  test Run unit tests in existing project.
  e2e Run e2e tests in existing project.
  lint Lints code in existing project.
  xi18n Extracts i18n messages from source code.
  run Runs Architect targets.
  eject Temporarily disabled. Ejects your app and output the proper webpack configuration and scripts.
  config Get/set configuration values.
  help Help.
  version Outputs Angular CLI version.
  doc Opens the official Angular API documentation for a given keyword.

您还可以根据文档< Github上的Angular CLI项目提供.

这篇关于Angular6:如何从命令行生成默认的angular.json文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆