fix(publish): error for missing version constraints on dry-publish instead of just publish (#23798)

Closes https://github.com/denoland/deno/issues/22835
This commit is contained in:
David Sherret 2024-05-14 10:30:09 -04:00 committed by GitHub
parent c0a600786e
commit c6189e2070
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 254 additions and 38 deletions

View file

@ -1,4 +1,4 @@
import * as inner from "jsr:@denotest/add";
import * as inner from "jsr:@denotest/add@1";
export function add(a: number, b: number): number {
return inner.add(a, b);

View file

@ -0,0 +1,5 @@
{
"args": "publish --dry-run",
"output": "publish.out",
"exitCode": 1
}

View file

@ -0,0 +1,9 @@
{
"name": "@scope/pkg",
"version": "1.0.0",
"exports": "./mod.ts",
"imports": {
"basic": "npm:@denotest/esm-basic",
"add": "jsr:@denotest/add"
}
}

View file

@ -0,0 +1,7 @@
import { add } from "add";
import * as basic from "basic";
import * as deps from "jsr:@denotest/deps";
console.log(add(1, 2));
console.log(deps);
console.log(basic);

View file

@ -0,0 +1,37 @@
[WILDCARD]
Checking for slow types in the public API...
Check file:///[WILDLINE]/mod.ts
error[missing-constraint]: specifier 'jsr:@denotest/add' is missing a version constraint
--> [WILDLINE]mod.ts:[WILDLINE]
|
1 | import { add } from "add";
| ^^^^^ the specifier
= hint: specify a version constraint for the specifier in the import map
info: the specifier resolved to version 1.0.0 today, but will resolve to a different
info: major version if one is published in the future and potentially break
docs: https://jsr.io/go/missing-constraint
error[missing-constraint]: specifier 'npm:@denotest/esm-basic' is missing a version constraint
--> [WILDLINE]mod.ts:[WILDLINE]
|
2 | import * as basic from "basic";
| ^^^^^^^ the specifier
= hint: specify a version constraint for the specifier in the import map
info: the specifier resolved to version 1.0.0 today, but will resolve to a different
info: major version if one is published in the future and potentially break
docs: https://jsr.io/go/missing-constraint
error[missing-constraint]: specifier 'jsr:@denotest/deps' is missing a version constraint
--> [WILDLINE]mod.ts:[WILDLINE]
|
3 | import * as deps from "jsr:@denotest/deps";
| ^^^^^^^^^^^^^^^^^^^^ the specifier
= hint: specify a version constraint for the specifier
info: the specifier resolved to version 1.0.0 today, but will resolve to a different
info: major version if one is published in the future and potentially break
docs: https://jsr.io/go/missing-constraint
error: Found 3 problems

View file

@ -0,0 +1,5 @@
{
"args": "publish --token 'sadfasdf'",
"output": "mod.out",
"exitCode": 1
}

View file

@ -0,0 +1,5 @@
import { renderToString } from "npm:preact-render-to-string@6";
export default function render() {
return renderToString(<div>foo.tsx</div>);
}

View file

@ -0,0 +1,11 @@
{
"name": "@foo/bar",
"version": "1.0.0",
"exports": {
".": "./mod.ts"
},
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "npm:preact"
}
}

View file

@ -0,0 +1,17 @@
[WILDCARD]
Checking for slow types in the public API...
Check file:///[WILDCARD]/mod.ts
error[missing-constraint]: specifier 'npm:preact/jsx-runtime' is missing a version constraint
--> [WILDLINE]
= hint: specify a version constraint for the specifier
info: the specifier resolved to version 10.19.6 today, but will resolve to a different
info: major version if one is published in the future and potentially break
docs: https://jsr.io/go/missing-constraint
warning[unsupported-jsx-tsx]: JSX and TSX files are currently not supported
--> [WILDLINE]foo.tsx
info: follow https://github.com/jsr-io/jsr/issues/24 for updates
error: Found 1 problem

View file

@ -0,0 +1,5 @@
import fooTsx from "./foo.tsx";
export function renderTsx() {
console.log(fooTsx());
}

View file

@ -2,6 +2,6 @@
"name": "@deno/foo",
"version": "0.0.1",
"dependencies": {
"picocolors": "*"
"picocolors": "1"
}
}

View file

@ -1,4 +1,4 @@
import { renderToString } from "npm:preact-render-to-string";
import { renderToString } from "npm:preact-render-to-string@6";
export default function render() {
return renderToString(<div>foo.tsx</div>);

View file

@ -1,4 +1,4 @@
import { renderToString } from "npm:preact-render-to-string";
import { renderToString } from "npm:preact-render-to-string@6";
export default function render() {
return renderToString(<div>foo.tsx</div>);

View file

@ -6,6 +6,6 @@
},
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "npm:preact"
"jsxImportSource": "npm:preact@10"
}
}