Skip to content

Commit

Permalink
Merge pull request #43 from drashland/fix-version-and-update-deps
Browse files Browse the repository at this point in the history
Fixed JSON error for getting std version, and updated to deno v1.2.2
  • Loading branch information
ebebbington authored Aug 3, 2020
2 parents 4c10bf3 + 7c84182 commit 9cc78df
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bumper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
update-dep:
strategy:
matrix:
deno: ["1.2.0"]
deno: ["1.2.2"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
deno: ["1.2.0"]
deno: ["1.2.2"]
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -28,7 +28,7 @@ jobs:
linting:
strategy:
matrix:
deno: ["1.2.0"]
deno: ["1.2.2"]
# Doesn't need to be checked in all OS
runs-on: ubuntu-latest

Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ Information on fmt
- Name: fmt
- Description: Cannot retrieve descriptions for std modules
- deno.land Link: https://deno.land/std@0.61.0/fmt
- deno.land Link: https://deno.land/std@0.63.0/fmt
- GitHub Repository: https://github.com/denoland/deno/tree/master/std/fmt
- Import Statement: import * as fmt from "https://deno.land/std@0.61.0/fmt";
- Latest Version: 0.61.0
- Import Statement: import * as fmt from "https://deno.land/std@0.63.0/fmt";
- Latest Version: 0.63.0
```

Expand All @@ -97,7 +97,7 @@ export { Drash } from "https://deno.land/x/drash@v1.0.0/mod.ts"; // out of date

import * as fs from "https://deno.land/std@0.53.0/fs/mod.ts"; // out of date

import * as colors from "https://deno.land/std@0.61.0/fmt/colors.ts"; // up to date
import * as colors from "https://deno.land/std@0.63.0/fmt/colors.ts"; // up to date

export { fs, colors }
```
Expand All @@ -112,7 +112,7 @@ Now we want to check if any of our dependencies need updating, but we don't want
$ dmm check
...
drash can be updated from v1.0.0 to v1.1.1
fs can be updated from 0.53.0 to 0.61.0
fs can be updated from 0.53.0 to 0.63.0
...
```

Expand All @@ -124,7 +124,7 @@ Lets update our dependencies as some are out of date:
$ dmm update
...
drash was updated from v1.0.0 to v1.1.1
fs was updated from 0.53.0 to 0.61.0
fs was updated from 0.53.0 to 0.63.0
...
```

Expand All @@ -133,9 +133,9 @@ Now lets check the `deps.ts` file, and you will notice the versions have been mo
```typescript
export { Drash } from "https://deno.land/x/drash@v1.1.1/mod.ts"; // was out of date

import * as fs from "https://deno.land/std@0.61.0/fs/mod.ts"; // was out of date
import * as fs from "https://deno.land/std@0.63.0/fs/mod.ts"; // was out of date

import * as colors from "https://deno.land/std@0.61.0/fmt/colors.ts";
import * as colors from "https://deno.land/std@0.63.0/fmt/colors.ts";

export { fs, colors }
```
Expand Down
4 changes: 2 additions & 2 deletions deps.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as colours from "https://deno.land/std@0.61.0/fmt/colors.ts";
import * as colours from "https://deno.land/std@0.63.0/fmt/colors.ts";
export { colours };

export { assertEquals } from "https://deno.land/std@0.61.0/testing/asserts.ts";
export { assertEquals } from "https://deno.land/std@0.63.0/testing/asserts.ts";
9 changes: 6 additions & 3 deletions src/services/deno_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ interface DenoLandDatabase {
*/
async function getLatestStdRelease(): Promise<string> {
const res = await fetch(
"https://raw.githubusercontent.com/denoland/deno_website2/master/deno_std_versions.json",
"https://raw.githubusercontent.com/denoland/deno_website2/master/versions.json",
);
const versions: string[] = await res.json();
let latestVersion = versions[0];
const versions: {
std: string[];
cli_to_std: { [key: string]: string };
} = await res.json(); // { std: ["0.63.0", ...], cli_to_std: { v1.2.2: "0.63.0", ... } }
const latestVersion = versions.std[0];
return latestVersion;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/check_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Deno.test({
"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 v1.1.1") + "\n" +
colours.yellow("drash can be updated from v1.0.0 to v1.2.1") + "\n" +
colours.yellow(
`fs can be updated from 0.53.0 to ${DenoService.getLatestStdRelease()}`,
) +
Expand Down Expand Up @@ -203,7 +203,7 @@ Deno.test({
"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 v1.1.1") + "\n" +
colours.yellow("drash can be updated from v1.0.0 to v1.2.1") + "\n" +
colours.yellow(
`fs can be updated from 0.53.0 to ${DenoService.getLatestStdRelease()}`,
) +
Expand Down
6 changes: 3 additions & 3 deletions tests/info_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ Deno.test({
"\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@v1.1.1\n" +
" - deno.land Link: https://deno.land/x/drash@v1.2.1\n" +
" - GitHub Repository: https://github.com/drashland/deno-drash\n" +
' - Import Statement: import * as drash from \"https://deno.land/x/drash@v1.1.1\";\n' +
" - Latest Version: v1.1.1\n" +
' - Import Statement: import * as drash from \"https://deno.land/x/drash@v1.2.1\";\n' +
" - Latest Version: v1.2.1\n" +
"\n",
);
assertEquals(stderr, "");
Expand Down
8 changes: 4 additions & 4 deletions tests/up-to-date-deps/deps.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Drash } from "https://deno.land/x/drash@v1.1.1/mod.ts"; // up to date
import { Drash } from "https://deno.land/x/drash@v1.2.1/mod.ts"; // up to date

import * as fs from "https://deno.land/std@0.61.0/fs/mod.ts"; // up to date
import * as fs from "https://deno.land/std@0.63.0/fs/mod.ts"; // up to date

import * as colors from "https://deno.land/std@0.61.0/fmt/colors.ts"; // up to date
import * as colors from "https://deno.land/std@0.63.0/fmt/colors.ts"; // up to date

import { Drash as drash } from "https://deno.land/x/drash@v1.1.1/mod.ts"; // up to date
import { Drash as drash } from "https://deno.land/x/drash@v1.2.1/mod.ts"; // up to date

export { Drash, fs, colors };
6 changes: 3 additions & 3 deletions tests/up-to-date-deps/original_deps.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Drash } from "https://deno.land/x/drash@v1.1.1/mod.ts"; // up to date
import { Drash } from "https://deno.land/x/drash@v1.2.1/mod.ts"; // up to date

import * as fs from "https://deno.land/std@0.61.0/fs/mod.ts"; // up to date
import * as fs from "https://deno.land/std@0.63.0/fs/mod.ts"; // up to date

import * as colors from "https://deno.land/std@0.61.0/fmt/colors.ts"; // up to date
import * as colors from "https://deno.land/std@0.63.0/fmt/colors.ts"; // up to date

export { Drash, fs, colors };
50 changes: 24 additions & 26 deletions tests/update_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Deno.test({
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 0.61.0") + "\n";
colours.green("fs was updated from 0.53.0 to 0.63.0") + "\n";
assertEquals(
stdout,
expected,
Expand All @@ -75,7 +75,7 @@ Deno.test({
Deno.readFileSync("tests/out-of-date-deps/deps.ts"),
);
assertEquals(newDepContent !== originalDepContent, true);
assertEquals(newDepContent.indexOf("std@0.61.0/fs") !== -1, true);
assertEquals(newDepContent.indexOf("std@0.63.0/fs") !== -1, true);
defaultDepsBackToOriginal("out-of-date-deps");
},
});
Expand Down Expand Up @@ -157,8 +157,8 @@ Deno.test({
"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 0.61.0") + "\n" +
colours.green("fmt was updated from v0.53.0 to v0.61.0") + "\n",
colours.green("fs was updated from 0.53.0 to 0.63.0") + "\n" +
colours.green("fmt was updated from v0.53.0 to v0.63.0") + "\n",
);
assertEquals(stderr, "");
assertEquals(status.code, 0);
Expand All @@ -170,8 +170,8 @@ Deno.test({
Deno.readFileSync("tests/out-of-date-deps/deps.ts"),
);
assertEquals(newDepContent !== originalDepContent, true);
assertEquals(newDepContent.indexOf("std@0.61.0/fs") !== -1, true);
assertEquals(newDepContent.indexOf("std@v0.61.0/fmt") !== -1, true);
assertEquals(newDepContent.indexOf("std@0.63.0/fs") !== -1, true);
assertEquals(newDepContent.indexOf("std@v0.63.0/fmt") !== -1, true);
defaultDepsBackToOriginal("out-of-date-deps");
},
});
Expand Down Expand Up @@ -246,15 +246,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" +
"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 v1.1.1") + "\n" +
colours.green("fs was updated from 0.53.0 to 0.61.0") + "\n" +
colours.green("fmt was updated from v0.53.0 to v0.61.0") + "\n",
);
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 v1.2.1") + "\n" +
colours.green("fs was updated from 0.53.0 to 0.63.0") + "\n" +
colours.green("fmt was updated from v0.53.0 to v0.63.0") + "\n";
assertEquals(stdout, assertedOutput);
assertEquals(stderr, "");
assertEquals(status.code, 0);
assertEquals(status.success, true);
Expand All @@ -265,9 +263,9 @@ Deno.test({
Deno.readFileSync("tests/out-of-date-deps/deps.ts"),
);
assertEquals(newDepContent !== originalDepContent, true);
assertEquals(newDepContent.indexOf("std@0.61.0/fs") !== -1, true);
assertEquals(newDepContent.indexOf("std@v0.61.0/fmt") !== -1, true);
assertEquals(newDepContent.indexOf("drash@v1.1.1") !== -1, true);
assertEquals(newDepContent.indexOf("std@0.63.0/fs") !== -1, true);
assertEquals(newDepContent.indexOf("std@v0.63.0/fmt") !== -1, true);
assertEquals(newDepContent.indexOf("drash@v1.2.1") !== -1, true);
defaultDepsBackToOriginal("out-of-date-deps");
},
});
Expand Down Expand Up @@ -345,7 +343,7 @@ Deno.test({
"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 v1.1.1") + "\n",
colours.green("drash was updated from v1.0.0 to v1.2.1") + "\n",
);
assertEquals(stderr, "");
assertEquals(status.code, 0);
Expand All @@ -357,7 +355,7 @@ Deno.test({
Deno.readFileSync("tests/out-of-date-deps/deps.ts"),
);
assertEquals(newDepContent !== originalDepContent, true);
assertEquals(newDepContent.indexOf("drash@v1.1.1") !== -1, true);
assertEquals(newDepContent.indexOf("drash@v1.2.1") !== -1, true);
defaultDepsBackToOriginal("out-of-date-deps");
},
});
Expand Down Expand Up @@ -439,8 +437,8 @@ Deno.test({
"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 v1.1.1") + "\n" +
colours.green("fmt was updated from v0.53.0 to v0.61.0") + "\n",
colours.green("drash was updated from v1.0.0 to v1.2.1") + "\n" +
colours.green("fmt was updated from v0.53.0 to v0.63.0") + "\n",
);
assertEquals(stderr, "");
assertEquals(status.code, 0);
Expand All @@ -452,8 +450,8 @@ Deno.test({
Deno.readFileSync("tests/out-of-date-deps/deps.ts"),
);
assertEquals(newDepContent !== originalDepContent, true);
assertEquals(newDepContent.indexOf("std@v0.61.0/fmt") !== -1, true);
assertEquals(newDepContent.indexOf("drash@v1.1.1") !== -1, true);
assertEquals(newDepContent.indexOf("std@v0.63.0/fmt") !== -1, true);
assertEquals(newDepContent.indexOf("drash@v1.2.1") !== -1, true);
defaultDepsBackToOriginal("out-of-date-deps");
},
});
Expand Down Expand Up @@ -489,7 +487,7 @@ Deno.test({
"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 0.61.0") + "\n",
colours.green("fs was updated from 0.53.0 to 0.63.0") + "\n",
);
assertEquals(stderr, "");
assertEquals(status.code, 0);
Expand All @@ -501,7 +499,7 @@ Deno.test({
Deno.readFileSync("tests/out-of-date-deps/deps.ts"),
);
assertEquals(newDepContent !== originalDepContent, true);
assertEquals(newDepContent.indexOf("std@0.61.0/fs") !== -1, true);
assertEquals(newDepContent.indexOf("std@0.63.0/fs") !== -1, true);
defaultDepsBackToOriginal("out-of-date-deps");
},
});

0 comments on commit 9cc78df

Please sign in to comment.