mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-09-11 14:35:30 +03:00
yarn: remove noOptional + improve UI
This commit is contained in:
parent
b1cb420434
commit
c2e9d3adf4
@ -210,7 +210,7 @@ class PackageCommand(Command):
|
||||
file=sys.stderr
|
||||
)
|
||||
exit(1)
|
||||
# interactively retrieve unswers for unspecified extra arguments
|
||||
# interactively retrieve answers for unspecified extra arguments
|
||||
else:
|
||||
print(f"\nThe translator '{translator['name']}' requires additional options")
|
||||
for arg_name, arg in unspecified_extra_args.items():
|
||||
@ -222,8 +222,11 @@ class PackageCommand(Command):
|
||||
print(f"Please specify '{arg_name}': {arg['description']}")
|
||||
print(f"Example values: " + ', '.join(arg['examples']))
|
||||
if 'default' in arg:
|
||||
print(f"\nLeave empty for default ({arg['default']})")
|
||||
specified_extra_args[arg_name] = self.ask(f"{arg_name}:", arg.get('default'))
|
||||
print(f"Leave empty for default ({arg['default']})")
|
||||
while True:
|
||||
specified_extra_args[arg_name] = self.ask(f"{arg_name}:", arg.get('default'))
|
||||
if specified_extra_args[arg_name]:
|
||||
break
|
||||
|
||||
# arguments for calling the translator nix module
|
||||
translator_input = dict(
|
||||
|
@ -16,7 +16,6 @@
|
||||
# extraArgs
|
||||
name,
|
||||
noDev,
|
||||
noOptional,
|
||||
peer,
|
||||
...
|
||||
}:
|
||||
@ -24,7 +23,6 @@
|
||||
let
|
||||
b = builtins;
|
||||
dev = ! noDev;
|
||||
optional = ! noOptional;
|
||||
|
||||
sourceDir = lib.elemAt inputDirectories 0;
|
||||
yarnLock = utils.readTextFile "${sourceDir}/yarn.lock";
|
||||
@ -52,7 +50,7 @@
|
||||
|
||||
mainPackageName =
|
||||
packageJSON.name or
|
||||
(if name != null then name else
|
||||
(if name != "{automatic}" then name else
|
||||
throw (
|
||||
"Could not identify package name. "
|
||||
+ "Please specify extra argument 'name'"
|
||||
@ -114,7 +112,7 @@
|
||||
let
|
||||
dependencies =
|
||||
dependencyObject.dependencies or []
|
||||
++ (lib.optionals optional (dependencyObject.optionalDependencies or []));
|
||||
++ dependencyObject.optionalDependencies or [];
|
||||
in
|
||||
lib.forEach
|
||||
dependencies
|
||||
@ -213,9 +211,10 @@
|
||||
hash =
|
||||
lib.last (lib.splitString "#" dependencyObject.resolved);
|
||||
in
|
||||
if lib.stringLength hash == 40 then hash
|
||||
else
|
||||
throw "Missing integrity for ${dependencyObject.yarnName}";
|
||||
if lib.stringLength hash == 40 then
|
||||
hash
|
||||
else
|
||||
throw "Missing integrity for ${dependencyObject.yarnName}";
|
||||
url = lib.head (lib.splitString "#" dependencyObject.resolved);
|
||||
};
|
||||
};
|
||||
@ -260,6 +259,7 @@
|
||||
"react"
|
||||
"@babel/code-frame"
|
||||
];
|
||||
default = "{automatic}";
|
||||
type = "argument";
|
||||
};
|
||||
|
||||
@ -268,11 +268,6 @@
|
||||
type = "flag";
|
||||
};
|
||||
|
||||
noOptional = {
|
||||
description = "Exclude optional dependencies";
|
||||
type = "flag";
|
||||
};
|
||||
|
||||
peer = {
|
||||
description = "Include peer dependencies";
|
||||
type = "flag";
|
||||
|
Loading…
Reference in New Issue
Block a user