是否可以通过 CLI 在 composer.json 的配置部分向 "allow-plugins" 添加设置?
Is it possible to add settings to "allow-plugins" in config section in composer.json through the CLI?
自 composer 2.2 起,设置 allow-plugins
将是强制性的我试图通过 CLI 中的 composer config
命令推送此设置,但没有成功。
我尝试了一些命令,例如:
composer config --json '{"allow-plugins.composer/installers":true, "allow-plugins.dealerdirect/phpcodesniffer-composer-installer": true, "allow-plugins.roots/wordpress-core-installer": true }'
composer config config.allow-plugins '{"composer/installers":true, "dealerdirect/phpcodesniffer-composer-installer": true, "wordpress-core-installer": true}'
composer config --append "allow-plugins" "composer/installers":true, "dealerdirect/phpcodesniffer-composer-installer": true, "wordpress-core-installer": true
composer config --json "allow-plugins" '{"composer/installers":true, "dealerdirect/phpcodesniffer-composer-installer": true, "roots/wordpress-core-installer": true }'
我得到的只是错误消息,例如“.. 未定义”或它是一个无效值。
我的是这样的:
"config": {
"optimize-autoloader": true,
"preferred-install": "dist"
},
而且,我需要添加这样的设置:
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"allow-plugins": {
"composer/installers": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"roots/wordpress-core-installer": true
}
},
这可以通过 CLI 实现吗?
你需要通过一个一个的设置。
composer config allow-plugins.composer/installers true
composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer config allow-plugins.roots/wordpress-core-installer true
在评论中编辑每个对话:
OP 希望也能实现在命令期间不被提示。为此,我们必须传递 --no-interaction
(或 -n
)选项。这在执行自动化任务时很有用。
OP 插件的完整示例:
composer config --no-interaction allow-plugins.composer/installerstrue
composer config --no-interaction allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer config --no-interaction allow-plugins.roots/wordpress-core-installer true
自 composer 2.2 起,设置 allow-plugins
将是强制性的我试图通过 CLI 中的 composer config
命令推送此设置,但没有成功。
我尝试了一些命令,例如:
composer config --json '{"allow-plugins.composer/installers":true, "allow-plugins.dealerdirect/phpcodesniffer-composer-installer": true, "allow-plugins.roots/wordpress-core-installer": true }'
composer config config.allow-plugins '{"composer/installers":true, "dealerdirect/phpcodesniffer-composer-installer": true, "wordpress-core-installer": true}'
composer config --append "allow-plugins" "composer/installers":true, "dealerdirect/phpcodesniffer-composer-installer": true, "wordpress-core-installer": true
composer config --json "allow-plugins" '{"composer/installers":true, "dealerdirect/phpcodesniffer-composer-installer": true, "roots/wordpress-core-installer": true }'
我得到的只是错误消息,例如“.. 未定义”或它是一个无效值。
我的是这样的:
"config": {
"optimize-autoloader": true,
"preferred-install": "dist"
},
而且,我需要添加这样的设置:
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"allow-plugins": {
"composer/installers": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"roots/wordpress-core-installer": true
}
},
这可以通过 CLI 实现吗?
你需要通过一个一个的设置。
composer config allow-plugins.composer/installers true
composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer config allow-plugins.roots/wordpress-core-installer true
在评论中编辑每个对话:
OP 希望也能实现在命令期间不被提示。为此,我们必须传递 --no-interaction
(或 -n
)选项。这在执行自动化任务时很有用。
OP 插件的完整示例:
composer config --no-interaction allow-plugins.composer/installerstrue
composer config --no-interaction allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer config --no-interaction allow-plugins.roots/wordpress-core-installer true