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

.gitignore takes precedence over include field during publish #879

Open
kaleidawave opened this issue Dec 21, 2024 · 2 comments
Open

.gitignore takes precedence over include field during publish #879

kaleidawave opened this issue Dec 21, 2024 · 2 comments

Comments

@kaleidawave
Copy link

Running the following

> bat .\jsr.json -pp
{
  "name": "...",
  "version": "...",
  "license": "MIT",
  "include": [
    "./build_bg.wasm",
    "./build.js",
    "./build.d.ts",
    "./main.js"
  ],
  "exports": {
    "./uninitialised": "./build.js",
    ".": "./main.js"
  }
}
> deno publish --allow-dirty --allow-slow-types
Check file:///C:/.../pkg/build.js
Check file:///C:/.../pkg/main.js
Warning Publishing a library with slow types is not recommended. This may lead to poor type checking performance for users of your package, may affect the quality of automatic documentation generation, and your package will not be shipped with a .d.ts file for Node.js users.
error[excluded-module]: module in package's module graph was excluded from publishing
 --> C:\...\pkg\build.js
  = hint: remove the module from 'exclude' and/or 'publish.exclude' in the config file or use 'publish.exclude' with a negative glob to unexclude from gitignore

  info: excluded modules referenced via a package export will error at runtime due to not existing in the package
  docs: https://jsr.io/go/excluded-module

error[excluded-module]: module in package's module graph was excluded from publishing
 --> C:\...\pkg\main.js
  = hint: remove the module from 'exclude' and/or 'publish.exclude' in the config file or use 'publish.exclude' with a negative glob to unexclude from gitignore

  info: excluded modules referenced via a package export will error at runtime due to not existing in the package
  docs: https://jsr.io/go/excluded-module

error: Found 2 problems

Two things:

  1. The fact this exclusion comes from .gitignore should be in these error messages. The hint is incorrect.
  2. How do I solve this without removing the .gitignore in the directory chain. The values in the include field should take precedence and/or deno publish should take a --ignore-git-ignore option.
@github-project-automation github-project-automation bot moved this to Needs Triage in JSR Dec 21, 2024
@dsherret
Copy link
Member

or use 'publish.exclude' with a negative glob to unexclude from gitignore

Try this:

  "publish": {
    "exclude": [
      "!./build_bg.wasm",
      "!./build.js",
      "!./build.d.ts",
      "!./main.js"
    ],
  }

I think a top level "include" has no effect at the moment, but it might work to move that under "publish": { "include": [...] } also. We've been meaning to implement a top level include in jsr.json, but haven't gotten around to it.

@kaleidawave
Copy link
Author

kaleidawave commented Dec 23, 2024

Awesome, double excluding fixes it for now

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

No branches or pull requests

2 participants