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

Workspaces no longer correctly identified since 5.10 #617

Closed
bbeesley opened this issue May 1, 2024 · 6 comments
Closed

Workspaces no longer correctly identified since 5.10 #617

bbeesley opened this issue May 1, 2024 · 6 comments
Labels
regression Something is no longer working

Comments

@bbeesley
Copy link
Contributor

bbeesley commented May 1, 2024

Updating to versions greater than 5.9.4 gives us thousands of errors. Running with the debug flag shows the reason for this, our workspaces are no longer properly identified. In the debug output I see the following:

[*] Included workspaces
[
  'root',
  'NOT_FOUND_packages/protobuf',
  'NOT_FOUND_packages/xoconfig',
  'NOT_FOUND_packages/tsconfig',
  'NOT_FOUND_packages/srv-http',
  'NOT_FOUND_packages/srv-utils',
  'NOT_FOUND_packages/srv-fetch',
  'NOT_FOUND_packages/srv-logger',
  'NOT_FOUND_packages/vas-clients',
  'NOT_FOUND_packages/srv-graphql',
  'NOT_FOUND_packages/fastify-utils',
  'NOT_FOUND_packages/srv-base-conf',
  'NOT_FOUND_packages/srv-idl-client',
  'NOT_FOUND_packages/srv-admin-server',
  'NOT_FOUND_packages/srv-backstage-utils',
  '@our-npm-org/xoconfig',
  '@our-npm-org/tsconfig',
  '@our-npm-org/srv-http',
  '@our-npm-org/protobuf',
  '@our-npm-org/srv-utils',
  '@our-npm-org/srv-fetch',
  '@our-npm-org/srv-logger',
  '@our-npm-org/vas-clients',
  '@our-npm-org/srv-graphql',
  '@our-npm-org/srv-base-conf',
  '@our-npm-org/fastify-utils',
  '@our-npm-org/srv-idl-client',
  '@our-npm-org/srv-admin-server',
  '@our-npm-org/srv-backstage-utils'
]

Workspace config in our root package json looks like this:

  "workspaces": [
    "./packages/*"
  ],

The name field in each of the workspace's package.json files includes the namespace for our npm org, which I assume is where its finding those names. But they don't map to what we have defined in config, which looks like:

  "workspaces": {
    "packages/*": {
      "entry": ["src/index.ts"],
      "project": ["src/*.ts", "src/**/*.ts"],
    },
    "packages/srv-graphql": {
      "entry": ["src/index.ts"],
      "project": ["src/*.ts", "src/**/*.ts"],
      "ignoreDependencies": ["prettier-2"]
    },

Holler if you need anymore information.

@bbeesley bbeesley added the regression Something is no longer working label May 1, 2024
@webpro
Copy link
Collaborator

webpro commented May 2, 2024

Thanks for the report. Does it work like before if you use "workspaces": ["packages/*"] in package.json - without the ./ prefix?

@glemiron
Copy link

glemiron commented May 2, 2024

I don't sure if it's related, but I've mentioned today that the config ignored if I run default npx knip. In the same time knip --include files works correct and uses the config.

It was easy to spot, because I use jest plugin for visual tests, but I have visual tests as unused files when I run default option.

npx knip --include files,exports,types also doesn't work as expected

UPD: Not an issue. I was reporting to a file, but put '>>' instead of '>'

@webpro
Copy link
Collaborator

webpro commented May 2, 2024

@glemiron Sound like a different issue. Feel free to open a new ticket with more details.

@bbeesley
Copy link
Contributor Author

bbeesley commented May 3, 2024

Thanks for the report. Does it work like before if you use "workspaces": ["packages/*"] in package.json - without the ./ prefix?

@webpro Yeah it does actually. That doesn't appear to affect anything else obvious so probably we can do that for now. I'd still suggest this needs a fix though since the leading ./ is what they show in the npm docs.

@webpro
Copy link
Collaborator

webpro commented May 3, 2024

Totally agree, just wanted to make sure what is exactly the issue here.

@webpro webpro closed this as completed in 6c71399 May 3, 2024
@webpro
Copy link
Collaborator

webpro commented May 3, 2024

🚀 This issue has been resolved in v5.12.1. See Release 5.12.1 for release notes.

Using Knip in a commercial project? Please consider sponsoring me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression Something is no longer working
Projects
None yet
Development

No branches or pull requests

3 participants