FriendsOfShopware / shopware-cli

CLI for Shopware Account and Shopware 6
MIT License
84 stars 32 forks source link

NPM strict mode #289

Closed shyim closed 10 months ago

shyim commented 10 months ago

Problem

shopware-cli searches for any package.json and installs the dependencies. For some package.json files it's waste of time as they only install dev dependencies, like formatter, linter, typescript compiler etc. Therefore, it makes sense to use the dependencies and devDependencies feature of the package.json file.

Example:

 + @typescript-eslint/parser@5.57.0
 + @babel/eslint-parser@7.22.15
 + @shopware-ag/eslint-config-base@2.0.0
 + @typescript-eslint/eslint-plugin@5.62.0 (v6.18.1 available)
 + eslint-import-resolver-webpack@0.13.7
 + eslint-plugin-file-progress@1.3.0
 + eslint-plugin-filename-rules@1.3.1
 + eslint-plugin-html@7.1.0
 + eslint-plugin-inclusive-language@2.2.0
 + eslint-plugin-jest@27.4.2
 + eslint-plugin-vue@9.14.1
 + eslint-plugin-vuejs-accessibility@2.1.0

everything installed of that extension is not relevant for the build result.

Solution

We have a new flag in the .shopware-extension.yml

# .shopware-extension.yml
npmStrict: true

When that is enabled, all npm install will be executed with --production flag. We check also before we execute the package manager if there is any dependency, to save time while executing the package manager.