ember-cli - 全局配置 ember-cli 以在新项目中使用 yarn

标签 ember-cli yarnpkg

有没有办法全局配置 ember-cli 以在新项目上使用 yarn?一个 ember new <project-name>应该使用 yarn 而不提供--yarn旗帜。

背景资料

最新版本的 ember-cli 使用 yarn 如果

  • yarn.lock文件存在于项目根目录或
  • 如果 --yarn提供标志。

  • 因为不可能有 yarn.lock在创建新项目之前,--yarn标志必须始终用于 ember new <project-name>如果应该使用 yarn 。

    如果我理解正确,ember-cli 使用 yam用于配置 .ember-cli文件。但据我所知,这个也只能在现有项目中使用,无法设置全局配置。

    动机

    我当然可以永远记得使用 --yarn创建新项目的标志,但我经常忘记它并且不得不中止命令。我更喜欢在 init 上使用 yarn,因为它要快得多。此外,如果它尚未用于项目生成,yarn.lock文件不是初始提交的一部分。这很烦人。

    最佳答案

    .ember-cli 可以同时配置 globally并在 per-package基础

    全局配置位于$HOME/.ember-cli

    Ember CLI’s runtime is configurable via a file named .ember-cli. The JSON-formatted file, which must be placed in your home directory, can include any command-line options whose names must be in camel case form



    仅项目更改将位于 /path/to/project/.ember-cli .

    It is now also possible to override command line options by creating a file in your app’s root directory called .ember-cli and placing desired overrides in it.



    由于您希望所有新创建的项目都使用 yarn,请将以下内容添加到 $HOME/.ember-cli
    "yarn": true
    

    关于ember-cli - 全局配置 ember-cli 以在新项目中使用 yarn,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51138372/

    相关文章:

    ember.js - ember-cli 从仓库内插件运行测试

    ember.js - 新的 Ember 应用程序出现黑屏

    ember.js - 升级 Ember 1.9.1 时的 Handlebars 问题

    reactjs - 'docker-compose run app yarn add raven-js'未在npm_modules中安装软件包

    yarnpkg - 在 yarn 工作区中,如何强制解决子项目的依赖项?

    node.js - 无法使用 create-react-app 生成项目

    yarnpkg - yarn 全局安装 : "adonis: command not found"

    javascript - 在同一页面中嵌入两个 Ember Cli 应用程序实例

    typescript - 在源文件夹之外引用 Typescript 项目

    ember.js - 如何在验收测试中模拟 Ember-CLI 服务?