diff options
| -rw-r--r-- | cli/tools/registry/pm.rs | 11 | ||||
| -rw-r--r-- | tests/specs/add/error_import_map_field/__test__.jsonc | 5 | ||||
| -rw-r--r-- | tests/specs/add/error_import_map_field/add.out | 2 | ||||
| -rw-r--r-- | tests/specs/add/error_import_map_field/deno.json | 3 | ||||
| -rw-r--r-- | tests/specs/add/error_import_map_field/import_map.json | 1 |
5 files changed, 22 insertions, 0 deletions
diff --git a/cli/tools/registry/pm.rs b/cli/tools/registry/pm.rs index 52f3310ba..3cdef071f 100644 --- a/cli/tools/registry/pm.rs +++ b/cli/tools/registry/pm.rs @@ -289,6 +289,17 @@ pub async fn add( _ => bail!("Failed updating config file due to no object."), }; + if obj.get_string("importMap").is_some() { + bail!( + concat!( + "`deno add` is not supported when configuration file contains an \"importMap\" field. ", + "Inline the import map into the Deno configuration file.\n", + " at {}", + ), + config_specifier + ); + } + let mut existing_imports = config_file.existing_imports()?; let is_npm = config_file.is_npm(); diff --git a/tests/specs/add/error_import_map_field/__test__.jsonc b/tests/specs/add/error_import_map_field/__test__.jsonc new file mode 100644 index 000000000..bf26b74e4 --- /dev/null +++ b/tests/specs/add/error_import_map_field/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "add jsr:@denotest/add", + "output": "add.out", + "exitCode": 1 +} diff --git a/tests/specs/add/error_import_map_field/add.out b/tests/specs/add/error_import_map_field/add.out new file mode 100644 index 000000000..ab787ea78 --- /dev/null +++ b/tests/specs/add/error_import_map_field/add.out @@ -0,0 +1,2 @@ +error: `deno add` is not supported when configuration file contains an "importMap" field. Inline the import map into the Deno configuration file. + at file:///[WILDLINE]/deno.json diff --git a/tests/specs/add/error_import_map_field/deno.json b/tests/specs/add/error_import_map_field/deno.json new file mode 100644 index 000000000..12a79304f --- /dev/null +++ b/tests/specs/add/error_import_map_field/deno.json @@ -0,0 +1,3 @@ +{ + "importMap": "./import_map.json" +} diff --git a/tests/specs/add/error_import_map_field/import_map.json b/tests/specs/add/error_import_map_field/import_map.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/tests/specs/add/error_import_map_field/import_map.json @@ -0,0 +1 @@ +{} |
