imjuni / ctix

CLI to generate barrel file for webpack, rollup entrypoint
MIT License
82 stars 22 forks source link

`@ctix-declaration` does not respect the include option and is incorrectly formatted #158

Closed smallmain closed 2 months ago

smallmain commented 2 months ago

ctix-demo.zip

  1. Take a look at the index.ts file:
import "./do.js"import "./test.js"

Missing ';' and line breaks, which should be:

import "./do.js";
import "./test.js";
  1. Take a look at the .ctirc file:
"include": [
  "**/*do*"
]

Should be only do.ts included, but test.ts is included anyway.

imjuni commented 2 months ago

@smallmain

Thank you for your dedicated contribution. This issue was fixed in version 2.6.3.

smallmain commented 2 months ago

@smallmain

Thank you for your dedicated contribution. This issue was fixed in version 2.6.3.

@imjuni Hi, it seems that the problem of '@ctix-declaration' does not respect the include option still exists.

imjuni commented 2 months ago

@smallmain Hi,

Thank you for waiting!

ctix

The include/exclude option mechanisms follow the diagram as shown. The @ctix-declaration comment directive is designed to work only for files included in the include option. If the @ctix-declaration directive is added to files that are not included, it will not work. In version v2.6.2, the @ctix-declaration directive worked differently than intended, but this issue was fixed in v2.6.3. We apologize for the inconvenience. Is it still working differently from the design?

smallmain commented 2 months ago

@smallmain Hi,

Thank you for waiting!

ctix

The include/exclude option mechanisms follow the diagram as shown. The @ctix-declaration comment directive is designed to work only for files included in the include option. If the @ctix-declaration directive is added to files that are not included, it will not work. In version v2.6.2, the @ctix-declaration directive worked differently than intended, but this issue was fixed in v2.6.3. We apologize for the inconvenience. Is it still working differently from the design?

@imjuni Yes, in 2.6.3 the problem still exists, will the above demo project 's ctix updated to 2.6.3, the test.js import is still generated, but the include does not include the file.

imjuni commented 2 months ago

@smallmain

I tested your reproducible repository, where the include option was set to ["/do"] and the exclude option to ["check**"]. As a result, the do.ts file was added due to the include option, and the check.ts and check2.ts files were excluded by the exclude option. In this case, the @ctix-declaration directive does not work to include files that are ignored by the exclude option.

The @ctix-declaration directive is designed to work with files that are already included by the include option. Therefore, you need to change your configuration as follows to get the desired result:

{
  "include": [
    "**/*do*",
    "check.ts"
  ],
  "exclude":[
    "check2.ts"
  ]
}
smallmain commented 2 months ago

@smallmain

I tested your reproducible repository, where the include option was set to ["/do"] and the exclude option to ["check**"]. As a result, the do.ts file was added due to the include option, and the check.ts and check2.ts files were excluded by the exclude option. In this case, the @ctix-declaration directive does not work to include files that are ignored by the exclude option.

The @ctix-declaration directive is designed to work with files that are already included by the include option. Therefore, you need to change your configuration as follows to get the desired result:

{
  "include": [
    "**/*do*",
    "check.ts"
  ],
  "exclude":[
    "check2.ts"
  ]
}

@imjuni

Not a check file, but a test file.

You can see that I only included **/*do*, but also included the test.js import.

imjuni commented 2 months ago

@smallmain Thank you for your dedicated contribution!

I was fixed this issue in v2.6.4.