summaryrefslogtreecommitdiff
path: root/cli/args/flags.rs
AgeCommit message (Collapse)Author
2024-07-10feat(node): Support executing npm package lifecycle scripts ↵Nathan Whitaker
(preinstall/install/postinstall) (#24487) Adds support for running npm package lifecycle scripts, opted into via a new `--allow-scripts` flag. With this PR, when running `deno cache` (or `DENO_FUTURE=1 deno install`) you can specify the `--allow-scripts=pkg1,pkg2` flag to run lifecycle scripts attached to the given packages. Note at the moment this only works when `nodeModulesDir` is true (using the local resolver). When a package with un-run lifecycle scripts is encountered, we emit a warning suggesting things may not work and to try running lifecycle scripts. Additionally, if a package script implicitly requires `node-gyp` and it's not found on the system, we emit a warning. Extra things in this PR: - Extracted out bits of `task.rs` into a separate module for reuse - Added a couple fields to `process.config` in order to support `node-gyp` (it relies on a few variables being there) - Drive by fix to downloading new npm packages to test registry --- TODO: - [x] validation for allow-scripts args (make sure it looks like an npm package) - [x] make allow-scripts matching smarter - [ ] figure out what issues this closes --- Review notes: - This adds a bunch of deps to our test registry due to using `node-gyp`, so it's pretty noisy
2024-07-10feat: deprecate `deno vendor` (#22183)Asher Gomez
This commit deprecates `deno vendor` subcommand in favor of using `--vendor` flag or `"vendor": true` setting in the config file. The subcommand is still available (until Deno 2) but is hidden from the help output. Closes #20584 --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-07-09feat(cli): `deno init --lib` (#22499)muddlebee
Closes #22287 Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com> Co-authored-by: David Sherret <dsherret@gmail.com>
2024-07-08fix(workspace): better cli file argument handling (#24447)David Sherret
Closes https://github.com/denoland/deno/issues/24422
2024-07-08feat: add `__tests__` to test file detection defaults (#24443)Marvin Hagemeister
The `jest` test runner popularized putting tests into a `__tests__` folder. Whilst many have switched to going with a `.test` suffix in the file name these days, there are still many jest projects that have `__tests__`. By adding this to the default test detection logic it makes `deno test` discover those out of the box.
2024-07-05fix(permissions): handle ipv6 addresses correctly (#24397)Luca Casonato
Also don't panic on invalid domain names and addresses. Extracted with cleanups up from #24080 Co-authored-by: Yazan AbdAl-Rahman <yazan.abdalrahman@exalt.ps>
2024-07-05feat: Deprecate --lock-write flag (#24436)Bartek Iwańczuk
This commit deprecates `--lock-write` flag by removing it from the help output and printing a warning message when it's used. Users should use `--frozen=false` instead which was added in https://github.com/denoland/deno/pull/24355. Towards https://github.com/denoland/deno/issues/24167.
2024-07-04feat: npm workspace and better Deno workspace support (#24334)David Sherret
Adds much better support for the unstable Deno workspaces as well as support for npm workspaces. npm workspaces is still lacking in that we only install packages into the root node_modules folder. We'll make it smarter over time in order for it to figure out when to add node_modules folders within packages. This includes a breaking change in config file resolution where we stop searching for config files on the first found package.json unless it's in a workspace. For the previous behaviour, the root deno.json needs to be updated to be a workspace by adding `"workspace": ["./path-to-pkg-json-folder-goes-here"]`. See details in https://github.com/denoland/deno_config/pull/66 Closes #24340 Closes #24159 Closes #24161 Closes #22020 Closes #18546 Closes #16106 Closes #24160
2024-07-02feat(cli): Add `--frozen` flag to error out if lockfile is out of date (#24355)Nathan Whitaker
Closes #18296. Adds a `--frozen` (alias `--frozen-lockfile`) flag that errors out if the lockfile is out of date. This is useful for running in CI (where an out of date lockfile is usually a mistake) or to prevent accidental changes in dependencies. ![Screenshot 2024-06-26 at 7 11 13 PM](https://github.com/denoland/deno/assets/17734409/538404b8-b422-4f05-89e8-4c9b1c248576)
2024-06-28chore: update deno_doc (#24308)Leo Kettmeir
2024-06-06refactor: remove `PermissionsContainer` in deno_runtime (#24119)David Sherret
Also removes permissions being passed in for node resolution. It was completely useless because we only checked it for reading package.json files, but Deno reading package.json files for resolution is perfectly fine. My guess is this is also a perf improvement because Deno is doing less work.
2024-06-04docs(console): More clearly indicate the contents of DENO_CERT (#24091)Andreas Kohn
The PEM file specified by DENO_CERT can contain multiple certificates https://github.com/denoland/deno/blob/13924fdb1b75325b9b6116accb800bd9f567f2c1/cli/args/mod.rs#L722-L742 Signed-off-by: Andreas Kohn <andreas.kohn@gmail.com>
2024-05-23feat(cli/test): `deno test --clean` (#23519)Asher Gomez
The result of the call is ignored as it throws even when the directory does not exist. Closes #23491
2024-05-23feat: add lowercase `-v` version flag (#23750)David Sherret
Ref https://github.com/denoland/deno/issues/5289
2024-05-17feat(serve): support `--port 0` to use an open port (#23846)Satya Rohith
Closes https://github.com/denoland/deno/issues/23845
2024-05-08chore: enable clippy::print_stdout and clippy::print_stderr (#23732)David Sherret
1. Generally we should prefer to use the `log` crate. 2. I very often accidentally commit `eprintln`s. When we should use `println` or `eprintln`, it's not too bad to be a bit more verbose and ignore the lint rule.
2024-05-08FUTURE: `deno install` changes (#23498)Bartek Iwańczuk
This PR implements the changes we plan to make to `deno install` in deno 2.0. - `deno install` without arguments caches dependencies from `package.json` / `deno.json` and sets up the `node_modules` folder - `deno install <pkg>` adds the package to the config file (either `package.json` or `deno.json`), i.e. it aliases `deno add` - `deno add` can also add deps to `package.json` (this is gated behind `DENO_FUTURE` due to uncertainty around handling projects with both `deno.json` and `package.json`) - `deno install -g <bin>` installs a package as a globally available binary (the same as `deno install <bin>` in 1.0) --------- Co-authored-by: Nathan Whitaker <nathan@deno.com>
2024-05-06fix(compile): relative permissions should be retained as relative (#23719)David Sherret
Closes #23715
2024-04-24chore: update deno_doc (#23544)Leo Kettmeir
2024-04-24feat: Add `deno serve` subcommand (#23511)Matt Mastracci
By default, `deno serve` will assign port 8000 (like `Deno.serve`). Users may choose a different port using `--port`. `deno serve /tmp/file.ts` `server.ts`: ```ts export default { fetch(req) { return new Response("hello world!\n"); }, }; ```
2024-04-17perf: v8 code cache (#23081)Igor Zinkovsky
This PR enables V8 code cache for ES modules and for `require` scripts through `op_eval_context`. Code cache artifacts are transparently stored and fetched using sqlite db and are passed to V8. `--no-code-cache` can be used to disable. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-04-17fix: add `DENO_FUTURE` to `deno --help` (#23368)Asher Gomez
2024-04-10chore: update references to `deno_std` to use JSR (#23239)Asher Gomez
There are more uses of `deno.land/std` in the codebase, but for URL parsing purposes rather than network calls or documentation.
2024-04-04fix(cli): update `deno doc` help to fit current usage (#23224)JOTSR
2024-04-04refactor(flags): prepare for deno install changes (#23217)Bartek Iwańczuk
This commit adds enum to "InstallFlags" and "UninstallFlags" that will allow to support both local and global (un)installation. Currently the local variant is not used. Towards https://github.com/denoland/deno/issues/23062
2024-03-27feat: add `--watch-exclude` flag (#21935)Łukasz Czerniawski
This PR introduces the ability to exclude certain paths from the file watcher in Deno. This is particularly useful when running scripts in watch mode, as it allows developers to prevent unnecessary restarts when changes are made to files that do not affect the running script, or when executing scripts that generate new files which results in an infinite restart loop. --------- Co-authored-by: David Sherret <dsherret@gmail.com>
2024-03-27feat(install): require -g / --global flag (#23060)Bartek Iwańczuk
In preparation for upcoming changes to `deno install` in Deno 2. If `-g` or `--global` flag is not provided a warning will be emitted: ``` ⚠️ `deno install` behavior will change in Deno 2. To preserve the current behavior use `-g` or `--global` flag. ``` The same will happen for `deno uninstall` - unless `-g`/`--global` flag is provided a warning will be emitted. Towards https://github.com/denoland/deno/issues/23062 --------- Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2024-03-22perf(cli): use args_os (#23039)Matt Mastracci
Extracted from #22718
2024-03-21feat(lint): `deno lint --fix` and lsp quick fixes (#22615)David Sherret
Adds a `--fix` option to deno lint. This currently doesn't work for basically any rules, but we can add them over time to deno lint.
2024-03-14chore(cli): move away from PathBuf in clap (#22036)Łukasz Czerniawski
2024-03-13chore(permissions): add allow_all flag (#22890)Matt Mastracci
Unlocking a potential perf optimization at a later date -- carry the `allow_all` flag into the permission container.
2024-03-08fix(publish): typo in `--allow-dirty` help text (#22799)mimikun
2024-03-07fix(publish): reland error if there are uncommitted changes (#22613) (#22632)Bartek Iwańczuk
Reverted in https://github.com/denoland/deno/pull/22625
2024-02-29feat(unstable): `deno add` subcommand (#22520)Bartek Iwańczuk
This commit adds "deno add" subcommand that has a basic support for adding "jsr:" packages to "deno.json" file. This currently doesn't support "npm:" specifiers and specifying version constraints.
2024-02-29feat(publish): enable package provenance by default on github actions (#22635)Divy Srivastava
2024-02-28Revert "fix(publish): error if there are uncommitted changes (#22613)" (#22625)Bartek Iwańczuk
This reverts commit c2c4e745a5db4f2e53aa70bf22b6c828fa1b4040.
2024-02-28chore(cli): rename `--trace-ops` to `--trace-leaks` (#22598)Matt Mastracci
As we add tracing to more types of runtime activity, `--trace-ops` is less useful of a name. `--trace-leaks` better reflects that this feature traces both ops and timers, and will eventually trace resource opening as well. This keeps `--trace-ops` as an alias for `--trace-leaks`, but prints a warning to the console suggesting migration to `--trace-leaks`. One test continues to use `--trace-ops` to test the deprecation warning. --------- Signed-off-by: Matt Mastracci <matthew@mastracci.com>
2024-02-28fix(publish): error if there are uncommitted changes (#22613)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/22330
2024-02-28feat(publish): provenance attestation (#22573)Divy Srivastava
Supply chain security for JSR. ``` $ deno publish --provenance Successfully published @divy/test_provenance@0.0.3 Provenance transparency log available at https://search.sigstore.dev/?logIndex=73657418 ``` 0. Package has been published. 1. Fetches the version manifest and verifies it's matching with uploaded files and exports. 2. Builds the attestation SLSA payload using Github actions env. 3. Creates an ephemeral key pair for signing the github token (aud=sigstore) and DSSE pre authentication tag. 4. Requests a X.509 signing certificate from Fulcio using the challenge and ephemeral public key PEM. 5. Prepares a DSSE envelop for Rekor to witness. Posts an intoto entry to Rekor and gets back the transparency log index. 6. Builds the provenance bundle and posts it to JSR.
2024-02-23fix(compile): allow to compile for ARM linux (#22542)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/22527
2024-02-23feat: infer dependencies from package.json (#22563)Marvin Hagemeister
<!-- 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.
2024-02-21feat(publish): type check on publish (#22506)David Sherret
Supersedes #22501 and also fixes that issue.
2024-02-19feat(unstable/lint): no-slow-types for JSR packages (#22430)David Sherret
1. Renames zap/fast-check to instead be a `no-slow-types` lint rule. 1. This lint rule is automatically run when doing `deno lint` for packages (deno.json files with a name, version, and exports field) 1. This lint rules still occurs on publish. It can be skipped by running with `--no-slow-types`
2024-02-19fix: write lockfile in `deno info` (#22272)Luca Casonato
2024-02-14feat(publish): allow passing config flag (#22416)Leo Kettmeir
2024-02-04perf: remove duplicate `env::current_dir` call in package.json search (#22255)David Sherret
Micro-optimization.
2024-02-01fix(publish): rename --no-fast-check to --no-zap (#22214)Bartek Iwańczuk
Also prints an information about the flag when there are `zap` errors.
2024-01-31chore(publish): add --no-fast-check flag (#22203)Bartek Iwańczuk
2024-01-24refactor: set removal version for `deno bundle` (#22062)Asher Gomez
This change sets the removal version for the `deno bundle` sub-command for Deno v2. The warnings appear when `deno bundle` is run and in the `--help` menu.
2024-01-23chore: make deno --help more colorful (#21962)Bartek Iwańczuk
This commit adds coloring to "--help" flag. Before: https://github.com/denoland/deno/assets/13602871/23753f95-3289-45bc-8a1e-842d0ccd92df After: https://github.com/denoland/deno/assets/13602871/91b035cc-f199-4cf4-a77c-f65b290b5e19