diff --git a/npm/README.md b/npm/README.md index e28f6ea..b63ceea 100644 --- a/npm/README.md +++ b/npm/README.md @@ -1,3 +1,10 @@ -# witme +# raen-cli + +An npm installation for [raen](https://github.com/raendev/raen). + +```bash +npm i -g raen-cli + +raen build --release +``` -An npm installation for [witme](https://github.com/ahalabs/witme) diff --git a/npm/__tests__/path.test.ts b/npm/__tests__/path.test.ts deleted file mode 100644 index 85f6acb..0000000 --- a/npm/__tests__/path.test.ts +++ /dev/null @@ -1,15 +0,0 @@ -import test from "ava"; -import { join } from "path"; -import { Binary } from "../src"; - -const TEST_FILES_PATH = join(__dirname, "..", "test_files"); -process.env['RAEN_BINARY_PATH'] = TEST_FILES_PATH; - -const name = "raen"; -const fakeUrl = "https://example.com"; - -test("can use local file", async (t) => { - const bin = await Binary.create(name, fakeUrl); - t.is(bin.installDir, TEST_FILES_PATH); - t.assert(await bin.exists()); -}); diff --git a/npm/__tests__/test.ts b/npm/__tests__/test.ts index efc8004..4d9fe4a 100644 --- a/npm/__tests__/test.ts +++ b/npm/__tests__/test.ts @@ -1,7 +1,7 @@ import test from "ava"; -import { join, resolve } from "path"; +import { join } from "path"; import { Binary } from "../src"; -import { AWSUrl } from "../src/getBinary"; +import { GithubUrl } from "../src/getBinary"; import { fileExists, inherit, rm } from "../src/utils"; process.env['PATH'] = ""; @@ -10,7 +10,7 @@ const name = "RAEN"; const LOCAL_PATH = Binary.DEFAULT_INSTALL_DIR; const LOCAL_BIN_PATH = join(LOCAL_PATH, name); const fakeUrl = "https://example.com"; -const realUrl = AWSUrl(); +const realUrl = GithubUrl(); @@ -71,12 +71,6 @@ test("can install file to destination with multiple urls", async (t) => { t.assert(await bin.exists()); }); -test("can use local file", async (t) => { - const localPath = resolve(join(__dirname, "..", "test_files")); - const bin = await Binary.create(name, realUrl, localPath); - t.is(bin.installDir, localPath); - t.assert(await bin.exists()); -}); test("can install and then run", async (t) => { const p = join(TEST_BIN_DESTINATION, "install_then_run"); diff --git a/npm/dist/getBinary.d.ts b/npm/dist/getBinary.d.ts index a370313..b7a6a26 100644 --- a/npm/dist/getBinary.d.ts +++ b/npm/dist/getBinary.d.ts @@ -1,3 +1,3 @@ import { Binary } from "."; -export declare function AWSUrl(): string; +export declare function GithubUrl(): string; export declare function getBinary(name?: string): Promise; diff --git a/npm/dist/getBinary.js b/npm/dist/getBinary.js index 212e593..7159637 100644 --- a/npm/dist/getBinary.js +++ b/npm/dist/getBinary.js @@ -1,6 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getBinary = exports.AWSUrl = void 0; +exports.getBinary = exports.GithubUrl = void 0; const _1 = require("."); const path_1 = require("path"); const os = require("os"); @@ -27,11 +27,11 @@ function getPlatform() { } throw new Error(`Unsupported platform: ${type} ${arch}`); } -function AWSUrl() { +function GithubUrl() { const [platform, arch] = getPlatform(); return `https://github.com/raendev/${NAME}/releases/download/v${version}/${NAME}-v${version}-${arch}-${platform}.tar.gz`; } -exports.AWSUrl = AWSUrl; +exports.GithubUrl = GithubUrl; function getBinary(name = NAME) { if (!process.env["RAEN_BIN_PATH"]) { process.env["RAEN_BINARY_PATH"] = (0, path_1.join)(os.homedir(), `.${NAME}`, NAME); @@ -39,7 +39,8 @@ function getBinary(name = NAME) { // Will use version after publishing to AWS // const version = require("./package.json").version; const fromEnv = process.env["RAEN_ARTIFACT_URL"]; - const urls = [AWSUrl()]; + const urls = [GithubUrl()]; + console.log(urls); if (fromEnv) { urls.unshift(fromEnv); } diff --git a/npm/package.json b/npm/package.json index 958eb21..e12f998 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "raen-cli", - "version": "0.0.5", + "version": "0.1.0", "description": "Tools for generating to and from wit format", "keywords": [ "WebAssembly", diff --git a/npm/src/getBinary.ts b/npm/src/getBinary.ts index 62f8193..e0af2e0 100644 --- a/npm/src/getBinary.ts +++ b/npm/src/getBinary.ts @@ -30,7 +30,7 @@ function getPlatform() { throw new Error(`Unsupported platform: ${type} ${arch}`); } -export function AWSUrl(): string { +export function GithubUrl(): string { const [platform, arch] = getPlatform(); return `https://github.com/raendev/${NAME}/releases/download/v${version}/${NAME}-v${version}-${arch}-${platform}.tar.gz`; } @@ -47,7 +47,8 @@ export function getBinary(name: string = NAME): Promise { // Will use version after publishing to AWS // const version = require("./package.json").version; const fromEnv = process.env["RAEN_ARTIFACT_URL"]; - const urls = [AWSUrl()]; + const urls = [GithubUrl()]; + console.log(urls) if (fromEnv) { urls.unshift(fromEnv); }