diff --git a/.github/labeler.yml b/.github/labeler.yml index 2aece7f6d..63b44274f 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -4,7 +4,7 @@ A-ast: A-cli: - changed-files: - - any-glob-to-any-file: ['crates/oxc_cli/**'] + - any-glob-to-any-file: ['apps/oxlint/**'] A-prettier: - changed-files: diff --git a/.github/workflows/bloat.yml b/.github/workflows/bloat.yml index 6fbd7375d..0b9297fb4 100644 --- a/.github/workflows/bloat.yml +++ b/.github/workflows/bloat.yml @@ -27,7 +27,7 @@ jobs: - name: Run run: | - export CMD="cargo bloat --profile release-debug -p oxc_cli --bin oxlint --features allocator" + export CMD="cargo bloat --profile release-debug -p oxlint --features allocator" # Get largest functions export BLOAT_FUNC_CMD="${CMD} -n 10" diff --git a/.github/workflows/release_cli.yml b/.github/workflows/release_cli.yml deleted file mode 100644 index 311bfd24d..000000000 --- a/.github/workflows/release_cli.yml +++ /dev/null @@ -1,177 +0,0 @@ -name: Release CLI - -on: - push: - branches: - - main - paths: - - npm/oxc/package.json # Please only commit this file, so we don't need to wait for test CI to pass. - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - check: - name: Check version - runs-on: ubuntu-latest - outputs: - version: ${{ env.version }} - version_changed: ${{ steps.version.outputs.changed }} - steps: - - uses: taiki-e/checkout-action@v1 - - - name: Check version changes - uses: EndBug/version-check@v2 - id: version - with: - static-checking: localIsNew - file-url: https://unpkg.com/oxidation-compiler@latest/package.json - file-name: npm/oxc/package.json - - - name: Set version name - if: steps.version.outputs.changed == 'true' - run: | - echo "Version change found! New version: ${{ steps.version.outputs.version }} (${{ steps.version.outputs.version_type }})" - echo "version=${{ steps.version.outputs.version }}" >> $GITHUB_ENV - - build: - needs: check - if: needs.check.outputs.version_changed == 'true' - env: - version: ${{ needs.check.outputs.version }} - outputs: - version: ${{ env.version }} - strategy: - matrix: - include: - - os: windows-latest - target: x86_64-pc-windows-msvc - code-target: win32-x64 - - - os: windows-latest - target: aarch64-pc-windows-msvc - code-target: win32-arm64 - - - os: ubuntu-latest - target: x86_64-unknown-linux-gnu - code-target: linux-x64 - - - os: ubuntu-20.04 - target: aarch64-unknown-linux-gnu - code-target: linux-arm64 - - - os: macos-14 - target: x86_64-apple-darwin - code-target: darwin-x64 - - - os: macos-14 - target: aarch64-apple-darwin - code-target: darwin-arm64 - - name: Package ${{ matrix.code-target }} - runs-on: ${{ matrix.os }} - steps: - - uses: taiki-e/checkout-action@v1 - - - name: Install Rust toolchain - run: rustup target add ${{ matrix.target }} - - - name: Install arm64 toolchain - if: matrix.code-target == 'linux-arm64' - run: | - sudo apt-get update - sudo apt-get install -y gcc-aarch64-linux-gnu - - - name: Cache - uses: Swatinem/rust-cache@v2 - with: - shared-key: release-${{ matrix.target }} - - - name: Build Binary - # strip debug symbols from std, see https://github.com/johnthagen/min-sized-rust#remove-panic-string-formatting-with-panic_immediate_abort - run: cargo build --release --target ${{ matrix.target }} -p oxc_cli --features allocator - env: - CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc - - # The binary is zipped to fix permission loss https://github.com/actions/upload-artifact#permission-loss - - name: Archive Binary - if: runner.os == 'Windows' - shell: bash - run: | - BIN_NAME=oxc-${{ matrix.code-target }} - mv target/${{ matrix.target }}/release/oxc_cli.exe $BIN_NAME.exe - 7z a $BIN_NAME.zip $BIN_NAME.exe - - # The binary is zipped to fix permission loss https://github.com/actions/upload-artifact#permission-loss - - name: Archive Binary - if: runner.os != 'Windows' - run: | - BIN_NAME=oxc-${{ matrix.code-target }} - mv target/${{ matrix.target }}/release/oxc_cli $BIN_NAME - tar czf $BIN_NAME.tar.gz $BIN_NAME - - - name: Upload Binary - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: binaries - path: | - *.zip - *.tar.gz - - publish: - name: Publish - runs-on: ubuntu-latest - permissions: - contents: write # for softprops/action-gh-release@v1 - id-token: write # for `npm publish --provenance` - needs: - - build - steps: - - uses: taiki-e/checkout-action@v1 - - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - registry-url: 'https://registry.npmjs.org' - - - name: Download Artifacts - uses: actions/download-artifact@v4 - with: - name: binaries - - - name: Unzip - uses: montudor/action-zip@v1 - with: - args: unzip -qq *.zip -d . - - - name: Untar - run: ls *.gz | xargs -i tar xf {} - - - name: Generate npm packages - run: | - node npm/oxc/scripts/generate-packages.mjs - cat npm/oxc/package.json - for package in npm/oxc*; do cat $package/package.json ; echo ; done - - - name: Publish npm packages as latest - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - shell: bash - # NOTE: The trailing slash on $package/ changes it to publishing the directory - run: | - for package in npm/oxc* - do - npm publish $package/ --tag latest --provenance --access public - echo '----' - done - - - name: Create GitHub Release - uses: softprops/action-gh-release@v2 - with: - name: CLI v${{ needs.build.outputs.version }} - draft: true - files: oxc-* - fail_on_unmatched_files: true diff --git a/.github/workflows/release_oxlint.yml b/.github/workflows/release_oxlint.yml index 2053d2872..68833eeb1 100644 --- a/.github/workflows/release_oxlint.yml +++ b/.github/workflows/release_oxlint.yml @@ -92,7 +92,7 @@ jobs: run: rustup target add ${{ matrix.target }} - name: Build with cross - run: cross build -p oxc_cli --bin oxlint --release --target=${{ matrix.target }} --features allocator + run: cross build --release --target=${{ matrix.target }} --bin oxlint --features allocator # The binary is zipped to fix permission loss https://github.com/actions/upload-artifact#permission-loss - name: Archive Binary diff --git a/Cargo.lock b/Cargo.lock index 233b85fab..adab08db9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1313,27 +1313,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "oxc_cli" -version = "0.0.0" -dependencies = [ - "bpaf", - "glob", - "ignore", - "jemallocator", - "miette", - "mimalloc", - "oxc_allocator", - "oxc_diagnostics", - "oxc_linter", - "oxc_parser", - "oxc_prettier", - "oxc_span", - "rayon", - "tempfile", - "tracing-subscriber", -] - [[package]] name = "oxc_codegen" version = "0.13.1" @@ -1751,6 +1730,24 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "oxlint" +version = "0.0.0" +dependencies = [ + "bpaf", + "glob", + "ignore", + "jemallocator", + "miette", + "mimalloc", + "oxc_diagnostics", + "oxc_linter", + "oxc_span", + "rayon", + "tempfile", + "tracing-subscriber", +] + [[package]] name = "parking_lot" version = "0.12.2" @@ -2961,8 +2958,8 @@ dependencies = [ "ckb_schemars", "handlebars", "insta", - "oxc_cli", "oxc_linter", + "oxlint", "pico-args", "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index 63b056713..69f0490f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [workspace] resolver = "2" -members = ["crates/*", "napi/*", "tasks/*", "wasm/*"] +members = ["apps/*", "crates/*", "napi/*", "tasks/*", "wasm/*"] exclude = ["tasks/lint_rules"] [workspace.package] diff --git a/crates/oxc_cli/Cargo.toml b/apps/oxlint/Cargo.toml similarity index 81% rename from crates/oxc_cli/Cargo.toml rename to apps/oxlint/Cargo.toml index 7cbd17b92..2ed706358 100644 --- a/crates/oxc_cli/Cargo.toml +++ b/apps/oxlint/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "oxc_cli" +name = "oxlint" version = "0.0.0" publish = false authors.workspace = true @@ -18,19 +18,9 @@ workspace = true [lib] doctest = false -[[bin]] -name = "oxc_cli" -path = "src/main.rs" -test = false - [[bin]] name = "oxlint" -path = "src/lint/main.rs" -test = false - -[[bin]] -name = "oxformat" -path = "src/format/main.rs" +path = "src/main.rs" test = false [target.'cfg(not(target_env = "msvc"))'.dependencies] @@ -40,11 +30,8 @@ jemallocator = { workspace = true, optional = true } mimalloc = { workspace = true, optional = true } [dependencies] -oxc_allocator = { workspace = true } oxc_diagnostics = { workspace = true } oxc_linter = { workspace = true } -oxc_parser = { workspace = true } -oxc_prettier = { workspace = true } oxc_span = { workspace = true } glob = { workspace = true } diff --git a/crates/oxc_cli/fixtures/astro/debugger.astro b/apps/oxlint/fixtures/astro/debugger.astro similarity index 100% rename from crates/oxc_cli/fixtures/astro/debugger.astro rename to apps/oxlint/fixtures/astro/debugger.astro diff --git a/crates/oxc_cli/fixtures/eslintrc_env/eslintrc_env_browser.json b/apps/oxlint/fixtures/eslintrc_env/eslintrc_env_browser.json similarity index 100% rename from crates/oxc_cli/fixtures/eslintrc_env/eslintrc_env_browser.json rename to apps/oxlint/fixtures/eslintrc_env/eslintrc_env_browser.json diff --git a/crates/oxc_cli/fixtures/eslintrc_env/eslintrc_no_env.json b/apps/oxlint/fixtures/eslintrc_env/eslintrc_no_env.json similarity index 100% rename from crates/oxc_cli/fixtures/eslintrc_env/eslintrc_no_env.json rename to apps/oxlint/fixtures/eslintrc_env/eslintrc_no_env.json diff --git a/crates/oxc_cli/fixtures/eslintrc_env/test.js b/apps/oxlint/fixtures/eslintrc_env/test.js similarity index 100% rename from crates/oxc_cli/fixtures/eslintrc_env/test.js rename to apps/oxlint/fixtures/eslintrc_env/test.js diff --git a/crates/oxc_cli/fixtures/eslintrc_off/eslintrc.json b/apps/oxlint/fixtures/eslintrc_off/eslintrc.json similarity index 100% rename from crates/oxc_cli/fixtures/eslintrc_off/eslintrc.json rename to apps/oxlint/fixtures/eslintrc_off/eslintrc.json diff --git a/crates/oxc_cli/fixtures/eslintrc_off/test.js b/apps/oxlint/fixtures/eslintrc_off/test.js similarity index 100% rename from crates/oxc_cli/fixtures/eslintrc_off/test.js rename to apps/oxlint/fixtures/eslintrc_off/test.js diff --git a/crates/oxc_cli/fixtures/linter/.customignore b/apps/oxlint/fixtures/linter/.customignore similarity index 100% rename from crates/oxc_cli/fixtures/linter/.customignore rename to apps/oxlint/fixtures/linter/.customignore diff --git a/crates/oxc_cli/fixtures/linter/debugger.js b/apps/oxlint/fixtures/linter/debugger.js similarity index 100% rename from crates/oxc_cli/fixtures/linter/debugger.js rename to apps/oxlint/fixtures/linter/debugger.js diff --git a/crates/oxc_cli/fixtures/linter/eslintrc.json b/apps/oxlint/fixtures/linter/eslintrc.json similarity index 100% rename from crates/oxc_cli/fixtures/linter/eslintrc.json rename to apps/oxlint/fixtures/linter/eslintrc.json diff --git a/crates/oxc_cli/fixtures/linter/nan.js b/apps/oxlint/fixtures/linter/nan.js similarity index 100% rename from crates/oxc_cli/fixtures/linter/nan.js rename to apps/oxlint/fixtures/linter/nan.js diff --git a/crates/oxc_cli/fixtures/linter/no_extension b/apps/oxlint/fixtures/linter/no_extension similarity index 100% rename from crates/oxc_cli/fixtures/linter/no_extension rename to apps/oxlint/fixtures/linter/no_extension diff --git a/crates/oxc_cli/fixtures/no_console_off/eslintrc.json b/apps/oxlint/fixtures/no_console_off/eslintrc.json similarity index 100% rename from crates/oxc_cli/fixtures/no_console_off/eslintrc.json rename to apps/oxlint/fixtures/no_console_off/eslintrc.json diff --git a/crates/oxc_cli/fixtures/no_console_off/test.js b/apps/oxlint/fixtures/no_console_off/test.js similarity index 100% rename from crates/oxc_cli/fixtures/no_console_off/test.js rename to apps/oxlint/fixtures/no_console_off/test.js diff --git a/crates/oxc_cli/fixtures/no_empty_allow_empty_catch/eslintrc.json b/apps/oxlint/fixtures/no_empty_allow_empty_catch/eslintrc.json similarity index 100% rename from crates/oxc_cli/fixtures/no_empty_allow_empty_catch/eslintrc.json rename to apps/oxlint/fixtures/no_empty_allow_empty_catch/eslintrc.json diff --git a/crates/oxc_cli/fixtures/no_empty_allow_empty_catch/test.js b/apps/oxlint/fixtures/no_empty_allow_empty_catch/test.js similarity index 100% rename from crates/oxc_cli/fixtures/no_empty_allow_empty_catch/test.js rename to apps/oxlint/fixtures/no_empty_allow_empty_catch/test.js diff --git a/crates/oxc_cli/fixtures/no_empty_disallow_empty_catch/eslintrc.json b/apps/oxlint/fixtures/no_empty_disallow_empty_catch/eslintrc.json similarity index 100% rename from crates/oxc_cli/fixtures/no_empty_disallow_empty_catch/eslintrc.json rename to apps/oxlint/fixtures/no_empty_disallow_empty_catch/eslintrc.json diff --git a/crates/oxc_cli/fixtures/no_empty_disallow_empty_catch/test.js b/apps/oxlint/fixtures/no_empty_disallow_empty_catch/test.js similarity index 100% rename from crates/oxc_cli/fixtures/no_empty_disallow_empty_catch/test.js rename to apps/oxlint/fixtures/no_empty_disallow_empty_catch/test.js diff --git a/crates/oxc_cli/fixtures/no_undef/eslintrc.json b/apps/oxlint/fixtures/no_undef/eslintrc.json similarity index 100% rename from crates/oxc_cli/fixtures/no_undef/eslintrc.json rename to apps/oxlint/fixtures/no_undef/eslintrc.json diff --git a/crates/oxc_cli/fixtures/no_undef/test.js b/apps/oxlint/fixtures/no_undef/test.js similarity index 100% rename from crates/oxc_cli/fixtures/no_undef/test.js rename to apps/oxlint/fixtures/no_undef/test.js diff --git a/crates/oxc_cli/fixtures/svelte/debugger.svelte b/apps/oxlint/fixtures/svelte/debugger.svelte similarity index 100% rename from crates/oxc_cli/fixtures/svelte/debugger.svelte rename to apps/oxlint/fixtures/svelte/debugger.svelte diff --git a/crates/oxc_cli/fixtures/test.min.js b/apps/oxlint/fixtures/test.min.js similarity index 100% rename from crates/oxc_cli/fixtures/test.min.js rename to apps/oxlint/fixtures/test.min.js diff --git a/crates/oxc_cli/fixtures/tsconfig/tsconfig.json b/apps/oxlint/fixtures/tsconfig/tsconfig.json similarity index 100% rename from crates/oxc_cli/fixtures/tsconfig/tsconfig.json rename to apps/oxlint/fixtures/tsconfig/tsconfig.json diff --git a/crates/oxc_cli/fixtures/typescript_eslint/eslintrc.json b/apps/oxlint/fixtures/typescript_eslint/eslintrc.json similarity index 100% rename from crates/oxc_cli/fixtures/typescript_eslint/eslintrc.json rename to apps/oxlint/fixtures/typescript_eslint/eslintrc.json diff --git a/crates/oxc_cli/fixtures/typescript_eslint/test.ts b/apps/oxlint/fixtures/typescript_eslint/test.ts similarity index 100% rename from crates/oxc_cli/fixtures/typescript_eslint/test.ts rename to apps/oxlint/fixtures/typescript_eslint/test.ts diff --git a/crates/oxc_cli/fixtures/vue/debugger.vue b/apps/oxlint/fixtures/vue/debugger.vue similarity index 100% rename from crates/oxc_cli/fixtures/vue/debugger.vue rename to apps/oxlint/fixtures/vue/debugger.vue diff --git a/crates/oxc_cli/fixtures/vue/empty.vue b/apps/oxlint/fixtures/vue/empty.vue similarity index 100% rename from crates/oxc_cli/fixtures/vue/empty.vue rename to apps/oxlint/fixtures/vue/empty.vue diff --git a/crates/oxc_cli/fixtures/walk_dir/bar.vue b/apps/oxlint/fixtures/walk_dir/bar.vue similarity index 100% rename from crates/oxc_cli/fixtures/walk_dir/bar.vue rename to apps/oxlint/fixtures/walk_dir/bar.vue diff --git a/crates/oxc_cli/fixtures/walk_dir/foo.js b/apps/oxlint/fixtures/walk_dir/foo.js similarity index 100% rename from crates/oxc_cli/fixtures/walk_dir/foo.js rename to apps/oxlint/fixtures/walk_dir/foo.js diff --git a/crates/oxc_cli/src/command/format.rs b/apps/oxlint/src/command/format.rs similarity index 100% rename from crates/oxc_cli/src/command/format.rs rename to apps/oxlint/src/command/format.rs diff --git a/crates/oxc_cli/src/command/ignore.rs b/apps/oxlint/src/command/ignore.rs similarity index 100% rename from crates/oxc_cli/src/command/ignore.rs rename to apps/oxlint/src/command/ignore.rs diff --git a/crates/oxc_cli/src/command/lint.rs b/apps/oxlint/src/command/lint.rs similarity index 100% rename from crates/oxc_cli/src/command/lint.rs rename to apps/oxlint/src/command/lint.rs diff --git a/crates/oxc_cli/src/command/mod.rs b/apps/oxlint/src/command/mod.rs similarity index 100% rename from crates/oxc_cli/src/command/mod.rs rename to apps/oxlint/src/command/mod.rs diff --git a/crates/oxc_cli/src/git.rs b/apps/oxlint/src/git.rs similarity index 100% rename from crates/oxc_cli/src/git.rs rename to apps/oxlint/src/git.rs diff --git a/crates/oxc_cli/src/lib.rs b/apps/oxlint/src/lib.rs similarity index 82% rename from crates/oxc_cli/src/lib.rs rename to apps/oxlint/src/lib.rs index b034ee77f..a98163f4d 100644 --- a/crates/oxc_cli/src/lib.rs +++ b/apps/oxlint/src/lib.rs @@ -1,5 +1,4 @@ mod command; -mod format; mod lint; mod result; mod runner; @@ -7,7 +6,6 @@ mod walk; pub use crate::{ command::*, - format::FormatRunner, lint::LintRunner, result::{CliRunResult, LintResult}, runner::Runner, diff --git a/crates/oxc_cli/src/lint/mod.rs b/apps/oxlint/src/lint/mod.rs similarity index 100% rename from crates/oxc_cli/src/lint/mod.rs rename to apps/oxlint/src/lint/mod.rs diff --git a/crates/oxc_cli/src/lint/main.rs b/apps/oxlint/src/main.rs similarity index 93% rename from crates/oxc_cli/src/lint/main.rs rename to apps/oxlint/src/main.rs index 8e956eca7..6ee464a2f 100644 --- a/crates/oxc_cli/src/lint/main.rs +++ b/apps/oxlint/src/main.rs @@ -10,13 +10,13 @@ static GLOBAL: jemallocator::Jemalloc = jemallocator::Jemalloc; #[global_allocator] static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; -use oxc_cli::{CliRunResult, LintRunner, Runner}; +use oxlint::{CliRunResult, LintRunner, Runner}; fn main() -> CliRunResult { init_tracing(); init_miette(); - let command = oxc_cli::lint_command().run(); + let command = oxlint::lint_command().run(); command.handle_threads(); LintRunner::new(command.lint_options).run() } diff --git a/crates/oxc_cli/src/result.rs b/apps/oxlint/src/result.rs similarity index 100% rename from crates/oxc_cli/src/result.rs rename to apps/oxlint/src/result.rs diff --git a/crates/oxc_cli/src/runner.rs b/apps/oxlint/src/runner.rs similarity index 100% rename from crates/oxc_cli/src/runner.rs rename to apps/oxlint/src/runner.rs diff --git a/crates/oxc_cli/src/walk.rs b/apps/oxlint/src/walk.rs similarity index 100% rename from crates/oxc_cli/src/walk.rs rename to apps/oxlint/src/walk.rs diff --git a/crates/oxc_cli/src/format/main.rs b/crates/oxc_cli/src/format/main.rs deleted file mode 100644 index b1e1d758b..000000000 --- a/crates/oxc_cli/src/format/main.rs +++ /dev/null @@ -1,26 +0,0 @@ -#![cfg(not(miri))] // Miri does not support custom allocators - -#[cfg(not(debug_assertions))] -#[cfg(not(target_env = "msvc"))] -#[global_allocator] -static GLOBAL: jemallocator::Jemalloc = jemallocator::Jemalloc; - -#[cfg(not(debug_assertions))] -#[cfg(target_os = "windows")] -#[global_allocator] -static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; - -use oxc_cli::{CliRunResult, FormatRunner, Runner}; - -fn main() -> CliRunResult { - init_miette(); - - let command = oxc_cli::format_command().fallback_to_usage().run(); - command.handle_threads(); - FormatRunner::new(command.format_options).run() -} - -// Initialize the data which relies on `is_atty` system calls so they don't block subsequent threads. -fn init_miette() { - miette::set_hook(Box::new(|_| Box::new(miette::MietteHandlerOpts::new().build()))).unwrap(); -} diff --git a/crates/oxc_cli/src/format/mod.rs b/crates/oxc_cli/src/format/mod.rs deleted file mode 100644 index 9d7b81f31..000000000 --- a/crates/oxc_cli/src/format/mod.rs +++ /dev/null @@ -1,58 +0,0 @@ -use std::path::Path; - -use oxc_allocator::Allocator; -use oxc_parser::Parser; -use oxc_prettier::{Prettier, PrettierOptions}; -use oxc_span::SourceType; -use rayon::prelude::{IntoParallelRefIterator, ParallelIterator}; - -use crate::{ - command::FormatOptions, - result::{CliRunResult, FormatResult}, - walk::Walk, - Runner, -}; - -pub struct FormatRunner { - options: FormatOptions, -} - -impl Runner for FormatRunner { - type Options = FormatOptions; - - fn new(options: Self::Options) -> Self { - Self { options } - } - - fn run(self) -> CliRunResult { - let FormatOptions { paths, ignore_options, .. } = &self.options; - - if paths.is_empty() { - return CliRunResult::InvalidOptions { message: "No paths are provided.".to_string() }; - } - - let now = std::time::Instant::now(); - - let paths = Walk::new(paths, ignore_options).paths(); - - paths.par_iter().for_each(|path| { - Self::format(path); - }); - - CliRunResult::FormatResult(FormatResult { - duration: now.elapsed(), - number_of_files: paths.len(), - }) - } -} - -impl FormatRunner { - fn format(path: &Path) { - let source_text = std::fs::read_to_string(path).unwrap(); - let allocator = Allocator::default(); - let source_type = SourceType::from_path(path).unwrap(); - let ret = Parser::new(&allocator, &source_text, source_type).preserve_parens(false).parse(); - let _ = Prettier::new(&allocator, &source_text, &ret.trivias, PrettierOptions::default()) - .build(&ret.program); - } -} diff --git a/crates/oxc_cli/src/main.rs b/crates/oxc_cli/src/main.rs deleted file mode 100644 index ecd5cd534..000000000 --- a/crates/oxc_cli/src/main.rs +++ /dev/null @@ -1,22 +0,0 @@ -#![cfg(not(miri))] // Miri does not support custom allocators - -#[cfg(not(debug_assertions))] -#[cfg(not(target_env = "msvc"))] -#[global_allocator] -static GLOBAL: jemallocator::Jemalloc = jemallocator::Jemalloc; - -#[cfg(not(debug_assertions))] -#[cfg(target_os = "windows")] -#[global_allocator] -static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; - -use oxc_cli::{CliCommand, CliRunResult, FormatRunner, LintRunner, Runner}; - -fn main() -> CliRunResult { - let options = oxc_cli::cli_command().fallback_to_usage().run(); - options.handle_threads(); - match options { - CliCommand::Lint(options) => LintRunner::new(options).run(), - CliCommand::Format(options) => FormatRunner::new(options).run(), - } -} diff --git a/justfile b/justfile index b03d356e2..9d17a8d5e 100755 --- a/justfile +++ b/justfile @@ -93,7 +93,7 @@ test-transform *args='': # Build oxlint in release build oxlint: - cargo build --release -p oxc_cli --bin oxlint --features allocator + cargo build --release --bin oxlint --features allocator # Generate the JavaScript global variables. See `tasks/javascript_globals` javascript-globals: diff --git a/tasks/website/Cargo.toml b/tasks/website/Cargo.toml index 4bdf3a2b5..ff4c9ffc3 100644 --- a/tasks/website/Cargo.toml +++ b/tasks/website/Cargo.toml @@ -17,7 +17,7 @@ doctest = false [dependencies] oxc_linter = { workspace = true } -oxc_cli = { path = "../../crates/oxc_cli" } +oxlint = { path = "../../apps/oxlint" } bpaf = { workspace = true, features = ["docgen"] } pico-args = { workspace = true } diff --git a/tasks/website/src/linter/cli.rs b/tasks/website/src/linter/cli.rs index 931c8d011..ba6c2af0a 100644 --- a/tasks/website/src/linter/cli.rs +++ b/tasks/website/src/linter/cli.rs @@ -1,5 +1,5 @@ use bpaf::Parser; -use oxc_cli::lint_options; +use oxlint::lint_options; #[test] fn test_cli() { @@ -11,7 +11,7 @@ fn test_cli() { #[test] fn test_cli_terminal() { - let snapshot = oxc_cli::lint_command().run_inner(&["--help"]).unwrap_err().unwrap_stdout(); + let snapshot = oxlint::lint_command().run_inner(&["--help"]).unwrap_err().unwrap_stdout(); insta::with_settings!({ prepend_module_to_snapshot => false }, { insta::assert_snapshot!(snapshot); });