[question]: Cannot configure `.ctiignore` file: ignore file loading complete error: detailIgnoreds.at is not a function
dankeboy36 opened this issue · 5 comments
I tried to filter exports, but I could not configure the .ctiignore
file. The fix must be simple, but I could not figure out how partial ignore works.
My setup:
src/foo.ts
:
export interface Foo {}
export interface Bar {}
tsconfig.json
:
{
"compilerOptions": {
"target": "es2016",
"module": "commonjs",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
},
"include": [
"./src"
]
}
.ctiignore
:
{
"**/*.ts": ["Bar"]
}
I did:
npx ctix single -p ./tsconfig.json -o ./src/index.ts
I got:
ignore file loading complete
[22-09-14 12:04:41] error: detailIgnoreds.at is not a function
[22-09-14 12:04:41] error: TypeError: detailIgnoreds.at is not a function
at getCtiIgnorePattern (/Users/path/to/my/project/node_modules/ctix/dist/cli.js:946:31)
at getExportInfo (/Users/path/to/my/project/node_modules/ctix/dist/cli.js:984:26)
at async Promise.all (index 0)
at getExportInfos (/Users/path/to/my/project/node_modules/ctix/dist/cli.js:1067:26)
at singleWritor (/Users/path/to/my/project/node_modules/ctix/dist/cli.js:2047:34)
at Object.handler (/Users/path/to/my/project/node_modules/ctix/dist/cli.js:2213:13)
I also tried the following ignore files, but none of them worked:
{
"src/foo.ts": ["Bar"]
}
{
"./src/foo.ts": ["Bar"]
}
{
"*": ["Bar"]
}
{
"**/*": ["Bar"]
}
I am using ctix@1.4.0
. Thank you!
@dankeboy36 Hi,
Are you create reproducible repo?
Of course, I will post the repo link here later today.
I have managed to fix the detailIgnoreds.at is not a function
error locally by using the "/src/foo.ts": ["Bar"]
format, but then the generated index.ts
contained export * from './foo';
which is not I want; so I could not get the partial filtering working.
Anyway, I appreciate your response and will share the repo link soon.
Here is the repo: https://github.com/dankeboy36/ctix-51
Please advise what's wrong with my setup.
I would expect the following ./src/index.ts
output:
export { Foo } from './foo';
or this one, if ctix
exports only type
:
export { type Foo } from './foo';
Thank you!
@dankeboy36 Hi,
I test your ctix-51 repository on win32(cygwin), ubuntu(wsl), macosx. But works fine. My test environment like below,
name | version |
---|---|
node | 16.15.1, 16.16.0, 16.17.0 |
npm | 8.11.0, 8.15.0 |
ctix | 1.4.0 |
typescript | 4.8.3 |
Asciinema movie
I think that package version or environment problem. What is your environment?
In additional,
If you want partial ignore in specific file, I recommand exactly file add to .ctiignore
like that
{
// Recommand exactly filename
"./src/foo.ts": [
"Bar"
]
}
Because wildcard mean like namedExport, default export check in every TypeScript files. And you can write comment in .ctiignore
because ctix use jsonc-parser 😀
I appreciate your time.
I can confirm that it works with Node.js v16.17.0
and npm
8.15.0
. It fails with v14.19.0
and 6.14.16
.
I am closing this issue.
Great lib; thank you for your work! 🙏