@arkstack/console 0.16.1 → 0.16.3

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/app.d.ts CHANGED
@@ -1,17 +1,6 @@
1
+ import { n as Core, t as ConsoleAppOptions } from "./types-C5drRyQu.js";
1
2
  import { CliApp } from "resora";
2
3
 
3
- //#region src/types.d.ts
4
- interface Core {
5
- [k: string]: any;
6
- getDriver: () => {
7
- [k: string]: any;
8
- name: string;
9
- };
10
- }
11
- interface ConsoleAppOptions {
12
- stubsDir?: string;
13
- }
14
- //#endregion
15
4
  //#region src/app.d.ts
16
5
  declare const resolveStubsDir: (config: {
17
6
  localStubsDir?: string;
@@ -0,0 +1,49 @@
1
+ import { Publisher } from "@arkstack/common";
2
+ import { existsSync, readdirSync } from "node:fs";
3
+ import { pathToFileURL } from "node:url";
4
+ import { join } from "node:path";
5
+ import { Arkstack } from "@arkstack/contract";
6
+
7
+ //#region dist/helpers.js
8
+ /**
9
+ * Import the `setup` module of every installed `@arkstack/*` package so its
10
+ * `publishes()` registrations run. Errors (missing build, side effects) are
11
+ * ignored so one bad package cannot break publishing.
12
+ */
13
+ const loadPackageSetups = async () => {
14
+ const scope = join(Arkstack.rootDir(), "node_modules", "@arkstack");
15
+ if (!existsSync(scope)) return;
16
+ for (const pkg of readdirSync(scope)) {
17
+ const setup = join(scope, pkg, "dist", "setup.js");
18
+ if (!existsSync(setup)) continue;
19
+ try {
20
+ await import(pathToFileURL(setup).href);
21
+ } catch {}
22
+ }
23
+ };
24
+ function groupPublishables(groupBy = "tag") {
25
+ const groups = /* @__PURE__ */ new Map();
26
+ const publishables = Publisher.publishables();
27
+ for (const item of publishables) {
28
+ const tag = item.tag ?? "untagged";
29
+ const key = groupBy === "tag" ? tag : item.package;
30
+ if (!groups.has(key)) groups.set(key, {
31
+ name: key,
32
+ packages: /* @__PURE__ */ new Set(),
33
+ tags: /* @__PURE__ */ new Set(),
34
+ entries: 0
35
+ });
36
+ const group = groups.get(key);
37
+ group.packages.add(item.package);
38
+ group.tags.add(tag);
39
+ group.entries += item.entries.length;
40
+ }
41
+ return Array.from(groups.values()).map((g) => ({
42
+ name: g.name,
43
+ value: g.name,
44
+ description: groupBy === "package" ? `${g.name} has ${g.tags.size} tag${g.tags.size === 1 ? "" : "s"} and ${g.entries} publishable${g.entries === 1 ? "" : "s"}` : g.name === "untagged" ? `These publishables have no tag and include ${g.entries} publishable${g.entries === 1 ? "" : "s"} from ${g.packages.size} package${g.packages.size === 1 ? "" : "s"}` : `This tag exists in ${g.packages.size} package${g.packages.size === 1 ? "" : "s"} and has ${g.entries} publishable${g.entries === 1 ? "" : "s"}`
45
+ }));
46
+ }
47
+
48
+ //#endregion
49
+ export { loadPackageSetups as n, groupPublishables as t };
@@ -0,0 +1,12 @@
1
+ import { r as GroupedOption } from "./types-C5drRyQu.js";
2
+
3
+ //#region src/helpers.d.ts
4
+ /**
5
+ * Import the `setup` module of every installed `@arkstack/*` package so its
6
+ * `publishes()` registrations run. Errors (missing build, side effects) are
7
+ * ignored so one bad package cannot break publishing.
8
+ */
9
+ declare const loadPackageSetups: () => Promise<void>;
10
+ declare function groupPublishables(groupBy?: 'tag' | 'package'): GroupedOption[];
11
+ //#endregion
12
+ export { groupPublishables, loadPackageSetups };
@@ -0,0 +1,3 @@
1
+ import { n as loadPackageSetups, t as groupPublishables } from "./helpers-CjopNM66.js";
2
+
3
+ export { groupPublishables, loadPackageSetups };
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { t as ArkstackConsoleApp } from "./app-Ek2hTWvh.js";
3
+ import { n as loadPackageSetups, t as groupPublishables } from "./helpers-CjopNM66.js";
3
4
  import { n as BaseTCConfig, r as TSConfig, t as BuildInterfaces } from "./BuildInterfaces-BBAwvchK.js";
4
5
  import { createRequire } from "node:module";
5
6
  import { Publisher, abort, abortIf, assertFound, config, discoverCommands, env, importFile, initializeGlobalContext, loadPrototypes, outputDir, rebuildOutput } from "@arkstack/common";
@@ -345,11 +346,21 @@ var PublishCommand = class extends Command {
345
346
  `;
346
347
  description = "Publish package artifacts into your application.";
347
348
  async handle() {
348
- await this.loadPackageSetups();
349
+ await loadPackageSetups();
350
+ const interactive = this.option("interaction") !== false;
349
351
  const filter = {
350
352
  package: this.option("package"),
351
353
  tag: this.option("tag")
352
354
  };
355
+ /**
356
+ * When nothing is targeted explicitly, ask which package to publish.
357
+ * An explicit `--tag` (or `--package`) is already a target, so it skips
358
+ * the prompt — and `--no-interaction` never prompts.
359
+ */
360
+ if (!filter.package && !filter.tag && interactive && !this.option("list")) {
361
+ const groups = groupPublishables("package");
362
+ filter.package = await this.choice("Choose a package to publish", groups);
363
+ }
353
364
  if (this.option("list")) {
354
365
  this.listGroups(Publisher.publishables(filter));
355
366
  return;
@@ -465,22 +476,6 @@ var PublishCommand = class extends Command {
465
476
  for (const entry of group.entries) this.line(` - ${stripStubSuffix(entry.to)}`);
466
477
  }
467
478
  }
468
- /**
469
- * Import the `setup` module of every installed `@arkstack/*` package so its
470
- * `publishes()` registrations run. Errors (missing build, side effects) are
471
- * ignored so one bad package cannot break publishing.
472
- */
473
- async loadPackageSetups() {
474
- const scope = join(Arkstack.rootDir(), "node_modules", "@arkstack");
475
- if (!existsSync(scope)) return;
476
- for (const pkg of readdirSync(scope)) {
477
- const setup = join(scope, pkg, "dist", "setup.js");
478
- if (!existsSync(setup)) continue;
479
- try {
480
- await import(pathToFileURL(setup).href);
481
- } catch {}
482
- }
483
- }
484
479
  describeFilter(filter) {
485
480
  const parts = [filter.package ? `package "${filter.package}"` : "", filter.tag ? `tag "${filter.tag}"` : ""].filter(Boolean);
486
481
  return parts.length ? ` for ${parts.join(" and ")}` : "";
@@ -0,0 +1,18 @@
1
+ //#region src/types.d.ts
2
+ interface Core {
3
+ [k: string]: any;
4
+ getDriver: () => {
5
+ [k: string]: any;
6
+ name: string;
7
+ };
8
+ }
9
+ interface ConsoleAppOptions {
10
+ stubsDir?: string;
11
+ }
12
+ interface GroupedOption {
13
+ name: string;
14
+ value: string;
15
+ description: string;
16
+ }
17
+ //#endregion
18
+ export { Core as n, GroupedOption as r, ConsoleAppOptions as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkstack/console",
3
- "version": "0.16.1",
3
+ "version": "0.16.3",
4
4
  "type": "module",
5
5
  "description": "Console module for Arkstack, providing the command-line runtime and console integration layer.",
6
6
  "homepage": "https://arkstack.toneflix.net/guide/cli",
@@ -24,22 +24,19 @@
24
24
  "files": [
25
25
  "dist"
26
26
  ],
27
- "publishConfig": {
28
- "access": "public"
27
+ "exports": {
28
+ ".": "./dist/index.js",
29
+ "./app": "./dist/app.js",
30
+ "./helpers": "./dist/helpers.js",
31
+ "./prepare": "./dist/prepare.js",
32
+ "./package.json": "./package.json"
29
33
  },
30
34
  "bin": {
31
35
  "ark": "./dist/index.js",
32
36
  "prepare": "./dist/prepare.js"
33
37
  },
34
- "exports": {
35
- ".": {
36
- "types": "./dist/index.d.ts",
37
- "import": "./dist/index.js"
38
- },
39
- "./app": {
40
- "types": "./dist/app.d.ts",
41
- "import": "./dist/app.js"
42
- }
38
+ "publishConfig": {
39
+ "access": "public"
43
40
  },
44
41
  "peerDependencies": {
45
42
  "arkormx": "^2.10.1",
@@ -51,8 +48,8 @@
51
48
  "chalk": "^5.6.2",
52
49
  "resora": "^1.3.27",
53
50
  "ts-morph": "^28.0.0",
54
- "@arkstack/common": "^0.16.1",
55
- "@arkstack/contract": "^0.16.1"
51
+ "@arkstack/common": "^0.16.3",
52
+ "@arkstack/contract": "^0.16.3"
56
53
  },
57
54
  "peerDependenciesMeta": {
58
55
  "arkormx": {