diff --git a/docs/dev-manual.md b/docs/dev-manual.md index dba45558..1269bcab 100644 --- a/docs/dev-manual.md +++ b/docs/dev-manual.md @@ -30,7 +30,8 @@ Currently available xtask commands: - `package` - build and package VSCode extension into a .vsix file - `--out` - output path for the .vsix file; default is "./witcherscript-ide.vsix" - `--target` - VSCode extension target, e.g. win32-x64 -- `install` - build, package and install the VSCode extension + - `--pre-release` - mark the package as pre-release +- `install` - build, package and install the VSCode extension locally ## Debugging diff --git a/xtask/src/cli.rs b/xtask/src/cli.rs index 1dc4988d..f929fc85 100644 --- a/xtask/src/cli.rs +++ b/xtask/src/cli.rs @@ -38,7 +38,10 @@ pub enum Commands { /// /// https://code.visualstudio.com/api/working-with-extensions/publishing-extension#platformspecific-extensions #[arg(long)] - target: Option + target: Option, + /// Mark the packed extension as pre-release + #[arg(long)] + pre_release: bool }, /// Build, package and install the VSCode extension Install diff --git a/xtask/src/commands/package.rs b/xtask/src/commands/package.rs index 96be216b..bd47bf3e 100644 --- a/xtask/src/commands/package.rs +++ b/xtask/src/commands/package.rs @@ -8,7 +8,7 @@ const VSIX_NAME: &'static str = "witcherscript-ide.vsix"; const NPM: &'static str = if cfg!(windows) { "npm.cmd" } else { "npm" }; const NPX: &'static str = if cfg!(windows) { "npx.cmd" } else { "npx" }; -pub fn package(output: Option, code_target: Option) -> anyhow::Result<()> { +pub fn package(output: Option, code_target: Option, pre_release: bool) -> anyhow::Result<()> { let sh = Shell::new()?; let root = project_root::get_project_root()?; let cwd = std::env::current_dir()?; @@ -26,6 +26,9 @@ pub fn package(output: Option, code_target: Option) -> anyhow::R if let Some(code_target) = &code_target { package_opt_args.extend(["--target", code_target]) } + if pre_release { + package_opt_args.extend(["--pre-release"]); + } cmd!(sh, "{NPM} --version").run().with_context(|| "npm is required")?; cmd!(sh, "{NPM} ci").run()?; diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 034474e1..a373e03a 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -11,7 +11,7 @@ fn main() -> anyhow::Result<()> { match cli.command { cli::Commands::PrepServer { release, target } => commands::prep_server(release, target), cli::Commands::PrepClient { watch, fast } => commands::prep_client(watch, fast), - cli::Commands::Package { out, target } => commands::package(out, target), + cli::Commands::Package { out, target, pre_release } => commands::package(out, target, pre_release), cli::Commands::Install => commands::install() } } \ No newline at end of file