@tolinax/ayoune-cli 2026.8.0 → 2026.8.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.
|
@@ -127,7 +127,6 @@ Examples:
|
|
|
127
127
|
.option("--collection <col>", "Default target collection name")
|
|
128
128
|
.option("--write-mode <mode>", "Write mode: insert, upsert, replace", "insert")
|
|
129
129
|
.action(async (options) => {
|
|
130
|
-
var _a;
|
|
131
130
|
try {
|
|
132
131
|
const opts = { ...program.opts(), ...options };
|
|
133
132
|
let { name, type, uri, database, collection, writeMode } = opts;
|
|
@@ -160,7 +159,8 @@ Examples:
|
|
|
160
159
|
const res = await apiCallHandler("config", "datatargets", "post", body, {
|
|
161
160
|
responseFormat: opts.responseFormat,
|
|
162
161
|
});
|
|
163
|
-
const
|
|
162
|
+
const created = Array.isArray(res.payload) ? res.payload[0] : res.payload;
|
|
163
|
+
const slug = (created === null || created === void 0 ? void 0 : created.slug) || name;
|
|
164
164
|
spinner.success({ text: `Target "${slug}" created — use with: ay db copy ${slug}` });
|
|
165
165
|
}
|
|
166
166
|
catch (e) {
|
|
@@ -1,28 +1,19 @@
|
|
|
1
1
|
//Initializes settings for system environment and inquirer
|
|
2
|
-
//
|
|
3
|
-
// Only register them when
|
|
2
|
+
// Plugins are lazy-loaded: inquirer-table-input, inquirer-fuzzy-path, etc.
|
|
3
|
+
// are heavy (~3000 modules). Only register them when interactive prompts are needed.
|
|
4
|
+
import inquirer from "inquirer";
|
|
5
|
+
import { createRequire } from "module";
|
|
4
6
|
let _initialized = false;
|
|
5
7
|
export function initializeSettings() {
|
|
6
8
|
if (_initialized)
|
|
7
9
|
return;
|
|
8
10
|
_initialized = true;
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
// Lazy-load only the heavy plugins via createRequire (ESM dynamic require)
|
|
12
|
+
const require = createRequire(import.meta.url);
|
|
13
|
+
inquirer.registerPrompt("fuzzypath", require("inquirer-fuzzy-path"));
|
|
14
|
+
inquirer.registerPrompt("search-list", require("inquirer-search-list"));
|
|
15
|
+
inquirer.registerPrompt("file-tree-selection", require("inquirer-file-tree-selection-prompt"));
|
|
16
|
+
inquirer.registerPrompt("table-input", require("inquirer-table-input"));
|
|
14
17
|
const InterruptedPrompt = require("inquirer-interrupted-prompt");
|
|
15
|
-
inquirer.registerPrompt("fuzzypath", inquirerFuzzyPath);
|
|
16
|
-
inquirer.registerPrompt("search-list", inquirerSearchList);
|
|
17
|
-
inquirer.registerPrompt("file-tree-selection", inquirerFileTreeSelection);
|
|
18
|
-
inquirer.registerPrompt("table-input", inquirerTableInput);
|
|
19
18
|
InterruptedPrompt.fromAll(inquirer);
|
|
20
19
|
}
|
|
21
|
-
/**
|
|
22
|
-
* Returns the inquirer instance with all custom prompts registered.
|
|
23
|
-
* Call this instead of importing inquirer directly when using custom prompt types.
|
|
24
|
-
*/
|
|
25
|
-
export function getInquirer() {
|
|
26
|
-
initializeSettings();
|
|
27
|
-
return require("inquirer");
|
|
28
|
-
}
|