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 -

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/.github/workflows/bumper.yml b/.github/workflows/bumper.yml index 500f7f3..1a85d5f 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 @@ -20,8 +20,8 @@ jobs: - name: Update Dependencies 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 + - name: Bump Versions + 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/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/.github/workflows/pre_release.yml b/.github/workflows/pre_release.yml new file mode 100644 index 0000000..d4cee53 --- /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/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 + 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 diff --git a/README.md b/README.md index 232fc86..98a0d54 100644 --- a/README.md +++ b/README.md @@ -19,16 +19,13 @@ --- -`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) @@ -36,7 +33,7 @@ # Documentation -[Full Documentation](https://drash.land/dmm/) +* [Full Documentation](https://drash.land/dmm/) # Features @@ -45,186 +42,39 @@ * 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 -``` -```sh -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 ... -``` - -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: - -``` -$ 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) 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. - -* 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"; - ^^^^^^^ +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 ``` -* 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: - ``` - import { red } from "https://x.nest.land/std@0.56.0/fmt/colors.ts"; // supported - import { something } from "https://deno.land/x/something@0v1.0.0/mod.ts"; // supported - ``` +# How it Works -* 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 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. - -* 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 +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 @@ -237,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). diff --git a/console/bumper_ci_service.ts b/console/bumper_ci_service.ts new file mode 100644 index 0000000..029778d --- /dev/null +++ b/console/bumper_ci_service.ts @@ -0,0 +1,14 @@ +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(moduleVersionFiles); +} else { + 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/console/update_deno_version_strings.ts b/console/update_deno_version_strings.ts deleted file mode 100644 index 3db3c94..0000000 --- a/console/update_deno_version_strings.ts +++ /dev/null @@ -1,85 +0,0 @@ -// 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 - -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; - -// 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), -); diff --git a/deps.ts b/deps.ts index 28e555f..7884281 100644 --- a/deps.ts +++ b/deps.ts @@ -1,4 +1,6 @@ -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"; +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"; diff --git a/mod.ts b/mod.ts index 787a5d6..e7b0d87 100644 --- a/mod.ts +++ b/mod.ts @@ -1,56 +1,30 @@ -import { colours } from "./deps.ts"; -import { helpMessage } from "./src/options/help.ts"; -import { versionMessage } from "./src/options/version.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"; -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); - } -} +const c = new CliService(Deno.args); -// Gather args -const args: string[] = Deno.args; -if (!args.length) { - console.error(colours.red("Invalid arguments. See --help")); - Deno.exit(1); -} +c.addSubcommand(["help", "--help"], async () => { + console.log(helpMessage); +}); -// Support --help usage -const wantsHelp: boolean = args.filter((arg) => arg === "--help").length === 1; -if (wantsHelp) { - console.info(helpMessage); - Deno.exit(); -} +c.addSubcommand(["version", "--version"], () => { + console.log(versionMessage); +}); -// Support --version usage -const wantsVersion: boolean = - args.filter((arg) => arg === "--version").length === 1; -if (wantsVersion) { - console.info(versionMessage); - Deno.exit(); -} +c.addSubcommand("info", async (args: string[]) => { + await info(args); +}, { requires_args: true }); -// 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); +c.addSubcommand("update", async (args: string[]) => { + await update(args); +}); -await run(purpose, modulesForPurpose); +c.addSubcommand("check", async (args: string[]) => { + await check(args); +}); + +c.run(); diff --git a/src/commands/check.ts b/src/commands/check.ts index 0b8c7de..70cf639 100644 --- a/src/commands/check.ts +++ b/src/commands/check.ts @@ -1,5 +1,4 @@ -import { colours } from "../../deps.ts"; -import IModule from "../interfaces/module.ts"; +import { LoggerService } from "../../deps.ts"; import ModuleService from "../services/module_service.ts"; /** @@ -17,36 +16,33 @@ export async function check(dependencies: string[]): Promise { ); if (modules === false || typeof modules === "boolean") { - console.error( - 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 - console.info("Comparing versions..."); + LoggerService.logInfo("Comparing versions..."); let depsCanBeUpdated: boolean = false; - let listOfModuleNamesToBeUpdated: string[] = []; + const listOfModuleNamesToBeUpdated: string[] = []; modules.forEach((module) => { if (module.importedVersion !== module.latestRelease) { depsCanBeUpdated = true; listOfModuleNamesToBeUpdated.push(module.name); - console.info( - colours.yellow( - module.name + " can be updated from " + module.importedVersion + - " to " + module.latestRelease, - ), + LoggerService.logInfo( + module.name + " can be updated from " + module.importedVersion + + " to " + module.latestRelease, ); } }); // Logging purposes if (depsCanBeUpdated) { - console.info( + LoggerService.logInfo( "To update, run: \n dmm update " + listOfModuleNamesToBeUpdated.join(" "), ); } else { - console.info(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 new file mode 100644 index 0000000..a7819a1 --- /dev/null +++ b/src/commands/help.ts @@ -0,0 +1,46 @@ +import { CliService } from "../../deps.ts"; +import { version } from "./version.ts"; + +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 [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: [ + { + 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", + ], + }, + ], +}); diff --git a/src/commands/info.ts b/src/commands/info.ts index 13ab3b2..af4b589 100644 --- a/src/commands/info.ts +++ b/src/commands/info.ts @@ -1,60 +1,51 @@ -import { colours } from "../../deps.ts"; +import { LoggerService } from "../../deps.ts"; 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 { - if (modules.length === 0 || modules.length > 1) { - console.error( - colours.red( - "Specify a single module to get information on. See --help", - ), + for (const index in modules) { + const moduleToGetInfoOn: string = modules[index]; + const stdResponse = await fetch( + "https://github.com/denoland/deno/tree/master/std/" + moduleToGetInfoOn, ); - Deno.exit(1); - } - 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) { - console.error( - colours.red("No module was found with " + 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", ); - 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 + '";'; - console.info( - "\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", - ); Deno.exit(); } diff --git a/src/commands/update.ts b/src/commands/update.ts index 5ed6998..18d4b7c 100644 --- a/src/commands/update.ts +++ b/src/commands/update.ts @@ -1,5 +1,4 @@ -import { colours } from "../../deps.ts"; -import IModule from "../interfaces/module.ts"; +import { LoggerService } from "../../deps.ts"; import ModuleService from "../services/module_service.ts"; /** @@ -17,15 +16,14 @@ export async function update(dependencies: string[]): Promise { ); if (modules === false || typeof modules === "boolean") { - console.error( - 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 - console.info("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,10 +41,8 @@ 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 { @@ -55,11 +51,9 @@ export async function update(dependencies: string[]): Promise { module.name + "@" + module.latestRelease, ); } - console.info( - colours.green( - module.name + " was updated from " + module.importedVersion + " to " + - module.latestRelease, - ), + LoggerService.logInfo( + module.name + " was updated from " + module.importedVersion + " to " + + module.latestRelease, ); depsWereUpdated = true; }); @@ -72,6 +66,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")); + LoggerService.logInfo("Everything is already up to date"); } } 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 diff --git a/src/options/help.ts b/src/options/help.ts deleted file mode 100644 index 0a5cff0..0000000 --- a/src/options/help.ts +++ /dev/null @@ -1,55 +0,0 @@ -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"; diff --git a/src/services/module_service.ts b/src/services/module_service.ts index c504d70..afb5596 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, LoggerService } from "../../deps.ts"; import DenoService from "../services/deno_service.ts"; import NestService from "../services/nest_service.ts"; @@ -51,7 +51,7 @@ export default class ModuleService { purpose: string, ): Promise { // Solely read the users `deps.ts` file - console.info("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"), @@ -87,11 +87,11 @@ export default class ModuleService { ? importVersionRegexResult[0] : ""; if (!importedVersion) { - console.error(colours.red( + LoggerService.logError( "The following line is not versioned. To update, your dependencies must be versioned." + "\n" + " " + dep, - )); + ); Deno.exit(1); } 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/integration/check_test.ts b/tests/integration/check_test.ts index 79e3119..0ecd49e 100644 --- a/tests/integration/check_test.ts +++ b/tests/integration/check_test.ts @@ -40,14 +40,12 @@ Deno.test({ assertEquals(stderr, ""); assertEquals( stdout, - "Gathering facts...\n" + - "Reading deps.ts to gather your dependencies...\n" + - "Comparing versions...\n" + - colours.yellow( - `fs can be updated from 0.53.0 to ${latestStdRelease}`, - ) + - "\n" + - "To update, run: \n" + + 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", ); @@ -85,10 +83,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); @@ -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.11.2 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); @@ -209,17 +204,14 @@ Deno.test({ assertEquals(stderr, ""); assertEquals( stdout, - "Gathering facts...\n" + - "Reading deps.ts to gather your dependencies...\n" + - "Comparing versions...\n" + - colours.yellow( - `drash can be updated from v1.0.0 to ${latestDrashRelease}`, - ) + "\n" + - colours.yellow( - `fs can be updated from 0.53.0 to ${latestStdRelease}`, - ) + - "\n" + - "To update, run: \n" + + 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", ); @@ -258,10 +250,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); @@ -296,29 +288,22 @@ Deno.test({ assertEquals(stderr, ""); assertEquals( stdout, - "Gathering facts...\n" + - "Reading deps.ts to gather your dependencies...\n" + - "Comparing versions...\n" + - colours.yellow( - `drash can be updated from v1.0.0 to ${latestDrashRelease}`, - ) + "\n" + - colours.yellow( - `fs can be updated from 0.53.0 to ${latestStdRelease}`, - ) + - "\n" + - colours.yellow( - `fmt can be updated from 0.53.0 to ${latestStdRelease}`, - ) + "\n" + - colours.yellow( - `cliffy can be updated from 0.11.2 to ${latestCliffyRelease}`, - ) + "\n" + - colours.yellow( - `log can be updated from 0.53.0 to ${latestStdRelease}`, - ) + "\n" + - colours.yellow( - `uuid can be updated from 0.61.0 to ${latestStdRelease}`, - ) + "\n" + - "To update, run: \n" + + 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") + " To update, run: \n" + " dmm update drash fs fmt cliffy log uuid" + "\n", ); @@ -355,10 +340,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); @@ -389,17 +374,14 @@ 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, - "Gathering facts...\n" + - "Reading deps.ts to gather your dependencies...\n", + 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); @@ -429,17 +411,14 @@ 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, - "Gathering facts...\n" + - "Reading deps.ts to gather your dependencies...\n", + 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); @@ -473,13 +452,14 @@ 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, - "Gathering facts...\n" + - "Reading deps.ts to gather your dependencies...\n", + 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 c94fb80..5b07905 100644 --- a/tests/integration/error_test.ts +++ b/tests/integration/error_test.ts @@ -16,10 +16,56 @@ 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, + ` +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); + assertEquals(status.success, true); }, }); @@ -45,13 +91,12 @@ 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", + stdout, + colours.red("ERROR") + " Subcommand `something` not recognized.\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..6036b35 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,50 @@ Deno.test({ assertEquals(stderr, ""); assertEquals( stdout, - "\n" + - "A 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` + - "\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@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", + ` +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/info_test.ts b/tests/integration/info_test.ts index 6124e31..40a98fc 100644 --- a/tests/integration/info_test.ts +++ b/tests/integration/info_test.ts @@ -24,11 +24,13 @@ 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, + colours.red("ERROR") + " Subcommand `info` requires arguments.\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,10 +57,7 @@ Deno.test({ const stderr = new TextDecoder("utf-8").decode(error); assertEquals( stdout, - "Gathering facts...\n" + - "\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` + @@ -93,10 +92,7 @@ Deno.test({ const stderr = new TextDecoder("utf-8").decode(error); assertEquals( stdout, - "Gathering facts...\n" + - "\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` + @@ -137,14 +133,34 @@ 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, + `${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, - colours.red("Specify a single module to get information on. See --help") + - "\n", + "", ); - assertEquals(status.code, 1); - assertEquals(status.success, false); + assertEquals(status.code, 0); + assertEquals(status.success, true); }, }); @@ -172,10 +188,13 @@ 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, + colours.red("ERROR") + " 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/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 a24bfc0..3acbd2b 100644 --- a/tests/integration/update_test.ts +++ b/tests/integration/update_test.ts @@ -47,6 +47,7 @@ function removeDependencyFile(dir: string): void { const path = "tests/" + dir + "/deps.ts"; Deno.removeSync(path); } catch (err) { + // do nothing } } @@ -75,12 +76,11 @@ 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" + - "Reading deps.ts to gather your dependencies...\n" + - "Checking if your modules can be updated...\n" + - colours.green( - `fs was updated from 0.53.0 to ${latestStdRelease}`, - ) + "\n"; + 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") + + ` fs was updated from 0.53.0 to ${latestStdRelease}\n`; assertEquals( stdout, expected, @@ -131,10 +131,10 @@ 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", + 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") + " Everything is already up to date\n", ); assertEquals(stderr, ""); assertEquals(status.code, 0); @@ -178,15 +178,13 @@ 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( - `fs was updated from 0.53.0 to ${latestStdRelease}`, - ) + "\n" + - colours.green( - `fmt was updated from 0.53.0 to ${latestStdRelease}`, - ) + "\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") + + ` 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); @@ -240,10 +238,10 @@ 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", + 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") + " Everything is already up to date\n", ); assertEquals(stderr, ""); assertEquals(status.code, 0); @@ -282,26 +280,21 @@ 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" + - "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}`) + - "\n" + - colours.green( - `fs was updated from 0.53.0 to ${latestStdRelease}`, - ) + "\n" + - colours.green( - `fmt was updated from 0.53.0 to ${latestStdRelease}`, - ) + "\n" + - colours.green( - `cliffy was updated from 0.11.2 to ${latestCliffyRelease}`, - ) + "\n" + - colours.green( - `log was updated from 0.53.0 to ${latestStdRelease}`, - ) + "\n" + - colours.green( - `uuid was updated from 0.61.0 to ${latestStdRelease}`, - ) + "\n"; + 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") + + ` 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); @@ -356,10 +349,10 @@ 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", + 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") + " Everything is already up to date\n", ); assertEquals(stderr, ""); assertEquals(status.code, 0); @@ -401,12 +394,11 @@ 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( - `drash was updated from v1.0.0 to ${latestDrashRelease}`, - ) + "\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") + + ` drash was updated from v1.0.0 to ${latestDrashRelease}\n`, ); assertEquals(stderr, ""); assertEquals(status.code, 0); @@ -452,13 +444,14 @@ Deno.test({ const stderr = new TextDecoder("utf-8").decode(error); assertEquals( stdout, - "Gathering facts...\n" + - "Reading deps.ts to gather your dependencies...\n", + colours.blue("INFO") + + " Reading deps.ts to gather your dependencies...\n" + + colours.red("ERROR") + + " 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); @@ -500,15 +493,13 @@ 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( - `drash was updated from v1.0.0 to ${latestDrashRelease}`, - ) + "\n" + - colours.green( - `fmt was updated from 0.53.0 to ${latestStdRelease}`, - ) + "\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") + + ` 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); @@ -561,12 +552,11 @@ 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( - `fs was updated from 0.53.0 to ${latestStdRelease}`, - ) + "\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") + + ` fs was updated from 0.53.0 to ${latestStdRelease}\n`, ); assertEquals(stderr, ""); assertEquals(status.code, 0); 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..138cc7a --- /dev/null +++ b/tests/unit/console/bumper_ci_service_test.ts @@ -0,0 +1,244 @@ +import { assertEquals } from "../../../deps.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"); + +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); + }, +}); + +//////////////////////////////////////////////////////////////////////////////// +// 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 +`;