Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--ignore and --only do not work #203

Closed
3axap4eHko opened this issue Mar 20, 2023 · 10 comments · Fixed by #275
Closed

--ignore and --only do not work #203

3axap4eHko opened this issue Mar 20, 2023 · 10 comments · Fixed by #275

Comments

@3axap4eHko
Copy link
Contributor

3axap4eHko commented Mar 20, 2023

When compiling code, option --ignore provided pattern does not go into the glob config. That said the following command will compile tests even if they are ignored,

swc src --ignore **/__tests__/**/*.ts -d build
@craigmiller160
Copy link

Yep, I just opened an issue on the same thing. It seems this has been a problem for a while. I'm shocked no one has fixed it yet.

@kdy1
Copy link
Member

kdy1 commented Sep 18, 2023

Can you try the new native CLI?

swc-project/swc#3859

@kdy1 kdy1 changed the title CLI option --ignore does not work --ignore and --only do not work Sep 18, 2023
@kdy1
Copy link
Member

kdy1 commented Sep 18, 2023

Closing in favor of #245

@kdy1 kdy1 closed this as completed Sep 18, 2023
@kdy1
Copy link
Member

kdy1 commented Sep 18, 2023

Oops I did it in the wrong way

@3axap4eHko
Copy link
Contributor Author

@kdy1 new swcx command throws the following error

HTTPError: Response code 404 (Not Found)
    at Request.<anonymous> (/home/zource/projects/interoperability/node_modules/@mole-inc/bin-wrapper/index.cjs:7017:44)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ERR_NON_2XX_3XX_RESPONSE',
  timings: {
    start: 1695049918109,
    socket: 1695049918110,
    lookup: 1695049918144,
    connect: 1695049918178,
    secureConnect: 1695049918222,
    upload: 1695049918222,
    response: 1695049918262,
    end: 1695049918375,
    error: undefined,
    abort: undefined,
    phases: {
      wait: 1,
      dns: 34,
      tcp: 34,
      tls: 44,
      request: 0,
      firstByte: 40,
      download: 113,
      total: 266
    }
  }
}

@kdy1
Copy link
Member

kdy1 commented Sep 18, 2023

@3axap4eHko Can you provide a repro?

@3axap4eHko
Copy link
Contributor Author

3axap4eHko commented Sep 18, 2023

@kdy1 in this repo https://github.com/3axap4eHko/interoperability just try yarn and then yarn swcx --help

@kdy1
Copy link
Member

kdy1 commented Sep 18, 2023

I tried several things, but seems like the ignore option of the native CLI is not working well.

Relevant code: https://github.com/swc-project/swc/blob/f66da772202a6f065488fbabb7e0a9d9a2d7089d/bindings/swc_cli/src/commands/compile.rs#L160-L167

Can you file an issue on the main repository instead?

@kdy1
Copy link
Member

kdy1 commented Sep 18, 2023

@3axap4eHko

This is the patch you should apply, regardless of the state of cli issues:

diff --git a/package.json b/package.json
index 638dd2e..0aaf316 100644
--- a/package.json
+++ b/package.json
@@ -8,7 +8,7 @@
     "inop": "bin/inop.js"
   },
   "scripts": {
-    "build": "rm -rf build && swc ./src -d build && rm -rf build/__tests__ && tsc --declaration --emitDeclarationOnly",
+    "build": "rm -rf build && swcx compile ./src --out-dir build && rm -rf build/__tests__ && tsc --declaration --emitDeclarationOnly",
     "test": "jest",
     "build:example": "(cd example && npm run build)",
     "test:example": "(cd example && npm run test)"
@@ -42,7 +42,7 @@
     "interoperability"
   ],
   "dependencies": {
-    "@swc/core": "^1.3.63",
+    "@swc/core": "^1.3.85",
     "commander": "^11.0.0",
     "fast-glob": "^3.2.12"
   },
diff --git a/yarn.lock b/yarn.lock
index 3386727..e90369b 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -676,7 +676,7 @@
   resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.85.tgz#5c7f3f366804b512cf26e1731d8714f0409f1204"
   integrity sha512-ktxWOMFJ0iqKn6WUHtXqi4CS7xkyHmrRtjllGRuGqxmLmDX/HSOfuQ55Tm1KXKk5oHLacJkUbOSF2kBrpZ8dpg==
 
-"@swc/core@^1.3.63":
+"@swc/core@^1.3.85":
   version "1.3.85"
   resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.3.85.tgz#36ce756854efa2320f601a2b3e1ca1096f8b3f16"
   integrity sha512-qnoxp+2O0GtvRdYnXgR1v8J7iymGGYpx6f6yCK9KxipOZOjrlKILFANYlghQxZyPUfXwK++TFxfSlX4r9wK+kg==

@3axap4eHko
Copy link
Contributor Author

@kdy1 I can confirm --ignore option does not work on swcx either

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants