@@ -50,30 +50,8 @@ public class Prettier extends SpotlessFormatterStep {
5050 paramLabel = "'PACKAGE=VERSION'" )
5151 Map <String , String > devDependencies ;
5252
53- @ CommandLine .Option (
54- names = {"--cache-dir" , "-C" },
55- description = "The directory to use for caching prettier." )
56- Path cacheDir ;
57-
58- @ CommandLine .Option (
59- names = {"--npm-exec" , "-n" },
60- description = "The explicit path to the npm executable." )
61- Path explicitNpmExecutable ;
62-
63- @ CommandLine .Option (
64- names = {"--node-exec" , "-N" },
65- description = "The explicit path to the node executable." )
66- Path explicitNodeExecutable ;
67-
68- @ CommandLine .Option (
69- names = {"--npmrc-file" , "-R" },
70- description = "The explicit path to the .npmrc file." )
71- Path explicitNpmrcFile ;
72-
73- @ CommandLine .Option (
74- names = {"--additional-npmrc-location" , "-A" },
75- description = "Additional locations to search for .npmrc files." )
76- List <Path > additionalNpmrcLocations ;
53+ @ CommandLine .Mixin
54+ NpmOptions npmOptions ;
7755
7856 @ CommandLine .Option (
7957 names = {"--prettier-config-path" , "-P" },
@@ -91,10 +69,10 @@ public class Prettier extends SpotlessFormatterStep {
9169 public List <FormatterStep > prepareFormatterSteps (SpotlessActionContext context ) {
9270 FormatterStep prettierFormatterStep = builder (context )
9371 .withDevDependencies (devDependencies ())
94- .withCacheDir (cacheDir )
95- .withExplicitNpmExecutable (explicitNpmExecutable )
96- .withExplicitNodeExecutable (explicitNodeExecutable )
97- .withExplicitNpmrcFile (explicitNpmrcFile )
72+ .withCacheDir (npmOptions . npmInstallCacheDir )
73+ .withExplicitNpmExecutable (npmOptions . explicitNpmExecutable )
74+ .withExplicitNodeExecutable (npmOptions . explicitNodeExecutable )
75+ .withExplicitNpmrcFile (npmOptions . explicitNpmrcFile )
9876 .withAdditionalNpmrcLocations (additionalNpmrcLocations ())
9977 .withPrettierConfigOptions (prettierConfigOptions ())
10078 .withPrettierConfigPath (prettierConfigPath )
@@ -134,7 +112,7 @@ private Map<String, String> devDependencies() {
134112 }
135113
136114 private List <Path > additionalNpmrcLocations () {
137- return use (additionalNpmrcLocations ).orIfNullGet (Collections ::emptyList );
115+ return use (npmOptions . additionalNpmrcLocations ).orIfNullGet (Collections ::emptyList );
138116 }
139117
140118 private PrettierFormatterStepBuilder builder (@ NotNull SpotlessActionContext context ) {
0 commit comments