Angular6: How can I generate a default angular.json file from command line [duplicate]

不想你离开。 提交于 2019-12-24 19:08:14

问题


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

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.

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


回答1:


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

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.

You could also manually create your own angular.json based on the documentation provided by the Angular CLI project on Github.



来源:https://stackoverflow.com/questions/52625788/angular6-how-can-i-generate-a-default-angular-json-file-from-command-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!