upfilesh 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const path_1 = __importDefault(require("path"));
7
7
  const upload_js_1 = require("./upload.js");
8
8
  const config_js_1 = require("./config.js");
9
+ const version_js_1 = require("./version.js");
9
10
  const args = process.argv.slice(2);
10
11
  function flag(name) {
11
12
  const i = args.findIndex(a => a === `--${name}`);
@@ -25,6 +26,10 @@ function formatSize(bytes) {
25
26
  }
26
27
  async function main() {
27
28
  const cmd = args[0];
29
+ if (cmd === "-v" || cmd === "--version" || cmd === "version") {
30
+ console.log(version_js_1.VERSION);
31
+ return;
32
+ }
28
33
  // upfile signup --email me@example.com [--owner-email owner@example.com]
29
34
  if (cmd === "signup") {
30
35
  const email = flag("email");
package/dist/upload.js CHANGED
@@ -19,13 +19,17 @@ const config_js_1 = require("./config.js");
19
19
  function getAuth() {
20
20
  const config = (0, config_js_1.loadConfig)();
21
21
  const apiKey = config.apiKey || process.env.UPFILE_API_KEY;
22
- const endpoint = config.endpoint || config_js_1.DEFAULT_ENDPOINT;
22
+ const endpoint = getEndpoint();
23
23
  if (!apiKey)
24
24
  throw new Error("No API key. Run: upfile signup --email your@email.com");
25
25
  return { apiKey, endpoint };
26
26
  }
27
+ function getEndpoint() {
28
+ const config = (0, config_js_1.loadConfig)();
29
+ return config.endpoint || config_js_1.DEFAULT_ENDPOINT;
30
+ }
27
31
  async function signup(email, ownerEmail) {
28
- const { endpoint } = getAuth();
32
+ const endpoint = getEndpoint();
29
33
  const res = await (0, node_fetch_1.default)(`${endpoint}/signup`, {
30
34
  method: "POST",
31
35
  headers: { "Content-Type": "application/json" },
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VERSION = void 0;
4
+ exports.VERSION = "0.2.2";
package/package.json CHANGED
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "name": "upfilesh",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Instant file uploads from the command line — upfile.sh",
5
5
  "bin": {
6
- "upfile": "./bin/upfile"
6
+ "upfile": "bin/upfile"
7
7
  },
8
8
  "main": "dist/index.js",
9
+ "packageManager": "yarn@1.22.22",
9
10
  "files": [
10
11
  "bin/",
11
12
  "dist/",
12
13
  "README.md"
13
14
  ],
14
15
  "scripts": {
15
- "build": "tsc",
16
+ "build": "node scripts/write-version.js && tsc",
16
17
  "dev": "ts-node src/index.ts",
17
18
  "prepublishOnly": "yarn build"
18
19
  },
@@ -29,7 +30,7 @@
29
30
  "license": "MIT",
30
31
  "repository": {
31
32
  "type": "git",
32
- "url": "https://github.com/upfilesh/cli.git"
33
+ "url": "git+https://github.com/upfilesh/cli.git"
33
34
  },
34
35
  "bugs": {
35
36
  "url": "https://github.com/upfilesh/cli/issues"