angular - Angular6:如何从命令行生成默认的 angular.json 文件
问题描述
我使用 Angular 6 创建了一个新模块,它将作为一个包在另一个项目中使用。
现在,我正在尝试配置 karma 和 jasmine,以便可以在其上创建单元测试。问题是我发现该项目没有任何angular.json
文件。
angular.json
可以从命令行生成默认文件吗?
解决方案
最好的办法是按照 danday74 的建议生成一个新项目,然后从该生成的项目中复制 angular.json 文件:
ng new project-name
快速检查“ng”命令行选项不会显示任何用于独立生成新 angular.json 的选项:
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 项目提供的文档手动创建自己的 angular.json 。
推荐阅读
- python - 使用三重索引填充数据框中的日期
- excel - 当我保护工作表时,在一个单元格中选择多个下拉列表的代码不起作用
- sql - SQL获取所有可能的数字组合
- angular - @HostListener 在鼠标按下时不向元素添加样式
- azure-sql-database - SQL Azure 工作人员百分比达到限制并导致请求失败
- google-apps-script - 如何使用 Apps 脚本在 Google 表格中增加日期
- java - 将 Java 8 升级到 11 的 powermock 问题
- azure - 访问 web.config 中的域模式时仅允许特定 IP
- cloud-foundry - 是否可以使用 cf CLI 报告已部署的应用程序版本
- r - 无法获取 shinyApp 中变量中存在的值的计数