mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 07:14:47 -05:00
remove --unstable flag from CLI features (#10190)
This commit is contained in:
parent
83770e898e
commit
baf7092ea2
7 changed files with 38 additions and 112 deletions
93
cli/flags.rs
93
cli/flags.rs
|
@ -482,12 +482,12 @@ fn compile_subcommand<'a, 'b>() -> App<'a, 'b> {
|
|||
.takes_value(true)
|
||||
.possible_values(&["x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc", "x86_64-apple-darwin", "aarch64-apple-darwin"])
|
||||
)
|
||||
.about("Compile the script into a self contained executable")
|
||||
.about("UNSTABLE: Compile the script into a self contained executable")
|
||||
.long_about(
|
||||
"Compiles the given script into a self contained executable.
|
||||
"UNSTABLE: Compiles the given script into a self contained executable.
|
||||
|
||||
deno compile --unstable -A https://deno.land/std/http/file_server.ts
|
||||
deno compile --unstable --output /usr/local/bin/color_util https://deno.land/std/examples/colors.ts
|
||||
deno compile -A https://deno.land/std/http/file_server.ts
|
||||
deno compile --output /usr/local/bin/color_util https://deno.land/std/examples/colors.ts
|
||||
|
||||
Any flags passed which affect runtime behavior, such as '--unstable',
|
||||
'--allow-*', '--v8-flags', etc. are encoded into the output executable and used
|
||||
|
@ -751,7 +751,7 @@ Ignore formatting a file by adding an ignore comment at the top of the file:
|
|||
.takes_value(true)
|
||||
.use_delimiter(true)
|
||||
.require_equals(true)
|
||||
.help("Ignore formatting particular source files. Use with --unstable"),
|
||||
.help("Ignore formatting particular source files"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("files")
|
||||
|
@ -795,7 +795,7 @@ TypeScript compiler cache: Subdirectory containing TS compiler output.",
|
|||
.arg(
|
||||
Arg::with_name("json")
|
||||
.long("json")
|
||||
.help("Outputs the information in JSON format")
|
||||
.help("UNSTABLE: Outputs the information in JSON format")
|
||||
.takes_value(false),
|
||||
)
|
||||
}
|
||||
|
@ -873,25 +873,25 @@ https://deno.land/manual/getting_started/setup_your_environment#editors-and-ides
|
|||
|
||||
fn lint_subcommand<'a, 'b>() -> App<'a, 'b> {
|
||||
SubCommand::with_name("lint")
|
||||
.about("Lint source files")
|
||||
.about("UNSTABLE: Lint source files")
|
||||
.long_about(
|
||||
"Lint JavaScript/TypeScript source code.
|
||||
"UNSTABLE: Lint JavaScript/TypeScript source code.
|
||||
|
||||
deno lint --unstable
|
||||
deno lint --unstable myfile1.ts myfile2.js
|
||||
deno lint
|
||||
deno lint myfile1.ts myfile2.js
|
||||
|
||||
Print result as JSON:
|
||||
|
||||
deno lint --unstable --json
|
||||
deno lint --json
|
||||
|
||||
Read from stdin:
|
||||
|
||||
cat file.ts | deno lint --unstable -
|
||||
cat file.ts | deno lint --unstable --json -
|
||||
cat file.ts | deno lint -
|
||||
cat file.ts | deno lint --json -
|
||||
|
||||
List available rules:
|
||||
|
||||
deno lint --unstable --rules
|
||||
deno lint --rules
|
||||
|
||||
Ignore diagnostics on the next line by preceding it with an ignore comment and
|
||||
rule name:
|
||||
|
@ -914,7 +914,6 @@ Ignore linting a file by adding an ignore comment at the top of the file:
|
|||
.arg(
|
||||
Arg::with_name("ignore")
|
||||
.long("ignore")
|
||||
.requires("unstable")
|
||||
.takes_value(true)
|
||||
.use_delimiter(true)
|
||||
.require_equals(true)
|
||||
|
@ -982,8 +981,7 @@ fn test_subcommand<'a, 'b>() -> App<'a, 'b> {
|
|||
Arg::with_name("no-run")
|
||||
.long("no-run")
|
||||
.help("Cache test modules, but don't run tests")
|
||||
.takes_value(false)
|
||||
.requires("unstable"),
|
||||
.takes_value(false),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("fail-fast")
|
||||
|
@ -1010,10 +1008,9 @@ fn test_subcommand<'a, 'b>() -> App<'a, 'b> {
|
|||
.long("coverage")
|
||||
.require_equals(true)
|
||||
.takes_value(true)
|
||||
.requires("unstable")
|
||||
.conflicts_with("inspect")
|
||||
.conflicts_with("inspect-brk")
|
||||
.help("Collect coverage profile data"),
|
||||
.help("UNSTABLE: Collect coverage profile data"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("files")
|
||||
|
@ -1333,11 +1330,10 @@ fn seed_arg<'a, 'b>() -> Arg<'a, 'b> {
|
|||
|
||||
fn watch_arg<'a, 'b>() -> Arg<'a, 'b> {
|
||||
Arg::with_name("watch")
|
||||
.requires("unstable")
|
||||
.long("watch")
|
||||
.help("Watch for file changes and restart process automatically")
|
||||
.help("UNSTABLE: Watch for file changes and restart process automatically")
|
||||
.long_help(
|
||||
"Watch for file changes and restart process automatically.
|
||||
"UNSTABLE: Watch for file changes and restart process automatically.
|
||||
Only local files from entry point module graph are watched.",
|
||||
)
|
||||
}
|
||||
|
@ -2010,13 +2006,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn run_watch() {
|
||||
let r = flags_from_vec(svec![
|
||||
"deno",
|
||||
"run",
|
||||
"--unstable",
|
||||
"--watch",
|
||||
"script.ts"
|
||||
]);
|
||||
let r = flags_from_vec(svec!["deno", "run", "--watch", "script.ts"]);
|
||||
let flags = r.unwrap();
|
||||
assert_eq!(
|
||||
flags,
|
||||
|
@ -2025,7 +2015,6 @@ mod tests {
|
|||
script: "script.ts".to_string(),
|
||||
},
|
||||
watch: true,
|
||||
unstable: true,
|
||||
..Flags::default()
|
||||
}
|
||||
);
|
||||
|
@ -2228,7 +2217,7 @@ mod tests {
|
|||
}
|
||||
);
|
||||
|
||||
let r = flags_from_vec(svec!["deno", "fmt", "--watch", "--unstable"]);
|
||||
let r = flags_from_vec(svec!["deno", "fmt", "--watch"]);
|
||||
assert_eq!(
|
||||
r.unwrap(),
|
||||
Flags {
|
||||
|
@ -2239,7 +2228,6 @@ mod tests {
|
|||
ext: "ts".to_string(),
|
||||
},
|
||||
watch: true,
|
||||
unstable: true,
|
||||
..Flags::default()
|
||||
}
|
||||
);
|
||||
|
@ -2249,7 +2237,6 @@ mod tests {
|
|||
"fmt",
|
||||
"--check",
|
||||
"--watch",
|
||||
"--unstable",
|
||||
"foo.ts",
|
||||
"--ignore=bar.js"
|
||||
]);
|
||||
|
@ -2263,7 +2250,6 @@ mod tests {
|
|||
ext: "ts".to_string(),
|
||||
},
|
||||
watch: true,
|
||||
unstable: true,
|
||||
..Flags::default()
|
||||
}
|
||||
);
|
||||
|
@ -2283,13 +2269,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn lint() {
|
||||
let r = flags_from_vec(svec![
|
||||
"deno",
|
||||
"lint",
|
||||
"--unstable",
|
||||
"script_1.ts",
|
||||
"script_2.ts"
|
||||
]);
|
||||
let r = flags_from_vec(svec!["deno", "lint", "script_1.ts", "script_2.ts"]);
|
||||
assert_eq!(
|
||||
r.unwrap(),
|
||||
Flags {
|
||||
|
@ -2302,17 +2282,12 @@ mod tests {
|
|||
json: false,
|
||||
ignore: vec![],
|
||||
},
|
||||
unstable: true,
|
||||
..Flags::default()
|
||||
}
|
||||
);
|
||||
|
||||
let r = flags_from_vec(svec![
|
||||
"deno",
|
||||
"lint",
|
||||
"--unstable",
|
||||
"--ignore=script_1.ts,script_2.ts"
|
||||
]);
|
||||
let r =
|
||||
flags_from_vec(svec!["deno", "lint", "--ignore=script_1.ts,script_2.ts"]);
|
||||
assert_eq!(
|
||||
r.unwrap(),
|
||||
Flags {
|
||||
|
@ -2325,12 +2300,11 @@ mod tests {
|
|||
PathBuf::from("script_2.ts")
|
||||
],
|
||||
},
|
||||
unstable: true,
|
||||
..Flags::default()
|
||||
}
|
||||
);
|
||||
|
||||
let r = flags_from_vec(svec!["deno", "lint", "--unstable", "--rules"]);
|
||||
let r = flags_from_vec(svec!["deno", "lint", "--rules"]);
|
||||
assert_eq!(
|
||||
r.unwrap(),
|
||||
Flags {
|
||||
|
@ -2340,18 +2314,11 @@ mod tests {
|
|||
json: false,
|
||||
ignore: vec![],
|
||||
},
|
||||
unstable: true,
|
||||
..Flags::default()
|
||||
}
|
||||
);
|
||||
|
||||
let r = flags_from_vec(svec![
|
||||
"deno",
|
||||
"lint",
|
||||
"--unstable",
|
||||
"--json",
|
||||
"script_1.ts"
|
||||
]);
|
||||
let r = flags_from_vec(svec!["deno", "lint", "--json", "script_1.ts"]);
|
||||
assert_eq!(
|
||||
r.unwrap(),
|
||||
Flags {
|
||||
|
@ -2361,7 +2328,6 @@ mod tests {
|
|||
json: true,
|
||||
ignore: vec![],
|
||||
},
|
||||
unstable: true,
|
||||
..Flags::default()
|
||||
}
|
||||
);
|
||||
|
@ -2894,13 +2860,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn bundle_watch() {
|
||||
let r = flags_from_vec(svec![
|
||||
"deno",
|
||||
"bundle",
|
||||
"--watch",
|
||||
"--unstable",
|
||||
"source.ts"
|
||||
]);
|
||||
let r = flags_from_vec(svec!["deno", "bundle", "--watch", "source.ts"]);
|
||||
assert_eq!(
|
||||
r.unwrap(),
|
||||
Flags {
|
||||
|
@ -2909,7 +2869,6 @@ mod tests {
|
|||
out_file: None,
|
||||
},
|
||||
watch: true,
|
||||
unstable: true,
|
||||
..Flags::default()
|
||||
}
|
||||
)
|
||||
|
|
18
cli/main.rs
18
cli/main.rs
|
@ -44,7 +44,6 @@ use crate::flags::Flags;
|
|||
use crate::fmt_errors::PrettyJsError;
|
||||
use crate::media_type::MediaType;
|
||||
use crate::module_loader::CliModuleLoader;
|
||||
use crate::program_state::exit_unstable;
|
||||
use crate::program_state::ProgramState;
|
||||
use crate::source_maps::apply_source_map;
|
||||
use crate::specifier_handler::FetchHandler;
|
||||
|
@ -320,10 +319,6 @@ async fn compile_command(
|
|||
args: Vec<String>,
|
||||
target: Option<String>,
|
||||
) -> Result<(), AnyError> {
|
||||
if !flags.unstable {
|
||||
exit_unstable("compile");
|
||||
}
|
||||
|
||||
let debug = flags.log_level == Some(log::Level::Debug);
|
||||
|
||||
let run_flags =
|
||||
|
@ -382,9 +377,6 @@ async fn info_command(
|
|||
maybe_specifier: Option<String>,
|
||||
json: bool,
|
||||
) -> Result<(), AnyError> {
|
||||
if json && !flags.unstable {
|
||||
exit_unstable("--json");
|
||||
}
|
||||
let program_state = ProgramState::build(flags).await?;
|
||||
if let Some(specifier) = maybe_specifier {
|
||||
let specifier = resolve_url_or_path(&specifier)?;
|
||||
|
@ -441,16 +433,12 @@ async fn lsp_command() -> Result<(), AnyError> {
|
|||
}
|
||||
|
||||
async fn lint_command(
|
||||
flags: Flags,
|
||||
_flags: Flags,
|
||||
files: Vec<PathBuf>,
|
||||
list_rules: bool,
|
||||
ignore: Vec<PathBuf>,
|
||||
json: bool,
|
||||
) -> Result<(), AnyError> {
|
||||
if !flags.unstable {
|
||||
exit_unstable("lint");
|
||||
}
|
||||
|
||||
if list_rules {
|
||||
tools::lint::print_rules_list(json);
|
||||
return Ok(());
|
||||
|
@ -898,10 +886,6 @@ async fn coverage_command(
|
|||
exclude: Vec<String>,
|
||||
lcov: bool,
|
||||
) -> Result<(), AnyError> {
|
||||
if !flags.unstable {
|
||||
exit_unstable("coverage");
|
||||
}
|
||||
|
||||
if files.is_empty() {
|
||||
println!("No matching coverage profiles found");
|
||||
std::process::exit(1);
|
||||
|
|
|
@ -34,14 +34,6 @@ use std::fs::read;
|
|||
use std::sync::Arc;
|
||||
use std::sync::Mutex;
|
||||
|
||||
pub fn exit_unstable(api_name: &str) {
|
||||
eprintln!(
|
||||
"Unstable API '{}'. The --unstable flag must be provided.",
|
||||
api_name
|
||||
);
|
||||
std::process::exit(70);
|
||||
}
|
||||
|
||||
/// This structure represents state of single "deno" program.
|
||||
///
|
||||
/// It is shared by all created workers (thus V8 isolates).
|
||||
|
|
|
@ -94,11 +94,8 @@ watcher. When Deno starts up with this flag it watches the entrypoint, and all
|
|||
local files the entrypoint statically imports. Whenever one of these files is
|
||||
changed on disk, the program will automatically be restarted.
|
||||
|
||||
**Note: file watcher is a new feature and still unstable thus it requires
|
||||
`--unstable` flag**
|
||||
|
||||
```
|
||||
deno run --watch --unstable main.ts
|
||||
deno run --watch main.ts
|
||||
```
|
||||
|
||||
### Integrity flags
|
||||
|
|
|
@ -254,13 +254,13 @@ formats by the `deno coverage` tool.
|
|||
git clone https://github.com/oakserver/oak && cd oak
|
||||
|
||||
# Collect your coverage profile with deno test --coverage=<output_directory>
|
||||
deno test --coverage=cov_profile --unstable
|
||||
deno test --coverage=cov_profile
|
||||
|
||||
# From this you can get a pretty printed diff of uncovered lines
|
||||
deno coverage --unstable cov_profile
|
||||
deno coverage cov_profile
|
||||
|
||||
# Or generate an lcov report
|
||||
deno coverage --unstable cov_profile --lcov > cov_profile.lcov
|
||||
deno coverage cov_profile --lcov > cov_profile.lcov
|
||||
|
||||
# Which can then be further processed by tools like genhtml
|
||||
genhtml -o cov_profile/html cov_profile.lcov
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
## Compiling Executables
|
||||
|
||||
> Since the compile functionality is relatively new, the `--unstable` flag has
|
||||
> to be set in order for the command to work.
|
||||
|
||||
`deno compile [--output <OUT>] <SRC>` will compile the script into a
|
||||
self-contained executable.
|
||||
|
||||
```
|
||||
> deno compile --unstable https://deno.land/std/examples/welcome.ts
|
||||
> deno compile https://deno.land/std/examples/welcome.ts
|
||||
```
|
||||
|
||||
If you omit the `OUT` parameter, the name of the executable file will be
|
||||
|
@ -20,14 +17,14 @@ execute the script must be specified at compilation time. This includes
|
|||
permission flags.
|
||||
|
||||
```
|
||||
> deno compile --unstable --allow-read --allow-net https://deno.land/std/http/file_server.ts
|
||||
> deno compile --allow-read --allow-net https://deno.land/std/http/file_server.ts
|
||||
```
|
||||
|
||||
[Script arguments](../getting_started/command_line_interface.md#script-arguments)
|
||||
can be partially embedded.
|
||||
|
||||
```
|
||||
> deno compile --unstable --allow-read --allow-net https://deno.land/std/http/file_server.ts -p 8080
|
||||
> deno compile --allow-read --allow-net https://deno.land/std/http/file_server.ts -p 8080
|
||||
> ./file_server --help
|
||||
```
|
||||
|
||||
|
|
|
@ -2,18 +2,15 @@
|
|||
|
||||
Deno ships with a built in code linter for JavaScript and TypeScript.
|
||||
|
||||
**Note: linter is a new feature and still unstable thus it requires `--unstable`
|
||||
flag**
|
||||
|
||||
```shell
|
||||
# lint all JS/TS files in the current directory and subdirectories
|
||||
deno lint --unstable
|
||||
deno lint
|
||||
# lint specific files
|
||||
deno lint --unstable myfile1.ts myfile2.ts
|
||||
deno lint myfile1.ts myfile2.ts
|
||||
# print result as JSON
|
||||
deno lint --unstable --json
|
||||
deno lint --json
|
||||
# read from stdin
|
||||
cat file.ts | deno lint --unstable -
|
||||
cat file.ts | deno lint -
|
||||
```
|
||||
|
||||
For more detail, run `deno lint --help`.
|
||||
|
|
Loading…
Reference in a new issue