Angular6: How can I generate a default angular.jso

2019-08-25 02:33发布

This question already has an answer here:

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条回答
\"骚年 ilove
2楼-- · 2019-08-25 03:09

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.

查看更多
登录 后发表回答