toolaby 1.4.0 → 1.4.1

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.
Files changed (2) hide show
  1. package/bin.mjs +6 -4
  2. package/package.json +1 -1
package/bin.mjs CHANGED
@@ -34,7 +34,7 @@ import { createHmac, randomBytes } from 'node:crypto';
34
34
  import { wireManifest, WORKER_LINES } from './lib/manifest.js';
35
35
  import { detectProject, CODE_FILES, filesToWrite, BUILD_COPY_NOTE } from './lib/project.js';
36
36
 
37
- const VERSION = '1.4.0';
37
+ const VERSION = '1.4.1';
38
38
  const CLIENT_ID = 'toolaby-cli';
39
39
  const argv = process.argv.slice(2);
40
40
  // `--version` and `--help` are commands of their own; every other command is the first bare word.
@@ -42,7 +42,8 @@ const command = argv.find((a) => ['--version', '-v', '--help', '-h'].includes(a)
42
42
  const rest = argv.filter((a) => a !== command);
43
43
  const positional = rest.filter((a) => !a.startsWith('--'));
44
44
  const opt = (k, d = null) => { const i = rest.indexOf(k); return i >= 0 && rest[i + 1] && !rest[i + 1].startsWith('--') ? rest[i + 1] : d; };
45
- const flag = (k) => rest.includes(k);
45
+ // `upgrade` is `wire --force`: the platform's files replaced with the current ones, the extension's own untouched.
46
+ const flag = (k) => rest.includes(k) || (k === '--force' && command === 'upgrade');
46
47
  const WALLS = { test: 'https://test.toolaby.app', live: 'https://toolaby.app' };
47
48
  const live = flag('--live');
48
49
  const wall = (opt('--wall') ?? process.env.TOOLABY_WALL ?? (live ? WALLS.live : WALLS.test)).replace(/\/$/, '');
@@ -186,7 +187,7 @@ async function filesFor(slug, scaffold, manifestKey = null) {
186
187
 
187
188
  async function wire() {
188
189
  const slug = positional[0];
189
- if (!isId(slug)) fail('usage: toolaby wire <tool-id> [--into <folder>] [--force] — `toolaby tools` lists your ids');
190
+ if (!isId(slug)) fail(command === 'upgrade' ? 'usage: toolaby upgrade <tool-id> [--into <folder>] — `toolaby tools` lists your ids' : 'usage: toolaby wire <tool-id> [--into <folder>] [--force] — `toolaby tools` lists your ids');
190
191
  const dir = resolve(opt('--into') ?? '.');
191
192
  if (!existsSync(dir)) fail(`${dir} does not exist`);
192
193
  const tree = listTree(dir, 3);
@@ -343,6 +344,7 @@ function help() {
343
344
  toolaby wire <tool-id> wire the extension in this folder to your tool, on Test
344
345
  toolaby wire <tool-id> --live the same, on Live: the store build
345
346
  --into <folder> another folder --force replace the platform's files
347
+ toolaby upgrade <tool-id> the platform's files replaced with the current ones — the popup, the client — yours untouched
346
348
  toolaby create <tool-id> a new, minimal extension for your tool, in <tool-id>/ --dir <folder>
347
349
  toolaby tools your tools, with their ids
348
350
  toolaby webhooks events the six events, with an example of each
@@ -355,7 +357,7 @@ function help() {
355
357
  `);
356
358
  }
357
359
 
358
- const commands = { login: async () => { await login(); }, logout, whoami, tools, wire, create, webhooks, help, '--help': help, '-h': help, '--version': () => out(VERSION), '-v': () => out(VERSION) };
360
+ const commands = { login: async () => { await login(); }, logout, whoami, tools, wire, upgrade: wire, create, webhooks, help, '--help': help, '-h': help, '--version': () => out(VERSION), '-v': () => out(VERSION) };
359
361
  const run = commands[command];
360
362
  if (!run) { console.error(`\n Unknown command "${command}".`); help(); process.exit(1); }
361
363
  Promise.resolve().then(run).catch((e) => fail(e.message));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolaby",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "The Toolaby command line: sign in once, then wire any Chrome extension to your tool on the Wall — sign-in, the Free plan, licences and subscriptions — or start a new one.",
5
5
  "type": "module",
6
6
  "bin": {