forked from swc-project/swc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(swc/cli): setup packages for binary
- relates with swc-project#1589
- Loading branch information
Showing
5 changed files
with
172 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[package] | ||
description = "Commandline for swc" | ||
name = "swc_cli" | ||
version = "0.1.0" | ||
edition = "2018" | ||
include = ["Cargo.toml", "src/**/*.rs"] | ||
license = "Apache-2.0" | ||
repository = "https://github.com/swc-project/swc.git" | ||
|
||
[[bin]] | ||
name = "swc" | ||
path = "./src/main.rs" | ||
|
||
[dependencies] | ||
structopt = { version = "0.3.25", features = [ "paw" ] } | ||
paw = "1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use std::path::PathBuf; | ||
|
||
use structopt::StructOpt; | ||
|
||
/// Transform, compile files. | ||
#[derive(Debug, StructOpt)] | ||
struct CompileCommand { | ||
///Filename to use when reading from stdin - this will be used in | ||
/// source-maps, errors etc | ||
#[structopt(short = "f", long = "filename")] | ||
file_name: String, | ||
/// Path to a .swcrc file to use | ||
#[structopt(parse(from_os_str), long = "config-file")] | ||
config_file: PathBuf, | ||
/// The name of the 'env' to use when loading configs and plugins. | ||
/// Defaults to the value of SWC_ENV, or else NODE_ENV, or else | ||
/// 'development'. | ||
/// | ||
/// DEPRECATED: use --env flag instead. | ||
#[structopt(long = "env-name")] | ||
env_name: String, | ||
} | ||
|
||
#[derive(StructOpt, Debug)] | ||
#[structopt(about = "Speedy Web Compiler")] | ||
pub enum SwcCommand { | ||
Compile(CompileCommand), | ||
} | ||
|
||
impl SwcCommand { | ||
pub fn execute(self) { | ||
match self { | ||
Self::Compile => {} | ||
}; | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
use cli::SwcCommand; | ||
|
||
#[paw::main] | ||
fn main(_args: SwcCommand) { | ||
unimplemented!("Not yet implemented"); | ||
} |