gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 01:44:45 24 4
gpt4 key购买 nike

有没有办法全局配置 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/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com