summaryrefslogtreecommitdiff
path: root/tests/testdata
diff options
context:
space:
mode:
authorMarvin Hagemeister <marvin@deno.com>2024-02-23 15:56:49 +0100
committerGitHub <noreply@github.com>2024-02-23 15:56:49 +0100
commitcddefecfff38215cef509aa6c0a2119682b49c15 (patch)
tree206068bb1eee956000404711f3aa8788080eed18 /tests/testdata
parent55fa61abc6490f98eb1bbd8ca02b34974fb54cb2 (diff)
feat: infer dependencies from package.json (#22563)
<!-- Before submitting a PR, please read https://docs.deno.com/runtime/manual/references/contributing 1. Give the PR a descriptive title. Examples of good title: - fix(std/http): Fix race condition in server - docs(console): Update docstrings - feat(doc): Handle nested reexports Examples of bad title: - fix #7123 - update docs - fix bugs 2. Ensure there is a related issue and it is referenced in the PR text. 3. Ensure there are tests that cover the changes. 4. Ensure `cargo test` passes. 5. Ensure `./tools/format.js` passes without changing files. 6. Ensure `./tools/lint.js` passes. 7. Open as a draft PR if your work is still in progress. The CI won't run all steps, but you can add '[ci]' to a commit message to force it to. 8. If you would like to run the benchmarks on the CI, add the 'ci-bench' label. --> This PR enhances the `deno publish` command to infer dependencies from `package.json` if present.
Diffstat (limited to 'tests/testdata')
-rw-r--r--tests/testdata/publish/package_json.out8
-rw-r--r--tests/testdata/publish/package_json/deno.json8
-rw-r--r--tests/testdata/publish/package_json/mod.ts9
-rw-r--r--tests/testdata/publish/package_json/package.json7
4 files changed, 32 insertions, 0 deletions
diff --git a/tests/testdata/publish/package_json.out b/tests/testdata/publish/package_json.out
new file mode 100644
index 000000000..7b54ce8da
--- /dev/null
+++ b/tests/testdata/publish/package_json.out
@@ -0,0 +1,8 @@
+Download http://localhost:4545/npm/registry/picocolors
+Download http://localhost:4545/npm/registry/picocolors/picocolors-1.0.0.tgz
+Check file:///[WILDCARD]/publish/package_json/mod.ts
+Checking for slow types in the public API...
+Check file:///[WILDCARD]/publish/package_json/mod.ts
+Publishing @foo/bar@1.0.0 ...
+Successfully published @foo/bar@1.0.0
+Visit http://127.0.0.1:4250/@foo/bar@1.0.0 for details
diff --git a/tests/testdata/publish/package_json/deno.json b/tests/testdata/publish/package_json/deno.json
new file mode 100644
index 000000000..6e2826ef5
--- /dev/null
+++ b/tests/testdata/publish/package_json/deno.json
@@ -0,0 +1,8 @@
+{
+ "name": "@foo/bar",
+ "version": "1.0.0",
+ "exports": {
+ ".": "./mod.ts"
+ },
+ "nodeModulesDir": false
+}
diff --git a/tests/testdata/publish/package_json/mod.ts b/tests/testdata/publish/package_json/mod.ts
new file mode 100644
index 000000000..ae98962fa
--- /dev/null
+++ b/tests/testdata/publish/package_json/mod.ts
@@ -0,0 +1,9 @@
+import pc from "picocolors";
+
+export function add(a: number, b: number): number {
+ return a + b;
+}
+
+export function getValue(): string {
+ return pc.green("hey");
+}
diff --git a/tests/testdata/publish/package_json/package.json b/tests/testdata/publish/package_json/package.json
new file mode 100644
index 000000000..c1b171f4c
--- /dev/null
+++ b/tests/testdata/publish/package_json/package.json
@@ -0,0 +1,7 @@
+{
+ "name": "@deno/foo",
+ "version": "0.0.1",
+ "dependencies": {
+ "picocolors": "*"
+ }
+}