From e566940ce0d77ff6cbc32d8adb24c086b040d25d Mon Sep 17 00:00:00 2001 From: Tristan Date: Mon, 15 Aug 2022 13:54:46 -0400 Subject: [PATCH] Bump, check flag --- CODE_OF_CONDUCT.md | 51 ++++++++++++++++++++++--------------------- README.md | 8 +++---- cli.ts | 25 ++++++++++++++++----- test/change.test.ts | 2 +- test/redirect.test.ts | 2 +- test/regex.test.ts | 2 +- 6 files changed, 52 insertions(+), 38 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 6de3f84..4f690d1 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -6,8 +6,8 @@ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, -nationality, personal appearance, race, religion, or sexual identity -and orientation. +nationality, personal appearance, race, religion, or sexual identity and +orientation. We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. @@ -17,23 +17,23 @@ diverse, inclusive, and healthy community. Examples of behavior that contributes to a positive environment for our community include: -* Demonstrating empathy and kindness toward other people -* Being respectful of differing opinions, viewpoints, and experiences -* Giving and gracefully accepting constructive feedback -* Accepting responsibility and apologizing to those affected by our mistakes, +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience -* Focusing on what is best not just for us as individuals, but for the - overall community +- Focusing on what is best not just for us as individuals, but for the overall + community Examples of unacceptable behavior include: -* The use of sexualized language or imagery, and sexual attention or - advances of any kind -* Trolling, insulting or derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or email - address, without their explicit permission -* Other conduct which could reasonably be considered inappropriate in a +- The use of sexualized language or imagery, and sexual attention or advances of + any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email address, + without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities @@ -60,8 +60,8 @@ representative at an online or offline event. Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at -LeoDog896@gmail.com. -All complaints will be reviewed and investigated promptly and fairly. +LeoDog896@gmail.com. All complaints will be reviewed and investigated promptly +and fairly. All community leaders are obligated to respect the privacy and security of the reporter of any incident. @@ -82,15 +82,15 @@ behavior was inappropriate. A public apology may be requested. ### 2. Warning -**Community Impact**: A violation through a single incident or series -of actions. +**Community Impact**: A violation through a single incident or series of +actions. **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels -like social media. Violating these terms may lead to a temporary or -permanent ban. +like social media. Violating these terms may lead to a temporary or permanent +ban. ### 3. Temporary Ban @@ -106,11 +106,11 @@ Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community -standards, including sustained inappropriate behavior, harassment of an +standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. -**Consequence**: A permanent ban from any sort of public interaction within -the community. +**Consequence**: A permanent ban from any sort of public interaction within the +community. ## Attribution @@ -118,7 +118,8 @@ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. -Community Impact Guidelines were inspired by [Mozilla's code of conduct +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). [homepage]: https://www.contributor-covenant.org diff --git a/README.md b/README.md index 7a945ca..1773fac 100644 --- a/README.md +++ b/README.md @@ -2,18 +2,18 @@ [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/LeoDog896/deno-outdated) +Pins your dependencies to the latest version & updates existing ones. + ```bash deno install --allow-read=./ --allow-net --allow-write=./ -f -n=deno-outdated https://deno.land/x/deno_outdated/cli.ts ``` -Or, add it to your deno.json's tasks: +Or, add it to your deno.json's (or deno.jsonc) tasks: ```json -"update": "deno run --allow-read=./ --allow-net --allow-write=./ https://deno.land/x/deno_outdated/cli.ts --ignore README.md", +"update": "deno run --allow-read=./ --allow-net --allow-write=./ https://deno.land/x/deno_outdated/cli.ts", ``` -Pins your dependencies to the latest version & updates existing ones. - ## Flags - `-q, --quiet`: Silence CLI output diff --git a/cli.ts b/cli.ts index 6183f3e..98b4499 100644 --- a/cli.ts +++ b/cli.ts @@ -1,5 +1,5 @@ import { Command } from "https://deno.land/x/cliffy@v0.24.3/command/mod.ts"; -import { basename, join } from "https://deno.land/std@0.151.0/path/mod.ts"; +import { basename, join } from "https://deno.land/std@0.152.0/path/mod.ts"; import { findAndReplace } from "./change.ts"; export async function* recursiveReaddir( @@ -19,6 +19,7 @@ export async function* recursiveReaddir( async function update( quiet: boolean, + check: boolean, ignore: string[] = [], lineIgnore: string, debug = false, @@ -38,10 +39,14 @@ async function update( const newSource = await findAndReplace(originalSource, lineIgnore); if (newSource !== originalSource) { - await Deno.writeTextFile( - file, - newSource, - ); + if (check) { + console.log(`${file} needs updating`); + } else { + await Deno.writeTextFile( + file, + newSource, + ); + } count++; @@ -71,12 +76,20 @@ await new Command() default: "i-deno-outdated", }, ) + .option( + "-c --check", + "True if the editor shouldn't change files and tell you about outdated dependencies.", + { + default: false, + }, + ) .description( "Check for outdated dependencies for deno.land/x and other various 3rd party vendors", ) - .action(async ({ quiet, ignore, lineIgnore, debug }) => { + .action(async ({ quiet, ignore, lineIgnore, debug, check }) => { const count = await update( quiet, + check, Array.isArray(ignore) ? ignore : [], typeof lineIgnore === "string" ? lineIgnore : "i-deno-outdated", debug, diff --git a/test/change.test.ts b/test/change.test.ts index 792e530..d75e2f9 100644 --- a/test/change.test.ts +++ b/test/change.test.ts @@ -3,7 +3,7 @@ import { assert, assertEquals, assertNotEquals, -} from "https://deno.land/std@0.151.0/testing/asserts.ts"; +} from "https://deno.land/std@0.152.0/testing/asserts.ts"; Deno.test("Source code translation works", async () => { const source = "const x = 'https://deno.land/std@0.146.0/testing/asserts.ts'"; // i-deno-outdated diff --git a/test/redirect.test.ts b/test/redirect.test.ts index ab53c0d..330a42e 100644 --- a/test/redirect.test.ts +++ b/test/redirect.test.ts @@ -2,7 +2,7 @@ import { checkRedirect } from "../redirect.ts"; import { assertEquals, assertNotEquals, -} from "https://deno.land/std@0.151.0/testing/asserts.ts"; +} from "https://deno.land/std@0.152.0/testing/asserts.ts"; Deno.test("Redirects redirect to another URL (against deno.land/x)", async () => { const redirect = await checkRedirect("https://deno.land/x/cliffy/mod.ts"); // i-deno-outdated diff --git a/test/regex.test.ts b/test/regex.test.ts index 59e8a79..60cb223 100644 --- a/test/regex.test.ts +++ b/test/regex.test.ts @@ -1,5 +1,5 @@ import { apply } from "../regex.ts"; -import { assertEquals } from "https://deno.land/std@0.151.0/testing/asserts.ts"; +import { assertEquals } from "https://deno.land/std@0.152.0/testing/asserts.ts"; Deno.test("Removal works (deno.land/x)", () => { const url = "https://deno.land/x/cliffy@v0.24.3/mod.ts";