Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
fix set up for Deno v0.36.0 (#34)
Browse files Browse the repository at this point in the history
* fix set up for Deno v0.36.0

* update ci
  • Loading branch information
axetroy authored Apr 5, 2020
1 parent 474433f commit 220d9c6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ name: ci
on: [push, pull_request]
jobs:
run:
name: Run on ${{ matrix.os }}
name: Deno v${{ matrix.deno }} in ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
deno: ["0.20.0", "0.38.0", "0.x"]
steps:
- uses: actions/checkout@master

Expand All @@ -24,7 +25,7 @@ jobs:
- name: Test
run: npm test

- name: Set up Deno
- name: Set up Deno v${{ matrix.deno }}
uses: ./

- name: Run deno
Expand Down
6 changes: 3 additions & 3 deletions __tests__/installer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ describe("installer tests", () => {
expect(fs.existsSync(path.join(denoDir, `deno${EXTENSION}`))).toBe(true);
}, 100000);

it("Acquires version of deno which less then v0.35.0", async () => {
await installer.getDeno("v0.35.0");
const denoDir = path.join(toolDir, "deno", "0.35.0", os.arch());
it("Acquires version of deno which less then v0.38.0", async () => {
await installer.getDeno("v0.20.0");
const denoDir = path.join(toolDir, "deno", "0.20.0", os.arch());

expect(fs.existsSync(`${denoDir}.complete`)).toBe(true);
expect(fs.existsSync(path.join(denoDir, `deno${EXTENSION}`))).toBe(true);
Expand Down
10 changes: 5 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4555,11 +4555,11 @@ const io = __webpack_require__(1);
const uuidV4 = __webpack_require__(898);
const HttpClient_1 = __webpack_require__(874);
function getDenoArch(version) {
return semver.lte(version, "0.35.0") ? "x64" : "x86_64";
return semver.lte(version, "0.38.0") ? "x64" : "x86_64";
}
function getDenoPlatform(version) {
const platform = os.platform();
const isLessThenV35 = semver.lte(version, "0.35.0");
const isLessThenV35 = semver.lte(version, "0.38.0");
let rtv = null;
if (platform === "darwin")
rtv = isLessThenV35 ? "osx" : "apple-darwin";
Expand Down Expand Up @@ -4637,11 +4637,11 @@ async function getAvailableVersions() {
}
exports.getAvailableVersions = getAvailableVersions;
function getDownloadUrl(version) {
// The old release file only keep to Deno v0.35.0
// The old release file only keep to Deno v0.38.0
const platform = getDenoPlatform(version);
const arch = getDenoArch(version);
let filename;
if (semver.lte(version, "0.35.0")) {
if (semver.lte(version, "0.38.0")) {
const extName = process.platform === "win32" ? "zip" : "gz";
filename = `deno_${platform}_${arch}.${extName}`;
}
Expand All @@ -4653,7 +4653,7 @@ function getDownloadUrl(version) {
exports.getDownloadUrl = getDownloadUrl;
async function extractDenoArchive(version, archiveFilepath) {
let extPath = "";
if (semver.lte(version, "0.35.0")) {
if (semver.lte(version, "0.38.0")) {
if (process.platform === "win32") {
extPath = await tc.extractZip(archiveFilepath);
}
Expand Down
10 changes: 5 additions & 5 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ import * as uuidV4 from "uuid";
import { HttpClient } from "typed-rest-client/HttpClient";

function getDenoArch(version: string): Arch {
return semver.lte(version, "0.35.0") ? "x64" : "x86_64";
return semver.lte(version, "0.38.0") ? "x64" : "x86_64";
}
function getDenoPlatform(version: string): Platform {
const platform = os.platform();
const isLessThenV35 = semver.lte(version, "0.35.0");
const isLessThenV35 = semver.lte(version, "0.38.0");

let rtv: Platform | null = null;
if (platform === "darwin") rtv = isLessThenV35 ? "osx" : "apple-darwin";
Expand Down Expand Up @@ -135,11 +135,11 @@ export async function getAvailableVersions() {
}

export function getDownloadUrl(version: string): string {
// The old release file only keep to Deno v0.35.0
// The old release file only keep to Deno v0.38.0
const platform = getDenoPlatform(version);
const arch = getDenoArch(version);
let filename: string;
if (semver.lte(version, "0.35.0")) {
if (semver.lte(version, "0.38.0")) {
const extName = process.platform === "win32" ? "zip" : "gz";
filename = `deno_${platform}_${arch}.${extName}`;
} else {
Expand All @@ -154,7 +154,7 @@ export async function extractDenoArchive(
archiveFilepath: string
): Promise<string> {
let extPath = "";
if (semver.lte(version, "0.35.0")) {
if (semver.lte(version, "0.38.0")) {
if (process.platform === "win32") {
extPath = await tc.extractZip(archiveFilepath);
} else {
Expand Down

0 comments on commit 220d9c6

Please sign in to comment.