diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index b2615e6..00f32f3 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@v2 - name: Install Deno - uses: denolib/setup-deno@master + uses: denoland/setup-deno@v1 - name: Integration run: | diff --git a/README.md b/README.md index af53fa0..3fa8966 100644 --- a/README.md +++ b/README.md @@ -19,17 +19,14 @@ --- -`dmm` 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. +`dmm` is a simple CLI tool to bump your dependencies from your `deps.ts` to +their latest versions. ### Features - Zero 3rd party 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 Deno Standard modules - Installation is optional - No variants of `node_modules` and `package.json` diff --git a/console/bumper_ci_service.ts b/console/bumper_ci_service.ts index c280e6e..1e5bc2b 100644 --- a/console/bumper_ci_service.ts +++ b/console/bumper_ci_service.ts @@ -1,12 +1,10 @@ import { BumperService } from "https://raw.githubusercontent.com/drashland/services/master/ci/bumper_service.ts"; -import { bumperFiles, preReleaseFiles } from "./bumper_ci_service_files.ts"; +import { preReleaseFiles } from "./bumper_ci_service_files.ts"; const b = new BumperService("dmm", Deno.args); if (b.isForPreRelease()) { b.bump(preReleaseFiles); -} else { - b.bump(bumperFiles); } // As dmm was used to update the deps, coy the file over so we dont need to include this in bumper files diff --git a/console/bumper_ci_service_files.ts b/console/bumper_ci_service_files.ts index bbe2ba8..42751df 100644 --- a/console/bumper_ci_service_files.ts +++ b/console/bumper_ci_service_files.ts @@ -14,7 +14,11 @@ export const regexes = { dmm_raw_github: /dmm\/v[0-9\.]+[0-9\.]+[0-9\.]/g, }; -export const preReleaseFiles = [ +export const preReleaseFiles: { + filename: string; + replaceTheRegex: RegExp; + replaceWith: string; +}[] = [ { filename: "./egg.json", replaceTheRegex: regexes.egg_json, @@ -26,5 +30,3 @@ export const preReleaseFiles = [ replaceWith: `version = "{{ thisModulesLatestVersion }}"`, }, ]; - -export const bumperFiles = []; diff --git a/mod.ts b/mod.ts index 5a296bb..3902cd7 100644 --- a/mod.ts +++ b/mod.ts @@ -1,8 +1,6 @@ import { Line } from "./deps.ts"; import { version } from "./src/commands/version.ts"; import { UpdateSubcommand } from "./src/commands/update.ts"; -import { InfoSubcommand } from "./src/commands/info.ts"; -import { CheckSubcommand } from "./src/commands/check.ts"; const c = new Line({ command: "dmm", @@ -11,8 +9,6 @@ const c = new Line({ version: `v${version}`, subcommands: [ UpdateSubcommand, - InfoSubcommand, - CheckSubcommand, ], }); diff --git a/src/commands/check.ts b/src/commands/check.ts deleted file mode 100644 index 1146458..0000000 --- a/src/commands/check.ts +++ /dev/null @@ -1,55 +0,0 @@ -import ModuleService from "../services/module_service.ts"; - -import { ConsoleLogger, Subcommand } from "../../deps.ts"; - -export class CheckSubcommand extends Subcommand { - public signature = "check [...modules]"; - public description = - "Check if the given dependencies you hold are outdated. Will check all if modules are omitted. Ex: dmm info; dmm info drash fs"; - - public async handle() { - const dependencies = Deno.args.filter((arg) => arg.indexOf("check") === -1); - // Create objects for each dep, with its name and version - const allModules = await ModuleService.constructModulesDataFromDeps( - "deps.ts", - ); - const selectedModules = allModules.filter((module) => { - if (dependencies.length) { // only return selected modules of selecting is set - return dependencies.indexOf(module.name) > -1; - } else { - return true; - } - }); - - if (selectedModules.length === 0) { - ConsoleLogger.error( - "Modules specified do not exist in your dependencies.", - ); - Deno.exit(1); - } - - // Compare imported and latest version - ConsoleLogger.info("Comparing versions..."); - let depsCanBeUpdated = false; - const listOfModuleNamesToBeUpdated: string[] = []; - selectedModules.forEach((module) => { - if (module.importedVersion !== module.latestRelease) { - depsCanBeUpdated = true; - listOfModuleNamesToBeUpdated.push(module.name); - ConsoleLogger.info( - module.name + " can be updated from " + module.importedVersion + - " to " + module.latestRelease, - ); - } - }); - // Logging purposes - if (depsCanBeUpdated) { - ConsoleLogger.info( - "To update, run: \n dmm update " + - listOfModuleNamesToBeUpdated.join(" "), - ); - } else { - ConsoleLogger.info("Your dependencies are up to date"); - } - } -} diff --git a/src/commands/info.ts b/src/commands/info.ts deleted file mode 100644 index 20c459f..0000000 --- a/src/commands/info.ts +++ /dev/null @@ -1,59 +0,0 @@ -import DenoService from "../services/deno_service.ts"; - -import { ConsoleLogger, Subcommand } from "../../deps.ts"; - -export class InfoSubcommand extends Subcommand { - public signature = "info [...modules]"; - public description = - "Get information about any number of given dependencies."; - - public async handle() { - const modules = Deno.args.filter((arg) => arg.indexOf("info") === -1); - if (modules.length === 0) { - ConsoleLogger.error("Subcommand `info` requires arguments."); - Deno.exit(1); - } - for (const index in modules) { - const moduleToGetInfoOn: string = modules[index]; - const stdResponse = await fetch( - "https://github.com/denoland/deno_std/tree/master/" + moduleToGetInfoOn, - ); - await stdResponse.arrayBuffer(); - const thirdPartyResponse = await fetch( - DenoService.DENO_CDN_URL + moduleToGetInfoOn + "/meta/versions.json", - ); // Only used so we can check if the module exists - await thirdPartyResponse.arrayBuffer(); - const isStd = stdResponse.status === 200; - const isThirdParty = thirdPartyResponse.status === 200; - if (!isStd && !isThirdParty) { - ConsoleLogger.error("No module was found with " + moduleToGetInfoOn); - Deno.exit(1); - } - const name = moduleToGetInfoOn; - let description; - let denoLandUrl; - let repositoryUrl; - let latestVersion; - if (isStd) { - latestVersion = await DenoService.getLatestModuleRelease("std"); - description = "Cannot retrieve descriptions for std modules"; - denoLandUrl = "https://deno.land/std@" + latestVersion + "/" + - name; - repositoryUrl = "https://github.com/denoland/deno_std/tree/master/" + - name; - } - if (isThirdParty) { - description = await DenoService.getThirdPartyDescription(name); - repositoryUrl = await DenoService.getThirdPartyRepoURL(name); - latestVersion = await DenoService.getLatestModuleRelease(name); - denoLandUrl = "https://deno.land/x/" + name + "@" + latestVersion; - } - const importLine = "import * as " + name + ' from "' + denoLandUrl + '";'; - ConsoleLogger.info( - `Information on ${name}\n\n - Name: ${name}\n - Description: ${description}\n - deno.land Link: ${denoLandUrl}\n - Repository: ${repositoryUrl}\n - Import Statement: ${importLine}\n - Latest Version: ${latestVersion}` + - "\n", - ); - } - Deno.exit(); - } -} diff --git a/tests/data/expected_help_message.ts b/tests/data/expected_help_message.ts index a3db5f1..e299f8d 100644 --- a/tests/data/expected_help_message.ts +++ b/tests/data/expected_help_message.ts @@ -14,9 +14,5 @@ SUBCOMMANDS update Update all dependencies in the \`deps.ts\` file in your CWD, or specify certain modules to update or a location to a dependency file. - info - Get information about any number of given dependencies. - check - Check if the given dependencies you hold are outdated. Will check all if modules are omitted. Ex: dmm info; dmm info drash fs `; diff --git a/tests/integration/check_test.ts b/tests/integration/check_test.ts deleted file mode 100644 index 6fcfa4b..0000000 --- a/tests/integration/check_test.ts +++ /dev/null @@ -1,472 +0,0 @@ -import { assertEquals, colours } from "../../deps.ts"; -import DenoService from "../../src/services/deno_service.ts"; -import NestService from "../../src/services/nest_service.ts"; -import { outOfDateDepsDir, upToDateDepsDir } from "./test_constants.ts"; -import GitHubService from "../../src/services/github_service.ts"; - -const latestDrashRelease = await DenoService.getLatestModuleRelease( - "drash", -); -const latestCliffyRelease = await NestService.getLatestModuleRelease( - "cliffy", -); -const latestStdRelease = await DenoService.getLatestModuleRelease("std"); -const latestWocketRelease = await GitHubService.getLatestModuleRelease( - "https://github.com/drashland/wocket", -); -// Check a specific dep that can be updated -Deno.test({ - name: "Check | Single | Modules to Update Exist - deno.land/x", - - //ignore: true, - async fn(): Promise { - const p = await Deno.run({ - cmd: [ - "deno", - "run", - "--allow-net", - "--allow-read", - "../../../mod.ts", - "check", - "fs", - ], - cwd: outOfDateDepsDir, - stdout: "piped", - stderr: "piped", - }); - const status = await p.status(); - const output = await p.output(); - await p.close(); - const stdout = new TextDecoder("utf-8").decode(output); - const error = await p.stderrOutput(); - const stderr = new TextDecoder("utf-8").decode(error); - assertEquals(stderr, ""); - assertEquals( - stdout, - colours.blue("INFO") + - " Reading deps.ts to gather your dependencies...\n" + - colours.blue("INFO") + " Comparing versions...\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", - ); - assertEquals(status.code, 0); - assertEquals(status.success, true); - }, -}); - -// Check a specific dep that is already up to date -Deno.test({ - name: "Check | Single | No Modules to Update - deno.land/x", - - //ignore: true, - async fn(): Promise { - const p = await Deno.run({ - cmd: [ - "deno", - "run", - "--allow-net", - "--allow-read", - "../../../mod.ts", - "check", - "fs", - ], - cwd: upToDateDepsDir, - stdout: "piped", - stderr: "piped", - }); - const status = await p.status(); - 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, ""); - assertEquals( - stdout, - 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); - }, -}); - -// Check a specific dep that can be updated -Deno.test({ - name: "Check | Single | Modules to Update Exist - nest.land", - - //ignore: true, - async fn(): Promise { - const p = await Deno.run({ - cmd: [ - "deno", - "run", - "--allow-net", - "--allow-read", - "../../../mod.ts", - "check", - "cliffy", - ], - cwd: outOfDateDepsDir, - stdout: "piped", - stderr: "piped", - }); - const status = await p.status(); - const output = await p.output(); - await p.close(); - const stdout = new TextDecoder("utf-8").decode(output); - const error = await p.stderrOutput(); - const stderr = new TextDecoder("utf-8").decode(error); - assertEquals(stderr, ""); - assertEquals( - stdout, - 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.11.2 to ${latestCliffyRelease}\n` + - colours.blue("INFO") + " To update, run: \n" + - " dmm update cliffy\n", - ); - assertEquals(status.code, 0); - assertEquals(status.success, true); - }, -}); - -// Check a specific dep that is already up to date -Deno.test({ - name: "Check | Single | No Modules to Update - nest.land", - - //ignore: true, - async fn(): Promise { - const p = await Deno.run({ - cmd: [ - "deno", - "run", - "--allow-net", - "--allow-read", - "../../../mod.ts", - "check", - "cliffy", - ], - cwd: upToDateDepsDir, - stdout: "piped", - stderr: "piped", - }); - const status = await p.status(); - 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, ""); - assertEquals( - stdout, - 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); - }, -}); - -// Check a list of deps that can be updated -Deno.test({ - name: "Check | Many | Modules to Update Exist", - - //ignore: true, - async fn(): Promise { - const p = await Deno.run({ - cmd: [ - "deno", - "run", - "--allow-net", - "--allow-read", - "../../../mod.ts", - "check", - "fs", - "drash", - ], - cwd: outOfDateDepsDir, - stdout: "piped", - stderr: "piped", - }); - const status = await p.status(); - 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, ""); - assertEquals( - stdout, - colours.blue("INFO") + - " Reading deps.ts to gather your dependencies...\n" + - colours.blue("INFO") + " Comparing versions...\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", - ); - assertEquals(status.code, 0); - assertEquals(status.success, true); - }, -}); - -// Check a list of deps that are already up to date -Deno.test({ - name: "Check | Many | No Modules to Update", - - //ignore: true, - async fn(): Promise { - const p = await Deno.run({ - cmd: [ - "deno", - "run", - "--allow-net", - "--allow-read", - "../../../mod.ts", - "check", - "fs", - "drash", - ], - cwd: upToDateDepsDir, - stdout: "piped", - stderr: "piped", - }); - const status = await p.status(); - 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, ""); - assertEquals( - stdout, - 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); - }, -}); - -// Check every dep and all of them are out of date -Deno.test({ - name: "Check | All | Modules to Update Exist", - - //ignore: true, - async fn(): Promise { - const p = await Deno.run({ - cmd: [ - "deno", - "run", - "--allow-net", - "--allow-read", - "../../../mod.ts", - "check", - ], - cwd: outOfDateDepsDir, - stdout: "piped", - stderr: "piped", - }); - const status = await p.status(); - 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, ""); - assertEquals( - stdout, - colours.blue("INFO") + - " Reading deps.ts to gather your dependencies...\n" + - colours.blue("INFO") + " Comparing versions...\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") + - ` 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") + - ` wocket can be updated from v0.4.0 to ${latestWocketRelease}\n` + - colours.blue("INFO") + " To update, run: \n" + - " dmm update drash fs fmt cliffy log uuid wocket" + - "\n", - ); - assertEquals(status.code, 0); - assertEquals(status.success, true); - }, -}); - -// Check every dep and all of them are already up to date -Deno.test({ - name: "Check | All | No Modules to Update", - - //ignore: true, - async fn(): Promise { - const p = await Deno.run({ - cmd: [ - "deno", - "run", - "--allow-net", - "--allow-read", - "../../../mod.ts", - "check", - ], - cwd: upToDateDepsDir, - stdout: "piped", - stderr: "piped", - }); - const status = await p.status(); - 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, ""); - assertEquals( - stdout, - 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); - }, -}); - -Deno.test({ - name: "Check | Modules Dont Exist in Dependencies", - - //ignore: true, - async fn(): Promise { - const p = await Deno.run({ - cmd: [ - "deno", - "run", - "--allow-net", - "--allow-read", - "../../../mod.ts", - "check", - "denon", - "io", - ], - cwd: upToDateDepsDir, - stdout: "piped", - stderr: "piped", - }); - const status = await p.status(); - 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), ""); - assertEquals( - stdout, - colours.blue("INFO") + - " Reading deps.ts to gather your dependencies...\n" + - colours.red("ERROR") + - " Modules specified do not exist in your dependencies.\n", - ); - assertEquals(status.code, 1); - assertEquals(status.success, false); - }, -}); - -Deno.test({ - name: "Check | std | Not Found", - - //ignore: true, - async fn(): Promise { - const p = await Deno.run({ - cmd: [ - "deno", - "run", - "--allow-net", - "--allow-read", - "../../../mod.ts", - "check", - "http", - ], - cwd: upToDateDepsDir, - stdout: "piped", - stderr: "piped", - }); - const status = await p.status(); - 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), ""); - assertEquals( - stdout, - colours.blue("INFO") + - " Reading deps.ts to gather your dependencies...\n" + - colours.red("ERROR") + - " Modules specified do not exist in your dependencies.\n", - ); - assertEquals(status.code, 1); - assertEquals(status.success, false); - }, -}); - -Deno.test({ - name: "Check | 3rd Party | Not Found", - - //ignore: true, - async fn(): Promise { - const p = await Deno.run({ - cmd: [ - "deno", - "run", - "--allow-net", - "--allow-read", - "../../../mod.ts", - "check", - "io", - ], - cwd: upToDateDepsDir, - stdout: "piped", - stderr: "piped", - }); - const status = await p.status(); - 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, - "", - ); - assertEquals( - stdout, - colours.blue("INFO") + - " Reading deps.ts to gather 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/error_test.ts b/tests/integration/error_test.ts index ed0644c..5a601c1 100644 --- a/tests/integration/error_test.ts +++ b/tests/integration/error_test.ts @@ -52,7 +52,7 @@ Deno.test({ assertEquals( stdout, colours.red("ERROR") + - ' Unknown input "something" specified.\n\nAVAILABLE OPTIONS\n\n -h, --help\n -v, --version\n\nAVAILABLE SUBCOMMANDS\n\n update\n info\n check\n\n', + ' Unknown input "something" specified.\n\nAVAILABLE OPTIONS\n\n -h, --help\n -v, --version\n\nAVAILABLE SUBCOMMANDS\n\n update\n\n', ); assertEquals(stderr, ""); assertEquals(status.code, 1); diff --git a/tests/integration/info_test.ts b/tests/integration/info_test.ts deleted file mode 100644 index 5e8850b..0000000 --- a/tests/integration/info_test.ts +++ /dev/null @@ -1,202 +0,0 @@ -import { assertEquals, colours } from "../../deps.ts"; -import DenoService from "../../src/services/deno_service.ts"; -import { outOfDateDepsDir, upToDateDepsDir } from "./test_constants.ts"; -const latestDrashRelease = await DenoService.getLatestModuleRelease( - "drash", -); -const latestStdRelease = await DenoService.getLatestModuleRelease("std"); - -// Check a specific dep that can be updated -Deno.test({ - name: "Info | Module Omitted | Should fail", - - //ignore: true, - async fn(): Promise { - const p = await Deno.run({ - cmd: ["deno", "run", "--allow-net", "../../../mod.ts", "info"], - cwd: outOfDateDepsDir, - stdout: "piped", - stderr: "piped", - }); - const status = await p.status(); - const output = await p.output(); - await p.close(); - 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") + " Subcommand `info` requires arguments.\n", - ); - assertEquals( - stderr, - "", - ); - assertEquals(status.code, 1); - assertEquals(status.success, false); - }, -}); - -// Check a specific dep that is already up to date -Deno.test({ - name: "Info | 3rd Party Module | Should pass", - - //ignore: true, - async fn(): Promise { - const p = await Deno.run({ - cmd: ["deno", "run", "--allow-net", "../../../mod.ts", "info", "drash"], - cwd: upToDateDepsDir, - stdout: "piped", - stderr: "piped", - }); - const status = await p.status(); - const output = await p.output(); - await p.close(); - const stdout = new TextDecoder("utf-8").decode(output); - const error = await p.stderrOutput(); - const stderr = new TextDecoder("utf-8").decode(error); - assertEquals( - stdout, - colours.blue("INFO") + " Information on drash\n\n" + - " - Name: drash\n" + - " - Description: A microframework for Deno's HTTP server with zero third-party dependencies\n" + - ` - deno.land Link: https://deno.land/x/drash@${latestDrashRelease}\n` + - " - Repository: https://github.com/drashland/drash\n" + - ` - Import Statement: import * as drash from \"https://deno.land/x/drash@${latestDrashRelease}\";\n` + - ` - Latest Version: ${latestDrashRelease}\n` + - "\n", - ); - assertEquals(stderr, ""); - assertEquals(status.code, 0); - assertEquals(status.success, true); - }, -}); - -// Check a list of deps that can be updated -Deno.test({ - name: "Info | std Module | Should pass", - - //ignore: true, - async fn(): Promise { - const p = await Deno.run({ - cmd: ["deno", "run", "--allow-net", "../../../mod.ts", "info", "fs"], - cwd: outOfDateDepsDir, - stdout: "piped", - stderr: "piped", - }); - const status = await p.status(); - const output = await p.output(); - await p.close(); - const stdout = new TextDecoder("utf-8").decode(output); - const error = await p.stderrOutput(); - const stderr = new TextDecoder("utf-8").decode(error); - assertEquals( - stdout, - 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` + - " - Repository: https://github.com/denoland/deno_std/tree/master/fs\n" + - ` - Import Statement: import * as fs from \"https://deno.land/std@${latestStdRelease}/fs\";\n` + - ` - Latest Version: ${latestStdRelease}\n` + - "\n", - ); - assertEquals(stderr, ""); - assertEquals(status.code, 0); - assertEquals(status.success, true); - }, -}); - -// Check a list of deps that are already up to date -Deno.test({ - name: "Info | Multiple Modules | Should fail", - - //ignore: true, - async fn(): Promise { - const p = await Deno.run({ - cmd: [ - "deno", - "run", - "--allow-net", - "../../../mod.ts", - "info", - "fs", - "drash", - ], - cwd: upToDateDepsDir, - stdout: "piped", - stderr: "piped", - }); - const status = await p.status(); - const output = await p.output(); - await p.close(); - const stdout = new TextDecoder("utf-8").decode(output); - const error = await p.stderrOutput(); - const stderr = new TextDecoder("utf-8").decode(error); - assertEquals( - stdout, - `${colours.blue("INFO")} Information on fs - - - Name: fs - - Description: Cannot retrieve descriptions for std modules - - deno.land Link: https://deno.land/std@${latestStdRelease}/fs - - Repository: https://github.com/denoland/deno_std/tree/master/fs - - Import Statement: import * as fs from "https://deno.land/std@${latestStdRelease}/fs"; - - Latest Version: ${latestStdRelease} - -${colours.blue("INFO")} Information on drash - - - Name: drash - - Description: A microframework for Deno's HTTP server with zero third-party dependencies - - deno.land Link: https://deno.land/x/drash@${latestDrashRelease} - - Repository: https://github.com/drashland/drash - - Import Statement: import * as drash from "https://deno.land/x/drash@${latestDrashRelease}"; - - Latest Version: ${latestDrashRelease} - -`, - ); - assertEquals( - stderr, - "", - ); - assertEquals(status.code, 0); - assertEquals(status.success, true); - }, -}); - -Deno.test({ - name: "Info | Invalid Module | Should fail", - - //ignore: true, - async fn(): Promise { - const p = await Deno.run({ - cmd: [ - "deno", - "run", - "--allow-net", - "../../../mod.ts", - "info", - "somethinggg", - ], - cwd: upToDateDepsDir, - stdout: "piped", - stderr: "piped", - }); - const status = await p.status(); - const output = await p.output(); - await p.close(); - 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") + " No module was found with somethinggg\n", - ); - assertEquals( - stderr, - "", - ); - assertEquals(status.code, 1); - assertEquals(status.success, false); - }, -}); diff --git a/tests/integration/up-to-date-deps/deps.ts b/tests/integration/up-to-date-deps/deps.ts index 1d26e36..960db64 100644 --- a/tests/integration/up-to-date-deps/deps.ts +++ b/tests/integration/up-to-date-deps/deps.ts @@ -1,4 +1,4 @@ -import { Drash } from "https://deno.land/x/drash@v2.1.0/mod.ts"; // up to date +import { Drash } from "https://deno.land/x/drash@v2.2.0/mod.ts"; // up to date import * as fs from "https://deno.land/std@0.116.0/fs/mod.ts"; // up to date diff --git a/tests/integration/up-to-date-deps/original_deps.ts b/tests/integration/up-to-date-deps/original_deps.ts index 1d26e36..960db64 100644 --- a/tests/integration/up-to-date-deps/original_deps.ts +++ b/tests/integration/up-to-date-deps/original_deps.ts @@ -1,4 +1,4 @@ -import { Drash } from "https://deno.land/x/drash@v2.1.0/mod.ts"; // up to date +import { Drash } from "https://deno.land/x/drash@v2.2.0/mod.ts"; // up to date import * as fs from "https://deno.land/std@0.116.0/fs/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 index 03e912a..0437a56 100644 --- a/tests/unit/console/bumper_ci_service_test.ts +++ b/tests/unit/console/bumper_ci_service_test.ts @@ -1,49 +1,10 @@ import { assertEquals } from "../../../deps.ts"; -import { - bumperFiles, - preReleaseFiles, -} from "../../../console/bumper_ci_service_files.ts"; +import { preReleaseFiles } 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"); - -Deno.test({ - name: "Bumper CI Service | bumps std versions in deps files correctly", - async fn(): Promise { - const file = bumperFiles[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 = bumperFiles[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 = bumperFiles[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 { @@ -57,7 +18,7 @@ Deno.test({ Deno.test({ name: "Bumper CI Service | bumps const statements correctly", async fn(): Promise { - const file = preReleaseFiles[2]; + const file = preReleaseFiles[1]; file.filename = "./tests/data/pattern_types.txt"; const bumped = await c.bump([file], false); assertEquals(bumped[0], data_constStatements); @@ -68,114 +29,6 @@ Deno.test({ // DATA PROVIDERS ////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -// deno-lint-ignore camelcase -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 -`; - -// deno-lint-ignore camelcase -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 -`; - -// deno-lint-ignore camelcase -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 -`; - // deno-lint-ignore camelcase const data_constStatements = `workflow files