Skip to content

Commit

Permalink
chore: prep npm for release (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
willemneal authored Nov 18, 2022
1 parent c86ea0e commit 1ac1260
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 34 deletions.
11 changes: 9 additions & 2 deletions npm/README.md
Original file line number Diff line number Diff line change
@@ -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)
15 changes: 0 additions & 15 deletions npm/__tests__/path.test.ts

This file was deleted.

12 changes: 3 additions & 9 deletions npm/__tests__/test.ts
Original file line number Diff line number Diff line change
@@ -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'] = "";
Expand All @@ -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();



Expand Down Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion npm/dist/getBinary.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { Binary } from ".";
export declare function AWSUrl(): string;
export declare function GithubUrl(): string;
export declare function getBinary(name?: string): Promise<Binary>;
9 changes: 5 additions & 4 deletions npm/dist/getBinary.js
Original file line number Diff line number Diff line change
@@ -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");
Expand All @@ -27,19 +27,20 @@ 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);
}
// 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);
}
Expand Down
2 changes: 1 addition & 1 deletion npm/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
5 changes: 3 additions & 2 deletions npm/src/getBinary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
}
Expand All @@ -47,7 +47,8 @@ export function getBinary(name: string = NAME): Promise<Binary> {
// 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);
}
Expand Down

0 comments on commit 1ac1260

Please sign in to comment.