From 19f20d1028886a3e3afb05cc39d2898688fd5479 Mon Sep 17 00:00:00 2001
From: Edward Bebbington
Date: Tue, 20 Oct 2020 20:06:13 +0100
Subject: [PATCH 01/39] Re-use logic from services
---
deps.ts | 11 ++++-
src/options/help.ts | 100 ++++++++++++++++++++------------------------
2 files changed, 55 insertions(+), 56 deletions(-)
diff --git a/deps.ts b/deps.ts
index 28e555f..66d42f0 100644
--- a/deps.ts
+++ b/deps.ts
@@ -1,4 +1,13 @@
import * as colours from "https://deno.land/std@0.74.0/fmt/colors.ts";
export { colours };
-
+export { createHelpMenu } from "https://raw.githubusercontent.com/drashland/services/master/cli/help_menu_service.ts";
+export {
+ commandIs,
+ commandRequiresArgs,
+} from "https://raw.githubusercontent.com/drashland/services/master/cli/command_service.ts";
+export {
+ logDebug,
+ logError,
+ logInfo,
+} from "https://raw.githubusercontent.com/drashland/services/master/cli/logger_service.ts";
export { assertEquals } from "https://deno.land/std@0.74.0/testing/asserts.ts";
diff --git a/src/options/help.ts b/src/options/help.ts
index 0a5cff0..d499433 100644
--- a/src/options/help.ts
+++ b/src/options/help.ts
@@ -1,55 +1,45 @@
-export const helpMessage: string = "\n" +
- "A module manager for Deno." +
- "\n" +
- "\n" +
- "USAGE:" +
- "\n" +
- " deno run --allow-read --allow-net [--allow-write] https://deno.land/x/dmm@v1.1.5/mod.ts [ARGS] [MODULES]" +
- "\n" +
- "\n" +
- " dmm [ARGS] [MODULES]" +
- "\n" +
- "\n" +
- "ARGUMENTS:" +
- "\n" +
- "The check and update arguments cannot be used together." +
- "\n" +
- "\n" +
- " check" +
- "\n" +
- " Checks the specified modules for newer version. Will check all if modules are omitted." +
- "\n" +
- "\n" +
- " update" +
- "\n" +
- " Updates the specified modules to the newest version. Will update all if modules are omitted." +
- "\n" +
- "\n" +
- " info" +
- "\n" +
- " Shows information about the given module, be it std or 3rd party. The 3rd party module must be referenced at https://deno.land/x/" +
- "\n" +
- "\n" +
- "OPTIONS:" +
- "\n" +
- " --help" +
- "\n" +
- " Prints help message" +
- "\n" +
- " --version" +
- "\n" +
- " Prints dmm version" +
- "\n" +
- "\n" +
- "EXAMPLE USAGE:" +
- "\n" +
- " Assume you are importing an out of date version of `fs` from `std`." +
- "\n" +
- " deno run --allow-net --allow-read https://deno.land/x/dmm@v1.1.5/mod.ts check fs" +
- "\n" +
- " deno run --allow-net --allow-read --allow-write https://deno.land/x/dmm@v1.1.5/mod.ts update fs" +
- "\n" +
- " deno run --allow-net https://deno.land/x/dmm@v1.1.5/mod.ts info http" +
- "\n" +
- " dmm info http" +
- "\n";
+import {createHelpMenu} from "../../deps.ts";
+import {version} from "./version.ts";
+
+export const helpMessage = createHelpMenu({
+ description: `A module manager for Deno.`,
+ usage: [
+ `deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v${version}/mod.ts`,
+ `dmm [command]`
+ ],
+ commands: {
+ 'check [modules]': "Checks the specified modules for newer version. Will check all if modules are omitted.",
+ 'update [modules]': 'Updates the specified modules to the newest version. Will update all if modules are omitted.',
+ 'info': "Shows information about the given module, be it std or 3rd party. The 3rd party module must be referenced at https://deno.land/x/",
+ '--help': "Prints the help message",
+ '--version': "Prints the current dmm version",
+ 'help': "Prints the help message",
+ 'version': "Prints the current dmm version"
+ },
+ example_usage: [
+ {
+ description: "Install dmm",
+ examples: [
+ `deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v${version}/mod.ts`
+ ]
+ },
+ {
+ description: "Check a single module",
+ examples: [
+ `dmm check fs`
+ ]
+ },
+ {
+ description: "Update a single module",
+ examples: [
+ `dmm update fs`
+ ]
+ },
+ {
+ description: "Get information about a module",
+ examples: [
+ "dmm info http"
+ ]
+ }
+ ]
+})
From 5512a814ae29045bdded97167af2927c41ed0837 Mon Sep 17 00:00:00 2001
From: Edward Bebbington
Date: Tue, 20 Oct 2020 21:06:38 +0100
Subject: [PATCH 02/39] Move options to commands directory
---
mod.ts | 4 ++--
src/{options => commands}/help.ts | 0
src/{options => commands}/version.ts | 0
3 files changed, 2 insertions(+), 2 deletions(-)
rename src/{options => commands}/help.ts (100%)
rename src/{options => commands}/version.ts (100%)
diff --git a/mod.ts b/mod.ts
index 787a5d6..60d4a3d 100644
--- a/mod.ts
+++ b/mod.ts
@@ -1,6 +1,6 @@
import { colours } from "./deps.ts";
-import { helpMessage } from "./src/options/help.ts";
-import { versionMessage } from "./src/options/version.ts";
+import { helpMessage } from "./src/commands/help.ts";
+import { versionMessage } from "./src/commands/version.ts";
import { info } from "./src/commands/info.ts";
import { check } from "./src/commands/check.ts";
import { update } from "./src/commands/update.ts";
diff --git a/src/options/help.ts b/src/commands/help.ts
similarity index 100%
rename from src/options/help.ts
rename to src/commands/help.ts
diff --git a/src/options/version.ts b/src/commands/version.ts
similarity index 100%
rename from src/options/version.ts
rename to src/commands/version.ts
From b51dc9b6cfcdc8dd8913501a72b25cb56ea6b280 Mon Sep 17 00:00:00 2001
From: Edward Bebbington
Date: Tue, 20 Oct 2020 22:16:54 +0100
Subject: [PATCH 03/39] Improve mod.ts logic using services
---
mod.ts | 78 ++++++++++++++++++++++------------------------------------
1 file changed, 30 insertions(+), 48 deletions(-)
diff --git a/mod.ts b/mod.ts
index 60d4a3d..988e97d 100644
--- a/mod.ts
+++ b/mod.ts
@@ -1,56 +1,38 @@
-import { colours } from "./deps.ts";
+import {colours, commandIs, logError} from "./deps.ts";
import { helpMessage } from "./src/commands/help.ts";
import { versionMessage } from "./src/commands/version.ts";
import { info } from "./src/commands/info.ts";
import { check } from "./src/commands/check.ts";
import { update } from "./src/commands/update.ts";
-async function run(
- purpose: string,
- modulesForPurpose: string[],
-): Promise {
- if (purpose === "check") {
- await check(modulesForPurpose);
- } else if (purpose === "info") {
- await info(modulesForPurpose);
- } else if (purpose === "update") {
- await update(modulesForPurpose);
- } else {
- console.error(
- colours.red("Specify either `check`, `info` or `update`. See --help"),
- );
- Deno.exit(1);
- }
-}
-
-// Gather args
-const args: string[] = Deno.args;
-if (!args.length) {
- console.error(colours.red("Invalid arguments. See --help"));
- Deno.exit(1);
-}
+const args = Deno.args.filter((arg, i) => {
+ return i !== 0
+})
-// Support --help usage
-const wantsHelp: boolean = args.filter((arg) => arg === "--help").length === 1;
-if (wantsHelp) {
- console.info(helpMessage);
- Deno.exit();
+switch (true) {
+ case commandIs("info"):
+ await info(args)
+ break
+ case commandIs("check"):
+ await check(args)
+ break
+ case commandIs("update"):
+ await update(args)
+ break
+ case commandIs("version"):
+ console.log(versionMessage)
+ break
+ case commandIs("help"):
+ console.log(helpMessage)
+ break
+ case commandIs("--help"):
+ console.log(helpMessage)
+ break
+ case commandIs("--version"):
+ console.log(versionMessage);
+ break
+ default:
+ logError("Invalid arguments")
+ console.log(helpMessage)
}
-
-// Support --version usage
-const wantsVersion: boolean =
- args.filter((arg) => arg === "--version").length === 1;
-if (wantsVersion) {
- console.info(versionMessage);
- Deno.exit();
-}
-
-// Gather facts
-console.info("Gathering facts...");
-const purposeAndModules: string[] = args.filter((arg) =>
- arg.indexOf("--") === -1
-);
-const purpose: string = purposeAndModules[0];
-const modulesForPurpose: string[] = purposeAndModules.slice(1);
-
-await run(purpose, modulesForPurpose);
+Deno.exit()
From d05ea2adabe7b917fc193af9746c5d6ff576e2cb Mon Sep 17 00:00:00 2001
From: Edward Bebbington
Date: Tue, 20 Oct 2020 22:38:24 +0100
Subject: [PATCH 04/39] Add pre release workflow to bump versions
---
.github/workflows/pre_release.yml | 45 +++++++++++++++++++++++++++++++
console/bump_versions.ts | 22 +++++++++++++++
2 files changed, 67 insertions(+)
create mode 100644 .github/workflows/pre_release.yml
create mode 100644 console/bump_versions.ts
diff --git a/.github/workflows/pre_release.yml b/.github/workflows/pre_release.yml
new file mode 100644
index 0000000..f127a9f
--- /dev/null
+++ b/.github/workflows/pre_release.yml
@@ -0,0 +1,45 @@
+name: pre-release
+
+on:
+ create
+
+jobs:
+
+ # Make a PR to master from a new branch with changes, and delete the created one
+ update-versions:
+
+ # Only run when a release-v* branch is created, and not by drashbot
+ if: contains(github.ref, 'release-v') && !contains(github.event.sender.login, 'drashbot')
+
+ strategy:
+ matrix:
+ deno: ["1.4.2"]
+
+ runs-on: ubuntu-latest
+
+ steps:
+
+ - name: Checkout master
+ uses: actions/checkout@v2
+ with:
+ ref: master
+
+ - name: Delete Remote Release Branch
+ run: git push --delete origin ${{ github.ref }}
+
+ - name: Install Deno
+ uses: denolib/setup-deno@v2
+ with:
+ deno-version: ${{ matrix.deno }}
+
+ - name: Bump Versions
+ run: deno run -A ./console/bump_versions.ts --version=${{ github.ref }} # version passed so we know what the new release version will be
+
+ - name: Create Pull Request
+ uses: peter-evans/create-pull-request@v2
+ with:
+ token: ${{ secrets.CI_USER_PAT }}
+ commit-message: bump versions
+ title: bump versions
+ body: This was auto-generated by GitHub Actions.
+ branch: release # Can change it to ${{ github.ref }} to be the branch name, but then we need to figure out how to stop this worjflow running when it creates another "release-vx.x.x" branch
\ No newline at end of file
diff --git a/console/bump_versions.ts b/console/bump_versions.ts
new file mode 100644
index 0000000..54626d6
--- /dev/null
+++ b/console/bump_versions.ts
@@ -0,0 +1,22 @@
+import { bumpVersions } from "https://raw.githubusercontent.com/drashland/services/master/console/bump_versions.ts";
+
+const branch: string = Deno.args[0].split("=")[1]; // ["--version", "release-vX.X.X"]
+const version = branch.substring(branch.indexOf("v") + 1); // 1.0.5
+
+bumpVersions([
+ {
+ filename: "./egg.json",
+ replaceTheRegex: /"version": "[0-9\.]+[0-9\.]+[0-9\.]"/,
+ replaceWith: `"version": "${version}"`
+ },
+ {
+ filename: "./README.md",
+ replaceTheRegex: /dmm@v[0-9\.]+[0-9\.]+[0-9\.]/g,
+ replaceWith: `dmm@v${version}`
+ },
+ {
+ filename: "./src/commands/version.ts",
+ replaceTheRegex: /version = "[0-9\.]+[0-9\.]+[0-9\.]"/,
+ replaceWith: `version = "${version}"`
+ }
+])
From e68d4bf2cd8f03874257319d3df504ab8f6f734e Mon Sep 17 00:00:00 2001
From: Edward Bebbington
Date: Tue, 20 Oct 2020 22:38:37 +0100
Subject: [PATCH 05/39] Update readme for new help message
---
README.md | 59 +++++++++++++++++++++++++++++++++----------------------
1 file changed, 36 insertions(+), 23 deletions(-)
diff --git a/README.md b/README.md
index aa64290..63ebb72 100644
--- a/README.md
+++ b/README.md
@@ -65,7 +65,6 @@ $ dmm ...
*Through the URL*
-If you are using this method, be sure to use the latest version of dmm in the command below
```
$ deno run --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts ...
```
@@ -151,40 +150,54 @@ export { fs, colors }
Should you need any more information, use the `--help` option:
```
-$ dmm --help
+A module manager for Deno.
-A module manager for Deno.
+USAGE
-USAGE:
- deno run --allow-read --allow-net [--allow-write] https://deno.land/x/dmm@v1.1.5/mod.ts [ARGS] [MODULES]
+ deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts
+ dmm [command]
- dmm [ARGS] [MODULES]
-ARGUMENTS:
-The check and update arguments cannot be used together.
+COMMANDS
- check
- Checks the specified modules for newer version. Will check all if modules are omitted.
+ check [modules]
+ Checks the specified modules for newer version. Will check all if modules are
+ omitted.
- update
- Updates the specified modules to the newest version. Will update all if modules are omitted.
+ update [modules]
+ Updates the specified modules to the newest version. Will update all if modules
+ are omitted.
- info
- Shows information about the given module, be it std or 3rd party. The 3rd party module must be referenced at https://deno.land/x/
+ info
+ Shows information about the given module, be it std or 3rd party. The 3rd party
+ module must be referenced at https://deno.land/x/
-OPTIONS:
--help
- Prints help message
+ Prints the help message
+
--version
- Prints dmm version
+ Prints the current dmm version
+
+ help
+ Prints the help message
+
+ version
+ Prints the current dmm version
+
+
+EXAMPLE USAGE
+
+ Install dmm
+ deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts
+
+ Check a single module
+ dmm check fs
-EXAMPLE USAGE:
- Assume you are importing an out of date version of `fs` from `std`. See [here](#quick-start) for adding further restrictions.
- deno run --allow-net --allow-read https://deno.land/x/dmm@v1.1.5/mod.ts check fs
- deno run --allow-net --allow-read --allow-write https://deno.land/x/dmm@v1.1.5/mod.ts update fs
- deno run --allow-net https://deno.land/x/dmm@v1.1.5/mod.ts info http
- dmm info http
+ Update a single module
+ dmm update fs
+ Get information about a module
+ dmm info http
```
# How it Works
From bfa68e4f03745d7489c3d4c6f44402c4a6ce7c48 Mon Sep 17 00:00:00 2001
From: Edward Bebbington
Date: Tue, 20 Oct 2020 22:40:47 +0100
Subject: [PATCH 06/39] deno fmt
---
console/bump_versions.ts | 10 ++++-----
mod.ts | 38 ++++++++++++++++----------------
src/commands/help.ts | 47 +++++++++++++++++++++-------------------
3 files changed, 49 insertions(+), 46 deletions(-)
diff --git a/console/bump_versions.ts b/console/bump_versions.ts
index 54626d6..2b7f26c 100644
--- a/console/bump_versions.ts
+++ b/console/bump_versions.ts
@@ -7,16 +7,16 @@ bumpVersions([
{
filename: "./egg.json",
replaceTheRegex: /"version": "[0-9\.]+[0-9\.]+[0-9\.]"/,
- replaceWith: `"version": "${version}"`
+ replaceWith: `"version": "${version}"`,
},
{
filename: "./README.md",
replaceTheRegex: /dmm@v[0-9\.]+[0-9\.]+[0-9\.]/g,
- replaceWith: `dmm@v${version}`
+ replaceWith: `dmm@v${version}`,
},
{
filename: "./src/commands/version.ts",
replaceTheRegex: /version = "[0-9\.]+[0-9\.]+[0-9\.]"/,
- replaceWith: `version = "${version}"`
- }
-])
+ replaceWith: `version = "${version}"`,
+ },
+]);
diff --git a/mod.ts b/mod.ts
index 988e97d..2caa224 100644
--- a/mod.ts
+++ b/mod.ts
@@ -1,4 +1,4 @@
-import {colours, commandIs, logError} from "./deps.ts";
+import { colours, commandIs, logError } from "./deps.ts";
import { helpMessage } from "./src/commands/help.ts";
import { versionMessage } from "./src/commands/version.ts";
import { info } from "./src/commands/info.ts";
@@ -6,33 +6,33 @@ import { check } from "./src/commands/check.ts";
import { update } from "./src/commands/update.ts";
const args = Deno.args.filter((arg, i) => {
- return i !== 0
-})
+ return i !== 0;
+});
switch (true) {
case commandIs("info"):
- await info(args)
- break
+ await info(args);
+ break;
case commandIs("check"):
- await check(args)
- break
+ await check(args);
+ break;
case commandIs("update"):
- await update(args)
- break
+ await update(args);
+ break;
case commandIs("version"):
- console.log(versionMessage)
- break
+ console.log(versionMessage);
+ break;
case commandIs("help"):
- console.log(helpMessage)
- break
+ console.log(helpMessage);
+ break;
case commandIs("--help"):
- console.log(helpMessage)
- break
+ console.log(helpMessage);
+ break;
case commandIs("--version"):
console.log(versionMessage);
- break
+ break;
default:
- logError("Invalid arguments")
- console.log(helpMessage)
+ logError("Invalid arguments");
+ console.log(helpMessage);
}
-Deno.exit()
+Deno.exit();
diff --git a/src/commands/help.ts b/src/commands/help.ts
index d499433..30b2192 100644
--- a/src/commands/help.ts
+++ b/src/commands/help.ts
@@ -1,45 +1,48 @@
-import {createHelpMenu} from "../../deps.ts";
-import {version} from "./version.ts";
+import { createHelpMenu } from "../../deps.ts";
+import { version } from "./version.ts";
export const helpMessage = createHelpMenu({
description: `A module manager for Deno.`,
usage: [
- `deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v${version}/mod.ts`,
- `dmm [command]`
+ `deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v${version}/mod.ts`,
+ `dmm [command]`,
],
commands: {
- 'check [modules]': "Checks the specified modules for newer version. Will check all if modules are omitted.",
- 'update [modules]': 'Updates the specified modules to the newest version. Will update all if modules are omitted.',
- 'info': "Shows information about the given module, be it std or 3rd party. The 3rd party module must be referenced at https://deno.land/x/",
- '--help': "Prints the help message",
- '--version': "Prints the current dmm version",
- 'help': "Prints the help message",
- 'version': "Prints the current dmm version"
+ "check [modules]":
+ "Checks the specified modules for newer version. Will check all if modules are omitted.",
+ "update [modules]":
+ "Updates the specified modules to the newest version. Will update all if modules are omitted.",
+ "info":
+ "Shows information about the given module, be it std or 3rd party. The 3rd party module must be referenced at https://deno.land/x/",
+ "--help": "Prints the help message",
+ "--version": "Prints the current dmm version",
+ "help": "Prints the help message",
+ "version": "Prints the current dmm version",
},
example_usage: [
{
description: "Install dmm",
examples: [
- `deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v${version}/mod.ts`
- ]
+ `deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v${version}/mod.ts`,
+ ],
},
{
description: "Check a single module",
examples: [
- `dmm check fs`
- ]
+ `dmm check fs`,
+ ],
},
{
description: "Update a single module",
examples: [
- `dmm update fs`
- ]
+ `dmm update fs`,
+ ],
},
{
description: "Get information about a module",
examples: [
- "dmm info http"
- ]
- }
- ]
-})
+ "dmm info http",
+ ],
+ },
+ ],
+});
From c0f29c532e3aa3393b4b9a87f387af9bda3d8b26 Mon Sep 17 00:00:00 2001
From: Edward Bebbington
Date: Tue, 20 Oct 2020 22:55:45 +0100
Subject: [PATCH 07/39] Fix tests
---
tests/integration/check_test.ts | 9 ---
tests/integration/error_test.ts | 120 ++++++++++++++++++++++++++++---
tests/integration/help_test.ts | 62 +++++++++-------
tests/integration/info_test.ts | 8 +--
tests/integration/update_test.ts | 12 +---
5 files changed, 150 insertions(+), 61 deletions(-)
diff --git a/tests/integration/check_test.ts b/tests/integration/check_test.ts
index c85da8c..529d39b 100644
--- a/tests/integration/check_test.ts
+++ b/tests/integration/check_test.ts
@@ -36,7 +36,6 @@ Deno.test({
assertEquals(stderr, "");
assertEquals(
stdout,
- "Gathering facts...\n" +
"Reading deps.ts to gather your dependencies...\n" +
"Comparing versions...\n" +
colours.yellow(
@@ -81,7 +80,6 @@ Deno.test({
assertEquals(stderr, "");
assertEquals(
stdout,
- "Gathering facts...\n" +
"Reading deps.ts to gather your dependencies...\n" +
"Comparing versions...\n" +
colours.green("Your dependencies are up to date") + "\n",
@@ -121,7 +119,6 @@ Deno.test({
assertEquals(stderr, "");
assertEquals(
stdout,
- "Gathering facts...\n" +
"Reading deps.ts to gather your dependencies...\n" +
"Comparing versions...\n" +
colours.yellow(
@@ -170,7 +167,6 @@ Deno.test({
assertEquals(stderr, "");
assertEquals(
stdout,
- "Gathering facts...\n" +
"Reading deps.ts to gather your dependencies...\n" +
"Comparing versions...\n" +
colours.green("Your dependencies are up to date") + "\n",
@@ -208,7 +204,6 @@ Deno.test({
assertEquals(stderr, "");
assertEquals(
stdout,
- "Gathering facts...\n" +
"Reading deps.ts to gather your dependencies...\n" +
"Comparing versions...\n" +
colours.yellow(
@@ -261,7 +256,6 @@ Deno.test({
assertEquals(stderr, "");
assertEquals(
stdout,
- "Gathering facts...\n" +
"Reading deps.ts to gather your dependencies...\n" +
"Comparing versions...\n" +
colours.green("Your dependencies are up to date") + "\n",
@@ -304,7 +298,6 @@ Deno.test({
);
assertEquals(
stdout,
- "Gathering facts...\n" +
"Reading deps.ts to gather your dependencies...\n",
);
assertEquals(status.code, 1);
@@ -344,7 +337,6 @@ Deno.test({
);
assertEquals(
stdout,
- "Gathering facts...\n" +
"Reading deps.ts to gather your dependencies...\n",
);
assertEquals(status.code, 1);
@@ -384,7 +376,6 @@ Deno.test({
);
assertEquals(
stdout,
- "Gathering facts...\n" +
"Reading deps.ts to gather your dependencies...\n",
);
assertEquals(status.code, 1);
diff --git a/tests/integration/error_test.ts b/tests/integration/error_test.ts
index c94fb80..72bfaf1 100644
--- a/tests/integration/error_test.ts
+++ b/tests/integration/error_test.ts
@@ -16,10 +16,61 @@ Deno.test({
const stdout = new TextDecoder("utf-8").decode(output);
const error = await p.stderrOutput();
const stderr = new TextDecoder("utf-8").decode(error);
- assertEquals(stdout, "");
- assertEquals(stderr, colours.red("Invalid arguments. See --help") + "\n");
- assertEquals(status.code, 1);
- assertEquals(status.success, false);
+ assertEquals(stdout,
+ colours.red("ERROR") + " Invalid arguments" + "\n" +
+ "\n" +
+ "A module manager for Deno.\n" +
+ "\n" +
+ "USAGE\n" +
+ "\n" +
+ " deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts\n" +
+ " dmm [command]\n" +
+ "\n" +
+ "\n" +
+ "COMMANDS\n" +
+ "\n" +
+ " check [modules]\n" +
+ " Checks the specified modules for newer version. Will check all if modules are \n" +
+ " omitted.\n" +
+ "\n" +
+ " update [modules]\n" +
+ " Updates the specified modules to the newest version. Will update all if modules \n" +
+ " are omitted.\n" +
+ "\n" +
+ " info\n" +
+ " Shows information about the given module, be it std or 3rd party. The 3rd party \n" +
+ " module must be referenced at https://deno.land/x/\n" +
+ "\n" +
+ " --help\n" +
+ " Prints the help message\n" +
+ "\n" +
+ " --version\n" +
+ " Prints the current dmm version\n" +
+ "\n" +
+ " help\n" +
+ " Prints the help message\n" +
+ "\n" +
+ " version\n" +
+ " Prints the current dmm version\n" +
+ "\n" +
+ "\n" +
+ "EXAMPLE USAGE\n" +
+ "\n" +
+ " Install dmm\n" +
+ " deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts\n" +
+ "\n" +
+ " Check a single module\n" +
+ " dmm check fs\n" +
+ "\n" +
+ " Update a single module\n" +
+ " dmm update fs\n" +
+ "\n" +
+ " Get information about a module\n" +
+ " dmm info http" + "\n\n"
+ );
+ assertEquals(stderr, "");
+ assertEquals(status.code, 0);
+ assertEquals(status.success, true);
},
});
@@ -45,13 +96,60 @@ Deno.test({
const stdout = new TextDecoder("utf-8").decode(output);
const error = await p.stderrOutput();
const stderr = new TextDecoder("utf-8").decode(error);
- assertEquals(stdout, "Gathering facts...\n");
- assertEquals(
- stderr,
- colours.red("Specify either `check`, `info` or `update`. See --help") +
- "\n",
+ assertEquals(stdout,
+ colours.red("ERROR") + " Invalid arguments" + "\n" +
+ "\n" +
+ "A module manager for Deno.\n" +
+ "\n" +
+ "USAGE\n" +
+ "\n" +
+ " deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts\n" +
+ " dmm [command]\n" +
+ "\n" +
+ "\n" +
+ "COMMANDS\n" +
+ "\n" +
+ " check [modules]\n" +
+ " Checks the specified modules for newer version. Will check all if modules are \n" +
+ " omitted.\n" +
+ "\n" +
+ " update [modules]\n" +
+ " Updates the specified modules to the newest version. Will update all if modules \n" +
+ " are omitted.\n" +
+ "\n" +
+ " info\n" +
+ " Shows information about the given module, be it std or 3rd party. The 3rd party \n" +
+ " module must be referenced at https://deno.land/x/\n" +
+ "\n" +
+ " --help\n" +
+ " Prints the help message\n" +
+ "\n" +
+ " --version\n" +
+ " Prints the current dmm version\n" +
+ "\n" +
+ " help\n" +
+ " Prints the help message\n" +
+ "\n" +
+ " version\n" +
+ " Prints the current dmm version\n" +
+ "\n" +
+ "\n" +
+ "EXAMPLE USAGE\n" +
+ "\n" +
+ " Install dmm\n" +
+ " deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts\n" +
+ "\n" +
+ " Check a single module\n" +
+ " dmm check fs\n" +
+ "\n" +
+ " Update a single module\n" +
+ " dmm update fs\n" +
+ "\n" +
+ " Get information about a module\n" +
+ " dmm info http" + "\n\n"
);
- assertEquals(status.code, 1);
- assertEquals(status.success, false);
+ assertEquals(stderr, "");
+ assertEquals(status.code, 0);
+ assertEquals(status.success, true);
},
});
diff --git a/tests/integration/help_test.ts b/tests/integration/help_test.ts
index 0a80657..9d6d49c 100644
--- a/tests/integration/help_test.ts
+++ b/tests/integration/help_test.ts
@@ -1,5 +1,5 @@
import { assertEquals, colours } from "../../deps.ts";
-import { version } from "../../src/options/version.ts";
+import { version } from "../../src/commands/version.ts";
import { outOfDateDepsDir, upToDateDepsDir } from "./test_constants.ts";
Deno.test({
@@ -20,44 +20,54 @@ Deno.test({
assertEquals(stderr, "");
assertEquals(
stdout,
- "\n" +
- "A module manager for Deno.\n" +
+ "\nA module manager for Deno.\n" +
"\n" +
- "USAGE:\n" +
- ` deno run --allow-read --allow-net [--allow-write] https://deno.land/x/dmm@v${version}/mod.ts [ARGS] [MODULES]\n` +
+ "USAGE\n" +
"\n" +
- " dmm [ARGS] [MODULES]\n" +
+ " deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts\n" +
+ " dmm [command]\n" +
"\n" +
- "ARGUMENTS:\n" +
- "The check and update arguments cannot be used together.\n" +
"\n" +
- " check\n" +
- " Checks the specified modules for newer version. Will check all if modules are omitted.\n" +
+ "COMMANDS\n" +
"\n" +
- " update\n" +
- " Updates the specified modules to the newest version. Will update all if modules are omitted.\n" +
+ " check [modules]\n" +
+ " Checks the specified modules for newer version. Will check all if modules are \n" +
+ " omitted.\n" +
"\n" +
- " info\n" +
- " Shows information about the given module, be it std or 3rd party. The 3rd party module must be referenced at https://deno.land/x/\n" +
+ " update [modules]\n" +
+ " Updates the specified modules to the newest version. Will update all if modules \n" +
+ " are omitted.\n" +
"\n" +
- "OPTIONS:" +
+ " info\n" +
+ " Shows information about the given module, be it std or 3rd party. The 3rd party \n" +
+ " module must be referenced at https://deno.land/x/\n" +
"\n" +
- " --help" +
+ " --help\n" +
+ " Prints the help message\n" +
"\n" +
- " Prints help message" +
+ " --version\n" +
+ " Prints the current dmm version\n" +
"\n" +
- " --version" +
+ " help\n" +
+ " Prints the help message\n" +
"\n" +
- " Prints dmm version" +
+ " version\n" +
+ " Prints the current dmm version\n" +
"\n" +
"\n" +
- "EXAMPLE USAGE:\n" +
- " Assume you are importing an out of date version of `fs` from `std`.\n" +
- ` deno run --allow-net --allow-read https://deno.land/x/dmm@v${version}/mod.ts check fs\n` +
- ` deno run --allow-net --allow-read --allow-write https://deno.land/x/dmm@v${version}/mod.ts update fs\n` +
- ` deno run --allow-net https://deno.land/x/dmm@v${version}/mod.ts info http\n` +
- " dmm info http\n" +
- "\n",
+ "EXAMPLE USAGE\n" +
+ "\n" +
+ " Install dmm\n" +
+ " deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts\n" +
+ "\n" +
+ " Check a single module\n" +
+ " dmm check fs\n" +
+ "\n" +
+ " Update a single module\n" +
+ " dmm update fs\n" +
+ "\n" +
+ " Get information about a module\n" +
+ " dmm info http" + "\n\n",
);
assertEquals(status.code, 0);
assertEquals(status.success, true);
diff --git a/tests/integration/info_test.ts b/tests/integration/info_test.ts
index 6124e31..8e1928e 100644
--- a/tests/integration/info_test.ts
+++ b/tests/integration/info_test.ts
@@ -24,7 +24,7 @@ Deno.test({
const stdout = new TextDecoder("utf-8").decode(output);
const error = await p.stderrOutput();
const stderr = new TextDecoder("utf-8").decode(error);
- assertEquals(stdout, "Gathering facts...\n");
+ assertEquals(stdout, "");
assertEquals(
stderr,
colours.red("Specify a single module to get information on. See --help") +
@@ -55,7 +55,6 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- "Gathering facts...\n" +
"\n" +
"Information on drash\n" +
"\n" +
@@ -93,7 +92,6 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- "Gathering facts...\n" +
"\n" +
"Information on fs\n" +
"\n" +
@@ -137,7 +135,7 @@ Deno.test({
const stdout = new TextDecoder("utf-8").decode(output);
const error = await p.stderrOutput();
const stderr = new TextDecoder("utf-8").decode(error);
- assertEquals(stdout, "Gathering facts...\n");
+ assertEquals(stdout, "");
assertEquals(
stderr,
colours.red("Specify a single module to get information on. See --help") +
@@ -172,7 +170,7 @@ Deno.test({
const stdout = new TextDecoder("utf-8").decode(output);
const error = await p.stderrOutput();
const stderr = new TextDecoder("utf-8").decode(error);
- assertEquals(stdout, "Gathering facts...\n");
+ assertEquals(stdout, "");
assertEquals(
stderr,
colours.red("No module was found with somethinggg") + "\n",
diff --git a/tests/integration/update_test.ts b/tests/integration/update_test.ts
index 1935bd8..f3b850f 100644
--- a/tests/integration/update_test.ts
+++ b/tests/integration/update_test.ts
@@ -71,7 +71,7 @@ Deno.test({
const stdout = new TextDecoder("utf-8").decode(output);
const error = await p.stderrOutput();
const stderr = new TextDecoder("utf-8").decode(error);
- const expected = "Gathering facts...\n" +
+ const expected =
"Reading deps.ts to gather your dependencies...\n" +
"Checking if your modules can be updated...\n" +
colours.green(
@@ -127,7 +127,6 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- "Gathering facts...\n" +
"Reading deps.ts to gather your dependencies...\n" +
"Checking if your modules can be updated...\n" +
colours.green("Everything is already up to date") + "\n",
@@ -174,7 +173,6 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- "Gathering facts...\n" +
"Reading deps.ts to gather your dependencies...\n" +
"Checking if your modules can be updated...\n" +
colours.green(
@@ -236,7 +234,6 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- "Gathering facts...\n" +
"Reading deps.ts to gather your dependencies...\n" +
"Checking if your modules can be updated...\n" +
colours.green("Everything is already up to date") + "\n",
@@ -278,7 +275,7 @@ Deno.test({
const stdout = new TextDecoder("utf-8").decode(output);
const error = await p.stderrOutput();
const stderr = new TextDecoder("utf-8").decode(error);
- const assertedOutput = "Gathering facts...\n" +
+ const assertedOutput =
"Reading deps.ts to gather your dependencies...\n" +
"Checking if your modules can be updated...\n" +
colours.green(`drash was updated from v1.0.0 to ${latestDrashRelease}`) +
@@ -346,7 +343,6 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- "Gathering facts...\n" +
"Reading deps.ts to gather your dependencies...\n" +
"Checking if your modules can be updated...\n" +
colours.green("Everything is already up to date") + "\n",
@@ -391,7 +387,6 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- "Gathering facts...\n" +
"Reading deps.ts to gather your dependencies...\n" +
"Checking if your modules can be updated...\n" +
colours.green(
@@ -442,7 +437,6 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- "Gathering facts...\n" +
"Reading deps.ts to gather your dependencies...\n",
);
assertEquals(
@@ -490,7 +484,6 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- "Gathering facts...\n" +
"Reading deps.ts to gather your dependencies...\n" +
"Checking if your modules can be updated...\n" +
colours.green(
@@ -551,7 +544,6 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- "Gathering facts...\n" +
"Reading deps.ts to gather your dependencies...\n" +
"Checking if your modules can be updated...\n" +
colours.green(
From 62852a46e8788123a85e37ccc0d1f55d8d00c246 Mon Sep 17 00:00:00 2001
From: Eric Crooks
Date: Tue, 20 Oct 2020 21:20:20 -0400
Subject: [PATCH 08/39] deno fmt
---
console/bump_versions.ts | 10 ++++-----
mod.ts | 38 ++++++++++++++++----------------
src/commands/help.ts | 47 +++++++++++++++++++++-------------------
3 files changed, 49 insertions(+), 46 deletions(-)
diff --git a/console/bump_versions.ts b/console/bump_versions.ts
index 54626d6..2b7f26c 100644
--- a/console/bump_versions.ts
+++ b/console/bump_versions.ts
@@ -7,16 +7,16 @@ bumpVersions([
{
filename: "./egg.json",
replaceTheRegex: /"version": "[0-9\.]+[0-9\.]+[0-9\.]"/,
- replaceWith: `"version": "${version}"`
+ replaceWith: `"version": "${version}"`,
},
{
filename: "./README.md",
replaceTheRegex: /dmm@v[0-9\.]+[0-9\.]+[0-9\.]/g,
- replaceWith: `dmm@v${version}`
+ replaceWith: `dmm@v${version}`,
},
{
filename: "./src/commands/version.ts",
replaceTheRegex: /version = "[0-9\.]+[0-9\.]+[0-9\.]"/,
- replaceWith: `version = "${version}"`
- }
-])
+ replaceWith: `version = "${version}"`,
+ },
+]);
diff --git a/mod.ts b/mod.ts
index 988e97d..2caa224 100644
--- a/mod.ts
+++ b/mod.ts
@@ -1,4 +1,4 @@
-import {colours, commandIs, logError} from "./deps.ts";
+import { colours, commandIs, logError } from "./deps.ts";
import { helpMessage } from "./src/commands/help.ts";
import { versionMessage } from "./src/commands/version.ts";
import { info } from "./src/commands/info.ts";
@@ -6,33 +6,33 @@ import { check } from "./src/commands/check.ts";
import { update } from "./src/commands/update.ts";
const args = Deno.args.filter((arg, i) => {
- return i !== 0
-})
+ return i !== 0;
+});
switch (true) {
case commandIs("info"):
- await info(args)
- break
+ await info(args);
+ break;
case commandIs("check"):
- await check(args)
- break
+ await check(args);
+ break;
case commandIs("update"):
- await update(args)
- break
+ await update(args);
+ break;
case commandIs("version"):
- console.log(versionMessage)
- break
+ console.log(versionMessage);
+ break;
case commandIs("help"):
- console.log(helpMessage)
- break
+ console.log(helpMessage);
+ break;
case commandIs("--help"):
- console.log(helpMessage)
- break
+ console.log(helpMessage);
+ break;
case commandIs("--version"):
console.log(versionMessage);
- break
+ break;
default:
- logError("Invalid arguments")
- console.log(helpMessage)
+ logError("Invalid arguments");
+ console.log(helpMessage);
}
-Deno.exit()
+Deno.exit();
diff --git a/src/commands/help.ts b/src/commands/help.ts
index d499433..30b2192 100644
--- a/src/commands/help.ts
+++ b/src/commands/help.ts
@@ -1,45 +1,48 @@
-import {createHelpMenu} from "../../deps.ts";
-import {version} from "./version.ts";
+import { createHelpMenu } from "../../deps.ts";
+import { version } from "./version.ts";
export const helpMessage = createHelpMenu({
description: `A module manager for Deno.`,
usage: [
- `deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v${version}/mod.ts`,
- `dmm [command]`
+ `deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v${version}/mod.ts`,
+ `dmm [command]`,
],
commands: {
- 'check [modules]': "Checks the specified modules for newer version. Will check all if modules are omitted.",
- 'update [modules]': 'Updates the specified modules to the newest version. Will update all if modules are omitted.',
- 'info': "Shows information about the given module, be it std or 3rd party. The 3rd party module must be referenced at https://deno.land/x/",
- '--help': "Prints the help message",
- '--version': "Prints the current dmm version",
- 'help': "Prints the help message",
- 'version': "Prints the current dmm version"
+ "check [modules]":
+ "Checks the specified modules for newer version. Will check all if modules are omitted.",
+ "update [modules]":
+ "Updates the specified modules to the newest version. Will update all if modules are omitted.",
+ "info":
+ "Shows information about the given module, be it std or 3rd party. The 3rd party module must be referenced at https://deno.land/x/",
+ "--help": "Prints the help message",
+ "--version": "Prints the current dmm version",
+ "help": "Prints the help message",
+ "version": "Prints the current dmm version",
},
example_usage: [
{
description: "Install dmm",
examples: [
- `deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v${version}/mod.ts`
- ]
+ `deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v${version}/mod.ts`,
+ ],
},
{
description: "Check a single module",
examples: [
- `dmm check fs`
- ]
+ `dmm check fs`,
+ ],
},
{
description: "Update a single module",
examples: [
- `dmm update fs`
- ]
+ `dmm update fs`,
+ ],
},
{
description: "Get information about a module",
examples: [
- "dmm info http"
- ]
- }
- ]
-})
+ "dmm info http",
+ ],
+ },
+ ],
+});
From d0d21453862f4a4289d3624fa80609ec278ba260 Mon Sep 17 00:00:00 2001
From: Eric Crooks
Date: Tue, 20 Oct 2020 21:30:24 -0400
Subject: [PATCH 09/39] use CommandService
---
deps.ts | 5 +---
mod.ts | 62 +++++++++++++++++++++++---------------------
src/commands/help.ts | 6 ++---
3 files changed, 36 insertions(+), 37 deletions(-)
diff --git a/deps.ts b/deps.ts
index 66d42f0..4cf2c6b 100644
--- a/deps.ts
+++ b/deps.ts
@@ -1,10 +1,7 @@
import * as colours from "https://deno.land/std@0.74.0/fmt/colors.ts";
export { colours };
export { createHelpMenu } from "https://raw.githubusercontent.com/drashland/services/master/cli/help_menu_service.ts";
-export {
- commandIs,
- commandRequiresArgs,
-} from "https://raw.githubusercontent.com/drashland/services/master/cli/command_service.ts";
+export { CommandService } from "https://raw.githubusercontent.com/drashland/services/master/cli/command_service.ts";
export {
logDebug,
logError,
diff --git a/mod.ts b/mod.ts
index 2caa224..b388b63 100644
--- a/mod.ts
+++ b/mod.ts
@@ -1,38 +1,42 @@
-import { colours, commandIs, logError } from "./deps.ts";
+import { colours, CommandService, logError } from "./deps.ts";
import { helpMessage } from "./src/commands/help.ts";
import { versionMessage } from "./src/commands/version.ts";
import { info } from "./src/commands/info.ts";
import { check } from "./src/commands/check.ts";
import { update } from "./src/commands/update.ts";
-const args = Deno.args.filter((arg, i) => {
+const args = Deno.args.slice().filter((arg: string, i: number) => {
return i !== 0;
});
-switch (true) {
- case commandIs("info"):
- await info(args);
- break;
- case commandIs("check"):
- await check(args);
- break;
- case commandIs("update"):
- await update(args);
- break;
- case commandIs("version"):
- console.log(versionMessage);
- break;
- case commandIs("help"):
- console.log(helpMessage);
- break;
- case commandIs("--help"):
- console.log(helpMessage);
- break;
- case commandIs("--version"):
- console.log(versionMessage);
- break;
- default:
- logError("Invalid arguments");
- console.log(helpMessage);
-}
-Deno.exit();
+const c = new CommandService(Deno.args);
+
+c.addCommand("--help", async () => {
+ console.log(helpMessage);
+});
+
+c.addCommand("--version", () => {
+ console.log(versionMessage);
+});
+
+c.addCommand("info", async () => {
+ await info(args);
+});
+
+c.addCommand("help", () => {
+ console.log(helpMessage);
+});
+
+c.addCommand("update", async () => {
+ await update(args);
+});
+
+c.addCommand("version", () => {
+ console.log(versionMessage);
+});
+
+c.addCommand("check", async () => {
+ await check(args);
+});
+
+c.executeCommand();
diff --git a/src/commands/help.ts b/src/commands/help.ts
index 30b2192..c9cdddb 100644
--- a/src/commands/help.ts
+++ b/src/commands/help.ts
@@ -14,10 +14,8 @@ export const helpMessage = createHelpMenu({
"Updates the specified modules to the newest version. Will update all if modules are omitted.",
"info":
"Shows information about the given module, be it std or 3rd party. The 3rd party module must be referenced at https://deno.land/x/",
- "--help": "Prints the help message",
- "--version": "Prints the current dmm version",
- "help": "Prints the help message",
- "version": "Prints the current dmm version",
+ "help, --help": "Prints the help message",
+ "version, --version": "Prints the current dmm version",
},
example_usage: [
{
From 07b7adc540149aed5799b42545e01108528c2d1b Mon Sep 17 00:00:00 2001
From: Eric Crooks
Date: Tue, 20 Oct 2020 21:34:10 -0400
Subject: [PATCH 10/39] fix import
---
tests/integration/help_test.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/integration/help_test.ts b/tests/integration/help_test.ts
index 0a80657..224ae58 100644
--- a/tests/integration/help_test.ts
+++ b/tests/integration/help_test.ts
@@ -1,5 +1,5 @@
import { assertEquals, colours } from "../../deps.ts";
-import { version } from "../../src/options/version.ts";
+import { version } from "../../src/commands/version.ts";
import { outOfDateDepsDir, upToDateDepsDir } from "./test_constants.ts";
Deno.test({
From adffbec73a815a42400361d964a6b58500ab9ff6 Mon Sep 17 00:00:00 2001
From: Edward Bebbington
Date: Wed, 21 Oct 2020 08:59:45 +0100
Subject: [PATCH 11/39] Use logging service for improved output
---
src/commands/check.ts | 12 ++---
src/commands/info.ts | 8 +--
src/commands/update.ts | 10 ++--
src/services/module_service.ts | 6 +--
tests/integration/check_test.ts | 84 ++++++++++++++------------------
tests/integration/info_test.ts | 21 ++++----
tests/integration/update_test.ts | 71 ++++++++++++++-------------
7 files changed, 102 insertions(+), 110 deletions(-)
diff --git a/src/commands/check.ts b/src/commands/check.ts
index 0b8c7de..00df828 100644
--- a/src/commands/check.ts
+++ b/src/commands/check.ts
@@ -1,4 +1,4 @@
-import { colours } from "../../deps.ts";
+import {colours, logError, logInfo} from "../../deps.ts";
import IModule from "../interfaces/module.ts";
import ModuleService from "../services/module_service.ts";
@@ -17,7 +17,7 @@ export async function check(dependencies: string[]): Promise {
);
if (modules === false || typeof modules === "boolean") {
- console.error(
+ logError(
colours.red("Modules specified do not exist in your dependencies."),
);
Deno.exit(1);
@@ -25,14 +25,14 @@ export async function check(dependencies: string[]): Promise {
}
// Compare imported and latest version
- console.info("Comparing versions...");
+ logInfo("Comparing versions...");
let depsCanBeUpdated: boolean = false;
let listOfModuleNamesToBeUpdated: string[] = [];
modules.forEach((module) => {
if (module.importedVersion !== module.latestRelease) {
depsCanBeUpdated = true;
listOfModuleNamesToBeUpdated.push(module.name);
- console.info(
+ logInfo(
colours.yellow(
module.name + " can be updated from " + module.importedVersion +
" to " + module.latestRelease,
@@ -42,11 +42,11 @@ export async function check(dependencies: string[]): Promise {
});
// Logging purposes
if (depsCanBeUpdated) {
- console.info(
+ logInfo(
"To update, run: \n dmm update " +
listOfModuleNamesToBeUpdated.join(" "),
);
} else {
- console.info(colours.green("Your dependencies are up to date"));
+ logInfo(colours.green("Your dependencies are up to date"));
}
}
diff --git a/src/commands/info.ts b/src/commands/info.ts
index 13ab3b2..3805c61 100644
--- a/src/commands/info.ts
+++ b/src/commands/info.ts
@@ -1,4 +1,4 @@
-import { colours } from "../../deps.ts";
+import {colours, logError, logInfo} from "../../deps.ts";
import DenoService from "../services/deno_service.ts";
/**
@@ -9,7 +9,7 @@ import DenoService from "../services/deno_service.ts";
*/
export async function info(modules: string[]): Promise {
if (modules.length === 0 || modules.length > 1) {
- console.error(
+ logError(
colours.red(
"Specify a single module to get information on. See --help",
),
@@ -26,7 +26,7 @@ export async function info(modules: string[]): Promise {
const isStd = stdResponse.status === 200;
const isThirdParty = thirdPartyResponse.status === 200;
if (!isStd && !isThirdParty) {
- console.error(
+ logError(
colours.red("No module was found with " + moduleToGetInfoOn),
);
Deno.exit(1);
@@ -51,7 +51,7 @@ export async function info(modules: string[]): Promise {
denoLandUrl = "https://deno.land/x/" + name + "@" + latestVersion;
}
const importLine = "import * as " + name + ' from "' + denoLandUrl + '";';
- console.info(
+ logInfo(
"\n" +
`Information on ${name}\n\n - Name: ${name}\n - Description: ${description}\n - deno.land Link: ${denoLandUrl}\n - GitHub Repository: ${gitHubUrl}\n - Import Statement: ${importLine}\n - Latest Version: ${latestVersion}` +
"\n",
diff --git a/src/commands/update.ts b/src/commands/update.ts
index 5ed6998..40bff1f 100644
--- a/src/commands/update.ts
+++ b/src/commands/update.ts
@@ -1,4 +1,4 @@
-import { colours } from "../../deps.ts";
+import {colours, logError, logInfo} from "../../deps.ts";
import IModule from "../interfaces/module.ts";
import ModuleService from "../services/module_service.ts";
@@ -17,7 +17,7 @@ export async function update(dependencies: string[]): Promise {
);
if (modules === false || typeof modules === "boolean") {
- console.error(
+ logError(
colours.red("Modules specified do not exist in your dependencies."),
);
Deno.exit(1);
@@ -25,7 +25,7 @@ export async function update(dependencies: string[]): Promise {
}
// Check for updates and rewrite `deps.ts` if needed
- console.info("Checking if your modules can be updated...");
+ logInfo("Checking if your modules can be updated...");
const usersWorkingDir: string = Deno.realPathSync(".");
let depsWereUpdated = false;
let depsContent: string = new TextDecoder().decode(
@@ -55,7 +55,7 @@ export async function update(dependencies: string[]): Promise {
module.name + "@" + module.latestRelease,
);
}
- console.info(
+ logInfo(
colours.green(
module.name + " was updated from " + module.importedVersion + " to " +
module.latestRelease,
@@ -72,6 +72,6 @@ export async function update(dependencies: string[]): Promise {
// And if none were updated, add some more logging
if (!depsWereUpdated) {
- console.info(colours.green("Everything is already up to date"));
+ logInfo(colours.green("Everything is already up to date"));
}
}
diff --git a/src/services/module_service.ts b/src/services/module_service.ts
index 3047e36..1fed832 100644
--- a/src/services/module_service.ts
+++ b/src/services/module_service.ts
@@ -1,5 +1,5 @@
import IModule from "../interfaces/module.ts";
-import { colours } from "../../deps.ts";
+import {colours, logError, logInfo} from "../../deps.ts";
import DenoService from "../services/deno_service.ts";
export default class ModuleService {
@@ -50,7 +50,7 @@ export default class ModuleService {
purpose: string,
): Promise {
// Solely read the users `deps.ts` file
- console.info("Reading deps.ts to gather your dependencies...");
+ logInfo("Reading deps.ts to gather your dependencies...");
const usersWorkingDir: string = Deno.realPathSync(".");
const depsContent: string = new TextDecoder().decode(
Deno.readFileSync(usersWorkingDir + "/deps.ts"),
@@ -81,7 +81,7 @@ export default class ModuleService {
? importVersionRegexResult[0]
: "";
if (!importedVersion) {
- console.error(colours.red(
+ logError(colours.red(
"The following line is not versioned. To update, your dependencies must be versioned." +
"\n" +
" " + dep,
diff --git a/tests/integration/check_test.ts b/tests/integration/check_test.ts
index 529d39b..67cfb45 100644
--- a/tests/integration/check_test.ts
+++ b/tests/integration/check_test.ts
@@ -36,13 +36,11 @@ Deno.test({
assertEquals(stderr, "");
assertEquals(
stdout,
- "Reading deps.ts to gather your dependencies...\n" +
- "Comparing versions...\n" +
- colours.yellow(
- `fs can be updated from 0.53.0 to ${latestStdRelease}`,
- ) +
+ colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") + " Comparing versions...\n" +
+ colours.blue("INFO") + " " + colours.yellow(`fs can be updated from 0.53.0 to ${latestStdRelease}`) +
"\n" +
- "To update, run: \n" +
+ colours.blue("INFO") + " To update, run: \n" +
" dmm update fs" +
"\n",
);
@@ -80,9 +78,9 @@ Deno.test({
assertEquals(stderr, "");
assertEquals(
stdout,
- "Reading deps.ts to gather your dependencies...\n" +
- "Comparing versions...\n" +
- colours.green("Your dependencies are up to date") + "\n",
+ colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") + " Comparing versions...\n" +
+ colours.blue("INFO") + " " + colours.green("Your dependencies are up to date") + "\n",
);
assertEquals(status.code, 0);
assertEquals(status.success, true);
@@ -119,16 +117,16 @@ Deno.test({
assertEquals(stderr, "");
assertEquals(
stdout,
- "Reading deps.ts to gather your dependencies...\n" +
- "Comparing versions...\n" +
- colours.yellow(
+ colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") + " Comparing versions...\n" +
+ colours.blue("INFO") + " " + colours.yellow(
`drash can be updated from v1.0.0 to ${latestDrashRelease}`,
) + "\n" +
- colours.yellow(
+ colours.blue("INFO") + " " +colours.yellow(
`fs can be updated from 0.53.0 to ${latestStdRelease}`,
) +
"\n" +
- "To update, run: \n" +
+ colours.blue("INFO") + " To update, run: \n" +
" dmm update drash fs" +
"\n",
);
@@ -167,9 +165,9 @@ Deno.test({
assertEquals(stderr, "");
assertEquals(
stdout,
- "Reading deps.ts to gather your dependencies...\n" +
- "Comparing versions...\n" +
- colours.green("Your dependencies are up to date") + "\n",
+ colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") + " Comparing versions...\n" +
+ colours.blue("INFO") + " " + colours.green("Your dependencies are up to date") + "\n",
);
assertEquals(status.code, 0);
assertEquals(status.success, true);
@@ -204,22 +202,22 @@ Deno.test({
assertEquals(stderr, "");
assertEquals(
stdout,
- "Reading deps.ts to gather your dependencies...\n" +
- "Comparing versions...\n" +
- colours.yellow(
+ colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") + " Comparing versions...\n" +
+ colours.blue("INFO") + " " + colours.yellow(
`drash can be updated from v1.0.0 to ${latestDrashRelease}`,
) + "\n" +
- colours.yellow(
+ colours.blue("INFO") + " " + colours.yellow(
`fs can be updated from 0.53.0 to ${latestStdRelease}`,
) +
"\n" +
- colours.yellow(
+ colours.blue("INFO") + " " + colours.yellow(
`fmt can be updated from 0.53.0 to ${latestStdRelease}`,
) + "\n" +
- colours.yellow(
+ colours.blue("INFO") + " " + colours.yellow(
`uuid can be updated from 0.61.0 to ${latestStdRelease}`,
) + "\n" +
- "To update, run: \n" +
+ colours.blue("INFO") + " To update, run: \n" +
" dmm update drash fs fmt uuid" +
"\n",
);
@@ -256,9 +254,9 @@ Deno.test({
assertEquals(stderr, "");
assertEquals(
stdout,
- "Reading deps.ts to gather your dependencies...\n" +
- "Comparing versions...\n" +
- colours.green("Your dependencies are up to date") + "\n",
+ colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") + " Comparing versions...\n" +
+ colours.blue("INFO") + " " + colours.green("Your dependencies are up to date") + "\n",
);
assertEquals(status.code, 0);
assertEquals(status.success, true);
@@ -289,16 +287,12 @@ Deno.test({
p.close();
const output = await p.output();
const stdout = new TextDecoder("utf-8").decode(output);
- const error = await p.stderrOutput();
- const stderr = new TextDecoder("utf-8").decode(error);
- assertEquals(
- stderr,
- colours.red("Modules specified do not exist in your dependencies.") +
- "\n",
- );
+ const stderr = await p.stderrOutput()
+ assertEquals(new TextDecoder().decode(stderr), "")
assertEquals(
stdout,
- "Reading deps.ts to gather your dependencies...\n",
+ colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.red("ERROR") + " " + colours.red("Modules specified do not exist in your dependencies.") + "\n"
);
assertEquals(status.code, 1);
assertEquals(status.success, false);
@@ -328,16 +322,12 @@ Deno.test({
p.close();
const output = await p.output();
const stdout = new TextDecoder("utf-8").decode(output);
- const error = await p.stderrOutput();
- const stderr = new TextDecoder("utf-8").decode(error);
- assertEquals(
- stderr,
- colours.red("Modules specified do not exist in your dependencies.") +
- "\n",
- );
+ const stderr = await p.stderrOutput()
+ assertEquals(new TextDecoder().decode(stderr), "")
assertEquals(
- stdout,
- "Reading deps.ts to gather your dependencies...\n",
+ stdout,
+ colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.red("ERROR") + " " + colours.red("Modules specified do not exist in your dependencies.") + "\n"
);
assertEquals(status.code, 1);
assertEquals(status.success, false);
@@ -371,12 +361,12 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stderr,
- colours.red("Modules specified do not exist in your dependencies.") +
- "\n",
+ "",
);
assertEquals(
stdout,
- "Reading deps.ts to gather your dependencies...\n",
+ colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.red("ERROR") + " " + colours.red("Modules specified do not exist in your dependencies.") + "\n"
);
assertEquals(status.code, 1);
assertEquals(status.success, false);
diff --git a/tests/integration/info_test.ts b/tests/integration/info_test.ts
index 8e1928e..d25796d 100644
--- a/tests/integration/info_test.ts
+++ b/tests/integration/info_test.ts
@@ -24,11 +24,11 @@ Deno.test({
const stdout = new TextDecoder("utf-8").decode(output);
const error = await p.stderrOutput();
const stderr = new TextDecoder("utf-8").decode(error);
- assertEquals(stdout, "");
+ assertEquals(stdout, colours.red("ERROR") + " " + colours.red("Specify a single module to get information on. See --help") +
+ "\n");
assertEquals(
stderr,
- colours.red("Specify a single module to get information on. See --help") +
- "\n",
+ ""
);
assertEquals(status.code, 1);
assertEquals(status.success, false);
@@ -55,7 +55,7 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- "\n" +
+ colours.blue("INFO") + " " + "\n" +
"Information on drash\n" +
"\n" +
" - Name: drash\n" +
@@ -92,7 +92,7 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- "\n" +
+ colours.blue("INFO") + " " + "\n" +
"Information on fs\n" +
"\n" +
" - Name: fs\n" +
@@ -135,11 +135,11 @@ Deno.test({
const stdout = new TextDecoder("utf-8").decode(output);
const error = await p.stderrOutput();
const stderr = new TextDecoder("utf-8").decode(error);
- assertEquals(stdout, "");
+ assertEquals(stdout, colours.red("ERROR") + " " + colours.red("Specify a single module to get information on. See --help") +
+ "\n");
assertEquals(
stderr,
- colours.red("Specify a single module to get information on. See --help") +
- "\n",
+ ""
);
assertEquals(status.code, 1);
assertEquals(status.success, false);
@@ -170,10 +170,11 @@ Deno.test({
const stdout = new TextDecoder("utf-8").decode(output);
const error = await p.stderrOutput();
const stderr = new TextDecoder("utf-8").decode(error);
- assertEquals(stdout, "");
+ assertEquals(stdout, colours.red("ERROR") + " " + colours.red("No module was found with somethinggg") + "\n",
+ );
assertEquals(
stderr,
- colours.red("No module was found with somethinggg") + "\n",
+ "",
);
assertEquals(status.code, 1);
assertEquals(status.success, false);
diff --git a/tests/integration/update_test.ts b/tests/integration/update_test.ts
index f3b850f..1c63c56 100644
--- a/tests/integration/update_test.ts
+++ b/tests/integration/update_test.ts
@@ -72,9 +72,9 @@ Deno.test({
const error = await p.stderrOutput();
const stderr = new TextDecoder("utf-8").decode(error);
const expected =
- "Reading deps.ts to gather your dependencies...\n" +
- "Checking if your modules can be updated...\n" +
- colours.green(
+ colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") + " Checking if your modules can be updated...\n" +
+ colours.blue("INFO") + " " + colours.green(
`fs was updated from 0.53.0 to ${latestStdRelease}`,
) + "\n";
assertEquals(
@@ -127,9 +127,9 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- "Reading deps.ts to gather your dependencies...\n" +
- "Checking if your modules can be updated...\n" +
- colours.green("Everything is already up to date") + "\n",
+ colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") + " Checking if your modules can be updated...\n" +
+ colours.blue("INFO") + " " + colours.green("Everything is already up to date") + "\n",
);
assertEquals(stderr, "");
assertEquals(status.code, 0);
@@ -173,12 +173,12 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- "Reading deps.ts to gather your dependencies...\n" +
- "Checking if your modules can be updated...\n" +
- colours.green(
+ colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") + " Checking if your modules can be updated...\n" +
+ colours.blue("INFO") + " " + colours.green(
`fs was updated from 0.53.0 to ${latestStdRelease}`,
) + "\n" +
- colours.green(
+ colours.blue("INFO") + " " + colours.green(
`fmt was updated from 0.53.0 to ${latestStdRelease}`,
) + "\n",
);
@@ -234,9 +234,9 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- "Reading deps.ts to gather your dependencies...\n" +
- "Checking if your modules can be updated...\n" +
- colours.green("Everything is already up to date") + "\n",
+ colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") + " Checking if your modules can be updated...\n" +
+ colours.blue("INFO") + " " + colours.green("Everything is already up to date") + "\n",
);
assertEquals(stderr, "");
assertEquals(status.code, 0);
@@ -276,17 +276,17 @@ Deno.test({
const error = await p.stderrOutput();
const stderr = new TextDecoder("utf-8").decode(error);
const assertedOutput =
- "Reading deps.ts to gather your dependencies...\n" +
- "Checking if your modules can be updated...\n" +
- colours.green(`drash was updated from v1.0.0 to ${latestDrashRelease}`) +
+ colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") + " Checking if your modules can be updated...\n" +
+ colours.blue("INFO") + " " + colours.green(`drash was updated from v1.0.0 to ${latestDrashRelease}`) +
"\n" +
- colours.green(
+ colours.blue("INFO") + " " + colours.green(
`fs was updated from 0.53.0 to ${latestStdRelease}`,
) + "\n" +
- colours.green(
+ colours.blue("INFO") + " " + colours.green(
`fmt was updated from 0.53.0 to ${latestStdRelease}`,
) + "\n" +
- colours.green(
+ colours.blue("INFO") + " " + colours.green(
`uuid was updated from 0.61.0 to ${latestStdRelease}`,
) + "\n";
assertEquals(stdout, assertedOutput);
@@ -343,9 +343,9 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- "Reading deps.ts to gather your dependencies...\n" +
- "Checking if your modules can be updated...\n" +
- colours.green("Everything is already up to date") + "\n",
+ colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") + " Checking if your modules can be updated...\n" +
+ colours.blue("INFO") + " " + colours.green("Everything is already up to date") + "\n",
);
assertEquals(stderr, "");
assertEquals(status.code, 0);
@@ -387,9 +387,9 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- "Reading deps.ts to gather your dependencies...\n" +
- "Checking if your modules can be updated...\n" +
- colours.green(
+ colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") + " Checking if your modules can be updated...\n" +
+ colours.blue("INFO") + " " + colours.green(
`drash was updated from v1.0.0 to ${latestDrashRelease}`,
) + "\n",
);
@@ -437,12 +437,13 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- "Reading deps.ts to gather your dependencies...\n",
+ colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.red("ERROR") + " " + colours.red("Modules specified do not exist in your dependencies.") +
+ "\n"
);
assertEquals(
stderr,
- colours.red("Modules specified do not exist in your dependencies.") +
- "\n",
+ ""
);
assertEquals(status.code, 1);
assertEquals(status.success, false);
@@ -484,12 +485,12 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- "Reading deps.ts to gather your dependencies...\n" +
- "Checking if your modules can be updated...\n" +
- colours.green(
+ colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") + " Checking if your modules can be updated...\n" +
+ colours.blue("INFO") + " " + colours.green(
`drash was updated from v1.0.0 to ${latestDrashRelease}`,
) + "\n" +
- colours.green(
+ colours.blue("INFO") + " " + colours.green(
`fmt was updated from 0.53.0 to ${latestStdRelease}`,
) + "\n",
);
@@ -544,9 +545,9 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- "Reading deps.ts to gather your dependencies...\n" +
- "Checking if your modules can be updated...\n" +
- colours.green(
+ colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") + " Checking if your modules can be updated...\n" +
+ colours.blue("INFO") + " " + colours.green(
`fs was updated from 0.53.0 to ${latestStdRelease}`,
) + "\n",
);
From 98e3c374c73b50d92a201c021131a5dc1ab35494 Mon Sep 17 00:00:00 2001
From: Edward Bebbington
Date: Wed, 21 Oct 2020 09:13:50 +0100
Subject: [PATCH 12/39] Improve bump versions script
---
console/bump_versions.ts | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/console/bump_versions.ts b/console/bump_versions.ts
index 2b7f26c..45078a1 100644
--- a/console/bump_versions.ts
+++ b/console/bump_versions.ts
@@ -1,22 +1,19 @@
import { bumpVersions } from "https://raw.githubusercontent.com/drashland/services/master/console/bump_versions.ts";
-const branch: string = Deno.args[0].split("=")[1]; // ["--version", "release-vX.X.X"]
-const version = branch.substring(branch.indexOf("v") + 1); // 1.0.5
-
-bumpVersions([
+bumpVersions(Deno.args, [
{
filename: "./egg.json",
replaceTheRegex: /"version": "[0-9\.]+[0-9\.]+[0-9\.]"/,
- replaceWith: `"version": "${version}"`,
+ replaceWith: `"version": "{{ version }}"`,
},
{
filename: "./README.md",
replaceTheRegex: /dmm@v[0-9\.]+[0-9\.]+[0-9\.]/g,
- replaceWith: `dmm@v${version}`,
+ replaceWith: `dmm@v{{ version }}`,
},
{
filename: "./src/commands/version.ts",
replaceTheRegex: /version = "[0-9\.]+[0-9\.]+[0-9\.]"/,
- replaceWith: `version = "${version}"`,
+ replaceWith: `version = "{{ version }}"`,
},
]);
From 0c10ea3c61e7d06c4dd79982356289b2ce79c2e4 Mon Sep 17 00:00:00 2001
From: Edward Bebbington
Date: Wed, 21 Oct 2020 09:19:27 +0100
Subject: [PATCH 13/39] fix tests
---
tests/integration/error_test.ts | 62 ++-------------------------------
tests/integration/help_test.ts | 10 ++----
2 files changed, 5 insertions(+), 67 deletions(-)
diff --git a/tests/integration/error_test.ts b/tests/integration/error_test.ts
index 72bfaf1..340b333 100644
--- a/tests/integration/error_test.ts
+++ b/tests/integration/error_test.ts
@@ -17,7 +17,6 @@ Deno.test({
const error = await p.stderrOutput();
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(stdout,
- colours.red("ERROR") + " Invalid arguments" + "\n" +
"\n" +
"A module manager for Deno.\n" +
"\n" +
@@ -41,16 +40,10 @@ Deno.test({
" Shows information about the given module, be it std or 3rd party. The 3rd party \n" +
" module must be referenced at https://deno.land/x/\n" +
"\n" +
- " --help\n" +
+ " help, --help\n" +
" Prints the help message\n" +
"\n" +
- " --version\n" +
- " Prints the current dmm version\n" +
- "\n" +
- " help\n" +
- " Prints the help message\n" +
- "\n" +
- " version\n" +
+ " version, --version\n" +
" Prints the current dmm version\n" +
"\n" +
"\n" +
@@ -97,56 +90,7 @@ Deno.test({
const error = await p.stderrOutput();
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(stdout,
- colours.red("ERROR") + " Invalid arguments" + "\n" +
- "\n" +
- "A module manager for Deno.\n" +
- "\n" +
- "USAGE\n" +
- "\n" +
- " deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts\n" +
- " dmm [command]\n" +
- "\n" +
- "\n" +
- "COMMANDS\n" +
- "\n" +
- " check [modules]\n" +
- " Checks the specified modules for newer version. Will check all if modules are \n" +
- " omitted.\n" +
- "\n" +
- " update [modules]\n" +
- " Updates the specified modules to the newest version. Will update all if modules \n" +
- " are omitted.\n" +
- "\n" +
- " info\n" +
- " Shows information about the given module, be it std or 3rd party. The 3rd party \n" +
- " module must be referenced at https://deno.land/x/\n" +
- "\n" +
- " --help\n" +
- " Prints the help message\n" +
- "\n" +
- " --version\n" +
- " Prints the current dmm version\n" +
- "\n" +
- " help\n" +
- " Prints the help message\n" +
- "\n" +
- " version\n" +
- " Prints the current dmm version\n" +
- "\n" +
- "\n" +
- "EXAMPLE USAGE\n" +
- "\n" +
- " Install dmm\n" +
- " deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts\n" +
- "\n" +
- " Check a single module\n" +
- " dmm check fs\n" +
- "\n" +
- " Update a single module\n" +
- " dmm update fs\n" +
- "\n" +
- " Get information about a module\n" +
- " dmm info http" + "\n\n"
+ colours.red("ERROR") + " Command `something` not recognized.\n"
);
assertEquals(stderr, "");
assertEquals(status.code, 0);
diff --git a/tests/integration/help_test.ts b/tests/integration/help_test.ts
index 9d6d49c..0d14f37 100644
--- a/tests/integration/help_test.ts
+++ b/tests/integration/help_test.ts
@@ -42,16 +42,10 @@ Deno.test({
" Shows information about the given module, be it std or 3rd party. The 3rd party \n" +
" module must be referenced at https://deno.land/x/\n" +
"\n" +
- " --help\n" +
+ " help, --help\n" +
" Prints the help message\n" +
"\n" +
- " --version\n" +
- " Prints the current dmm version\n" +
- "\n" +
- " help\n" +
- " Prints the help message\n" +
- "\n" +
- " version\n" +
+ " version, --version\n" +
" Prints the current dmm version\n" +
"\n" +
"\n" +
From 613dd215890f77ae91461312b57cf5f48e6be7f7 Mon Sep 17 00:00:00 2001
From: Edward Bebbington
Date: Wed, 21 Oct 2020 09:19:38 +0100
Subject: [PATCH 14/39] deno fmt
---
src/commands/check.ts | 2 +-
src/commands/info.ts | 2 +-
src/commands/update.ts | 2 +-
src/services/module_service.ts | 2 +-
tests/integration/check_test.ts | 65 +++++++++++++++++++++-----------
tests/integration/error_test.ts | 12 +++---
tests/integration/info_test.ts | 33 +++++++++++-----
tests/integration/update_test.ts | 63 +++++++++++++++++++------------
8 files changed, 115 insertions(+), 66 deletions(-)
diff --git a/src/commands/check.ts b/src/commands/check.ts
index 00df828..f9345ad 100644
--- a/src/commands/check.ts
+++ b/src/commands/check.ts
@@ -1,4 +1,4 @@
-import {colours, logError, logInfo} from "../../deps.ts";
+import { colours, logError, logInfo } from "../../deps.ts";
import IModule from "../interfaces/module.ts";
import ModuleService from "../services/module_service.ts";
diff --git a/src/commands/info.ts b/src/commands/info.ts
index 3805c61..3d12916 100644
--- a/src/commands/info.ts
+++ b/src/commands/info.ts
@@ -1,4 +1,4 @@
-import {colours, logError, logInfo} from "../../deps.ts";
+import { colours, logError, logInfo } from "../../deps.ts";
import DenoService from "../services/deno_service.ts";
/**
diff --git a/src/commands/update.ts b/src/commands/update.ts
index 40bff1f..95bd421 100644
--- a/src/commands/update.ts
+++ b/src/commands/update.ts
@@ -1,4 +1,4 @@
-import {colours, logError, logInfo} from "../../deps.ts";
+import { colours, logError, logInfo } from "../../deps.ts";
import IModule from "../interfaces/module.ts";
import ModuleService from "../services/module_service.ts";
diff --git a/src/services/module_service.ts b/src/services/module_service.ts
index 1fed832..9f5df28 100644
--- a/src/services/module_service.ts
+++ b/src/services/module_service.ts
@@ -1,5 +1,5 @@
import IModule from "../interfaces/module.ts";
-import {colours, logError, logInfo} from "../../deps.ts";
+import { colours, logError, logInfo } from "../../deps.ts";
import DenoService from "../services/deno_service.ts";
export default class ModuleService {
diff --git a/tests/integration/check_test.ts b/tests/integration/check_test.ts
index 67cfb45..ee781ca 100644
--- a/tests/integration/check_test.ts
+++ b/tests/integration/check_test.ts
@@ -36,9 +36,11 @@ Deno.test({
assertEquals(stderr, "");
assertEquals(
stdout,
- colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") +
+ " Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Comparing versions...\n" +
- colours.blue("INFO") + " " + colours.yellow(`fs can be updated from 0.53.0 to ${latestStdRelease}`) +
+ colours.blue("INFO") + " " +
+ colours.yellow(`fs can be updated from 0.53.0 to ${latestStdRelease}`) +
"\n" +
colours.blue("INFO") + " To update, run: \n" +
" dmm update fs" +
@@ -78,9 +80,11 @@ Deno.test({
assertEquals(stderr, "");
assertEquals(
stdout,
- colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") +
+ " Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Comparing versions...\n" +
- colours.blue("INFO") + " " + colours.green("Your dependencies are up to date") + "\n",
+ colours.blue("INFO") + " " +
+ colours.green("Your dependencies are up to date") + "\n",
);
assertEquals(status.code, 0);
assertEquals(status.success, true);
@@ -117,12 +121,13 @@ Deno.test({
assertEquals(stderr, "");
assertEquals(
stdout,
- colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") +
+ " Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Comparing versions...\n" +
colours.blue("INFO") + " " + colours.yellow(
`drash can be updated from v1.0.0 to ${latestDrashRelease}`,
) + "\n" +
- colours.blue("INFO") + " " +colours.yellow(
+ colours.blue("INFO") + " " + colours.yellow(
`fs can be updated from 0.53.0 to ${latestStdRelease}`,
) +
"\n" +
@@ -165,9 +170,11 @@ Deno.test({
assertEquals(stderr, "");
assertEquals(
stdout,
- colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") +
+ " Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Comparing versions...\n" +
- colours.blue("INFO") + " " + colours.green("Your dependencies are up to date") + "\n",
+ colours.blue("INFO") + " " +
+ colours.green("Your dependencies are up to date") + "\n",
);
assertEquals(status.code, 0);
assertEquals(status.success, true);
@@ -202,7 +209,8 @@ Deno.test({
assertEquals(stderr, "");
assertEquals(
stdout,
- colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") +
+ " Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Comparing versions...\n" +
colours.blue("INFO") + " " + colours.yellow(
`drash can be updated from v1.0.0 to ${latestDrashRelease}`,
@@ -214,7 +222,7 @@ Deno.test({
colours.blue("INFO") + " " + colours.yellow(
`fmt can be updated from 0.53.0 to ${latestStdRelease}`,
) + "\n" +
- colours.blue("INFO") + " " + colours.yellow(
+ colours.blue("INFO") + " " + colours.yellow(
`uuid can be updated from 0.61.0 to ${latestStdRelease}`,
) + "\n" +
colours.blue("INFO") + " To update, run: \n" +
@@ -254,9 +262,11 @@ Deno.test({
assertEquals(stderr, "");
assertEquals(
stdout,
- colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") +
+ " Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Comparing versions...\n" +
- colours.blue("INFO") + " " + colours.green("Your dependencies are up to date") + "\n",
+ colours.blue("INFO") + " " +
+ colours.green("Your dependencies are up to date") + "\n",
);
assertEquals(status.code, 0);
assertEquals(status.success, true);
@@ -287,12 +297,15 @@ Deno.test({
p.close();
const output = await p.output();
const stdout = new TextDecoder("utf-8").decode(output);
- const stderr = await p.stderrOutput()
- assertEquals(new TextDecoder().decode(stderr), "")
+ const stderr = await p.stderrOutput();
+ assertEquals(new TextDecoder().decode(stderr), "");
assertEquals(
stdout,
- colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
- colours.red("ERROR") + " " + colours.red("Modules specified do not exist in your dependencies.") + "\n"
+ colours.blue("INFO") +
+ " Reading deps.ts to gather your dependencies...\n" +
+ colours.red("ERROR") + " " +
+ colours.red("Modules specified do not exist in your dependencies.") +
+ "\n",
);
assertEquals(status.code, 1);
assertEquals(status.success, false);
@@ -322,12 +335,15 @@ Deno.test({
p.close();
const output = await p.output();
const stdout = new TextDecoder("utf-8").decode(output);
- const stderr = await p.stderrOutput()
- assertEquals(new TextDecoder().decode(stderr), "")
+ const stderr = await p.stderrOutput();
+ assertEquals(new TextDecoder().decode(stderr), "");
assertEquals(
- stdout,
- colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
- colours.red("ERROR") + " " + colours.red("Modules specified do not exist in your dependencies.") + "\n"
+ stdout,
+ colours.blue("INFO") +
+ " Reading deps.ts to gather your dependencies...\n" +
+ colours.red("ERROR") + " " +
+ colours.red("Modules specified do not exist in your dependencies.") +
+ "\n",
);
assertEquals(status.code, 1);
assertEquals(status.success, false);
@@ -365,8 +381,11 @@ Deno.test({
);
assertEquals(
stdout,
- colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
- colours.red("ERROR") + " " + colours.red("Modules specified do not exist in your dependencies.") + "\n"
+ colours.blue("INFO") +
+ " Reading deps.ts to gather your dependencies...\n" +
+ colours.red("ERROR") + " " +
+ colours.red("Modules specified do not exist in your dependencies.") +
+ "\n",
);
assertEquals(status.code, 1);
assertEquals(status.success, false);
diff --git a/tests/integration/error_test.ts b/tests/integration/error_test.ts
index 340b333..874bd57 100644
--- a/tests/integration/error_test.ts
+++ b/tests/integration/error_test.ts
@@ -16,8 +16,9 @@ Deno.test({
const stdout = new TextDecoder("utf-8").decode(output);
const error = await p.stderrOutput();
const stderr = new TextDecoder("utf-8").decode(error);
- assertEquals(stdout,
- "\n" +
+ assertEquals(
+ stdout,
+ "\n" +
"A module manager for Deno.\n" +
"\n" +
"USAGE\n" +
@@ -59,7 +60,7 @@ Deno.test({
" dmm update fs\n" +
"\n" +
" Get information about a module\n" +
- " dmm info http" + "\n\n"
+ " dmm info http" + "\n\n",
);
assertEquals(stderr, "");
assertEquals(status.code, 0);
@@ -89,8 +90,9 @@ Deno.test({
const stdout = new TextDecoder("utf-8").decode(output);
const error = await p.stderrOutput();
const stderr = new TextDecoder("utf-8").decode(error);
- assertEquals(stdout,
- colours.red("ERROR") + " Command `something` not recognized.\n"
+ assertEquals(
+ stdout,
+ colours.red("ERROR") + " Command `something` not recognized.\n",
);
assertEquals(stderr, "");
assertEquals(status.code, 0);
diff --git a/tests/integration/info_test.ts b/tests/integration/info_test.ts
index d25796d..040f154 100644
--- a/tests/integration/info_test.ts
+++ b/tests/integration/info_test.ts
@@ -24,11 +24,17 @@ Deno.test({
const stdout = new TextDecoder("utf-8").decode(output);
const error = await p.stderrOutput();
const stderr = new TextDecoder("utf-8").decode(error);
- assertEquals(stdout, colours.red("ERROR") + " " + colours.red("Specify a single module to get information on. See --help") +
- "\n");
+ assertEquals(
+ stdout,
+ colours.red("ERROR") + " " +
+ colours.red(
+ "Specify a single module to get information on. See --help",
+ ) +
+ "\n",
+ );
assertEquals(
stderr,
- ""
+ "",
);
assertEquals(status.code, 1);
assertEquals(status.success, false);
@@ -55,7 +61,7 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- colours.blue("INFO") + " " + "\n" +
+ colours.blue("INFO") + " " + "\n" +
"Information on drash\n" +
"\n" +
" - Name: drash\n" +
@@ -92,7 +98,7 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- colours.blue("INFO") + " " + "\n" +
+ colours.blue("INFO") + " " + "\n" +
"Information on fs\n" +
"\n" +
" - Name: fs\n" +
@@ -135,11 +141,17 @@ Deno.test({
const stdout = new TextDecoder("utf-8").decode(output);
const error = await p.stderrOutput();
const stderr = new TextDecoder("utf-8").decode(error);
- assertEquals(stdout, colours.red("ERROR") + " " + colours.red("Specify a single module to get information on. See --help") +
- "\n");
+ assertEquals(
+ stdout,
+ colours.red("ERROR") + " " +
+ colours.red(
+ "Specify a single module to get information on. See --help",
+ ) +
+ "\n",
+ );
assertEquals(
stderr,
- ""
+ "",
);
assertEquals(status.code, 1);
assertEquals(status.success, false);
@@ -170,7 +182,10 @@ Deno.test({
const stdout = new TextDecoder("utf-8").decode(output);
const error = await p.stderrOutput();
const stderr = new TextDecoder("utf-8").decode(error);
- assertEquals(stdout, colours.red("ERROR") + " " + colours.red("No module was found with somethinggg") + "\n",
+ assertEquals(
+ stdout,
+ colours.red("ERROR") + " " +
+ colours.red("No module was found with somethinggg") + "\n",
);
assertEquals(
stderr,
diff --git a/tests/integration/update_test.ts b/tests/integration/update_test.ts
index 1c63c56..b9d8ef5 100644
--- a/tests/integration/update_test.ts
+++ b/tests/integration/update_test.ts
@@ -71,10 +71,10 @@ Deno.test({
const stdout = new TextDecoder("utf-8").decode(output);
const error = await p.stderrOutput();
const stderr = new TextDecoder("utf-8").decode(error);
- const expected =
- colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
- colours.blue("INFO") + " Checking if your modules can be updated...\n" +
- colours.blue("INFO") + " " + colours.green(
+ const expected = colours.blue("INFO") +
+ " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") + " Checking if your modules can be updated...\n" +
+ colours.blue("INFO") + " " + colours.green(
`fs was updated from 0.53.0 to ${latestStdRelease}`,
) + "\n";
assertEquals(
@@ -127,9 +127,11 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") +
+ " Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Checking if your modules can be updated...\n" +
- colours.blue("INFO") + " " + colours.green("Everything is already up to date") + "\n",
+ colours.blue("INFO") + " " +
+ colours.green("Everything is already up to date") + "\n",
);
assertEquals(stderr, "");
assertEquals(status.code, 0);
@@ -173,7 +175,8 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") +
+ " Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Checking if your modules can be updated...\n" +
colours.blue("INFO") + " " + colours.green(
`fs was updated from 0.53.0 to ${latestStdRelease}`,
@@ -234,9 +237,11 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") +
+ " Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Checking if your modules can be updated...\n" +
- colours.blue("INFO") + " " + colours.green("Everything is already up to date") + "\n",
+ colours.blue("INFO") + " " +
+ colours.green("Everything is already up to date") + "\n",
);
assertEquals(stderr, "");
assertEquals(status.code, 0);
@@ -275,18 +280,19 @@ Deno.test({
const stdout = new TextDecoder("utf-8").decode(output);
const error = await p.stderrOutput();
const stderr = new TextDecoder("utf-8").decode(error);
- const assertedOutput =
- colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
- colours.blue("INFO") + " Checking if your modules can be updated...\n" +
- colours.blue("INFO") + " " + colours.green(`drash was updated from v1.0.0 to ${latestDrashRelease}`) +
+ const assertedOutput = colours.blue("INFO") +
+ " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") + " Checking if your modules can be updated...\n" +
+ colours.blue("INFO") + " " +
+ colours.green(`drash was updated from v1.0.0 to ${latestDrashRelease}`) +
"\n" +
- colours.blue("INFO") + " " + colours.green(
+ colours.blue("INFO") + " " + colours.green(
`fs was updated from 0.53.0 to ${latestStdRelease}`,
) + "\n" +
- colours.blue("INFO") + " " + colours.green(
+ colours.blue("INFO") + " " + colours.green(
`fmt was updated from 0.53.0 to ${latestStdRelease}`,
) + "\n" +
- colours.blue("INFO") + " " + colours.green(
+ colours.blue("INFO") + " " + colours.green(
`uuid was updated from 0.61.0 to ${latestStdRelease}`,
) + "\n";
assertEquals(stdout, assertedOutput);
@@ -343,9 +349,11 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") +
+ " Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Checking if your modules can be updated...\n" +
- colours.blue("INFO") + " " + colours.green("Everything is already up to date") + "\n",
+ colours.blue("INFO") + " " +
+ colours.green("Everything is already up to date") + "\n",
);
assertEquals(stderr, "");
assertEquals(status.code, 0);
@@ -387,7 +395,8 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") +
+ " Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Checking if your modules can be updated...\n" +
colours.blue("INFO") + " " + colours.green(
`drash was updated from v1.0.0 to ${latestDrashRelease}`,
@@ -437,13 +446,15 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
- colours.red("ERROR") + " " + colours.red("Modules specified do not exist in your dependencies.") +
- "\n"
+ colours.blue("INFO") +
+ " Reading deps.ts to gather your dependencies...\n" +
+ colours.red("ERROR") + " " +
+ colours.red("Modules specified do not exist in your dependencies.") +
+ "\n",
);
assertEquals(
stderr,
- ""
+ "",
);
assertEquals(status.code, 1);
assertEquals(status.success, false);
@@ -485,7 +496,8 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") +
+ " Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Checking if your modules can be updated...\n" +
colours.blue("INFO") + " " + colours.green(
`drash was updated from v1.0.0 to ${latestDrashRelease}`,
@@ -545,7 +557,8 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- colours.blue("INFO") + " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") +
+ " Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Checking if your modules can be updated...\n" +
colours.blue("INFO") + " " + colours.green(
`fs was updated from 0.53.0 to ${latestStdRelease}`,
From ad39adc7409ca1a9084a35347a9e575b334c5059 Mon Sep 17 00:00:00 2001
From: Edward Bebbington
Date: Wed, 21 Oct 2020 09:20:14 +0100
Subject: [PATCH 15/39] deno lint
---
src/commands/check.ts | 2 +-
tests/integration/update_test.ts | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/commands/check.ts b/src/commands/check.ts
index f9345ad..5204d8b 100644
--- a/src/commands/check.ts
+++ b/src/commands/check.ts
@@ -27,7 +27,7 @@ export async function check(dependencies: string[]): Promise {
// Compare imported and latest version
logInfo("Comparing versions...");
let depsCanBeUpdated: boolean = false;
- let listOfModuleNamesToBeUpdated: string[] = [];
+ const listOfModuleNamesToBeUpdated: string[] = [];
modules.forEach((module) => {
if (module.importedVersion !== module.latestRelease) {
depsCanBeUpdated = true;
diff --git a/tests/integration/update_test.ts b/tests/integration/update_test.ts
index b9d8ef5..d6eade2 100644
--- a/tests/integration/update_test.ts
+++ b/tests/integration/update_test.ts
@@ -43,6 +43,7 @@ function removeDependencyFile(dir: string): void {
const path = "tests/" + dir + "/deps.ts";
Deno.removeSync(path);
} catch (err) {
+ // do nothing
}
}
From 098bb27b63acd986426735bf07f9ee78b95c8624 Mon Sep 17 00:00:00 2001
From: Edward Bebbington
Date: Wed, 21 Oct 2020 10:14:53 +0100
Subject: [PATCH 16/39] Tidied up README
---
.README.md | 228 -----------------------------------------------------
README.md | 170 ++-------------------------------------
2 files changed, 6 insertions(+), 392 deletions(-)
delete mode 100644 .README.md
diff --git a/.README.md b/.README.md
deleted file mode 100644
index 8d9d439..0000000
--- a/.README.md
+++ /dev/null
@@ -1,228 +0,0 @@
-
-
-
Deno Module Manager
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
----
-
-`dmm` (pronounced "Dim") is a Deno module manager. Updating your dependencies within `deps.ts` and checking if new versions are available hasn't been easier.
-
-`dmm` will read your imported/exported modules that sit inside your `deps.ts` and check them against their latest version if you ask it to, and update them if you want it to.
-
-# Contents
-
-* [Features](#features)
-* [Quick Start](#quick-start)
-* [Example](#example)
-* [How it Works](#how-it-works)
-* [Contributing](#contributing)
-* [License](#license)
-
-# Features
-
-* Zero dependencies
-* Easy and simple to use
-* Checks dependencies for newer versions
-* Will update your dependencies for you
-* Gives information on modules
-* Accounts for 3rd party and `std` modules
-* Installation is optional
-* Will be kept up to date and maintained consistently
-* No variants of `node_modules` and `package.json`
-* No extra configuration around import maps
-
-# Quick Start
-
-There are two ways you can use this module: installing it though `deno`, or running it though a URL.
-
-As dmm only needs to read and write to your `deps.ts`, as well as requiring network access using Deno's CDN and API, you can restrict the access this module has.
-
-*Install*
-```
-$ deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts
-$ dmm ...
-```
-
-*Through the URL*
-
-If you are using this method, be sure to use the latest version of dmm in the command below
-```
-$ deno run --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts ...
-```
-
-In the examples below, dmm is installed and we will be using it that way to make the commands easier to read.
-
-# Example
-
-In this example, we are going to run through every step of dmm. We will be checking dependencies, updating them, and getting information about certain ones.
-
-**Step 1 - Info**
-
-Say I want to get information about the fmt module:
-
-```
-$ dmm info fmt
-
-Information on fmt
-
- - Name: fmt
- - Description: Cannot retrieve descriptions for std modules
- - deno.land Link: https://deno.land/std@{{ latestStdVersion }}/fmt
- - GitHub Repository: https://github.com/denoland/deno/tree/master/std/fmt
- - Import Statement: import * as fmt from "https://deno.land/std@{{ latestStdVersion }}/fmt";
- - Latest Version: {{ latestStdVersion }}
-
-```
-
-**Step 2 - Adding `fmt` as a dependency to use `colors`**
-
-Along with my current dependencies, I decided to import the `colors` sub-module of `fmt` in my `deps.ts` file:
-
-```typescript
-export { Drash } from "https://deno.land/x/drash@v1.0.0/mod.ts"; // out of date
-
-import * as fs from "https://deno.land/std@0.53.0/fs/mod.ts"; // out of date
-
-import * as colors from "https://deno.land/std@{{ latestStdVersion }}/fmt/colors.ts"; // up to date
-
-export { fs, colors }
-```
-
-Take notice of the out of date dependencies.
-
-**Step 3 - Check**
-
-Now we want to check if any of our dependencies need updating, but we don't want to update them yet.
-
-```
-$ dmm check
-...
-drash can be updated from v1.0.0 to {{ latestDrashVersion }}
-fs can be updated from 0.53.0 to {{ latestStdVersion }}
-...
-```
-
-**Step 4 - Update**
-
-Lets update our dependencies as some are out of date:
-
-```
-$ dmm update
-...
-drash was updated from v1.0.0 to {{ latestDrashVersion }}
-fs was updated from 0.53.0 to {{ latestStdVersion }}
-...
-```
-
-Now lets check the `deps.ts` file, and you will notice the versions have been modified:
-
-```typescript
-export { Drash } from "https://deno.land/x/drash@{{ latestDrashVersion }}/mod.ts"; // was out of date
-
-import * as fs from "https://deno.land/std@{{ latestStdVersion }}/fs/mod.ts"; // was out of date
-
-import * as colors from "https://deno.land/std@{{ latestStdVersion }}/fmt/colors.ts";
-
-export { fs, colors }
-```
-
-**Step 5 - Help**
-
-Should you need any more information, use the `--help` option:
-
-```
-$ dmm --help
-
-A module manager for Deno.
-
-USAGE:
- deno run --allow-read --allow-net [--allow-write] https://deno.land/x/dmm@v1.1.5/mod.ts [ARGS] [MODULES]
-
- dmm [ARGS] [MODULES]
-
-ARGUMENTS:
-The check and update arguments cannot be used together.
-
- check
- Checks the specified modules for newer version. Will check all if modules are omitted.
-
- update
- Updates the specified modules to the newest version. Will update all if modules are omitted.
-
- info
- Shows information about the given module, be it std or 3rd party. The 3rd party module must be referenced at https://deno.land/x/
-
-OPTIONS:
- --help
- Prints help message
- --version
- Prints dmm version
-
-EXAMPLE USAGE:
- Assume you are importing an out of date version of `fs` from `std`. See [here](#quick-start) for adding further restrictions.
- deno run --allow-net --allow-read https://deno.land/x/dmm@v1.1.5/mod.ts check fs
- deno run --allow-net --allow-read --allow-write https://deno.land/x/dmm@v1.1.5/mod.ts update fs
- deno run --allow-net https://deno.land/x/dmm@v1.1.5/mod.ts info http
- dmm info http
-
-```
-
-# How it Works
-
-dmm will only read modules that reside on [deno.land](https://deno.land), whether they are 3rd party or `std` modules. As long as you are either importing then exporting a module, or only exporting a module, dmm will check that dependency.
-
-* Your dependencies must be versioned. Not versioning your dependencies is bad practice and can lead to many problems in your project, which is why dmm will not support it. For example:
- ```
- import { red } from "https://deno.land/std@0.56.0/fmt/colors.ts";
- ^^^^^^^
- ```
-
-* dmm only supports importing/exporting modules from Deno's registry: [deno.land](https://deno.land), 3rd party or `std`. For example:
- ```
- import { red } from "https://deno.land/std@0.56.0/fmt/colors.ts"; // supported
- import { something } from "https://deno.land/x/something@0v1.0.0/mod.ts"; // supported
- ```
-
-* dmm will read every `from "https://deno.land/..."` line in your `deps.ts` and using the name and version, will convert the dependencies into objects.
-
-* dmm will then retrieve the rest of the required information for later use for each module:
- * Latest version - For std and 3rd party, this is pulled using `https://cdn.deno.land`.
- * GitHub URL - Retrieved through the GitHub API
- * Description - For 3rd party modules, it is taken from `https://api.deno.land`. There is currently no way to get descriptions for std modules.
-
-* After this, dmm will run different actions based on the purpose:
-
- * **check**
-
- Will compare the version you are using of a module with the latest one
-
- * **update**
-
- If the latest version is more recent than the one you use for a given module, dmm will update the version in your `deps.ts` file
-
- * **info**
-
- Displays information about the given module using information collated at the start of the script
-
-## Contributing
-
-Contributors are welcomed!
-
-Please read through our [contributing guidelines](./.github/CONTRIBUTING.md). Included are directions for opening issues, coding standards, and notes on development.
-
-## License
-By contributing your code, you agree to license your contribution under the [MIT License](./LICENSE).
diff --git a/README.md b/README.md
index 63ebb72..489e8e1 100644
--- a/README.md
+++ b/README.md
@@ -28,7 +28,6 @@
* [Documentation](#documentation)
* [Features](#features)
* [Quick Start](#quick-start)
-* [Example](#example)
* [How it Works](#how-it-works)
* [Mirrors](#mirrors)
* [Contributing](#contributing)
@@ -60,183 +59,26 @@ As dmm only needs to read and write to your `deps.ts`, as well as requiring netw
*Install*
```
$ deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts
-$ dmm ...
+$ dmm help
```
*Through the URL*
```
-$ deno run --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts ...
+$ deno run --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts help
```
In the examples below, dmm is installed and we will be using it that way to make the commands easier to read.
-
-# Example
-In this example, we are going to run through every step of dmm. We will be checking dependencies, updating them, and getting information about certain ones.
-
-**Step 1 - Info**
-
-Say I want to get information about the fmt module:
-
-```
-$ dmm info fmt
-
-Information on fmt
-
- - Name: fmt
- - Description: Cannot retrieve descriptions for std modules
- - deno.land Link: https://deno.land/std@0.74.0/fmt
- - GitHub Repository: https://github.com/denoland/deno/tree/master/std/fmt
- - Import Statement: import * as fmt from "https://deno.land/std@0.74.0/fmt";
- - Latest Version: 0.74.0
-
-```
-
-**Step 2 - Adding `fmt` as a dependency to use `colors`**
-
-Along with my current dependencies, I decided to import the `colors` sub-module of `fmt` in my `deps.ts` file:
-
-```typescript
-export { Drash } from "https://deno.land/x/drash@v1.0.0/mod.ts"; // out of date
-
-import * as fs from "https://deno.land/std@0.53.0/fs/mod.ts"; // out of date
-
-import * as colors from "https://deno.land/std@0.74.0/fmt/colors.ts"; // up to date
-
-export { fs, colors }
-```
-
-Take notice of the out of date dependencies.
-
-**Step 3 - Check**
-
-Now we want to check if any of our dependencies need updating, but we don't want to update them yet.
-
-```
-$ dmm check
-...
-drash can be updated from v1.0.0 to v1.2.5
-fs can be updated from 0.53.0 to 0.74.0
-...
-```
-
-**Step 4 - Update**
-
-Lets update our dependencies as some are out of date:
-
-```
-$ dmm update
-...
-drash was updated from v1.0.0 to v1.2.5
-fs was updated from 0.53.0 to 0.74.0
-...
-```
-
-Now lets check the `deps.ts` file, and you will notice the versions have been modified:
-
-```typescript
-export { Drash } from "https://deno.land/x/drash@v1.2.5/mod.ts"; // was out of date
-
-import * as fs from "https://deno.land/std@0.74.0/fs/mod.ts"; // was out of date
-
-import * as colors from "https://deno.land/std@0.74.0/fmt/colors.ts";
-
-export { fs, colors }
-```
-
-**Step 5 - Help**
-
-Should you need any more information, use the `--help` option:
-
-```
-A module manager for Deno.
-
-USAGE
-
- deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts
- dmm [command]
-
-
-COMMANDS
-
- check [modules]
- Checks the specified modules for newer version. Will check all if modules are
- omitted.
-
- update [modules]
- Updates the specified modules to the newest version. Will update all if modules
- are omitted.
-
- info
- Shows information about the given module, be it std or 3rd party. The 3rd party
- module must be referenced at https://deno.land/x/
-
- --help
- Prints the help message
-
- --version
- Prints the current dmm version
-
- help
- Prints the help message
-
- version
- Prints the current dmm version
-
-
-EXAMPLE USAGE
-
- Install dmm
- deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts
-
- Check a single module
- dmm check fs
+# How it Works
- Update a single module
- dmm update fs
+* dmm reads the `deps.ts` file at the current working directory. It will check for versioned imports/exports and check or update against each one
- Get information about a module
- dmm info http
-```
-
-# How it Works
+* dmm currently only supports the deno.land registry (https://deno.land)
+* For updating, dmm will fetch the latest version/release for each dependency and update your `deps.ts` if it is newer than the one you use
dmm will only read modules that reside on [deno.land](https://deno.land), whether they are 3rd party or `std` modules. As long as you are either importing then exporting a module, or only exporting a module, dmm will check that dependency.
-* Your dependencies must be versioned. Not versioning your dependencies is bad practice and can lead to many problems in your project, which is why dmm will not support it. For example:
- ```
- import { red } from "https://deno.land/std@0.56.0/fmt/colors.ts";
- ^^^^^^^
- ```
-
-* dmm only supports importing/exporting modules from Deno's registry: [deno.land](https://deno.land), 3rd party or `std`. For example:
- ```
- import { red } from "https://deno.land/std@0.56.0/fmt/colors.ts"; // supported
- import { something } from "https://deno.land/x/something@0v1.0.0/mod.ts"; // supported
- ```
-
-* dmm will read every `from "https://deno.land/..."` line in your `deps.ts` and using the name and version, will convert the dependencies into objects.
-
-* dmm will then retrieve the rest of the required information for later use for each module:
- * Latest version - For std and 3rd party, this is pulled using `https://cdn.deno.land`.
- * GitHub URL - Retrieved through the GitHub API
- * Description - For 3rd party modules, it is taken from `https://api.deno.land`. There is currently no way to get descriptions for std modules.
-
-* After this, dmm will run different actions based on the purpose:
-
- * **check**
-
- Will compare the version you are using of a module with the latest one
-
- * **update**
-
- If the latest version is more recent than the one you use for a given module, dmm will update the version in your `deps.ts` file
-
- * **info**
-
- Displays information about the given module using information collated at the start of the script
-
## Mirrors
* https://nest.land/package/dmm
From 9352591a591229d5ba95390e7b5d0cbdc8f64843 Mon Sep 17 00:00:00 2001
From: Edward Bebbington
Date: Wed, 21 Oct 2020 10:21:53 +0100
Subject: [PATCH 17/39] Re-use logic from services to update version strings
following bumper
---
console/update_deno_version_strings.ts | 107 ++++++-------------------
1 file changed, 24 insertions(+), 83 deletions(-)
diff --git a/console/update_deno_version_strings.ts b/console/update_deno_version_strings.ts
index 3db3c94..ee9845e 100644
--- a/console/update_deno_version_strings.ts
+++ b/console/update_deno_version_strings.ts
@@ -1,85 +1,26 @@
-// Overview
-//
-// Updates deno version strings in files.
-// This scripts main purpose is to aid the `bumper`,
-// removing any extra manual work when we bump the deno version
+import { bumper } from "https://raw.githubusercontent.com/drashland/services/master/console/bumper.ts";
-let fileContent = "";
-const decoder = new TextDecoder();
-const encoder = new TextEncoder();
-let fetchRes = await fetch("https://cdn.deno.land/deno/meta/versions.json");
-let versions: {
- latest: string;
- versions: string[];
-} = await fetchRes.json(); // eg { latest: "v1.3.3", versions: ["v1.3.2", ...] }
-const latestDenoVersion = versions.latest.replace("v", "");
-fetchRes = await fetch("https://cdn.deno.land/std/meta/versions.json");
-versions = await fetchRes.json();
-const latestStdVersion = versions.latest.replace("v", ""); // replacing because std doesn't allow `v` in imports, so it's never seen anymore
-fetchRes = await fetch("https://cdn.deno.land/drash/meta/versions.json");
-versions = await fetchRes.json();
-const latestDrashVersion = versions.latest;
+bumper([
+ {
+ filename: "./.github/workflows/master.yml",
+ replaceTheRegex: /deno: ["[0-9.]+[0-9.]+[0-9]"]/g,
+ replaceWith: `deno: ["{{ latestDenoVersion }}"]`
+ },
+ {
+ filename: "./.github/workflows/bumper.yml",
+ replaceTheRegex: /deno: ["[0-9.]+[0-9.]+[0-9]"]/g,
+ replaceWith: `deno: ["{{ latestDenoVersion }}"]`
+ },
+ {
+ filename: "./tests/integration/up-to-date-deps/original_deps.ts",
+ replaceTheRegex: /std@[0-9.]+[0-9.]+[0-9]/g,
+ replaceWith: "std@{{ latestStdVersion }}"
+ },
+ {
+ filename: "./tests/integration/up-to-date-deps/original_deps.ts",
+ replaceTheRegex: /drash@v[0-9.]+[0-9.]+[0-9]/g,
+ replaceWith: "drash@v{{ latestDrashVersion }}"
+ }
+])
-// Master workflow
-fileContent = decoder.decode(
- await Deno.readFile("./.github/workflows/master.yml"),
-);
-fileContent = fileContent.replace(
- /deno: ["[0-9.]+[0-9.]+[0-9]"]/g,
- `deno: ["${latestDenoVersion}"]`,
-);
-await Deno.writeFile(
- "./.github/workflows/master.yml",
- encoder.encode(fileContent),
-);
-
-// Bumper workflow
-fileContent = decoder.decode(
- await Deno.readFile("./.github/workflows/bumper.yml"),
-);
-fileContent = fileContent.replace(
- /deno: ["[0-9.]+[0-9.]+[0-9]"]/g,
- `deno: ["${latestDenoVersion}"]`,
-);
-await Deno.writeFile(
- "./.github/workflows/bumper.yml",
- encoder.encode(fileContent),
-);
-
-// Readme, all occurrences for std versions
-fileContent = decoder.decode(
- await Deno.readFile("./.README.md"),
-);
-fileContent = fileContent.replace( // imports
- /{{ latestStdVersion }}/g,
- `${latestStdVersion}`,
-);
-fileContent = fileContent.replace( // " was updated from to
- /{{ latestDrashVersion }}/g,
- `${latestDrashVersion}`,
-);
-await Deno.writeFile(
- "./README.md",
- encoder.encode(fileContent),
-);
-
-// up-to-date dependencies for tests
-fileContent = decoder.decode(
- await Deno.readFile("./tests/integration/up-to-date-deps/original_deps.ts"),
-);
-fileContent = fileContent.replace( // imports
- /std@[0-9.]+[0-9.]+[0-9]/g,
- `std@${latestStdVersion}`,
-);
-fileContent = fileContent.replace( // imports
- /drash@v[0-9.]+[0-9.]+[0-9]/g,
- `drash@${latestDrashVersion}`,
-);
-await Deno.writeFile(
- "./tests/integration/up-to-date-deps/original_deps.ts",
- encoder.encode(fileContent),
-);
-await Deno.writeFile(
- "./tests/integration/up-to-date-deps/deps.ts",
- encoder.encode(fileContent),
-);
+//Deno.copyFileSync("./tests/integration/up-to-date-deps/original_deps.ts", "./tests/integration/up-to-date-deps/deps.ts")
\ No newline at end of file
From a7dcc8fe6607effb4919947a72a891eb92c3f127 Mon Sep 17 00:00:00 2001
From: Edward Bebbington
Date: Wed, 21 Oct 2020 10:22:53 +0100
Subject: [PATCH 18/39] deno fmt
---
console/update_deno_version_strings.ts | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/console/update_deno_version_strings.ts b/console/update_deno_version_strings.ts
index ee9845e..22369bb 100644
--- a/console/update_deno_version_strings.ts
+++ b/console/update_deno_version_strings.ts
@@ -4,23 +4,23 @@ bumper([
{
filename: "./.github/workflows/master.yml",
replaceTheRegex: /deno: ["[0-9.]+[0-9.]+[0-9]"]/g,
- replaceWith: `deno: ["{{ latestDenoVersion }}"]`
+ replaceWith: `deno: ["{{ latestDenoVersion }}"]`,
},
{
filename: "./.github/workflows/bumper.yml",
replaceTheRegex: /deno: ["[0-9.]+[0-9.]+[0-9]"]/g,
- replaceWith: `deno: ["{{ latestDenoVersion }}"]`
+ replaceWith: `deno: ["{{ latestDenoVersion }}"]`,
},
{
filename: "./tests/integration/up-to-date-deps/original_deps.ts",
replaceTheRegex: /std@[0-9.]+[0-9.]+[0-9]/g,
- replaceWith: "std@{{ latestStdVersion }}"
+ replaceWith: "std@{{ latestStdVersion }}",
},
{
filename: "./tests/integration/up-to-date-deps/original_deps.ts",
replaceTheRegex: /drash@v[0-9.]+[0-9.]+[0-9]/g,
- replaceWith: "drash@v{{ latestDrashVersion }}"
- }
-])
+ replaceWith: "drash@v{{ latestDrashVersion }}",
+ },
+]);
-//Deno.copyFileSync("./tests/integration/up-to-date-deps/original_deps.ts", "./tests/integration/up-to-date-deps/deps.ts")
\ No newline at end of file
+//Deno.copyFileSync("./tests/integration/up-to-date-deps/original_deps.ts", "./tests/integration/up-to-date-deps/deps.ts")
From 2de6614a7140dca13c658518c00786755e03456b Mon Sep 17 00:00:00 2001
From: Edward Bebbington
Date: Wed, 21 Oct 2020 10:24:57 +0100
Subject: [PATCH 19/39] Correct updating test deps
---
console/update_deno_version_strings.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/console/update_deno_version_strings.ts b/console/update_deno_version_strings.ts
index 22369bb..f02c7f5 100644
--- a/console/update_deno_version_strings.ts
+++ b/console/update_deno_version_strings.ts
@@ -23,4 +23,4 @@ bumper([
},
]);
-//Deno.copyFileSync("./tests/integration/up-to-date-deps/original_deps.ts", "./tests/integration/up-to-date-deps/deps.ts")
+Deno.copyFileSync("./tests/integration/up-to-date-deps/original_deps.ts", "./tests/integration/up-to-date-deps/deps.ts")
From 9d382e9f946b08cb787dbbc91e12a59d592e7a24 Mon Sep 17 00:00:00 2001
From: Edward Bebbington
Date: Wed, 21 Oct 2020 10:25:31 +0100
Subject: [PATCH 20/39] deno fmt
---
console/update_deno_version_strings.ts | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/console/update_deno_version_strings.ts b/console/update_deno_version_strings.ts
index f02c7f5..79cd439 100644
--- a/console/update_deno_version_strings.ts
+++ b/console/update_deno_version_strings.ts
@@ -23,4 +23,7 @@ bumper([
},
]);
-Deno.copyFileSync("./tests/integration/up-to-date-deps/original_deps.ts", "./tests/integration/up-to-date-deps/deps.ts")
+Deno.copyFileSync(
+ "./tests/integration/up-to-date-deps/original_deps.ts",
+ "./tests/integration/up-to-date-deps/deps.ts",
+);
From dd3925d8735f92a33db2c38e63f88be13b93fd3f Mon Sep 17 00:00:00 2001
From: Eric Crooks
Date: Wed, 21 Oct 2020 19:03:36 -0400
Subject: [PATCH 21/39] refactor based on services
---
console/update_deno_version_strings.ts | 49 ++++++++++++--------------
deps.ts | 10 ++----
mod.ts | 34 ++++++------------
src/commands/check.ts | 18 ++++------
src/commands/help.ts | 4 +--
src/commands/info.ts | 17 ++-------
src/commands/update.ts | 22 ++++--------
src/services/module_service.ts | 8 ++---
8 files changed, 57 insertions(+), 105 deletions(-)
diff --git a/console/update_deno_version_strings.ts b/console/update_deno_version_strings.ts
index 79cd439..4d3d2d6 100644
--- a/console/update_deno_version_strings.ts
+++ b/console/update_deno_version_strings.ts
@@ -1,29 +1,24 @@
-import { bumper } from "https://raw.githubusercontent.com/drashland/services/master/console/bumper.ts";
+import { BumperService } from "https://raw.githubusercontent.com/drashland/services/master/ci/bumper_service.ts";
-bumper([
- {
- filename: "./.github/workflows/master.yml",
- replaceTheRegex: /deno: ["[0-9.]+[0-9.]+[0-9]"]/g,
- replaceWith: `deno: ["{{ latestDenoVersion }}"]`,
- },
- {
- filename: "./.github/workflows/bumper.yml",
- replaceTheRegex: /deno: ["[0-9.]+[0-9.]+[0-9]"]/g,
- replaceWith: `deno: ["{{ latestDenoVersion }}"]`,
- },
- {
- filename: "./tests/integration/up-to-date-deps/original_deps.ts",
- replaceTheRegex: /std@[0-9.]+[0-9.]+[0-9]/g,
- replaceWith: "std@{{ latestStdVersion }}",
- },
- {
- filename: "./tests/integration/up-to-date-deps/original_deps.ts",
- replaceTheRegex: /drash@v[0-9.]+[0-9.]+[0-9]/g,
- replaceWith: "drash@v{{ latestDrashVersion }}",
- },
-]);
+const b = new BumperService("dmm", Deno.args);
-Deno.copyFileSync(
- "./tests/integration/up-to-date-deps/original_deps.ts",
- "./tests/integration/up-to-date-deps/deps.ts",
-);
+if (b.isForPreRelease()) {
+ // Update files across the filesystem
+} else {
+ b.bump([
+ {
+ filename: "./tests/integration/up-to-date-deps/original_deps.ts",
+ replaceTheRegex: /std@[0-9.]+[0-9.]+[0-9]/g,
+ replaceWith: "std@{{ latestStdVersion }}",
+ },
+ {
+ filename: "./tests/integration/up-to-date-deps/original_deps.ts",
+ replaceTheRegex: /drash@v[0-9.]+[0-9.]+[0-9]/g,
+ replaceWith: "drash@v{{ latestDrashVersion }}",
+ },
+ ]);
+ Deno.copyFileSync(
+ "./tests/integration/up-to-date-deps/original_deps.ts",
+ "./tests/integration/up-to-date-deps/deps.ts",
+ );
+}
diff --git a/deps.ts b/deps.ts
index 4cf2c6b..50a342d 100644
--- a/deps.ts
+++ b/deps.ts
@@ -1,10 +1,6 @@
import * as colours from "https://deno.land/std@0.74.0/fmt/colors.ts";
export { colours };
-export { createHelpMenu } from "https://raw.githubusercontent.com/drashland/services/master/cli/help_menu_service.ts";
-export { CommandService } from "https://raw.githubusercontent.com/drashland/services/master/cli/command_service.ts";
-export {
- logDebug,
- logError,
- logInfo,
-} from "https://raw.githubusercontent.com/drashland/services/master/cli/logger_service.ts";
+export { CliService } from "https://raw.githubusercontent.com/drashland/services/master/cli/cli_service.ts";
+export { LoggerService } from "https://raw.githubusercontent.com/drashland/services/master/logger/logger_service.ts";
+export { BumperService } from "https://raw.githubusercontent.com/drashland/services/master/ci/bumper_service.ts";
export { assertEquals } from "https://deno.land/std@0.74.0/testing/asserts.ts";
diff --git a/mod.ts b/mod.ts
index b388b63..2e244c9 100644
--- a/mod.ts
+++ b/mod.ts
@@ -1,42 +1,30 @@
-import { colours, CommandService, logError } from "./deps.ts";
+import { CliService } from "./deps.ts";
import { helpMessage } from "./src/commands/help.ts";
import { versionMessage } from "./src/commands/version.ts";
import { info } from "./src/commands/info.ts";
import { check } from "./src/commands/check.ts";
import { update } from "./src/commands/update.ts";
-const args = Deno.args.slice().filter((arg: string, i: number) => {
- return i !== 0;
-});
-
-const c = new CommandService(Deno.args);
+const c = new CliService(Deno.args);
-c.addCommand("--help", async () => {
+c.addCommand(["help", "--help"], async () => {
console.log(helpMessage);
});
-c.addCommand("--version", () => {
+c.addCommand(["version", "--version"], () => {
console.log(versionMessage);
});
-c.addCommand("info", async () => {
+c.addCommand("info", async (args: string[]) => {
await info(args);
-});
-
-c.addCommand("help", () => {
- console.log(helpMessage);
-});
+}, { requires_args: true });
-c.addCommand("update", async () => {
+c.addCommand("update", async (args: string[]) => {
await update(args);
-});
+}, { requires_args: true });
-c.addCommand("version", () => {
- console.log(versionMessage);
-});
-
-c.addCommand("check", async () => {
+c.addCommand("check", async (args: string[]) => {
await check(args);
-});
+}, { requires_args: true });
-c.executeCommand();
+c.run();
diff --git a/src/commands/check.ts b/src/commands/check.ts
index 5204d8b..aa927da 100644
--- a/src/commands/check.ts
+++ b/src/commands/check.ts
@@ -1,5 +1,4 @@
-import { colours, logError, logInfo } from "../../deps.ts";
-import IModule from "../interfaces/module.ts";
+import { LoggerService} from "../../deps.ts";
import ModuleService from "../services/module_service.ts";
/**
@@ -17,36 +16,31 @@ export async function check(dependencies: string[]): Promise {
);
if (modules === false || typeof modules === "boolean") {
- logError(
- colours.red("Modules specified do not exist in your dependencies."),
- );
+ LoggerService.logError("Modules specified do not exist in your dependencies.");
Deno.exit(1);
- return;
}
// Compare imported and latest version
- logInfo("Comparing versions...");
+ LoggerService.logInfo("Comparing versions...");
let depsCanBeUpdated: boolean = false;
const listOfModuleNamesToBeUpdated: string[] = [];
modules.forEach((module) => {
if (module.importedVersion !== module.latestRelease) {
depsCanBeUpdated = true;
listOfModuleNamesToBeUpdated.push(module.name);
- logInfo(
- colours.yellow(
+ LoggerService.logInfo(
module.name + " can be updated from " + module.importedVersion +
" to " + module.latestRelease,
- ),
);
}
});
// Logging purposes
if (depsCanBeUpdated) {
- logInfo(
+ LoggerService.logInfo(
"To update, run: \n dmm update " +
listOfModuleNamesToBeUpdated.join(" "),
);
} else {
- logInfo(colours.green("Your dependencies are up to date"));
+ LoggerService.logInfo("Your dependencies are up to date");
}
}
diff --git a/src/commands/help.ts b/src/commands/help.ts
index c9cdddb..d51b9ff 100644
--- a/src/commands/help.ts
+++ b/src/commands/help.ts
@@ -1,7 +1,7 @@
-import { createHelpMenu } from "../../deps.ts";
+import { CliService } from "../../deps.ts";
import { version } from "./version.ts";
-export const helpMessage = createHelpMenu({
+export const helpMessage = CliService.createHelpMenu({
description: `A module manager for Deno.`,
usage: [
`deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v${version}/mod.ts`,
diff --git a/src/commands/info.ts b/src/commands/info.ts
index 3d12916..91f03e2 100644
--- a/src/commands/info.ts
+++ b/src/commands/info.ts
@@ -1,4 +1,4 @@
-import { colours, logError, logInfo } from "../../deps.ts";
+import { LoggerService } from "../../deps.ts";
import DenoService from "../services/deno_service.ts";
/**
@@ -8,14 +8,6 @@ import DenoService from "../services/deno_service.ts";
* @param modules - List of modules to get info on. Currently, we only support 1, so `modules[0]` will be used
*/
export async function info(modules: string[]): Promise {
- if (modules.length === 0 || modules.length > 1) {
- logError(
- colours.red(
- "Specify a single module to get information on. See --help",
- ),
- );
- Deno.exit(1);
- }
const moduleToGetInfoOn = modules[0];
const stdResponse = await fetch(
"https://github.com/denoland/deno/tree/master/std/" + moduleToGetInfoOn,
@@ -26,9 +18,7 @@ export async function info(modules: string[]): Promise {
const isStd = stdResponse.status === 200;
const isThirdParty = thirdPartyResponse.status === 200;
if (!isStd && !isThirdParty) {
- logError(
- colours.red("No module was found with " + moduleToGetInfoOn),
- );
+ LoggerService.logError("No module was found with " + moduleToGetInfoOn);
Deno.exit(1);
}
const name = moduleToGetInfoOn;
@@ -51,8 +41,7 @@ export async function info(modules: string[]): Promise {
denoLandUrl = "https://deno.land/x/" + name + "@" + latestVersion;
}
const importLine = "import * as " + name + ' from "' + denoLandUrl + '";';
- logInfo(
- "\n" +
+ LoggerService.logInfo(
`Information on ${name}\n\n - Name: ${name}\n - Description: ${description}\n - deno.land Link: ${denoLandUrl}\n - GitHub Repository: ${gitHubUrl}\n - Import Statement: ${importLine}\n - Latest Version: ${latestVersion}` +
"\n",
);
diff --git a/src/commands/update.ts b/src/commands/update.ts
index 95bd421..314e1c6 100644
--- a/src/commands/update.ts
+++ b/src/commands/update.ts
@@ -1,5 +1,4 @@
-import { colours, logError, logInfo } from "../../deps.ts";
-import IModule from "../interfaces/module.ts";
+import { LoggerService} from "../../deps.ts";
import ModuleService from "../services/module_service.ts";
/**
@@ -17,15 +16,12 @@ export async function update(dependencies: string[]): Promise {
);
if (modules === false || typeof modules === "boolean") {
- logError(
- colours.red("Modules specified do not exist in your dependencies."),
- );
+ LoggerService.logError("Modules specified do not exist in your dependencies.");
Deno.exit(1);
- return;
}
// Check for updates and rewrite `deps.ts` if needed
- logInfo("Checking if your modules can be updated...");
+ LoggerService.logInfo("Checking if your modules can be updated...");
const usersWorkingDir: string = Deno.realPathSync(".");
let depsWereUpdated = false;
let depsContent: string = new TextDecoder().decode(
@@ -43,11 +39,7 @@ export async function update(dependencies: string[]): Promise {
);
// `v` is not supported for std imports anymore
if (module.importedVersion.indexOf("v") > -1) {
- console.warn(
- colours.yellow(
- `You are importing a version of ${module.name} prefixed with "v". deno.land does not support this and will throw a 403 error.`,
- ),
- );
+ LoggerService.logWarn(`You are importing a version of ${module.name} prefixed with "v". deno.land does not support this and will throw a 403 error.`);
}
} else {
depsContent = depsContent.replace(
@@ -55,11 +47,9 @@ export async function update(dependencies: string[]): Promise {
module.name + "@" + module.latestRelease,
);
}
- logInfo(
- colours.green(
+ LoggerService.logInfo(
module.name + " was updated from " + module.importedVersion + " to " +
module.latestRelease,
- ),
);
depsWereUpdated = true;
});
@@ -72,6 +62,6 @@ export async function update(dependencies: string[]): Promise {
// And if none were updated, add some more logging
if (!depsWereUpdated) {
- logInfo(colours.green("Everything is already up to date"));
+ LoggerService.logInfo("Everything is already up to date");
}
}
diff --git a/src/services/module_service.ts b/src/services/module_service.ts
index 9f5df28..b80c45a 100644
--- a/src/services/module_service.ts
+++ b/src/services/module_service.ts
@@ -1,5 +1,5 @@
import IModule from "../interfaces/module.ts";
-import { colours, logError, logInfo } from "../../deps.ts";
+import { colours, LoggerService } from "../../deps.ts";
import DenoService from "../services/deno_service.ts";
export default class ModuleService {
@@ -50,7 +50,7 @@ export default class ModuleService {
purpose: string,
): Promise {
// Solely read the users `deps.ts` file
- logInfo("Reading deps.ts to gather your dependencies...");
+ LoggerService.logInfo("Reading deps.ts to gather your dependencies...");
const usersWorkingDir: string = Deno.realPathSync(".");
const depsContent: string = new TextDecoder().decode(
Deno.readFileSync(usersWorkingDir + "/deps.ts"),
@@ -81,11 +81,11 @@ export default class ModuleService {
? importVersionRegexResult[0]
: "";
if (!importedVersion) {
- logError(colours.red(
+ LoggerService.logError(
"The following line is not versioned. To update, your dependencies must be versioned." +
"\n" +
" " + dep,
- ));
+ );
Deno.exit(1);
}
From 8b8d84f094f603ad82111a07e8bcfaf818e12bbe Mon Sep 17 00:00:00 2001
From: Eric Crooks
Date: Wed, 21 Oct 2020 19:07:16 -0400
Subject: [PATCH 22/39] put pre-release stuff in
---
.github/workflows/bumper.yml | 4 ++--
.github/workflows/pre_release.yml | 4 ++--
console/bump_versions.ts | 19 -------------------
...ersion_strings.ts => bumper_ci_service.ts} | 18 +++++++++++++++++-
4 files changed, 21 insertions(+), 24 deletions(-)
delete mode 100644 console/bump_versions.ts
rename console/{update_deno_version_strings.ts => bumper_ci_service.ts} (59%)
diff --git a/.github/workflows/bumper.yml b/.github/workflows/bumper.yml
index 47535db..de9bdf4 100644
--- a/.github/workflows/bumper.yml
+++ b/.github/workflows/bumper.yml
@@ -21,7 +21,7 @@ jobs:
run: deno run --allow-net --allow-read --allow-write mod.ts update
- name: Update Dependency Version Strings
- run: deno run --allow-read --allow-write --allow-net console/update_deno_version_strings.ts
+ run: deno run --allow-read --allow-write --allow-net console/bumper_ci_service.ts
- name: Create Pull Request
uses: peter-evans/create-pull-request@v2
@@ -30,4 +30,4 @@ jobs:
commit-message: Update dependencies
title: Update dependencies
body: This was auto-generated by GitHub Actions.
- branch: update-dependencies
\ No newline at end of file
+ branch: update-dependencies
diff --git a/.github/workflows/pre_release.yml b/.github/workflows/pre_release.yml
index f127a9f..d4cee53 100644
--- a/.github/workflows/pre_release.yml
+++ b/.github/workflows/pre_release.yml
@@ -33,7 +33,7 @@ jobs:
deno-version: ${{ matrix.deno }}
- name: Bump Versions
- run: deno run -A ./console/bump_versions.ts --version=${{ github.ref }} # version passed so we know what the new release version will be
+ run: deno run -A ./console/bumper_ci_service.ts --version=${{ github.ref }} # version passed so we know what the new release version will be
- name: Create Pull Request
uses: peter-evans/create-pull-request@v2
@@ -42,4 +42,4 @@ jobs:
commit-message: bump versions
title: bump versions
body: This was auto-generated by GitHub Actions.
- branch: release # Can change it to ${{ github.ref }} to be the branch name, but then we need to figure out how to stop this worjflow running when it creates another "release-vx.x.x" branch
\ No newline at end of file
+ branch: release # Can change it to ${{ github.ref }} to be the branch name, but then we need to figure out how to stop this worjflow running when it creates another "release-vx.x.x" branch
diff --git a/console/bump_versions.ts b/console/bump_versions.ts
deleted file mode 100644
index 45078a1..0000000
--- a/console/bump_versions.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { bumpVersions } from "https://raw.githubusercontent.com/drashland/services/master/console/bump_versions.ts";
-
-bumpVersions(Deno.args, [
- {
- filename: "./egg.json",
- replaceTheRegex: /"version": "[0-9\.]+[0-9\.]+[0-9\.]"/,
- replaceWith: `"version": "{{ version }}"`,
- },
- {
- filename: "./README.md",
- replaceTheRegex: /dmm@v[0-9\.]+[0-9\.]+[0-9\.]/g,
- replaceWith: `dmm@v{{ version }}`,
- },
- {
- filename: "./src/commands/version.ts",
- replaceTheRegex: /version = "[0-9\.]+[0-9\.]+[0-9\.]"/,
- replaceWith: `version = "{{ version }}"`,
- },
-]);
diff --git a/console/update_deno_version_strings.ts b/console/bumper_ci_service.ts
similarity index 59%
rename from console/update_deno_version_strings.ts
rename to console/bumper_ci_service.ts
index 4d3d2d6..405111e 100644
--- a/console/update_deno_version_strings.ts
+++ b/console/bumper_ci_service.ts
@@ -3,7 +3,23 @@ import { BumperService } from "https://raw.githubusercontent.com/drashland/servi
const b = new BumperService("dmm", Deno.args);
if (b.isForPreRelease()) {
- // Update files across the filesystem
+ bumpVersions(Deno.args, [
+ {
+ filename: "./egg.json",
+ replaceTheRegex: /"version": "[0-9\.]+[0-9\.]+[0-9\.]"/,
+ replaceWith: `"version": "{{ version }}"`,
+ },
+ {
+ filename: "./README.md",
+ replaceTheRegex: /dmm@v[0-9\.]+[0-9\.]+[0-9\.]/g,
+ replaceWith: `dmm@v{{ version }}`,
+ },
+ {
+ filename: "./src/commands/version.ts",
+ replaceTheRegex: /version = "[0-9\.]+[0-9\.]+[0-9\.]"/,
+ replaceWith: `version = "{{ version }}"`,
+ },
+ ]);
} else {
b.bump([
{
From 874f6b21e6344231d95a1b24a1eeeb321f29ab8c Mon Sep 17 00:00:00 2001
From: Eric Crooks
Date: Wed, 21 Oct 2020 19:07:40 -0400
Subject: [PATCH 23/39] fix method call
---
console/bumper_ci_service.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/console/bumper_ci_service.ts b/console/bumper_ci_service.ts
index 405111e..9cec763 100644
--- a/console/bumper_ci_service.ts
+++ b/console/bumper_ci_service.ts
@@ -3,7 +3,7 @@ import { BumperService } from "https://raw.githubusercontent.com/drashland/servi
const b = new BumperService("dmm", Deno.args);
if (b.isForPreRelease()) {
- bumpVersions(Deno.args, [
+ b.bump([
{
filename: "./egg.json",
replaceTheRegex: /"version": "[0-9\.]+[0-9\.]+[0-9\.]"/,
From 2efef4f60255b82320c72bc04454c88db7108ee5 Mon Sep 17 00:00:00 2001
From: Eric Crooks
Date: Wed, 21 Oct 2020 19:13:49 -0400
Subject: [PATCH 24/39] add yml files
---
console/bumper_ci_service.ts | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/console/bumper_ci_service.ts b/console/bumper_ci_service.ts
index 9cec763..beed24c 100644
--- a/console/bumper_ci_service.ts
+++ b/console/bumper_ci_service.ts
@@ -32,6 +32,21 @@ if (b.isForPreRelease()) {
replaceTheRegex: /drash@v[0-9.]+[0-9.]+[0-9]/g,
replaceWith: "drash@v{{ latestDrashVersion }}",
},
+ {
+ filename: "./.github/workflows/master.yml",
+ replaceTheRegex: /deno: ["[0-9.]+[0-9.]+[0-9]"]/g,
+ replaceWith: `deno: ["{{ latestDenoVersion }}"]`,
+ },
+ {
+ filename: "./.github/workflows/bumper.yml",
+ replaceTheRegex: /deno: ["[0-9.]+[0-9.]+[0-9]"]/g,
+ replaceWith: `deno: ["{{ latestDenoVersion }}"]`,
+ },
+ {
+ filename: "./.github/workflows/pre_release.yml",
+ replaceTheRegex: /deno: ["[0-9.]+[0-9.]+[0-9]"]/g,
+ replaceWith: `deno: ["{{ latestDenoVersion }}"]`,
+ },
]);
Deno.copyFileSync(
"./tests/integration/up-to-date-deps/original_deps.ts",
From a096569acd36a5365b8fbf84147dbda856c7d941 Mon Sep 17 00:00:00 2001
From: Eric Crooks
Date: Wed, 21 Oct 2020 19:44:03 -0400
Subject: [PATCH 25/39] use thisModulesLatestVersion
---
console/bumper_ci_service.ts | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/console/bumper_ci_service.ts b/console/bumper_ci_service.ts
index beed24c..35e4e91 100644
--- a/console/bumper_ci_service.ts
+++ b/console/bumper_ci_service.ts
@@ -7,17 +7,17 @@ if (b.isForPreRelease()) {
{
filename: "./egg.json",
replaceTheRegex: /"version": "[0-9\.]+[0-9\.]+[0-9\.]"/,
- replaceWith: `"version": "{{ version }}"`,
+ replaceWith: `"version": "{{ thisModulesLatestVersion }}"`,
},
{
filename: "./README.md",
replaceTheRegex: /dmm@v[0-9\.]+[0-9\.]+[0-9\.]/g,
- replaceWith: `dmm@v{{ version }}`,
+ replaceWith: `dmm@v{{ thisModulesLatestVersion }}`,
},
{
filename: "./src/commands/version.ts",
replaceTheRegex: /version = "[0-9\.]+[0-9\.]+[0-9\.]"/,
- replaceWith: `version = "{{ version }}"`,
+ replaceWith: `version = "{{ thisModulesLatestVersion }}"`,
},
]);
} else {
From 4d59609de49e2315dca2fc769c7a6266705dc898 Mon Sep 17 00:00:00 2001
From: Eric Crooks
Date: Wed, 21 Oct 2020 22:48:09 -0400
Subject: [PATCH 26/39] test bumper script process
---
console/bumper_ci_service.ts | 47 +---
console/bumper_ci_service_files.ts | 56 +++++
tests/data/pattern_types.txt | 33 +++
tests/unit/console/bumper_ci_service_test.ts | 246 +++++++++++++++++++
4 files changed, 338 insertions(+), 44 deletions(-)
create mode 100644 console/bumper_ci_service_files.ts
create mode 100644 tests/data/pattern_types.txt
create mode 100644 tests/unit/console/bumper_ci_service_test.ts
diff --git a/console/bumper_ci_service.ts b/console/bumper_ci_service.ts
index 35e4e91..029778d 100644
--- a/console/bumper_ci_service.ts
+++ b/console/bumper_ci_service.ts
@@ -1,53 +1,12 @@
import { BumperService } from "https://raw.githubusercontent.com/drashland/services/master/ci/bumper_service.ts";
+import { denoVersionFiles, moduleVersionFiles } "./bumper_ci_service_files.ts";
const b = new BumperService("dmm", Deno.args);
if (b.isForPreRelease()) {
- b.bump([
- {
- filename: "./egg.json",
- replaceTheRegex: /"version": "[0-9\.]+[0-9\.]+[0-9\.]"/,
- replaceWith: `"version": "{{ thisModulesLatestVersion }}"`,
- },
- {
- filename: "./README.md",
- replaceTheRegex: /dmm@v[0-9\.]+[0-9\.]+[0-9\.]/g,
- replaceWith: `dmm@v{{ thisModulesLatestVersion }}`,
- },
- {
- filename: "./src/commands/version.ts",
- replaceTheRegex: /version = "[0-9\.]+[0-9\.]+[0-9\.]"/,
- replaceWith: `version = "{{ thisModulesLatestVersion }}"`,
- },
- ]);
+ b.bump(moduleVersionFiles);
} else {
- b.bump([
- {
- filename: "./tests/integration/up-to-date-deps/original_deps.ts",
- replaceTheRegex: /std@[0-9.]+[0-9.]+[0-9]/g,
- replaceWith: "std@{{ latestStdVersion }}",
- },
- {
- filename: "./tests/integration/up-to-date-deps/original_deps.ts",
- replaceTheRegex: /drash@v[0-9.]+[0-9.]+[0-9]/g,
- replaceWith: "drash@v{{ latestDrashVersion }}",
- },
- {
- filename: "./.github/workflows/master.yml",
- replaceTheRegex: /deno: ["[0-9.]+[0-9.]+[0-9]"]/g,
- replaceWith: `deno: ["{{ latestDenoVersion }}"]`,
- },
- {
- filename: "./.github/workflows/bumper.yml",
- replaceTheRegex: /deno: ["[0-9.]+[0-9.]+[0-9]"]/g,
- replaceWith: `deno: ["{{ latestDenoVersion }}"]`,
- },
- {
- filename: "./.github/workflows/pre_release.yml",
- replaceTheRegex: /deno: ["[0-9.]+[0-9.]+[0-9]"]/g,
- replaceWith: `deno: ["{{ latestDenoVersion }}"]`,
- },
- ]);
+ b.bump(denoVersionFiles);
Deno.copyFileSync(
"./tests/integration/up-to-date-deps/original_deps.ts",
"./tests/integration/up-to-date-deps/deps.ts",
diff --git a/console/bumper_ci_service_files.ts b/console/bumper_ci_service_files.ts
new file mode 100644
index 0000000..666d40a
--- /dev/null
+++ b/console/bumper_ci_service_files.ts
@@ -0,0 +1,56 @@
+export const regexes = {
+ const_statements: /version = ".+"/g,
+ deps_drash: /drash@v[0-9.]+[0-9.]+[0-9]/g,
+ deps_std: /std@[0-9.]+[0-9.]+[0-9]/g,
+ egg_json: /"version": ".+"/,
+ urls: /dmm@v[0-9\.]+[0-9\.]+[0-9\.]/g,
+ yml_deno: /deno: \[".+"\]/g,
+};
+
+export const moduleVersionFiles = [
+ {
+ filename: "./egg.json",
+ replaceTheRegex: regexes.egg_json,
+ replaceWith: `"version": "{{ thisModulesLatestVersion }}"`,
+ },
+ {
+ filename: "./README.md",
+ replaceTheRegex: regexes.urls,
+ replaceWith: `dmm@v{{ thisModulesLatestVersion }}`,
+ },
+ {
+ filename: "./src/commands/version.ts",
+ replaceTheRegex: regexes.const_statements,
+ replaceWith: `version = "{{ thisModulesLatestVersion }}"`,
+ },
+];
+
+export const denoVersionFiles = [
+ {
+ filename: "./tests/integration/up-to-date-deps/original_deps.ts",
+ replaceTheRegex: regexes.deps_std,
+ replaceWith: "std@{{ latestStdVersion }}",
+ },
+ // Yes... this is NOT a deno version file, but we're trying to keep the tests
+ // up to date and it has a Drash version... so gtfo... leave this alone kthx.
+ {
+ filename: "./tests/integration/up-to-date-deps/original_deps.ts",
+ replaceTheRegex: regexes.deps_drash,
+ replaceWith: "drash@v{{ latestDrashVersion }}",
+ },
+ {
+ filename: "./.github/workflows/master.yml",
+ replaceTheRegex: regexes.yml_deno,
+ replaceWith: `deno: ["{{ latestDenoVersion }}"]`,
+ },
+ {
+ filename: "./.github/workflows/bumper.yml",
+ replaceTheRegex: regexes.yml_deno,
+ replaceWith: `deno: ["{{ latestDenoVersion }}"]`,
+ },
+ {
+ filename: "./.github/workflows/pre_release.yml",
+ replaceTheRegex: regexes.yml_deno,
+ replaceWith: `deno: ["{{ latestDenoVersion }}"]`,
+ },
+];
diff --git a/tests/data/pattern_types.txt b/tests/data/pattern_types.txt
new file mode 100644
index 0000000..29db095
--- /dev/null
+++ b/tests/data/pattern_types.txt
@@ -0,0 +1,33 @@
+workflow files
+
+deno: ["0.0.0"]
+deno: ["0.0.0"]
+
+-----
+
+urls
+
+https://deno.land/x/dmm@v0.0.0/mod.ts
+https://deno.land/x/dmm@v0.0.0/mod.ts
+
+----
+
+consts
+
+export const version = "0.0.0";
+export const version = "0.0.0";
+
+----
+
+egg.json
+
+"version": "0.0.0",
+
+----
+
+deps files
+
+import { Drash } from "https://deno.land/x/drash@v0.0.0/mod.ts"; // up to date
+import * as fs from "https://deno.land/std@0.0.0/fs/mod.ts"; // up to date
+import * as colors from "https://deno.land/std@0.0.0/fmt/colors.ts"; // up to date
+export { v4 } from "https://deno.land/std@0.0.0/uuid/mod.ts"; // up to date
diff --git a/tests/unit/console/bumper_ci_service_test.ts b/tests/unit/console/bumper_ci_service_test.ts
new file mode 100644
index 0000000..fcb8931
--- /dev/null
+++ b/tests/unit/console/bumper_ci_service_test.ts
@@ -0,0 +1,246 @@
+import { Rhum } from "https://raw.githubusercontent.com/drashland/rhum/rhum-cli/mod.ts";
+import {
+ denoVersionFiles,
+ moduleVersionFiles,
+} from "../../../console/bumper_ci_service_files.ts";
+import { BumperService } from "../../../deps.ts";
+
+// Not for pre-release
+const b = new BumperService("dmm", Deno.args);
+
+// For pre-release
+const c = new BumperService("dmm", ["--version=1.2.3"]);
+
+const latestVersions = await b.getLatestVersions();
+const latestVersionDrash = await c.getModulesLatestVersion("drash");
+
+Rhum.testPlan(async () => {
+
+ /**
+ * The test cases in this test suite process as follows:
+ *
+ * 1. Take a file.
+ * 2. Switch out the file for the test file. This test file mocks different
+ * patterns that the regex SHOULD match and replace.
+ * 3. Bump the file.
+ * 4. Assert that everything is as expected.
+ */
+ await Rhum.testSuite(
+ "bumper_ci_service.ts",
+ () => {
+ Rhum.testCase("bumps std versions in deps files correctly", async () => {
+ const file = denoVersionFiles[0];
+ file.filename = "./tests/data/pattern_types.txt";
+ const bumped = await b.bump([file], false);
+ Rhum.asserts.assertEquals(bumped[0], data_depsStd);
+ });
+
+ Rhum.testCase("bumps drash versions in deps files correctly", async () => {
+ const file = denoVersionFiles[1];
+ file.filename = "./tests/data/pattern_types.txt";
+ const bumped = await b.bump([file], false);
+ Rhum.asserts.assertEquals(bumped[0], data_depsDrash);
+ });
+
+ Rhum.testCase("bumps deno versions in yml files correctly", async () => {
+ const file = denoVersionFiles[2];
+ file.filename = "./tests/data/pattern_types.txt";
+ const bumped = await b.bump([file], false);
+ Rhum.asserts.assertEquals(bumped[0], data_denoVersionsYml);
+ });
+
+ Rhum.testCase("bumps egg.json correctly", async () => {
+ const file = moduleVersionFiles[0];
+ file.filename = "./tests/data/pattern_types.txt";
+ const bumped = await c.bump([file], false);
+ Rhum.asserts.assertEquals(bumped[0], data_eggJson);
+ });
+
+ Rhum.testCase("bumps const statements correctly", async () => {
+ const file = moduleVersionFiles[2];
+ file.filename = "./tests/data/pattern_types.txt";
+ const bumped = await c.bump([file], false);
+ Rhum.asserts.assertEquals(bumped[0], data_constStatements);
+ });
+ },
+ );
+});
+
+////////////////////////////////////////////////////////////////////////////////
+// DATA PROVIDERS //////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
+
+const data_depsStd = `workflow files
+
+deno: ["0.0.0"]
+deno: ["0.0.0"]
+
+-----
+
+urls
+
+https://deno.land/x/dmm@v0.0.0/mod.ts
+https://deno.land/x/dmm@v0.0.0/mod.ts
+
+----
+
+consts
+
+export const version = "0.0.0";
+export const version = "0.0.0";
+
+----
+
+egg.json
+
+"version": "0.0.0",
+
+----
+
+deps files
+
+import { Drash } from "https://deno.land/x/drash@v0.0.0/mod.ts"; // up to date
+import * as fs from "https://deno.land/std@${latestVersions.deno_std}/fs/mod.ts"; // up to date
+import * as colors from "https://deno.land/std@${latestVersions.deno_std}/fmt/colors.ts"; // up to date
+export { v4 } from "https://deno.land/std@${latestVersions.deno_std}/uuid/mod.ts"; // up to date
+`;
+
+const data_depsDrash = `workflow files
+
+deno: ["0.0.0"]
+deno: ["0.0.0"]
+
+-----
+
+urls
+
+https://deno.land/x/dmm@v0.0.0/mod.ts
+https://deno.land/x/dmm@v0.0.0/mod.ts
+
+----
+
+consts
+
+export const version = "0.0.0";
+export const version = "0.0.0";
+
+----
+
+egg.json
+
+"version": "0.0.0",
+
+----
+
+deps files
+
+import { Drash } from "https://deno.land/x/drash@v${latestVersionDrash}/mod.ts"; // up to date
+import * as fs from "https://deno.land/std@0.0.0/fs/mod.ts"; // up to date
+import * as colors from "https://deno.land/std@0.0.0/fmt/colors.ts"; // up to date
+export { v4 } from "https://deno.land/std@0.0.0/uuid/mod.ts"; // up to date
+`;
+
+const data_denoVersionsYml = `workflow files
+
+deno: ["${latestVersions.deno}"]
+deno: ["${latestVersions.deno}"]
+
+-----
+
+urls
+
+https://deno.land/x/dmm@v0.0.0/mod.ts
+https://deno.land/x/dmm@v0.0.0/mod.ts
+
+----
+
+consts
+
+export const version = "0.0.0";
+export const version = "0.0.0";
+
+----
+
+egg.json
+
+"version": "0.0.0",
+
+----
+
+deps files
+
+import { Drash } from "https://deno.land/x/drash@v0.0.0/mod.ts"; // up to date
+import * as fs from "https://deno.land/std@0.0.0/fs/mod.ts"; // up to date
+import * as colors from "https://deno.land/std@0.0.0/fmt/colors.ts"; // up to date
+export { v4 } from "https://deno.land/std@0.0.0/uuid/mod.ts"; // up to date
+`;
+
+const data_constStatements = `workflow files
+
+deno: ["0.0.0"]
+deno: ["0.0.0"]
+
+-----
+
+urls
+
+https://deno.land/x/dmm@v0.0.0/mod.ts
+https://deno.land/x/dmm@v0.0.0/mod.ts
+
+----
+
+consts
+
+export const version = "1.2.3";
+export const version = "1.2.3";
+
+----
+
+egg.json
+
+"version": "0.0.0",
+
+----
+
+deps files
+
+import { Drash } from "https://deno.land/x/drash@v0.0.0/mod.ts"; // up to date
+import * as fs from "https://deno.land/std@0.0.0/fs/mod.ts"; // up to date
+import * as colors from "https://deno.land/std@0.0.0/fmt/colors.ts"; // up to date
+export { v4 } from "https://deno.land/std@0.0.0/uuid/mod.ts"; // up to date
+`;
+
+const data_eggJson = `workflow files
+
+deno: ["0.0.0"]
+deno: ["0.0.0"]
+
+-----
+
+urls
+
+https://deno.land/x/dmm@v0.0.0/mod.ts
+https://deno.land/x/dmm@v0.0.0/mod.ts
+
+----
+
+consts
+
+export const version = "0.0.0";
+export const version = "0.0.0";
+
+----
+
+egg.json
+
+"version": "1.2.3",
+
+----
+
+deps files
+
+import { Drash } from "https://deno.land/x/drash@v0.0.0/mod.ts"; // up to date
+import * as fs from "https://deno.land/std@0.0.0/fs/mod.ts"; // up to date
+import * as colors from "https://deno.land/std@0.0.0/fmt/colors.ts"; // up to date
+export { v4 } from "https://deno.land/std@0.0.0/uuid/mod.ts"; // up to date
+`;
From fa794d48812faec5e582b608a430bd36ae7a3f28 Mon Sep 17 00:00:00 2001
From: Eric Crooks
Date: Thu, 22 Oct 2020 08:07:23 -0400
Subject: [PATCH 27/39] make changes based on cli service changes
---
mod.ts | 10 +++++-----
src/commands/help.ts | 2 +-
tests/integration/out-of-date-deps/deps.ts | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/mod.ts b/mod.ts
index 2e244c9..a2ec633 100644
--- a/mod.ts
+++ b/mod.ts
@@ -7,23 +7,23 @@ import { update } from "./src/commands/update.ts";
const c = new CliService(Deno.args);
-c.addCommand(["help", "--help"], async () => {
+c.addSubcommand(["help", "--help"], async () => {
console.log(helpMessage);
});
-c.addCommand(["version", "--version"], () => {
+c.addSubcommand(["version", "--version"], () => {
console.log(versionMessage);
});
-c.addCommand("info", async (args: string[]) => {
+c.addSubcommand("info", async (args: string[]) => {
await info(args);
}, { requires_args: true });
-c.addCommand("update", async (args: string[]) => {
+c.addSubcommand("update", async (args: string[]) => {
await update(args);
}, { requires_args: true });
-c.addCommand("check", async (args: string[]) => {
+c.addSubcommand("check", async (args: string[]) => {
await check(args);
}, { requires_args: true });
diff --git a/src/commands/help.ts b/src/commands/help.ts
index d51b9ff..e5c73bb 100644
--- a/src/commands/help.ts
+++ b/src/commands/help.ts
@@ -7,7 +7,7 @@ export const helpMessage = CliService.createHelpMenu({
`deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v${version}/mod.ts`,
`dmm [command]`,
],
- commands: {
+ subcommands: {
"check [modules]":
"Checks the specified modules for newer version. Will check all if modules are omitted.",
"update [modules]":
diff --git a/tests/integration/out-of-date-deps/deps.ts b/tests/integration/out-of-date-deps/deps.ts
index f3ecbe9..1a79952 100644
--- a/tests/integration/out-of-date-deps/deps.ts
+++ b/tests/integration/out-of-date-deps/deps.ts
@@ -1,6 +1,6 @@
import { Drash } from "https://deno.land/x/drash@v1.0.0/mod.ts"; // out of date
-import * as fs from "https://deno.land/std@0.53.0/fs/mod.ts"; // out of date
+import * as fs from "https://deno.land/std@0.74.0/fs/mod.ts"; // out of date
import * as colors from "https://deno.land/std@0.53.0/fmt/colors.ts"; // out to date
From 59f3fef0be243818bebdd1273549411c9590430b Mon Sep 17 00:00:00 2001
From: Eric Crooks
Date: Thu, 22 Oct 2020 09:27:03 -0400
Subject: [PATCH 28/39] use display instead of show
---
src/commands/help.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/commands/help.ts b/src/commands/help.ts
index e5c73bb..c9c0507 100644
--- a/src/commands/help.ts
+++ b/src/commands/help.ts
@@ -13,7 +13,7 @@ export const helpMessage = CliService.createHelpMenu({
"update [modules]":
"Updates the specified modules to the newest version. Will update all if modules are omitted.",
"info":
- "Shows information about the given module, be it std or 3rd party. The 3rd party module must be referenced at https://deno.land/x/",
+ "Displays information about the given module, be it std or 3rd party. The 3rd party module must be referenced at https://deno.land/x/",
"help, --help": "Prints the help message",
"version, --version": "Prints the current dmm version",
},
From 48d9573d17f0fc688f63f772b3102ef77804f665 Mon Sep 17 00:00:00 2001
From: Eric Crooks
Date: Thu, 22 Oct 2020 20:11:29 -0400
Subject: [PATCH 29/39] state Bump Versions in CI
---
.github/workflows/bumper.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/bumper.yml b/.github/workflows/bumper.yml
index de9bdf4..cc6e5f0 100644
--- a/.github/workflows/bumper.yml
+++ b/.github/workflows/bumper.yml
@@ -20,7 +20,7 @@ jobs:
- name: Update Dependencies
run: deno run --allow-net --allow-read --allow-write mod.ts update
- - name: Update Dependency Version Strings
+ - name: Bump Versions
run: deno run --allow-read --allow-write --allow-net console/bumper_ci_service.ts
- name: Create Pull Request
From 80f6373411f18527feceddb016468178971ffa91 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
<41898282+github-actions[bot]@users.noreply.github.com>
Date: Wed, 28 Oct 2020 00:27:48 +0000
Subject: [PATCH 30/39] Update dependencies
---
.github/workflows/bumper.yml | 2 +-
.github/workflows/master.yml | 4 +-
README.md | 54 ++++++++-----------
deps.ts | 4 +-
tests/integration/up-to-date-deps/deps.ts | 8 +--
.../up-to-date-deps/original_deps.ts | 8 +--
6 files changed, 34 insertions(+), 46 deletions(-)
diff --git a/.github/workflows/bumper.yml b/.github/workflows/bumper.yml
index 500f7f3..0a32ae8 100644
--- a/.github/workflows/bumper.yml
+++ b/.github/workflows/bumper.yml
@@ -7,7 +7,7 @@ jobs:
update-dep:
strategy:
matrix:
- deno: ["1.4.6"]
+ deno: ["1.5.0"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml
index e158866..b3d31dd 100644
--- a/.github/workflows/master.yml
+++ b/.github/workflows/master.yml
@@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
- deno: ["1.4.6"]
+ deno: ["1.5.0"]
runs-on: ${{ matrix.os }}
steps:
@@ -32,7 +32,7 @@ jobs:
linting:
strategy:
matrix:
- deno: ["1.4.6"]
+ deno: ["1.5.0"]
# Doesn't need to be checked in all OS
runs-on: ubuntu-latest
diff --git a/README.md b/README.md
index 232fc86..4a81f92 100644
--- a/README.md
+++ b/README.md
@@ -25,19 +25,13 @@
# Contents
-* [Documentation](#documentation)
* [Features](#features)
* [Quick Start](#quick-start)
* [Example](#example)
* [How it Works](#how-it-works)
-* [Mirrors](#mirrors)
* [Contributing](#contributing)
* [License](#license)
-# Documentation
-
-[Full Documentation](https://drash.land/dmm/)
-
# Features
* Zero dependencies
@@ -58,18 +52,16 @@ There are two ways you can use this module: installing it though `deno`, or runn
As dmm only needs to read and write to your `deps.ts`, as well as requiring network access using Deno's CDN and API, you can restrict the access this module has.
*Install*
-```sh
-deno install --allow-net='cdn.deno.land,api.deno.land,x.nest.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts
```
-```sh
-dmm ...
+$ deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts
+$ dmm ...
```
*Through the URL*
If you are using this method, be sure to use the latest version of dmm in the command below
-```sh
-deno run --allow-net='cdn.deno.land,api.deno.land,x.nest.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts ...
+```
+$ deno run --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts ...
```
In the examples below, dmm is installed and we will be using it that way to make the commands easier to read.
@@ -89,10 +81,10 @@ Information on fmt
- Name: fmt
- Description: Cannot retrieve descriptions for std modules
- - deno.land Link: https://deno.land/std@0.74.0/fmt
+ - deno.land Link: https://deno.land/std@0.75.0/fmt
- GitHub Repository: https://github.com/denoland/deno/tree/master/std/fmt
- - Import Statement: import * as fmt from "https://deno.land/std@0.74.0/fmt";
- - Latest Version: 0.74.0
+ - Import Statement: import * as fmt from "https://deno.land/std@0.75.0/fmt";
+ - Latest Version: 0.75.0
```
@@ -105,7 +97,7 @@ export { Drash } from "https://deno.land/x/drash@v1.0.0/mod.ts"; // out of date
import * as fs from "https://deno.land/std@0.53.0/fs/mod.ts"; // out of date
-import * as colors from "https://deno.land/std@0.74.0/fmt/colors.ts"; // up to date
+import * as colors from "https://deno.land/std@0.75.0/fmt/colors.ts"; // up to date
export { fs, colors }
```
@@ -120,7 +112,7 @@ Now we want to check if any of our dependencies need updating, but we don't want
$ dmm check
...
drash can be updated from v1.0.0 to v1.2.5
-fs can be updated from 0.53.0 to 0.74.0
+fs can be updated from 0.53.0 to 0.75.0
...
```
@@ -132,7 +124,7 @@ Lets update our dependencies as some are out of date:
$ dmm update
...
drash was updated from v1.0.0 to v1.2.5
-fs was updated from 0.53.0 to 0.74.0
+fs was updated from 0.53.0 to 0.75.0
...
```
@@ -141,9 +133,9 @@ Now lets check the `deps.ts` file, and you will notice the versions have been mo
```typescript
export { Drash } from "https://deno.land/x/drash@v1.2.5/mod.ts"; // was out of date
-import * as fs from "https://deno.land/std@0.74.0/fs/mod.ts"; // was out of date
+import * as fs from "https://deno.land/std@0.75.0/fs/mod.ts"; // was out of date
-import * as colors from "https://deno.land/std@0.74.0/fmt/colors.ts";
+import * as colors from "https://deno.land/std@0.75.0/fmt/colors.ts";
export { fs, colors }
```
@@ -191,26 +183,26 @@ EXAMPLE USAGE:
# How it Works
-dmm will only read modules that reside on [deno.land](https://deno.land) or [nest.land](https://nest.land), whether they are 3rd party or `std` modules. As long as you are either importing then exporting a module, or only exporting a module, dmm will check that dependency.
+dmm will only read modules that reside on [deno.land](https://deno.land), whether they are 3rd party or `std` modules. As long as you are either importing then exporting a module, or only exporting a module, dmm will check that dependency.
* Your dependencies must be versioned. Not versioning your dependencies is bad practice and can lead to many problems in your project, which is why dmm will not support it. For example:
```
- import { red } from "https://x.nest.land/std@0.56.0/fmt/colors.ts";
+ import { red } from "https://deno.land/std@0.56.0/fmt/colors.ts";
^^^^^^^
```
-* dmm only supports importing/exporting modules from [deno.land/x](https://deno.land/x), [deno.land/std](https://deno.land/std) and [x.nest.land](https://nest.land), 3rd party or `std`. For example:
+* dmm only supports importing/exporting modules from Deno's registry: [deno.land](https://deno.land), 3rd party or `std`. For example:
```
- import { red } from "https://x.nest.land/std@0.56.0/fmt/colors.ts"; // supported
+ import { red } from "https://deno.land/std@0.56.0/fmt/colors.ts"; // supported
import { something } from "https://deno.land/x/something@0v1.0.0/mod.ts"; // supported
```
-* dmm will read every `from "https://deno.land/..."` or `from "https://x.nest.land/..."` line in your `deps.ts` and using the name and version, will convert the dependencies into objects.
+* dmm will read every `from "https://deno.land/..."` line in your `deps.ts` and using the name and version, will convert the dependencies into objects.
* dmm will then retrieve the rest of the required information for later use for each module:
- * Latest version - For std and 3rd party, this is pulled using `https://cdn.deno.land` or `https://x.deno.land/api` .
- * GitHub URL - Fetched from `https://cdn.deno.land` or `https://x.deno.land/api`
- * Description - For 3rd party modules, it is taken from `https://api.deno.land` or `https://x.deno.land/api`. There is currently no way to get descriptions for std modules.
+ * Latest version - For std and 3rd party, this is pulled using `https://cdn.deno.land`.
+ * GitHub URL - Retrieved through the GitHub API
+ * Description - For 3rd party modules, it is taken from `https://api.deno.land`. There is currently no way to get descriptions for std modules.
* After this, dmm will run different actions based on the purpose:
@@ -225,11 +217,7 @@ dmm will only read modules that reside on [deno.land](https://deno.land) or [nes
* **info**
Displays information about the given module using information collated at the start of the script
-
-## Mirrors
-
-* https://nest.land/package/dmm
-
+
## Contributing
Contributors are welcomed!
diff --git a/deps.ts b/deps.ts
index 28e555f..65535ef 100644
--- a/deps.ts
+++ b/deps.ts
@@ -1,4 +1,4 @@
-import * as colours from "https://deno.land/std@0.74.0/fmt/colors.ts";
+import * as colours from "https://deno.land/std@0.75.0/fmt/colors.ts";
export { colours };
-export { assertEquals } from "https://deno.land/std@0.74.0/testing/asserts.ts";
+export { assertEquals } from "https://deno.land/std@0.75.0/testing/asserts.ts";
diff --git a/tests/integration/up-to-date-deps/deps.ts b/tests/integration/up-to-date-deps/deps.ts
index 58b1b3a..6ed90ab 100644
--- a/tests/integration/up-to-date-deps/deps.ts
+++ b/tests/integration/up-to-date-deps/deps.ts
@@ -1,13 +1,13 @@
import { Drash } from "https://deno.land/x/drash@v1.2.5/mod.ts"; // up to date
-import * as fs from "https://deno.land/std@0.74.0/fs/mod.ts"; // up to date
+import * as fs from "https://deno.land/std@0.75.0/fs/mod.ts"; // up to date
-import * as colors from "https://deno.land/std@0.74.0/fmt/colors.ts"; //up to date
+import * as colors from "https://deno.land/std@0.75.0/fmt/colors.ts"; //up to date
import * as Cliffy from "https://x.nest.land/cliffy@0.14.3/mod.ts"; //up to date
-import * as log from "https://x.nest.land/std@0.74.0/log/mod.ts"; //up to date
+import * as log from "https://x.nest.land/std@0.75.0/log/mod.ts"; //up to date
-export { v4 } from "https://x.nest.land/std@0.74.0/uuid/mod.ts"; //up to date
+export { v4 } from "https://x.nest.land/std@0.75.0/uuid/mod.ts"; //up to date
export { Cliffy, colors, Drash, fs, log };
diff --git a/tests/integration/up-to-date-deps/original_deps.ts b/tests/integration/up-to-date-deps/original_deps.ts
index 58b1b3a..6ed90ab 100644
--- a/tests/integration/up-to-date-deps/original_deps.ts
+++ b/tests/integration/up-to-date-deps/original_deps.ts
@@ -1,13 +1,13 @@
import { Drash } from "https://deno.land/x/drash@v1.2.5/mod.ts"; // up to date
-import * as fs from "https://deno.land/std@0.74.0/fs/mod.ts"; // up to date
+import * as fs from "https://deno.land/std@0.75.0/fs/mod.ts"; // up to date
-import * as colors from "https://deno.land/std@0.74.0/fmt/colors.ts"; //up to date
+import * as colors from "https://deno.land/std@0.75.0/fmt/colors.ts"; //up to date
import * as Cliffy from "https://x.nest.land/cliffy@0.14.3/mod.ts"; //up to date
-import * as log from "https://x.nest.land/std@0.74.0/log/mod.ts"; //up to date
+import * as log from "https://x.nest.land/std@0.75.0/log/mod.ts"; //up to date
-export { v4 } from "https://x.nest.land/std@0.74.0/uuid/mod.ts"; //up to date
+export { v4 } from "https://x.nest.land/std@0.75.0/uuid/mod.ts"; //up to date
export { Cliffy, colors, Drash, fs, log };
From 12e0750afe7e9cd446ee001b681db7c0aeff0bec Mon Sep 17 00:00:00 2001
From: Eric Crooks
Date: Fri, 30 Oct 2020 16:05:38 -0400
Subject: [PATCH 31/39] use Deno.test() instead of Rhum v2
---
tests/unit/console/bumper_ci_service_test.ts | 100 +++++++++----------
1 file changed, 49 insertions(+), 51 deletions(-)
diff --git a/tests/unit/console/bumper_ci_service_test.ts b/tests/unit/console/bumper_ci_service_test.ts
index fcb8931..8045fb7 100644
--- a/tests/unit/console/bumper_ci_service_test.ts
+++ b/tests/unit/console/bumper_ci_service_test.ts
@@ -1,4 +1,4 @@
-import { Rhum } from "https://raw.githubusercontent.com/drashland/rhum/rhum-cli/mod.ts";
+import { assertEquals } from "../../../deps.ts";
import {
denoVersionFiles,
moduleVersionFiles,
@@ -14,56 +14,54 @@ const c = new BumperService("dmm", ["--version=1.2.3"]);
const latestVersions = await b.getLatestVersions();
const latestVersionDrash = await c.getModulesLatestVersion("drash");
-Rhum.testPlan(async () => {
-
- /**
- * The test cases in this test suite process as follows:
- *
- * 1. Take a file.
- * 2. Switch out the file for the test file. This test file mocks different
- * patterns that the regex SHOULD match and replace.
- * 3. Bump the file.
- * 4. Assert that everything is as expected.
- */
- await Rhum.testSuite(
- "bumper_ci_service.ts",
- () => {
- Rhum.testCase("bumps std versions in deps files correctly", async () => {
- const file = denoVersionFiles[0];
- file.filename = "./tests/data/pattern_types.txt";
- const bumped = await b.bump([file], false);
- Rhum.asserts.assertEquals(bumped[0], data_depsStd);
- });
-
- Rhum.testCase("bumps drash versions in deps files correctly", async () => {
- const file = denoVersionFiles[1];
- file.filename = "./tests/data/pattern_types.txt";
- const bumped = await b.bump([file], false);
- Rhum.asserts.assertEquals(bumped[0], data_depsDrash);
- });
-
- Rhum.testCase("bumps deno versions in yml files correctly", async () => {
- const file = denoVersionFiles[2];
- file.filename = "./tests/data/pattern_types.txt";
- const bumped = await b.bump([file], false);
- Rhum.asserts.assertEquals(bumped[0], data_denoVersionsYml);
- });
-
- Rhum.testCase("bumps egg.json correctly", async () => {
- const file = moduleVersionFiles[0];
- file.filename = "./tests/data/pattern_types.txt";
- const bumped = await c.bump([file], false);
- Rhum.asserts.assertEquals(bumped[0], data_eggJson);
- });
-
- Rhum.testCase("bumps const statements correctly", async () => {
- const file = moduleVersionFiles[2];
- file.filename = "./tests/data/pattern_types.txt";
- const bumped = await c.bump([file], false);
- Rhum.asserts.assertEquals(bumped[0], data_constStatements);
- });
- },
- );
+Deno.test({
+ name: "Bumper CI Service | bumps std versions in deps files correctly",
+ async fn(): Promise {
+ const file = denoVersionFiles[0];
+ file.filename = "./tests/data/pattern_types.txt";
+ const bumped = await b.bump([file], false);
+ assertEquals(bumped[0], data_depsStd);
+ }
+});
+
+Deno.test({
+ name: "Bumper CI Service | bumps drash versions in deps files correctly",
+ async fn(): Promise {
+ const file = denoVersionFiles[1];
+ file.filename = "./tests/data/pattern_types.txt";
+ const bumped = await b.bump([file], false);
+ assertEquals(bumped[0], data_depsDrash);
+ }
+});
+
+Deno.test({
+ name: "Bumper CI Service | bumps deno versions in yml files correctly",
+ async fn(): Promise {
+ const file = denoVersionFiles[2];
+ file.filename = "./tests/data/pattern_types.txt";
+ const bumped = await b.bump([file], false);
+ assertEquals(bumped[0], data_denoVersionsYml);
+ }
+});
+
+Deno.test({
+ name: "Bumper CI Service | bumps eggs.json correctly",
+ async fn(): Promise {
+ const file = moduleVersionFiles[0];
+ file.filename = "./tests/data/pattern_types.txt";
+ const bumped = await c.bump([file], false);
+ assertEquals(bumped[0], data_eggJson);
+ }
+});
+
+Deno.test({
+ name: "Bumper CI Service | bumps const statements correctly",
+ async fn(): Promise {
+ const file = moduleVersionFiles[2];
+ file.filename = "./tests/data/pattern_types.txt";
+ const bumped = await c.bump([file], false);
+ assertEquals(bumped[0], data_constStatements);
+ }
});
////////////////////////////////////////////////////////////////////////////////
From c5f42197e53433ea76cc3697fbc851ec41fc4640 Mon Sep 17 00:00:00 2001
From: Eric Crooks
Date: Fri, 30 Oct 2020 16:06:27 -0400
Subject: [PATCH 32/39] deno fmt
---
src/commands/check.ts | 10 ++++++----
src/commands/info.ts | 2 +-
src/commands/update.ts | 14 +++++++++-----
tests/unit/console/bumper_ci_service_test.ts | 10 +++++-----
4 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/src/commands/check.ts b/src/commands/check.ts
index aa927da..70cf639 100644
--- a/src/commands/check.ts
+++ b/src/commands/check.ts
@@ -1,4 +1,4 @@
-import { LoggerService} from "../../deps.ts";
+import { LoggerService } from "../../deps.ts";
import ModuleService from "../services/module_service.ts";
/**
@@ -16,7 +16,9 @@ export async function check(dependencies: string[]): Promise {
);
if (modules === false || typeof modules === "boolean") {
- LoggerService.logError("Modules specified do not exist in your dependencies.");
+ LoggerService.logError(
+ "Modules specified do not exist in your dependencies.",
+ );
Deno.exit(1);
}
@@ -29,8 +31,8 @@ export async function check(dependencies: string[]): Promise {
depsCanBeUpdated = true;
listOfModuleNamesToBeUpdated.push(module.name);
LoggerService.logInfo(
- module.name + " can be updated from " + module.importedVersion +
- " to " + module.latestRelease,
+ module.name + " can be updated from " + module.importedVersion +
+ " to " + module.latestRelease,
);
}
});
diff --git a/src/commands/info.ts b/src/commands/info.ts
index 91f03e2..12f5d8f 100644
--- a/src/commands/info.ts
+++ b/src/commands/info.ts
@@ -42,7 +42,7 @@ export async function info(modules: string[]): Promise {
}
const importLine = "import * as " + name + ' from "' + denoLandUrl + '";';
LoggerService.logInfo(
- `Information on ${name}\n\n - Name: ${name}\n - Description: ${description}\n - deno.land Link: ${denoLandUrl}\n - GitHub Repository: ${gitHubUrl}\n - Import Statement: ${importLine}\n - Latest Version: ${latestVersion}` +
+ `Information on ${name}\n\n - Name: ${name}\n - Description: ${description}\n - deno.land Link: ${denoLandUrl}\n - GitHub Repository: ${gitHubUrl}\n - Import Statement: ${importLine}\n - Latest Version: ${latestVersion}` +
"\n",
);
Deno.exit();
diff --git a/src/commands/update.ts b/src/commands/update.ts
index 314e1c6..18d4b7c 100644
--- a/src/commands/update.ts
+++ b/src/commands/update.ts
@@ -1,4 +1,4 @@
-import { LoggerService} from "../../deps.ts";
+import { LoggerService } from "../../deps.ts";
import ModuleService from "../services/module_service.ts";
/**
@@ -16,7 +16,9 @@ export async function update(dependencies: string[]): Promise {
);
if (modules === false || typeof modules === "boolean") {
- LoggerService.logError("Modules specified do not exist in your dependencies.");
+ LoggerService.logError(
+ "Modules specified do not exist in your dependencies.",
+ );
Deno.exit(1);
}
@@ -39,7 +41,9 @@ export async function update(dependencies: string[]): Promise {
);
// `v` is not supported for std imports anymore
if (module.importedVersion.indexOf("v") > -1) {
- LoggerService.logWarn(`You are importing a version of ${module.name} prefixed with "v". deno.land does not support this and will throw a 403 error.`);
+ LoggerService.logWarn(
+ `You are importing a version of ${module.name} prefixed with "v". deno.land does not support this and will throw a 403 error.`,
+ );
}
} else {
depsContent = depsContent.replace(
@@ -48,8 +52,8 @@ export async function update(dependencies: string[]): Promise {
);
}
LoggerService.logInfo(
- module.name + " was updated from " + module.importedVersion + " to " +
- module.latestRelease,
+ module.name + " was updated from " + module.importedVersion + " to " +
+ module.latestRelease,
);
depsWereUpdated = true;
});
diff --git a/tests/unit/console/bumper_ci_service_test.ts b/tests/unit/console/bumper_ci_service_test.ts
index 8045fb7..138cc7a 100644
--- a/tests/unit/console/bumper_ci_service_test.ts
+++ b/tests/unit/console/bumper_ci_service_test.ts
@@ -21,7 +21,7 @@ Deno.test({
file.filename = "./tests/data/pattern_types.txt";
const bumped = await b.bump([file], false);
assertEquals(bumped[0], data_depsStd);
- }
+ },
});
Deno.test({
@@ -31,7 +31,7 @@ Deno.test({
file.filename = "./tests/data/pattern_types.txt";
const bumped = await b.bump([file], false);
assertEquals(bumped[0], data_depsDrash);
- }
+ },
});
Deno.test({
@@ -41,7 +41,7 @@ Deno.test({
file.filename = "./tests/data/pattern_types.txt";
const bumped = await b.bump([file], false);
assertEquals(bumped[0], data_denoVersionsYml);
- }
+ },
});
Deno.test({
@@ -51,7 +51,7 @@ Deno.test({
file.filename = "./tests/data/pattern_types.txt";
const bumped = await c.bump([file], false);
assertEquals(bumped[0], data_eggJson);
- }
+ },
});
Deno.test({
@@ -61,7 +61,7 @@ Deno.test({
file.filename = "./tests/data/pattern_types.txt";
const bumped = await c.bump([file], false);
assertEquals(bumped[0], data_constStatements);
- }
+ },
});
////////////////////////////////////////////////////////////////////////////////
From 5a1c0275e7e15d469d26858d28fa352557a36509 Mon Sep 17 00:00:00 2001
From: Eric Crooks
Date: Fri, 30 Oct 2020 16:08:27 -0400
Subject: [PATCH 33/39] fix error test
---
tests/integration/error_test.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/integration/error_test.ts b/tests/integration/error_test.ts
index 874bd57..07cb6b4 100644
--- a/tests/integration/error_test.ts
+++ b/tests/integration/error_test.ts
@@ -92,7 +92,7 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- colours.red("ERROR") + " Command `something` not recognized.\n",
+ colours.red("ERROR") + " Subcommand `something` not recognized.\n",
);
assertEquals(stderr, "");
assertEquals(status.code, 0);
From 0836d4a42827f9203500823b6ab107d5b0b3d5f8 Mon Sep 17 00:00:00 2001
From: Eric Crooks
Date: Fri, 30 Oct 2020 17:27:30 -0400
Subject: [PATCH 34/39] fixing tests; fixing commands based on tests
---
mod.ts | 4 +-
src/commands/help.ts | 6 +-
src/commands/info.ts | 76 ++++++++--------
tests/integration/check_test.ts | 90 ++++++++-----------
tests/integration/info_test.ts | 45 +++++-----
tests/integration/up-to-date-deps/deps.ts | 10 +--
.../up-to-date-deps/original_deps.ts | 10 +--
tests/integration/update_test.ts | 73 +++++++--------
8 files changed, 147 insertions(+), 167 deletions(-)
diff --git a/mod.ts b/mod.ts
index a2ec633..e7b0d87 100644
--- a/mod.ts
+++ b/mod.ts
@@ -21,10 +21,10 @@ c.addSubcommand("info", async (args: string[]) => {
c.addSubcommand("update", async (args: string[]) => {
await update(args);
-}, { requires_args: true });
+});
c.addSubcommand("check", async (args: string[]) => {
await check(args);
-}, { requires_args: true });
+});
c.run();
diff --git a/src/commands/help.ts b/src/commands/help.ts
index c9c0507..a7819a1 100644
--- a/src/commands/help.ts
+++ b/src/commands/help.ts
@@ -5,15 +5,15 @@ export const helpMessage = CliService.createHelpMenu({
description: `A module manager for Deno.`,
usage: [
`deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v${version}/mod.ts`,
- `dmm [command]`,
+ `dmm [SUBCOMMAND]`,
],
subcommands: {
"check [modules]":
"Checks the specified modules for newer version. Will check all if modules are omitted.",
"update [modules]":
"Updates the specified modules to the newest version. Will update all if modules are omitted.",
- "info":
- "Displays information about the given module, be it std or 3rd party. The 3rd party module must be referenced at https://deno.land/x/",
+ "info [modules]":
+ "Displays information about the given modules, be it std or 3rd party. The 3rd party module must be referenced at https://deno.land/x/",
"help, --help": "Prints the help message",
"version, --version": "Prints the current dmm version",
},
diff --git a/src/commands/info.ts b/src/commands/info.ts
index 12f5d8f..af4b589 100644
--- a/src/commands/info.ts
+++ b/src/commands/info.ts
@@ -5,45 +5,47 @@ import DenoService from "../services/deno_service.ts";
* Supplies information on the given module in the first
* index of `modules`
*
- * @param modules - List of modules to get info on. Currently, we only support 1, so `modules[0]` will be used
+ * @param modules - List of modules to get info on.
*/
export async function info(modules: string[]): Promise {
- const moduleToGetInfoOn = modules[0];
- const stdResponse = await fetch(
- "https://github.com/denoland/deno/tree/master/std/" + moduleToGetInfoOn,
- );
- const thirdPartyResponse = await fetch(
- DenoService.DENO_CDN_URL + moduleToGetInfoOn + "/meta/versions.json",
- ); // Only used so we can check if the module exists
- const isStd = stdResponse.status === 200;
- const isThirdParty = thirdPartyResponse.status === 200;
- if (!isStd && !isThirdParty) {
- LoggerService.logError("No module was found with " + moduleToGetInfoOn);
- Deno.exit(1);
+ for (const index in modules) {
+ const moduleToGetInfoOn: string = modules[index];
+ const stdResponse = await fetch(
+ "https://github.com/denoland/deno/tree/master/std/" + moduleToGetInfoOn,
+ );
+ const thirdPartyResponse = await fetch(
+ DenoService.DENO_CDN_URL + moduleToGetInfoOn + "/meta/versions.json",
+ ); // Only used so we can check if the module exists
+ const isStd = stdResponse.status === 200;
+ const isThirdParty = thirdPartyResponse.status === 200;
+ if (!isStd && !isThirdParty) {
+ LoggerService.logError("No module was found with " + moduleToGetInfoOn);
+ Deno.exit(1);
+ }
+ const name = moduleToGetInfoOn;
+ let description;
+ let denoLandUrl;
+ let gitHubUrl;
+ let latestVersion;
+ if (isStd) {
+ latestVersion = await DenoService.getLatestModuleRelease("std");
+ description = "Cannot retrieve descriptions for std modules";
+ denoLandUrl = "https://deno.land/std@" + latestVersion + "/" +
+ name;
+ gitHubUrl = "https://github.com/denoland/deno/tree/master/std/" + name;
+ }
+ if (isThirdParty) {
+ description = await DenoService.getThirdPartyDescription(name);
+ gitHubUrl = "https://github.com/" +
+ await DenoService.getThirdPartyRepoAndOwner(name);
+ latestVersion = await DenoService.getLatestModuleRelease(name);
+ denoLandUrl = "https://deno.land/x/" + name + "@" + latestVersion;
+ }
+ const importLine = "import * as " + name + ' from "' + denoLandUrl + '";';
+ LoggerService.logInfo(
+ `Information on ${name}\n\n - Name: ${name}\n - Description: ${description}\n - deno.land Link: ${denoLandUrl}\n - GitHub Repository: ${gitHubUrl}\n - Import Statement: ${importLine}\n - Latest Version: ${latestVersion}` +
+ "\n",
+ );
}
- const name = moduleToGetInfoOn;
- let description;
- let denoLandUrl;
- let gitHubUrl;
- let latestVersion;
- if (isStd) {
- latestVersion = await DenoService.getLatestModuleRelease("std");
- description = "Cannot retrieve descriptions for std modules";
- denoLandUrl = "https://deno.land/std@" + latestVersion + "/" +
- name;
- gitHubUrl = "https://github.com/denoland/deno/tree/master/std/" + name;
- }
- if (isThirdParty) {
- description = await DenoService.getThirdPartyDescription(name);
- gitHubUrl = "https://github.com/" +
- await DenoService.getThirdPartyRepoAndOwner(name);
- latestVersion = await DenoService.getLatestModuleRelease(name);
- denoLandUrl = "https://deno.land/x/" + name + "@" + latestVersion;
- }
- const importLine = "import * as " + name + ' from "' + denoLandUrl + '";';
- LoggerService.logInfo(
- `Information on ${name}\n\n - Name: ${name}\n - Description: ${description}\n - deno.land Link: ${denoLandUrl}\n - GitHub Repository: ${gitHubUrl}\n - Import Statement: ${importLine}\n - Latest Version: ${latestVersion}` +
- "\n",
- );
Deno.exit();
}
diff --git a/tests/integration/check_test.ts b/tests/integration/check_test.ts
index 4deb342..6544222 100644
--- a/tests/integration/check_test.ts
+++ b/tests/integration/check_test.ts
@@ -43,9 +43,8 @@ Deno.test({
colours.blue("INFO") +
" Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Comparing versions...\n" +
- colours.blue("INFO") + " " +
- colours.yellow(`fs can be updated from 0.53.0 to ${latestStdRelease}`) +
- "\n" +
+ colours.blue("INFO") +
+ ` fs can be updated from 0.53.0 to ${latestStdRelease}` + "\n" +
colours.blue("INFO") + " To update, run: \n" +
" dmm update fs" +
"\n",
@@ -87,8 +86,7 @@ Deno.test({
colours.blue("INFO") +
" Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Comparing versions...\n" +
- colours.blue("INFO") + " " +
- colours.green("Your dependencies are up to date") + "\n",
+ colours.blue("INFO") + " Your dependencies are up to date" + "\n",
);
assertEquals(status.code, 0);
assertEquals(status.success, true);
@@ -124,16 +122,13 @@ Deno.test({
assertEquals(stderr, "");
assertEquals(
stdout,
- "Gathering facts...\n" +
- "Reading deps.ts to gather your dependencies...\n" +
- "Comparing versions...\n" +
- colours.yellow(
- `cliffy can be updated from 0.11.2 to ${latestCliffyRelease}`,
- ) +
- "\n" +
- "To update, run: \n" +
- " dmm update cliffy" +
- "\n",
+ colours.blue("INFO") +
+ " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") + " Comparing versions...\n" +
+ colours.blue("INFO") +
+ ` cliffy can be updated from 0.14.3 to ${latestCliffyRelease}\n` +
+ colours.blue("INFO") + " To update, run: \n" +
+ " dmm update cliffy\n",
);
assertEquals(status.code, 0);
assertEquals(status.success, true);
@@ -169,10 +164,10 @@ Deno.test({
assertEquals(stderr, "");
assertEquals(
stdout,
- "Gathering facts...\n" +
- "Reading deps.ts to gather your dependencies...\n" +
- "Comparing versions...\n" +
- colours.green("Your dependencies are up to date") + "\n",
+ colours.blue("INFO") +
+ " Reading deps.ts to gather your dependencies...\n" +
+ colours.blue("INFO") + " Comparing versions...\n" +
+ colours.blue("INFO") + " Your dependencies are up to date" + "\n",
);
assertEquals(status.code, 0);
assertEquals(status.success, true);
@@ -212,13 +207,10 @@ Deno.test({
colours.blue("INFO") +
" Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Comparing versions...\n" +
- colours.blue("INFO") + " " + colours.yellow(
- `drash can be updated from v1.0.0 to ${latestDrashRelease}`,
- ) + "\n" +
- colours.blue("INFO") + " " + colours.yellow(
- `fs can be updated from 0.53.0 to ${latestStdRelease}`,
- ) +
- "\n" +
+ colours.blue("INFO") +
+ ` drash can be updated from v1.0.0 to ${latestDrashRelease}\n` +
+ colours.blue("INFO") +
+ ` fs can be updated from 0.53.0 to ${latestStdRelease}\n` +
colours.blue("INFO") + " To update, run: \n" +
" dmm update drash fs" +
"\n",
@@ -261,8 +253,7 @@ Deno.test({
colours.blue("INFO") +
" Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Comparing versions...\n" +
- colours.blue("INFO") + " " +
- colours.green("Your dependencies are up to date") + "\n",
+ colours.blue("INFO") + " Your dependencies are up to date\n",
);
assertEquals(status.code, 0);
assertEquals(status.success, true);
@@ -300,21 +291,18 @@ Deno.test({
colours.blue("INFO") +
" Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Comparing versions...\n" +
- colours.blue("INFO") + " " + colours.yellow(
- `drash can be updated from v1.0.0 to ${latestDrashRelease}`,
- ) + "\n" +
- colours.blue("INFO") + " " + colours.yellow(
- `fs can be updated from 0.53.0 to ${latestStdRelease}`,
- ) +
- "\n" +
- colours.blue("INFO") + " " + colours.yellow(
- `fmt can be updated from 0.53.0 to ${latestStdRelease}`,
- ) + "\n" +
- colours.blue("INFO") + " " + colours.yellow(
- `uuid can be updated from 0.61.0 to ${latestStdRelease}`,
- ) + "\n" +
+ colours.blue("INFO") +
+ ` drash can be updated from v1.0.0 to ${latestDrashRelease}\n` +
+ colours.blue("INFO") +
+ ` fs can be updated from 0.53.0 to ${latestStdRelease}\n` +
+ colours.blue("INFO") +
+ ` cliffy can be updated from 0.14.3 to ${latestCliffyRelease}\n` +
+ colours.blue("INFO") +
+ ` log can be updated from 0.53.0 to ${latestStdRelease}\n` +
+ colours.blue("INFO") +
+ ` uuid can be updated from 0.61.0 to ${latestStdRelease}\n` +
colours.blue("INFO") + " To update, run: \n" +
- " dmm update drash fs fmt uuid" +
+ " dmm update drash fs cliffy log uuid" +
"\n",
);
assertEquals(status.code, 0);
@@ -353,8 +341,7 @@ Deno.test({
colours.blue("INFO") +
" Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Comparing versions...\n" +
- colours.blue("INFO") + " " +
- colours.green("Your dependencies are up to date") + "\n",
+ colours.blue("INFO") + " Your dependencies are up to date\n",
);
assertEquals(status.code, 0);
assertEquals(status.success, true);
@@ -391,9 +378,8 @@ Deno.test({
stdout,
colours.blue("INFO") +
" Reading deps.ts to gather your dependencies...\n" +
- colours.red("ERROR") + " " +
- colours.red("Modules specified do not exist in your dependencies.") +
- "\n",
+ colours.red("ERROR") +
+ " Modules specified do not exist in your dependencies.\n",
);
assertEquals(status.code, 1);
assertEquals(status.success, false);
@@ -429,9 +415,8 @@ Deno.test({
stdout,
colours.blue("INFO") +
" Reading deps.ts to gather your dependencies...\n" +
- colours.red("ERROR") + " " +
- colours.red("Modules specified do not exist in your dependencies.") +
- "\n",
+ colours.red("ERROR") +
+ " Modules specified do not exist in your dependencies.\n",
);
assertEquals(status.code, 1);
assertEquals(status.success, false);
@@ -471,9 +456,8 @@ Deno.test({
stdout,
colours.blue("INFO") +
" Reading deps.ts to gather your dependencies...\n" +
- colours.red("ERROR") + " " +
- colours.red("Modules specified do not exist in your dependencies.") +
- "\n",
+ colours.red("ERROR") +
+ " Modules specified do not exist in your dependencies.\n",
);
assertEquals(status.code, 1);
assertEquals(status.success, false);
diff --git a/tests/integration/info_test.ts b/tests/integration/info_test.ts
index 040f154..40a98fc 100644
--- a/tests/integration/info_test.ts
+++ b/tests/integration/info_test.ts
@@ -26,11 +26,7 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- colours.red("ERROR") + " " +
- colours.red(
- "Specify a single module to get information on. See --help",
- ) +
- "\n",
+ colours.red("ERROR") + " Subcommand `info` requires arguments.\n",
);
assertEquals(
stderr,
@@ -61,9 +57,7 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- colours.blue("INFO") + " " + "\n" +
- "Information on drash\n" +
- "\n" +
+ colours.blue("INFO") + " Information on drash\n\n" +
" - Name: drash\n" +
" - Description: A REST microframework for Deno's HTTP server with zero dependencies.\n" +
` - deno.land Link: https://deno.land/x/drash@${latestDrashRelease}\n` +
@@ -98,9 +92,7 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- colours.blue("INFO") + " " + "\n" +
- "Information on fs\n" +
- "\n" +
+ colours.blue("INFO") + " Information on fs\n\n" +
" - Name: fs\n" +
" - Description: Cannot retrieve descriptions for std modules\n" +
` - deno.land Link: https://deno.land/std@${latestStdRelease}/fs\n` +
@@ -143,18 +135,32 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- colours.red("ERROR") + " " +
- colours.red(
- "Specify a single module to get information on. See --help",
- ) +
- "\n",
+ `${colours.blue("INFO")} Information on fs
+
+ - Name: fs
+ - Description: Cannot retrieve descriptions for std modules
+ - deno.land Link: https://deno.land/std@0.75.0/fs
+ - GitHub Repository: https://github.com/denoland/deno/tree/master/std/fs
+ - Import Statement: import * as fs from "https://deno.land/std@0.75.0/fs";
+ - Latest Version: 0.75.0
+
+${colours.blue("INFO")} Information on drash
+
+ - Name: drash
+ - Description: A REST microframework for Deno's HTTP server with zero dependencies.
+ - deno.land Link: https://deno.land/x/drash@v1.2.5
+ - GitHub Repository: https://github.com/drashland/deno-drash
+ - Import Statement: import * as drash from "https://deno.land/x/drash@v1.2.5";
+ - Latest Version: v1.2.5
+
+`,
);
assertEquals(
stderr,
"",
);
- assertEquals(status.code, 1);
- assertEquals(status.success, false);
+ assertEquals(status.code, 0);
+ assertEquals(status.success, true);
},
});
@@ -184,8 +190,7 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- colours.red("ERROR") + " " +
- colours.red("No module was found with somethinggg") + "\n",
+ colours.red("ERROR") + " No module was found with somethinggg\n",
);
assertEquals(
stderr,
diff --git a/tests/integration/up-to-date-deps/deps.ts b/tests/integration/up-to-date-deps/deps.ts
index 58b1b3a..ac90225 100644
--- a/tests/integration/up-to-date-deps/deps.ts
+++ b/tests/integration/up-to-date-deps/deps.ts
@@ -1,13 +1,13 @@
import { Drash } from "https://deno.land/x/drash@v1.2.5/mod.ts"; // up to date
-import * as fs from "https://deno.land/std@0.74.0/fs/mod.ts"; // up to date
+import * as fs from "https://deno.land/std@0.75.0/fs/mod.ts"; // up to date
-import * as colors from "https://deno.land/std@0.74.0/fmt/colors.ts"; //up to date
+import * as colors from "https://deno.land/std@0.75.0/fmt/colors.ts"; //up to date
-import * as Cliffy from "https://x.nest.land/cliffy@0.14.3/mod.ts"; //up to date
+import * as Cliffy from "https://x.nest.land/cliffy@0.15.0/mod.ts"; //up to date
-import * as log from "https://x.nest.land/std@0.74.0/log/mod.ts"; //up to date
+import * as log from "https://x.nest.land/std@0.75.0/log/mod.ts"; //up to date
-export { v4 } from "https://x.nest.land/std@0.74.0/uuid/mod.ts"; //up to date
+export { v4 } from "https://x.nest.land/std@0.75.0/uuid/mod.ts"; //up to date
export { Cliffy, colors, Drash, fs, log };
diff --git a/tests/integration/up-to-date-deps/original_deps.ts b/tests/integration/up-to-date-deps/original_deps.ts
index 58b1b3a..ac90225 100644
--- a/tests/integration/up-to-date-deps/original_deps.ts
+++ b/tests/integration/up-to-date-deps/original_deps.ts
@@ -1,13 +1,13 @@
import { Drash } from "https://deno.land/x/drash@v1.2.5/mod.ts"; // up to date
-import * as fs from "https://deno.land/std@0.74.0/fs/mod.ts"; // up to date
+import * as fs from "https://deno.land/std@0.75.0/fs/mod.ts"; // up to date
-import * as colors from "https://deno.land/std@0.74.0/fmt/colors.ts"; //up to date
+import * as colors from "https://deno.land/std@0.75.0/fmt/colors.ts"; //up to date
-import * as Cliffy from "https://x.nest.land/cliffy@0.14.3/mod.ts"; //up to date
+import * as Cliffy from "https://x.nest.land/cliffy@0.15.0/mod.ts"; //up to date
-import * as log from "https://x.nest.land/std@0.74.0/log/mod.ts"; //up to date
+import * as log from "https://x.nest.land/std@0.75.0/log/mod.ts"; //up to date
-export { v4 } from "https://x.nest.land/std@0.74.0/uuid/mod.ts"; //up to date
+export { v4 } from "https://x.nest.land/std@0.75.0/uuid/mod.ts"; //up to date
export { Cliffy, colors, Drash, fs, log };
diff --git a/tests/integration/update_test.ts b/tests/integration/update_test.ts
index a3b10be..3acbd2b 100644
--- a/tests/integration/update_test.ts
+++ b/tests/integration/update_test.ts
@@ -79,9 +79,8 @@ Deno.test({
const expected = colours.blue("INFO") +
" Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Checking if your modules can be updated...\n" +
- colours.blue("INFO") + " " + colours.green(
- `fs was updated from 0.53.0 to ${latestStdRelease}`,
- ) + "\n";
+ colours.blue("INFO") +
+ ` fs was updated from 0.53.0 to ${latestStdRelease}\n`;
assertEquals(
stdout,
expected,
@@ -135,8 +134,7 @@ Deno.test({
colours.blue("INFO") +
" Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Checking if your modules can be updated...\n" +
- colours.blue("INFO") + " " +
- colours.green("Everything is already up to date") + "\n",
+ colours.blue("INFO") + " Everything is already up to date\n",
);
assertEquals(stderr, "");
assertEquals(status.code, 0);
@@ -183,12 +181,10 @@ Deno.test({
colours.blue("INFO") +
" Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Checking if your modules can be updated...\n" +
- colours.blue("INFO") + " " + colours.green(
- `fs was updated from 0.53.0 to ${latestStdRelease}`,
- ) + "\n" +
- colours.blue("INFO") + " " + colours.green(
- `fmt was updated from 0.53.0 to ${latestStdRelease}`,
- ) + "\n",
+ colours.blue("INFO") +
+ ` fs was updated from 0.53.0 to ${latestStdRelease}\n` +
+ colours.blue("INFO") +
+ ` fmt was updated from 0.53.0 to ${latestStdRelease}\n`,
);
assertEquals(stderr, "");
assertEquals(status.code, 0);
@@ -245,8 +241,7 @@ Deno.test({
colours.blue("INFO") +
" Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Checking if your modules can be updated...\n" +
- colours.blue("INFO") + " " +
- colours.green("Everything is already up to date") + "\n",
+ colours.blue("INFO") + " Everything is already up to date\n",
);
assertEquals(stderr, "");
assertEquals(status.code, 0);
@@ -288,18 +283,18 @@ Deno.test({
const assertedOutput = colours.blue("INFO") +
" Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Checking if your modules can be updated...\n" +
- colours.blue("INFO") + " " +
- colours.green(`drash was updated from v1.0.0 to ${latestDrashRelease}`) +
- "\n" +
- colours.blue("INFO") + " " + colours.green(
- `fs was updated from 0.53.0 to ${latestStdRelease}`,
- ) + "\n" +
- colours.blue("INFO") + " " + colours.green(
- `fmt was updated from 0.53.0 to ${latestStdRelease}`,
- ) + "\n" +
- colours.blue("INFO") + " " + colours.green(
- `uuid was updated from 0.61.0 to ${latestStdRelease}`,
- ) + "\n";
+ colours.blue("INFO") +
+ ` drash was updated from v1.0.0 to ${latestDrashRelease}\n` +
+ colours.blue("INFO") +
+ ` fs was updated from 0.53.0 to ${latestStdRelease}\n` +
+ colours.blue("INFO") +
+ ` fmt was updated from 0.53.0 to ${latestStdRelease}\n` +
+ colours.blue("INFO") +
+ ` cliffy was updated from 0.11.2 to ${latestCliffyRelease}\n` +
+ colours.blue("INFO") +
+ ` log was updated from 0.53.0 to ${latestStdRelease}\n` +
+ colours.blue("INFO") +
+ ` uuid was updated from 0.61.0 to ${latestStdRelease}\n`;
assertEquals(stdout, assertedOutput);
assertEquals(stderr, "");
assertEquals(status.code, 0);
@@ -357,8 +352,7 @@ Deno.test({
colours.blue("INFO") +
" Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Checking if your modules can be updated...\n" +
- colours.blue("INFO") + " " +
- colours.green("Everything is already up to date") + "\n",
+ colours.blue("INFO") + " Everything is already up to date\n",
);
assertEquals(stderr, "");
assertEquals(status.code, 0);
@@ -403,9 +397,8 @@ Deno.test({
colours.blue("INFO") +
" Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Checking if your modules can be updated...\n" +
- colours.blue("INFO") + " " + colours.green(
- `drash was updated from v1.0.0 to ${latestDrashRelease}`,
- ) + "\n",
+ colours.blue("INFO") +
+ ` drash was updated from v1.0.0 to ${latestDrashRelease}\n`,
);
assertEquals(stderr, "");
assertEquals(status.code, 0);
@@ -453,9 +446,8 @@ Deno.test({
stdout,
colours.blue("INFO") +
" Reading deps.ts to gather your dependencies...\n" +
- colours.red("ERROR") + " " +
- colours.red("Modules specified do not exist in your dependencies.") +
- "\n",
+ colours.red("ERROR") +
+ " Modules specified do not exist in your dependencies.\n",
);
assertEquals(
stderr,
@@ -504,12 +496,10 @@ Deno.test({
colours.blue("INFO") +
" Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Checking if your modules can be updated...\n" +
- colours.blue("INFO") + " " + colours.green(
- `drash was updated from v1.0.0 to ${latestDrashRelease}`,
- ) + "\n" +
- colours.blue("INFO") + " " + colours.green(
- `fmt was updated from 0.53.0 to ${latestStdRelease}`,
- ) + "\n",
+ colours.blue("INFO") +
+ ` drash was updated from v1.0.0 to ${latestDrashRelease}\n` +
+ colours.blue("INFO") +
+ ` fmt was updated from 0.53.0 to ${latestStdRelease}\n`,
);
assertEquals(stderr, "");
assertEquals(status.code, 0);
@@ -565,9 +555,8 @@ Deno.test({
colours.blue("INFO") +
" Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Checking if your modules can be updated...\n" +
- colours.blue("INFO") + " " + colours.green(
- `fs was updated from 0.53.0 to ${latestStdRelease}`,
- ) + "\n",
+ colours.blue("INFO") +
+ ` fs was updated from 0.53.0 to ${latestStdRelease}\n`,
);
assertEquals(stderr, "");
assertEquals(status.code, 0);
From 2022fab24f328ab6120938a7db210e71f28593df Mon Sep 17 00:00:00 2001
From: Eric Crooks
Date: Fri, 30 Oct 2020 17:37:43 -0400
Subject: [PATCH 35/39] fixing tests
---
tests/integration/check_test.ts | 8 +-
tests/integration/error_test.ts | 87 +++++++++++-----------
tests/integration/help_test.ts | 86 ++++++++++-----------
tests/integration/out-of-date-deps/deps.ts | 2 +-
4 files changed, 94 insertions(+), 89 deletions(-)
diff --git a/tests/integration/check_test.ts b/tests/integration/check_test.ts
index 6544222..0ecd49e 100644
--- a/tests/integration/check_test.ts
+++ b/tests/integration/check_test.ts
@@ -126,7 +126,7 @@ Deno.test({
" Reading deps.ts to gather your dependencies...\n" +
colours.blue("INFO") + " Comparing versions...\n" +
colours.blue("INFO") +
- ` cliffy can be updated from 0.14.3 to ${latestCliffyRelease}\n` +
+ ` cliffy can be updated from 0.11.2 to ${latestCliffyRelease}\n` +
colours.blue("INFO") + " To update, run: \n" +
" dmm update cliffy\n",
);
@@ -296,13 +296,15 @@ Deno.test({
colours.blue("INFO") +
` fs can be updated from 0.53.0 to ${latestStdRelease}\n` +
colours.blue("INFO") +
- ` cliffy can be updated from 0.14.3 to ${latestCliffyRelease}\n` +
+ ` fmt can be updated from 0.53.0 to ${latestStdRelease}\n` +
+ colours.blue("INFO") +
+ ` cliffy can be updated from 0.11.2 to ${latestCliffyRelease}\n` +
colours.blue("INFO") +
` log can be updated from 0.53.0 to ${latestStdRelease}\n` +
colours.blue("INFO") +
` uuid can be updated from 0.61.0 to ${latestStdRelease}\n` +
colours.blue("INFO") + " To update, run: \n" +
- " dmm update drash fs cliffy log uuid" +
+ " dmm update drash fs fmt cliffy log uuid" +
"\n",
);
assertEquals(status.code, 0);
diff --git a/tests/integration/error_test.ts b/tests/integration/error_test.ts
index 07cb6b4..6141815 100644
--- a/tests/integration/error_test.ts
+++ b/tests/integration/error_test.ts
@@ -18,49 +18,50 @@ Deno.test({
const stderr = new TextDecoder("utf-8").decode(error);
assertEquals(
stdout,
- "\n" +
- "A module manager for Deno.\n" +
- "\n" +
- "USAGE\n" +
- "\n" +
- " deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts\n" +
- " dmm [command]\n" +
- "\n" +
- "\n" +
- "COMMANDS\n" +
- "\n" +
- " check [modules]\n" +
- " Checks the specified modules for newer version. Will check all if modules are \n" +
- " omitted.\n" +
- "\n" +
- " update [modules]\n" +
- " Updates the specified modules to the newest version. Will update all if modules \n" +
- " are omitted.\n" +
- "\n" +
- " info\n" +
- " Shows information about the given module, be it std or 3rd party. The 3rd party \n" +
- " module must be referenced at https://deno.land/x/\n" +
- "\n" +
- " help, --help\n" +
- " Prints the help message\n" +
- "\n" +
- " version, --version\n" +
- " Prints the current dmm version\n" +
- "\n" +
- "\n" +
- "EXAMPLE USAGE\n" +
- "\n" +
- " Install dmm\n" +
- " deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts\n" +
- "\n" +
- " Check a single module\n" +
- " dmm check fs\n" +
- "\n" +
- " Update a single module\n" +
- " dmm update fs\n" +
- "\n" +
- " Get information about a module\n" +
- " dmm info http" + "\n\n",
+ `
+A module manager for Deno.
+
+USAGE
+
+ deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts
+ dmm [SUBCOMMAND]
+
+SUBCOMMANDS
+
+ check [modules]
+ Checks the specified modules for newer version. Will check all if modules are
+ omitted.
+
+ update [modules]
+ Updates the specified modules to the newest version. Will update all if modules
+ are omitted.
+
+ info [modules]
+ Displays information about the given modules, be it std or 3rd party. The 3rd
+ party module must be referenced at https://deno.land/x/
+
+ help, --help
+ Prints the help message
+
+ version, --version
+ Prints the current dmm version
+
+
+EXAMPLE USAGE
+
+ Install dmm
+ deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts
+
+ Check a single module
+ dmm check fs
+
+ Update a single module
+ dmm update fs
+
+ Get information about a module
+ dmm info http
+
+`
);
assertEquals(stderr, "");
assertEquals(status.code, 0);
diff --git a/tests/integration/help_test.ts b/tests/integration/help_test.ts
index 0d14f37..e986158 100644
--- a/tests/integration/help_test.ts
+++ b/tests/integration/help_test.ts
@@ -20,48 +20,50 @@ Deno.test({
assertEquals(stderr, "");
assertEquals(
stdout,
- "\nA module manager for Deno.\n" +
- "\n" +
- "USAGE\n" +
- "\n" +
- " deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts\n" +
- " dmm [command]\n" +
- "\n" +
- "\n" +
- "COMMANDS\n" +
- "\n" +
- " check [modules]\n" +
- " Checks the specified modules for newer version. Will check all if modules are \n" +
- " omitted.\n" +
- "\n" +
- " update [modules]\n" +
- " Updates the specified modules to the newest version. Will update all if modules \n" +
- " are omitted.\n" +
- "\n" +
- " info\n" +
- " Shows information about the given module, be it std or 3rd party. The 3rd party \n" +
- " module must be referenced at https://deno.land/x/\n" +
- "\n" +
- " help, --help\n" +
- " Prints the help message\n" +
- "\n" +
- " version, --version\n" +
- " Prints the current dmm version\n" +
- "\n" +
- "\n" +
- "EXAMPLE USAGE\n" +
- "\n" +
- " Install dmm\n" +
- " deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts\n" +
- "\n" +
- " Check a single module\n" +
- " dmm check fs\n" +
- "\n" +
- " Update a single module\n" +
- " dmm update fs\n" +
- "\n" +
- " Get information about a module\n" +
- " dmm info http" + "\n\n",
+ `
+A module manager for Deno.
+
+USAGE
+
+ deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts
+ dmm [SUBCOMMAND]
+
+SUBCOMMANDS
+
+ check [modules]
+ Checks the specified modules for newer version. Will check all if modules are
+ omitted.
+
+ update [modules]
+ Updates the specified modules to the newest version. Will update all if modules
+ are omitted.
+
+ info [modules]
+ Displays information about the given modules, be it std or 3rd party. The 3rd
+ party module must be referenced at https://deno.land/x/
+
+ help, --help
+ Prints the help message
+
+ version, --version
+ Prints the current dmm version
+
+
+EXAMPLE USAGE
+
+ Install dmm
+ deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts
+
+ Check a single module
+ dmm check fs
+
+ Update a single module
+ dmm update fs
+
+ Get information about a module
+ dmm info http
+
+`
);
assertEquals(status.code, 0);
assertEquals(status.success, true);
diff --git a/tests/integration/out-of-date-deps/deps.ts b/tests/integration/out-of-date-deps/deps.ts
index 44b34aa..1539a61 100644
--- a/tests/integration/out-of-date-deps/deps.ts
+++ b/tests/integration/out-of-date-deps/deps.ts
@@ -1,6 +1,6 @@
import { Drash } from "https://deno.land/x/drash@v1.0.0/mod.ts"; // out of date
-import * as fs from "https://deno.land/std@0.74.0/fs/mod.ts"; // out of date
+import * as fs from "https://deno.land/std@0.53.0/fs/mod.ts"; // out of date
import * as colors from "https://deno.land/std@0.53.0/fmt/colors.ts"; //out of date
From 8b8fbefb99a977c522a66f0a990687f7cd22504a Mon Sep 17 00:00:00 2001
From: Eric Crooks
Date: Fri, 30 Oct 2020 17:54:07 -0400
Subject: [PATCH 36/39] improve README; make it more digestible
---
README.md | 42 +++++++++++++++---------------------------
1 file changed, 15 insertions(+), 27 deletions(-)
diff --git a/README.md b/README.md
index ddc6d45..19885c6 100644
--- a/README.md
+++ b/README.md
@@ -19,9 +19,7 @@
---
-`dmm` (pronounced "Dim") is a Deno module manager. Updating your dependencies within `deps.ts` and checking if new versions are available hasn't been easier.
-
-`dmm` will read your imported/exported modules that sit inside your `deps.ts` and check them against their latest version if you ask it to, and update them if you want it to.
+`dmm` (pronounced "dim") is a Deno module manager. It can update your `deps.ts` file, check if any of your dependencies are out of date, and give you information about any module in the Deno world. Managing your dependencies hasn't been easier.
# Contents
@@ -35,7 +33,7 @@
# Documentation
-[Full Documentation](https://drash.land/dmm/)
+* [Full Documentation](https://drash.land/dmm/)
# Features
@@ -44,40 +42,29 @@
* Checks dependencies for newer versions
* Will update your dependencies for you
* Gives information on modules
-* Accounts for 3rd party and `std` modules
+* Accounts for 3rd party and Deno Standard modules
* Installation is optional
-* Will be kept up to date and maintained consistently
* No variants of `node_modules` and `package.json`
* No extra configuration around import maps
# Quick Start
-There are two ways you can use this module: installing it though `deno`, or running it though a URL.
-
-As dmm only needs to read and write to your `deps.ts`, as well as requiring network access using Deno's CDN and API, you can restrict the access this module has.
-
-*Install*
-```sh
-$ deno install --allow-net='cdn.deno.land,api.deno.land,x.nest.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts
-$ dmm help
-```
-
-*Through the URL*
+There are two ways you can use this module:
-```
-$ deno run --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts help
-```
+1. You can install it through the `deno` command.
+ ```sh
+ $ deno install --allow-net='cdn.deno.land,api.deno.land,x.nest.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts
+ $ dmm help
+ ````
-In the examples below, dmm is installed and we will be using it that way to make the commands easier to read.
+2. Run it through a URL.
+ ```sh
+ $ deno run --allow-net='cdn.deno.land,api.deno.land,x.nest.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts help
+ ```
# How it Works
-* dmm reads the `deps.ts` file at the current working directory. It will check for versioned imports/exports and check or update against each one
-
-* dmm currently only supports the deno.land registry (https://deno.land)
-
-* For updating, dmm will fetch the latest version/release for each dependency and update your `deps.ts` if it is newer than the one you use
-dmm will only read modules that reside on [deno.land](https://deno.land), whether they are 3rd party or `std` modules. As long as you are either importing then exporting a module, or only exporting a module, dmm will check that dependency.
+dmm reads the `deps.ts` file at the current working directory -- checking versioned `import` and `export` statements and checking to see if they can be updated. If any dependency can be updated, it lets you know which ones can be updated; and if you want to update them, dmm will rewrite your `deps.ts` file so that your dependencies reflect their latest versions.
## Mirrors
@@ -90,4 +77,5 @@ Contributors are welcomed!
Please read through our [contributing guidelines](./.github/CONTRIBUTING.md). Included are directions for opening issues, coding standards, and notes on development.
## License
+
By contributing your code, you agree to license your contribution under the [MIT License](./LICENSE).
From d1a005bcc06289491bca9b2e9d5411167b7b1edf Mon Sep 17 00:00:00 2001
From: Eric Crooks
Date: Fri, 30 Oct 2020 17:57:41 -0400
Subject: [PATCH 37/39] shorten terminal commands; add raw github url to
--allow-net flag
---
README.md | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 19885c6..98a0d54 100644
--- a/README.md
+++ b/README.md
@@ -53,13 +53,23 @@ There are two ways you can use this module:
1. You can install it through the `deno` command.
```sh
- $ deno install --allow-net='cdn.deno.land,api.deno.land,x.nest.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts
+ $ deno install \
+ --allow-net='cdn.deno.land,api.deno.land,x.nest.land,raw.githubusercontent.com' \
+ --allow-read='.' \
+ --allow-write='deps.ts' \
+ https://deno.land/x/dmm@v1.1.5/mod.ts
+
$ dmm help
````
2. Run it through a URL.
```sh
- $ deno run --allow-net='cdn.deno.land,api.deno.land,x.nest.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts help
+ $ deno run \
+ --allow-net='cdn.deno.land,api.deno.land,x.nest.land,raw.githubusercontent.com' \
+ --allow-read='.' \
+ --allow-write='deps.ts' \
+ https://deno.land/x/dmm@v1.1.5/mod.ts \
+ help
```
# How it Works
From 46b6a8809ad6fe03f67d11bb7bdaac358dc537eb Mon Sep 17 00:00:00 2001
From: Eric Crooks
Date: Fri, 30 Oct 2020 17:58:38 -0400
Subject: [PATCH 38/39] deno fmt
---
tests/integration/error_test.ts | 2 +-
tests/integration/help_test.ts | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/integration/error_test.ts b/tests/integration/error_test.ts
index 6141815..5b07905 100644
--- a/tests/integration/error_test.ts
+++ b/tests/integration/error_test.ts
@@ -61,7 +61,7 @@ EXAMPLE USAGE
Get information about a module
dmm info http
-`
+`,
);
assertEquals(stderr, "");
assertEquals(status.code, 0);
diff --git a/tests/integration/help_test.ts b/tests/integration/help_test.ts
index e986158..6036b35 100644
--- a/tests/integration/help_test.ts
+++ b/tests/integration/help_test.ts
@@ -63,7 +63,7 @@ EXAMPLE USAGE
Get information about a module
dmm info http
-`
+`,
);
assertEquals(status.code, 0);
assertEquals(status.success, true);
From b7c42a20407f03d244dbf1965cea7c4c1d8f8a7b Mon Sep 17 00:00:00 2001
From: Eric Crooks
Date: Sat, 31 Oct 2020 02:09:57 -0400
Subject: [PATCH 39/39] fix readme
---
README.md | 205 +++++++++---------------------------------------------
1 file changed, 34 insertions(+), 171 deletions(-)
diff --git a/README.md b/README.md
index 4a81f92..98a0d54 100644
--- a/README.md
+++ b/README.md
@@ -19,19 +19,22 @@
---
-`dmm` (pronounced "Dim") is a Deno module manager. Updating your dependencies within `deps.ts` and checking if new versions are available hasn't been easier.
-
-`dmm` will read your imported/exported modules that sit inside your `deps.ts` and check them against their latest version if you ask it to, and update them if you want it to.
+`dmm` (pronounced "dim") is a Deno module manager. It can update your `deps.ts` file, check if any of your dependencies are out of date, and give you information about any module in the Deno world. Managing your dependencies hasn't been easier.
# Contents
+* [Documentation](#documentation)
* [Features](#features)
* [Quick Start](#quick-start)
-* [Example](#example)
* [How it Works](#how-it-works)
+* [Mirrors](#mirrors)
* [Contributing](#contributing)
* [License](#license)
+# Documentation
+
+* [Full Documentation](https://drash.land/dmm/)
+
# Features
* Zero dependencies
@@ -39,185 +42,44 @@
* Checks dependencies for newer versions
* Will update your dependencies for you
* Gives information on modules
-* Accounts for 3rd party and `std` modules
+* Accounts for 3rd party and Deno Standard modules
* Installation is optional
-* Will be kept up to date and maintained consistently
* No variants of `node_modules` and `package.json`
* No extra configuration around import maps
# Quick Start
-There are two ways you can use this module: installing it though `deno`, or running it though a URL.
-
-As dmm only needs to read and write to your `deps.ts`, as well as requiring network access using Deno's CDN and API, you can restrict the access this module has.
-
-*Install*
-```
-$ deno install --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts
-$ dmm ...
-```
-
-*Through the URL*
-
-If you are using this method, be sure to use the latest version of dmm in the command below
-```
-$ deno run --allow-net='cdn.deno.land,api.deno.land' --allow-read='.' --allow-write='deps.ts' https://deno.land/x/dmm@v1.1.5/mod.ts ...
-```
-
-In the examples below, dmm is installed and we will be using it that way to make the commands easier to read.
-
-# Example
-
-In this example, we are going to run through every step of dmm. We will be checking dependencies, updating them, and getting information about certain ones.
-
-**Step 1 - Info**
-
-Say I want to get information about the fmt module:
-
-```
-$ dmm info fmt
-
-Information on fmt
-
- - Name: fmt
- - Description: Cannot retrieve descriptions for std modules
- - deno.land Link: https://deno.land/std@0.75.0/fmt
- - GitHub Repository: https://github.com/denoland/deno/tree/master/std/fmt
- - Import Statement: import * as fmt from "https://deno.land/std@0.75.0/fmt";
- - Latest Version: 0.75.0
-
-```
-
-**Step 2 - Adding `fmt` as a dependency to use `colors`**
-
-Along with my current dependencies, I decided to import the `colors` sub-module of `fmt` in my `deps.ts` file:
-
-```typescript
-export { Drash } from "https://deno.land/x/drash@v1.0.0/mod.ts"; // out of date
-
-import * as fs from "https://deno.land/std@0.53.0/fs/mod.ts"; // out of date
-
-import * as colors from "https://deno.land/std@0.75.0/fmt/colors.ts"; // up to date
-
-export { fs, colors }
-```
-
-Take notice of the out of date dependencies.
-
-**Step 3 - Check**
-
-Now we want to check if any of our dependencies need updating, but we don't want to update them yet.
-
-```
-$ dmm check
-...
-drash can be updated from v1.0.0 to v1.2.5
-fs can be updated from 0.53.0 to 0.75.0
-...
-```
-
-**Step 4 - Update**
-
-Lets update our dependencies as some are out of date:
-
-```
-$ dmm update
-...
-drash was updated from v1.0.0 to v1.2.5
-fs was updated from 0.53.0 to 0.75.0
-...
-```
-
-Now lets check the `deps.ts` file, and you will notice the versions have been modified:
-
-```typescript
-export { Drash } from "https://deno.land/x/drash@v1.2.5/mod.ts"; // was out of date
-
-import * as fs from "https://deno.land/std@0.75.0/fs/mod.ts"; // was out of date
-
-import * as colors from "https://deno.land/std@0.75.0/fmt/colors.ts";
-
-export { fs, colors }
-```
-
-**Step 5 - Help**
-
-Should you need any more information, use the `--help` option:
-
-```
-$ dmm --help
-
-A module manager for Deno.
-
-USAGE:
- deno run --allow-read --allow-net [--allow-write] https://deno.land/x/dmm@v1.1.5/mod.ts [ARGS] [MODULES]
-
- dmm [ARGS] [MODULES]
-
-ARGUMENTS:
-The check and update arguments cannot be used together.
-
- check
- Checks the specified modules for newer version. Will check all if modules are omitted.
-
- update
- Updates the specified modules to the newest version. Will update all if modules are omitted.
-
- info
- Shows information about the given module, be it std or 3rd party. The 3rd party module must be referenced at https://deno.land/x/
-
-OPTIONS:
- --help
- Prints help message
- --version
- Prints dmm version
-
-EXAMPLE USAGE:
- Assume you are importing an out of date version of `fs` from `std`. See [here](#quick-start) for adding further restrictions.
- deno run --allow-net --allow-read https://deno.land/x/dmm@v1.1.5/mod.ts check fs
- deno run --allow-net --allow-read --allow-write https://deno.land/x/dmm@v1.1.5/mod.ts update fs
- deno run --allow-net https://deno.land/x/dmm@v1.1.5/mod.ts info http
- dmm info http
-
-```
+There are two ways you can use this module:
+
+1. You can install it through the `deno` command.
+ ```sh
+ $ deno install \
+ --allow-net='cdn.deno.land,api.deno.land,x.nest.land,raw.githubusercontent.com' \
+ --allow-read='.' \
+ --allow-write='deps.ts' \
+ https://deno.land/x/dmm@v1.1.5/mod.ts
+
+ $ dmm help
+ ````
+
+2. Run it through a URL.
+ ```sh
+ $ deno run \
+ --allow-net='cdn.deno.land,api.deno.land,x.nest.land,raw.githubusercontent.com' \
+ --allow-read='.' \
+ --allow-write='deps.ts' \
+ https://deno.land/x/dmm@v1.1.5/mod.ts \
+ help
+ ```
# How it Works
-dmm will only read modules that reside on [deno.land](https://deno.land), whether they are 3rd party or `std` modules. As long as you are either importing then exporting a module, or only exporting a module, dmm will check that dependency.
+dmm reads the `deps.ts` file at the current working directory -- checking versioned `import` and `export` statements and checking to see if they can be updated. If any dependency can be updated, it lets you know which ones can be updated; and if you want to update them, dmm will rewrite your `deps.ts` file so that your dependencies reflect their latest versions.
-* Your dependencies must be versioned. Not versioning your dependencies is bad practice and can lead to many problems in your project, which is why dmm will not support it. For example:
- ```
- import { red } from "https://deno.land/std@0.56.0/fmt/colors.ts";
- ^^^^^^^
- ```
+## Mirrors
-* dmm only supports importing/exporting modules from Deno's registry: [deno.land](https://deno.land), 3rd party or `std`. For example:
- ```
- import { red } from "https://deno.land/std@0.56.0/fmt/colors.ts"; // supported
- import { something } from "https://deno.land/x/something@0v1.0.0/mod.ts"; // supported
- ```
+* https://nest.land/package/dmm
-* dmm will read every `from "https://deno.land/..."` line in your `deps.ts` and using the name and version, will convert the dependencies into objects.
-
-* dmm will then retrieve the rest of the required information for later use for each module:
- * Latest version - For std and 3rd party, this is pulled using `https://cdn.deno.land`.
- * GitHub URL - Retrieved through the GitHub API
- * Description - For 3rd party modules, it is taken from `https://api.deno.land`. There is currently no way to get descriptions for std modules.
-
-* After this, dmm will run different actions based on the purpose:
-
- * **check**
-
- Will compare the version you are using of a module with the latest one
-
- * **update**
-
- If the latest version is more recent than the one you use for a given module, dmm will update the version in your `deps.ts` file
-
- * **info**
-
- Displays information about the given module using information collated at the start of the script
-
## Contributing
Contributors are welcomed!
@@ -225,4 +87,5 @@ Contributors are welcomed!
Please read through our [contributing guidelines](./.github/CONTRIBUTING.md). Included are directions for opening issues, coding standards, and notes on development.
## License
+
By contributing your code, you agree to license your contribution under the [MIT License](./LICENSE).