Bower と devDependencies と依存関係 質問する

Bower と devDependencies と依存関係 質問する

私は「yo angular」を実行しましたが、その後、1.0.8 がインストールされ、Angular コンポーネントをアンインストールしたことがわかりました。しかし、元の bower.json ファイルでは、devDependencies ではなく、dependencies の下にすべての 1.2.0-rc.2 コンポーネント angular-mocks と angular-scenario を再度追加したときに、「devDependencies」の下に angular-mocks と angular-scenario がありました。

devDependencies がどのように使用されているか、また手動で修正する必要があるか、それともそのままにしておく必要があるかが気になります。bower CLI で何かを開発依存関係としてマークする方法を指定する方法はありますか?

編集後のファイル:

{
    name: "Angular",
    version: "0.0.0",
    dependencies: {
        json3: "~3.2.4",
        jquery: "~1.9.1",
        bootstrap-sass: "~2.3.1",
        es5-shim: "~2.0.8",
        angular-mocks: "1.2.0-rc.2",
        angular-sanitize: "1.2.0-rc.2",
        angular-resource: "1.2.0-rc.2",
        angular-cookies: "1.2.0-rc.2",
        angular: "1.2.0-rc.2",
        angular-scenario: "1.2.0-rc.2"
    },
    devDependencies: { }
}

編集前:

{
    "name": "Angular",
    "version": "0.0.0",
    "dependencies": {
        "angular": "~1.0.7",
        "json3": "~3.2.4",
        "jquery": "~1.9.1",
        "bootstrap-sass": "~2.3.1",
        "es5-shim": "~2.0.8",
        "angular-resource": "~1.0.7",
        "angular-cookies": "~1.0.7",
        "angular-sanitize": "~1.0.7"
    },
    "devDependencies": {
        "angular-mocks": "~1.0.7",
        "angular-scenario": "~1.0.7"
    }
}

ベストアンサー1

devDependenciesユニットテスト、スクリプトのパッケージ化、ドキュメント生成などの開発関連のスクリプト用です。

dependencies実稼働環境での使用には必須であり、開発環境でも必要であると想定されます。

devDependenciesを 内に含めてもdependencies、害にはなりません。モジュールはインストール中にさらに多くのファイル (バイト) をバンドルするだけで、より多くの (不要な) リソースを消費します。純粋主義者の観点から見ると、これらの余分なバイトは有害である可能性がありますが、それはあなたの視点に依存します。

を見るとbower help install、 の下にリストされているモジュールは、または をdevDependencies介し​​てモジュールのインストール中に省略できることがわかります。例:-p--production

bower install angular-latest --production

これは、開発プラットフォーム以外のインストールを実行する場合に推奨される方法です。

逆に、 の下にリストされているモジュールを省略する方法はありませんdependencies


現在[メールアドレス](見るバウアー最新ソース)、bower help結果は次のようになります。

Usage:

    bower <command> [<args>] [<options>]

Commands:

    cache                   Manage bower cache
    help                    Display help information about Bower
    home                    Opens a package homepage into your favorite browser
    info                    Info of a particular package
    init                    Interactively create a bower.json file
    install                 Install a package locally
    link                    Symlink a package folder
    list                    List local packages
    lookup                  Look up a package URL by name
    prune                   Removes local extraneous packages
    register                Register a package
    search                  Search for a package by name
    update                  Update a local package
    uninstall               Remove a local package

Options:

    -f, --force             Makes various commands more forceful
    -j, --json              Output consumable JSON
    -l, --log-level         What level of logs to report
    -o, --offline           Do not hit the network
    -q, --quiet             Only output important information
    -s, --silent            Do not output anything, besides errors
    -V, --verbose           Makes output more verbose
    --allow-root            Allows running commands as root

See 'bower help <command>' for more information on a specific command.

さらに、bower help install(参照:最新の情報源):

Usage:

    bower install [<options>]
    bower install <endpoint> [<endpoint> ..] [<options>]

Options:

    -F, --force-latest      Force latest version on conflict
    -h, --help              Show this help message
    -p, --production        Do not install project devDependencies
    -S, --save              Save installed packages into the project's bower.json dependencies
    -D, --save-dev          Save installed packages into the project's bower.json devDependencies

    Additionally all global options listed in 'bower help' are available

Description:

    Installs the project dependencies or a specific set of endpoints.
    Endpoints can have multiple forms:
    - <source>
    - <source>#<target>
    - <name>=<source>#<target>

    Where:
    - <source> is a package URL, physical location or registry name
    - <target> is a valid range, commit, branch, etc.
    - <name> is the name it should have locally.

おすすめ記事