@arkstack/console 0.19.2 → 0.19.4

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.
@@ -2,6 +2,7 @@ import { existsSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
2
2
  import path from "node:path";
3
3
  import { Arkstack } from "@arkstack/contract";
4
4
  import { Node, Project } from "ts-morph";
5
+ import { readFile } from "node:fs/promises";
5
6
 
6
7
  //#region src/prepare/TSConfig.ts
7
8
  const TSConfig = {
@@ -47,20 +48,27 @@ var BuildInterfaces = class BuildInterfaces {
47
48
  static checker;
48
49
  /**
49
50
  * Generate configuration interfaces
50
- *
51
- * @param configDir
51
+ *
52
+ * @param configDir
52
53
  */
53
54
  static configs(configDir) {
54
55
  configDir ??= path.join(Arkstack.rootDir(), "src/config");
55
56
  const declaration = this.generateConfig(configDir);
56
57
  writeFileSync(path.join(Arkstack.rootDir(), ".arkstack/ark.d.ts"), declaration, "utf8");
57
58
  }
58
- static tsconfig() {
59
+ static async tsconfig() {
60
+ const pkg = JSON.parse(await readFile(path.join(process.cwd(), "package.json"), "utf-8"));
61
+ const deps = Object.keys(pkg.dependencies ?? {}).concat(Object.keys(pkg.devDependencies ?? {}));
62
+ if (deps.includes("@arkstack/inertia")) TSConfig["include"] = [...TSConfig["include"], "../resources"];
63
+ if (deps.includes("react")) TSConfig["compilerOptions"] = {
64
+ ...TSConfig["compilerOptions"],
65
+ jsx: "react-jsx"
66
+ };
59
67
  const configs = {
60
68
  ".arkstack/tsconfig.json": JSON.stringify(TSConfig, void 0, 2),
61
69
  "tsconfig.json": JSON.stringify(BaseTCConfig, void 0, 2)
62
70
  };
63
- for (const [file, config] of Object.entries(configs)) writeFileSync(path.join(Arkstack.rootDir(), file), config, "utf8");
71
+ for (const [file, config] of Object.entries(configs)) writeFileSync(path.join(Arkstack.rootDir(), file), config + "\n", "utf8");
64
72
  }
65
73
  /**
66
74
  * Generate an `EnvRegistry` augmentation from the application's `.env`
@@ -103,11 +111,11 @@ var BuildInterfaces = class BuildInterfaces {
103
111
  "}"
104
112
  ].join("\n");
105
113
  }
106
- /**
107
- * Prefer `.env.example` (the documented schema), then `.env`.
108
- *
109
- * @param root
110
- * @returns
114
+ /**
115
+ * Prefer `.env.example` (the documented schema), then `.env`.
116
+ *
117
+ * @param root
118
+ * @returns
111
119
  */
112
120
  static resolveEnvFile(root) {
113
121
  for (const name of [".env.example", ".env"]) {
@@ -115,11 +123,11 @@ var BuildInterfaces = class BuildInterfaces {
115
123
  if (existsSync(file)) return file;
116
124
  }
117
125
  }
118
- /**
119
- * Parse `KEY=VALUE` lines, skipping blanks, comments and invalid names.
120
- *
121
- * @param contents
122
- * @returns
126
+ /**
127
+ * Parse `KEY=VALUE` lines, skipping blanks, comments and invalid names.
128
+ *
129
+ * @param contents
130
+ * @returns
123
131
  */
124
132
  static parseEnvFile(contents) {
125
133
  const entries = {};
@@ -136,11 +144,11 @@ var BuildInterfaces = class BuildInterfaces {
136
144
  }
137
145
  return entries;
138
146
  }
139
- /**
140
- * Infer a TS type from a value, mirroring env()'s runtime coercion.
141
- *
142
- * @param value
143
- * @returns
147
+ /**
148
+ * Infer a TS type from a value, mirroring env()'s runtime coercion.
149
+ *
150
+ * @param value
151
+ * @returns
144
152
  */
145
153
  static inferEnvType(value) {
146
154
  if (value === "") return "string";
@@ -153,10 +161,10 @@ var BuildInterfaces = class BuildInterfaces {
153
161
  if (!Number.isNaN(Number(value))) return "number";
154
162
  return "string";
155
163
  }
156
- /**
164
+ /**
157
165
  * Resolve the framework's own `EnvRegistry` keys to skip during generation.
158
- *
159
- * @returns
166
+ *
167
+ * @returns
160
168
  */
161
169
  static frameworkEnvKeys() {
162
170
  try {
@@ -256,9 +264,9 @@ var BuildInterfaces = class BuildInterfaces {
256
264
  /**
257
265
  * ts-morph resolves computed keys like path.join(...) as { [x: number]: any }
258
266
  * detect these by checking the type text for an index signature pattern
259
- *
260
- * @param type
261
- * @returns
267
+ *
268
+ * @param type
269
+ * @returns
262
270
  */
263
271
  static isDynamicMap(type) {
264
272
  return /^\{ \[x: (string|number)\]:/.test(type.getText());
@@ -68,16 +68,16 @@ var ArkstackConsoleApp = class extends CliApp {
68
68
  return outputPath;
69
69
  };
70
70
  /**
71
- * Normalize a file path by removing the current working directory from it.
72
- *
73
- * @param p
74
- * @returns
71
+ * Normalize a file path by removing the current working directory from it.
72
+ *
73
+ * @param p
74
+ * @returns
75
75
  */
76
76
  normalizePath = (p) => {
77
77
  return p.replace(Arkstack.rootDir(), "");
78
78
  };
79
79
  /**
80
- * Recursively merge defaultConfig with config from resora.config.js, giving
80
+ * Recursively merge defaultConfig with config from resora.config.js, giving
81
81
  * precedence to resora.
82
82
  */
83
83
  mergeConfig = () => {
package/dist/app.js CHANGED
@@ -1,3 +1,3 @@
1
- import { t as ArkstackConsoleApp } from "./app-DFznSRvS.js";
1
+ import { t as ArkstackConsoleApp } from "./app-BfLHdYcV.js";
2
2
 
3
3
  export { ArkstackConsoleApp };
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ declare class BuildInterfaces {
8
8
  * @param configDir
9
9
  */
10
10
  static configs(configDir?: string): void;
11
- static tsconfig(): void;
11
+ static tsconfig(): Promise<void>;
12
12
  /**
13
13
  * Generate an `EnvRegistry` augmentation from the application's `.env`
14
14
  * schema, giving `env()` precise return types for app-specific variables.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { t as ArkstackConsoleApp } from "./app-DFznSRvS.js";
2
+ import { t as ArkstackConsoleApp } from "./app-BfLHdYcV.js";
3
3
  import { n as loadPackageSetups, t as groupPublishables } from "./helpers-BfDN6Q79.js";
4
- import { n as BaseTCConfig, r as TSConfig, t as BuildInterfaces } from "./BuildInterfaces-BeMseJhx.js";
4
+ import { n as BaseTCConfig, r as TSConfig, t as BuildInterfaces } from "./BuildInterfaces-CzwqOKDl.js";
5
5
  import { createRequire } from "node:module";
6
6
  import { Logger, Publisher, abort, abortIf, assertFound, config as config$1, discoverCommands, env, importFile, initializeGlobalContext, loadPrototypes, outputDir, rebuildOutput } from "@arkstack/common";
7
7
  import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, statSync, writeFileSync } from "node:fs";
@@ -129,9 +129,9 @@ var DevCommand = class DevCommand extends Command {
129
129
  * switches it to `0.0.0.0` to expose it on the local network. `--secure` flags
130
130
  * the driver to serve HTTPS. The command itself owns the Ngrok tunnel so
131
131
  * watcher-driven application restarts cannot replace its public URL.
132
- *
133
- * @param options
134
- * @returns
132
+ *
133
+ * @param options
134
+ * @returns
135
135
  */
136
136
  static devServerEnv(options) {
137
137
  const vars = {
@@ -469,11 +469,11 @@ var PublishCommand = class extends Command {
469
469
  gated
470
470
  };
471
471
  }
472
- /**
473
- * Extract the selectable values from a confirmation's choices.
474
- *
475
- * @param options
476
- * @returns
472
+ /**
473
+ * Extract the selectable values from a confirmation's choices.
474
+ *
475
+ * @param options
476
+ * @returns
477
477
  */
478
478
  choiceValues(options) {
479
479
  return options.map((option) => typeof option === "string" ? option : option.value);
@@ -583,11 +583,11 @@ var logo_default = String.raw`
583
583
 
584
584
  //#endregion
585
585
  //#region dist/index.js
586
- /**
587
- * A missing-module error from importing a stale/incomplete build artifact.
588
- *
589
- * @param error
590
- * @returns
586
+ /**
587
+ * A missing-module error from importing a stale/incomplete build artifact.
588
+ *
589
+ * @param error
590
+ * @returns
591
591
  */
592
592
  const isMissingModuleError = (error) => {
593
593
  const code = error?.code;
@@ -617,8 +617,8 @@ const loadCoreApp = async () => {
617
617
  };
618
618
  /**
619
619
  * Runs the console kernel, initializing the application and registering commands.
620
- *
621
- * @param options
620
+ *
621
+ * @param options
622
622
  */
623
623
  const runConsoleKernel = async (options = {}) => {
624
624
  loadPrototypes();
@@ -656,10 +656,10 @@ const runConsoleKernel = async (options = {}) => {
656
656
  });
657
657
  };
658
658
  /**
659
- * Determines if the current module is being executed as the entry
659
+ * Determines if the current module is being executed as the entry
660
660
  * point of the application.
661
- *
662
- * @returns
661
+ *
662
+ * @returns
663
663
  */
664
664
  const isEntrypointExecution = () => {
665
665
  const argvEntry = process.argv[1];
package/dist/prepare.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as BuildInterfaces } from "./BuildInterfaces-BeMseJhx.js";
2
+ import { t as BuildInterfaces } from "./BuildInterfaces-CzwqOKDl.js";
3
3
  import { existsSync, mkdirSync, readdirSync } from "node:fs";
4
4
  import path from "node:path";
5
5
  import { Arkstack } from "@arkstack/contract";
@@ -80,7 +80,7 @@ if (!process.env.NODE_CI) {
80
80
  BuildInterfaces.configs();
81
81
  BuildInterfaces.env();
82
82
  }
83
- BuildInterfaces.tsconfig();
83
+ await BuildInterfaces.tsconfig();
84
84
  await ArkormArtifacts.sync();
85
85
  const LOG_LEVEL = parseInt(process.env.VERBOSITY ?? "0") > 0 ? [] : ["--log-level=silent"];
86
86
  const NODE_ENV = process.env.NODE_ENV || "development";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkstack/console",
3
- "version": "0.19.2",
3
+ "version": "0.19.4",
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",
@@ -42,7 +42,7 @@
42
42
  "peerDependencies": {
43
43
  "arkormx": "^2.12.8",
44
44
  "clear-router": "^2.9.3",
45
- "@arkstack/database": "^0.19.2"
45
+ "@arkstack/database": "^0.19.4"
46
46
  },
47
47
  "dependencies": {
48
48
  "@ngrok/ngrok": "^1.7.0",
@@ -51,8 +51,8 @@
51
51
  "chalk": "^5.6.2",
52
52
  "resora": "^1.3.34",
53
53
  "ts-morph": "^28.0.0",
54
- "@arkstack/common": "^0.19.2",
55
- "@arkstack/contract": "^0.19.2"
54
+ "@arkstack/common": "^0.19.4",
55
+ "@arkstack/contract": "^0.19.4"
56
56
  },
57
57
  "peerDependenciesMeta": {
58
58
  "@arkstack/database": {