@cenk1cenk2/oclif-common 3.9.8 → 3.9.10
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.d.ts +423 -52
- package/dist/index.js +1298 -22
- package/package.json +1 -1
- package/dist/base.command-d3038122.d.ts +0 -77
- package/dist/commands/base.command.d.ts +0 -24
- package/dist/commands/base.command.js +0 -174
- package/dist/commands/config.command.d.ts +0 -71
- package/dist/commands/config.command.js +0 -60
- package/dist/commands/index.d.ts +0 -34
- package/dist/commands/index.js +0 -18
- package/dist/constants/file.constants.d.ts +0 -5
- package/dist/constants/file.constants.js +0 -30
- package/dist/constants/global-flags.constants.d.ts +0 -5
- package/dist/constants/global-flags.constants.js +0 -53
- package/dist/constants/help-groups.constants.d.ts +0 -5
- package/dist/constants/help-groups.constants.js +0 -30
- package/dist/constants/index.d.ts +0 -4
- package/dist/constants/index.js +0 -19
- package/dist/hooks/index.d.ts +0 -6
- package/dist/hooks/index.js +0 -19
- package/dist/hooks/not-found.hook.d.ts +0 -5
- package/dist/hooks/not-found.hook.js +0 -37
- package/dist/hooks/store.hook.d.ts +0 -7
- package/dist/hooks/store.hook.js +0 -31
- package/dist/hooks/update-notifier.hook.d.ts +0 -5
- package/dist/hooks/update-notifier.hook.js +0 -37
- package/dist/interfaces/class.interface.d.ts +0 -3
- package/dist/interfaces/class.interface.js +0 -15
- package/dist/interfaces/config-command.interface.d.ts +0 -12
- package/dist/interfaces/config-command.interface.js +0 -15
- package/dist/interfaces/index.d.ts +0 -10
- package/dist/interfaces/index.js +0 -20
- package/dist/interfaces/oclif.interface.d.ts +0 -9
- package/dist/interfaces/oclif.interface.js +0 -27
- package/dist/interfaces/type-helper.interface.d.ts +0 -8
- package/dist/interfaces/type-helper.interface.js +0 -15
- package/dist/lib/config/config.constants.d.ts +0 -8
- package/dist/lib/config/config.constants.js +0 -33
- package/dist/lib/config/config.interface.d.ts +0 -15
- package/dist/lib/config/config.interface.js +0 -15
- package/dist/lib/config/config.service.d.ts +0 -24
- package/dist/lib/config/config.service.js +0 -172
- package/dist/lib/config/index.d.ts +0 -24
- package/dist/lib/config/index.js +0 -18
- package/dist/lib/fs/filesystem.service.d.ts +0 -28
- package/dist/lib/fs/filesystem.service.js +0 -162
- package/dist/lib/fs/index.d.ts +0 -2
- package/dist/lib/fs/index.js +0 -17
- package/dist/lib/index.d.ts +0 -29
- package/dist/lib/index.js +0 -23
- package/dist/lib/locker/index.d.ts +0 -4
- package/dist/lib/locker/index.js +0 -18
- package/dist/lib/locker/locker.interface.d.ts +0 -17
- package/dist/lib/locker/locker.interface.js +0 -15
- package/dist/lib/locker/locker.service.d.ts +0 -30
- package/dist/lib/locker/locker.service.js +0 -170
- package/dist/lib/parser/env-parser.service.d.ts +0 -13
- package/dist/lib/parser/env-parser.service.js +0 -62
- package/dist/lib/parser/index.d.ts +0 -8
- package/dist/lib/parser/index.js +0 -21
- package/dist/lib/parser/json-parser.service.d.ts +0 -12
- package/dist/lib/parser/json-parser.service.js +0 -52
- package/dist/lib/parser/parser.interface.d.ts +0 -7
- package/dist/lib/parser/parser.interface.js +0 -15
- package/dist/lib/parser/parser.service.d.ts +0 -21
- package/dist/lib/parser/parser.service.js +0 -87
- package/dist/lib/parser/yaml-parser.service.d.ts +0 -12
- package/dist/lib/parser/yaml-parser.service.js +0 -53
- package/dist/lib/setup.d.ts +0 -3
- package/dist/lib/setup.js +0 -60
- package/dist/lib/store/index.d.ts +0 -2
- package/dist/lib/store/index.js +0 -18
- package/dist/lib/store/store.interface.d.ts +0 -5
- package/dist/lib/store/store.interface.js +0 -15
- package/dist/lib/store/store.service.d.ts +0 -12
- package/dist/lib/store/store.service.js +0 -48
- package/dist/lib/validator/index.d.ts +0 -5
- package/dist/lib/validator/index.js +0 -18
- package/dist/lib/validator/validator.interface.d.ts +0 -9
- package/dist/lib/validator/validator.interface.js +0 -15
- package/dist/lib/validator/validator.service.d.ts +0 -16
- package/dist/lib/validator/validator.service.js +0 -77
- package/dist/utils/color.d.ts +0 -5
- package/dist/utils/color.js +0 -34
- package/dist/utils/defaults.d.ts +0 -11
- package/dist/utils/defaults.js +0 -47
- package/dist/utils/environment.d.ts +0 -7
- package/dist/utils/environment.js +0 -44
- package/dist/utils/index.d.ts +0 -17
- package/dist/utils/index.js +0 -34
- package/dist/utils/logger/index.d.ts +0 -10
- package/dist/utils/logger/index.js +0 -21
- package/dist/utils/logger/listr-logger.d.ts +0 -20
- package/dist/utils/logger/listr-logger.js +0 -60
- package/dist/utils/logger/logger.constants.d.ts +0 -20
- package/dist/utils/logger/logger.constants.js +0 -48
- package/dist/utils/logger/logger.d.ts +0 -31
- package/dist/utils/logger/logger.interface.d.ts +0 -16
- package/dist/utils/logger/logger.interface.js +0 -15
- package/dist/utils/logger/logger.js +0 -200
- package/dist/utils/logger/pipe/index.d.ts +0 -9
- package/dist/utils/logger/pipe/index.js +0 -19
- package/dist/utils/logger/pipe/pipe-process-to-listr.d.ts +0 -6
- package/dist/utils/logger/pipe/pipe-process-to-listr.js +0 -43
- package/dist/utils/logger/pipe/pipe-process-to-logger.d.ts +0 -13
- package/dist/utils/logger/pipe/pipe-process-to-logger.interface.d.ts +0 -16
- package/dist/utils/logger/pipe/pipe-process-to-logger.interface.js +0 -15
- package/dist/utils/logger/pipe/pipe-process-to-logger.js +0 -80
- package/dist/utils/merge.constants.d.ts +0 -6
- package/dist/utils/merge.constants.js +0 -31
- package/dist/utils/merge.d.ts +0 -8
- package/dist/utils/merge.js +0 -47
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var not_found_hook_exports = {};
|
|
20
|
-
__export(not_found_hook_exports, {
|
|
21
|
-
notFoundHook: () => notFoundHook
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(not_found_hook_exports);
|
|
24
|
-
var import_core = require("@oclif/core");
|
|
25
|
-
var import_logger = require("../utils/logger");
|
|
26
|
-
const notFoundHook = /* @__PURE__ */ __name(async (opts) => {
|
|
27
|
-
const logger = new import_logger.Logger(opts.config.name);
|
|
28
|
-
logger.fatal("Command not found. Take a look at help. You can also use --[h]elp flag for subcommands.", { custom: opts.config.name });
|
|
29
|
-
logger.direct("");
|
|
30
|
-
const help = new import_core.Help(opts.config);
|
|
31
|
-
await help.showHelp(["--all"]);
|
|
32
|
-
process.exit(127);
|
|
33
|
-
}, "notFoundHook");
|
|
34
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
-
0 && (module.exports = {
|
|
36
|
-
notFoundHook
|
|
37
|
-
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Hook } from '@oclif/core';
|
|
2
|
-
import { StoreService } from '../lib/store/store.service.js';
|
|
3
|
-
import '../lib/store/store.interface.js';
|
|
4
|
-
|
|
5
|
-
declare const storeHook: <T extends Record<PropertyKey, any> = Record<PropertyKey, any>>(cb: (opts: any, store: StoreService<T>) => void) => Hook<'init'>;
|
|
6
|
-
|
|
7
|
-
export { storeHook };
|
package/dist/hooks/store.hook.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var store_hook_exports = {};
|
|
20
|
-
__export(store_hook_exports, {
|
|
21
|
-
storeHook: () => storeHook
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(store_hook_exports);
|
|
24
|
-
var import_lib = require("../lib");
|
|
25
|
-
const storeHook = /* @__PURE__ */ __name((cb) => async (opts) => {
|
|
26
|
-
cb(opts, new import_lib.StoreService());
|
|
27
|
-
}, "storeHook");
|
|
28
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
-
0 && (module.exports = {
|
|
30
|
-
storeHook
|
|
31
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
-
var update_notifier_hook_exports = {};
|
|
26
|
-
__export(update_notifier_hook_exports, {
|
|
27
|
-
updateNotifierHook: () => updateNotifierHook
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(update_notifier_hook_exports);
|
|
30
|
-
var import_update_notifier = __toESM(require("update-notifier"));
|
|
31
|
-
const updateNotifierHook = /* @__PURE__ */ __name(async (opts) => {
|
|
32
|
-
(0, import_update_notifier.default)({ pkg: { name: opts.config.name, version: opts.config.version } }).notify({ isGlobal: true });
|
|
33
|
-
}, "updateNotifierHook");
|
|
34
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
-
0 && (module.exports = {
|
|
36
|
-
updateNotifierHook
|
|
37
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
var class_interface_exports = {};
|
|
15
|
-
module.exports = __toCommonJS(class_interface_exports);
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { LockerService } from '../lib/locker/locker.service.js';
|
|
2
|
-
import '../lib/locker/locker.interface.js';
|
|
3
|
-
import '../utils/merge.constants.js';
|
|
4
|
-
import '../lib/parser/parser.interface.js';
|
|
5
|
-
|
|
6
|
-
type ConfigCommandChoices<T extends string> = Record<T, () => void | Promise<void>>;
|
|
7
|
-
interface ConfigCommandSetup<T extends string = string, LockFile = any> {
|
|
8
|
-
choices: ConfigCommandChoices<T>;
|
|
9
|
-
locker?: LockerService<LockFile>;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export { ConfigCommandChoices, ConfigCommandSetup };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
var config_command_interface_exports = {};
|
|
15
|
-
module.exports = __toCommonJS(config_command_interface_exports);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { ClassType } from './class.interface.js';
|
|
2
|
-
export { ConfigCommandChoices, ConfigCommandSetup } from './config-command.interface.js';
|
|
3
|
-
export { InferArgs, InferFlags } from './oclif.interface.js';
|
|
4
|
-
export { DeepPartial } from './type-helper.interface.js';
|
|
5
|
-
export { Arg, ArgInput, Flag, FlagInput, InferredFlags } from '@oclif/core/lib/interfaces';
|
|
6
|
-
export { Flags } from '@oclif/core';
|
|
7
|
-
import '../lib/locker/locker.service.js';
|
|
8
|
-
import '../lib/locker/locker.interface.js';
|
|
9
|
-
import '../utils/merge.constants.js';
|
|
10
|
-
import '../lib/parser/parser.interface.js';
|
package/dist/interfaces/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var interfaces_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(interfaces_exports);
|
|
17
|
-
__reExport(interfaces_exports, require("./class.interface"), module.exports);
|
|
18
|
-
__reExport(interfaces_exports, require("./config-command.interface"), module.exports);
|
|
19
|
-
__reExport(interfaces_exports, require("./oclif.interface"), module.exports);
|
|
20
|
-
__reExport(interfaces_exports, require("./type-helper.interface"), module.exports);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Command } from '@oclif/core';
|
|
2
|
-
export { Flags } from '@oclif/core';
|
|
3
|
-
import { InferredFlags } from '@oclif/core/lib/interfaces';
|
|
4
|
-
export { Arg, ArgInput, Flag, FlagInput, InferredFlags } from '@oclif/core/lib/interfaces';
|
|
5
|
-
|
|
6
|
-
type InferFlags<T extends typeof Command> = InferredFlags<T['globalFlags'] & T['flags']>;
|
|
7
|
-
type InferArgs<T extends typeof Command> = Record<T['args'][number]['name'], string>;
|
|
8
|
-
|
|
9
|
-
export { InferArgs, InferFlags };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var oclif_interface_exports = {};
|
|
19
|
-
__export(oclif_interface_exports, {
|
|
20
|
-
Flags: () => import_core.Flags
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(oclif_interface_exports);
|
|
23
|
-
var import_core = require("@oclif/core");
|
|
24
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
25
|
-
0 && (module.exports = {
|
|
26
|
-
Flags
|
|
27
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
var type_helper_interface_exports = {};
|
|
15
|
-
module.exports = __toCommonJS(type_helper_interface_exports);
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var config_constants_exports = {};
|
|
19
|
-
__export(config_constants_exports, {
|
|
20
|
-
ConfigEnvKeys: () => ConfigEnvKeys
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(config_constants_exports);
|
|
23
|
-
var ConfigEnvKeys = /* @__PURE__ */ ((ConfigEnvKeys2) => {
|
|
24
|
-
ConfigEnvKeys2["NAME"] = "__name";
|
|
25
|
-
ConfigEnvKeys2["PARSER"] = "__format";
|
|
26
|
-
ConfigEnvKeys2["ELEMENT"] = "__element";
|
|
27
|
-
ConfigEnvKeys2["ELEMENT_REPLACER"] = "${i}";
|
|
28
|
-
return ConfigEnvKeys2;
|
|
29
|
-
})(ConfigEnvKeys || {});
|
|
30
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
-
0 && (module.exports = {
|
|
32
|
-
ConfigEnvKeys
|
|
33
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { LogLevels } from '../../utils/logger/logger.constants.js';
|
|
2
|
-
|
|
3
|
-
interface GlobalConfig {
|
|
4
|
-
logLevel: LogLevels;
|
|
5
|
-
ci: boolean;
|
|
6
|
-
json: boolean;
|
|
7
|
-
}
|
|
8
|
-
interface ConfigIterator {
|
|
9
|
-
key: (string | number)[];
|
|
10
|
-
env: string;
|
|
11
|
-
parser?: string;
|
|
12
|
-
extensions?: ConfigIterator[];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { ConfigIterator, GlobalConfig };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
var config_interface_exports = {};
|
|
15
|
-
module.exports = __toCommonJS(config_interface_exports);
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import './config.interface.js';
|
|
2
|
-
export { a as ConfigService } from '../../base.command-d3038122.js';
|
|
3
|
-
import '../locker/locker.interface.js';
|
|
4
|
-
import '../parser/parser.service.js';
|
|
5
|
-
import '../../utils/logger/logger.constants.js';
|
|
6
|
-
import '../../utils/merge.constants.js';
|
|
7
|
-
import '@oclif/core';
|
|
8
|
-
import 'listr2';
|
|
9
|
-
import '../../utils/logger/logger.js';
|
|
10
|
-
import '../../utils/logger/logger.interface.js';
|
|
11
|
-
import 'winston';
|
|
12
|
-
import '../fs/filesystem.service.js';
|
|
13
|
-
import 'fs-extra';
|
|
14
|
-
import '../../utils/defaults.js';
|
|
15
|
-
import '../store/store.service.js';
|
|
16
|
-
import '../store/store.interface.js';
|
|
17
|
-
import '../validator/validator.service.js';
|
|
18
|
-
import '../validator/validator.interface.js';
|
|
19
|
-
import 'class-transformer';
|
|
20
|
-
import 'class-validator';
|
|
21
|
-
import '../../interfaces/class.interface.js';
|
|
22
|
-
import '../../interfaces/oclif.interface.js';
|
|
23
|
-
import '@oclif/core/lib/interfaces';
|
|
24
|
-
import '../parser/parser.interface.js';
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
-
var config_service_exports = {};
|
|
26
|
-
__export(config_service_exports, {
|
|
27
|
-
ConfigService: () => ConfigService
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(config_service_exports);
|
|
30
|
-
var import_object_path_immutable = __toESM(require("object-path-immutable"));
|
|
31
|
-
var import_path = require("path");
|
|
32
|
-
var import_config = require("./config.constants");
|
|
33
|
-
var import_constants = require("../../constants");
|
|
34
|
-
var import_parser = require("../parser/parser.service");
|
|
35
|
-
var import_utils = require("../../utils");
|
|
36
|
-
var import_logger = require("../../utils/logger");
|
|
37
|
-
class ConfigService {
|
|
38
|
-
constructor(oclif, command, config) {
|
|
39
|
-
this.oclif = oclif;
|
|
40
|
-
this.command = command;
|
|
41
|
-
if (ConfigService.instance) {
|
|
42
|
-
return ConfigService.instance;
|
|
43
|
-
}
|
|
44
|
-
this.root = this.oclif.root;
|
|
45
|
-
this.defaults = (0, import_path.join)(this.oclif.root, import_constants.FileConstants.CONFIG_SERVICE_DEFAULTS_DIR);
|
|
46
|
-
this.logger = new import_logger.Logger(this.constructor.name, { level: config.logLevel });
|
|
47
|
-
Object.assign(this, config);
|
|
48
|
-
this.recalculate();
|
|
49
|
-
this.parser = new import_parser.ParserService();
|
|
50
|
-
ConfigService.instance = this;
|
|
51
|
-
this.logger.trace("Created a new instance.");
|
|
52
|
-
}
|
|
53
|
-
async read(path) {
|
|
54
|
-
const config = await this.parser.read(path);
|
|
55
|
-
this.logger.trace("Read config from: %s", path);
|
|
56
|
-
return config;
|
|
57
|
-
}
|
|
58
|
-
async extend(paths, strategy = import_utils.MergeStrategy.OVERWRITE) {
|
|
59
|
-
this.logger.trace("Will generate config from: %o with %s", paths, strategy);
|
|
60
|
-
const configs = (await Promise.all(
|
|
61
|
-
paths.map(async (path) => {
|
|
62
|
-
try {
|
|
63
|
-
const config = typeof path === "string" ? await this.parser.read(path) : path;
|
|
64
|
-
this.logger.trace("Extending config from: %s", path);
|
|
65
|
-
return config;
|
|
66
|
-
} catch (e) {
|
|
67
|
-
this.logger.trace("Failed to extend config from: %s", e.message);
|
|
68
|
-
}
|
|
69
|
-
})
|
|
70
|
-
)).filter(Boolean);
|
|
71
|
-
return this.merge(configs, strategy);
|
|
72
|
-
}
|
|
73
|
-
merge(configs, strategy = import_utils.MergeStrategy.OVERWRITE) {
|
|
74
|
-
if (configs.length === 0) {
|
|
75
|
-
throw new Error("Nothing to merge, configuration files are empty.");
|
|
76
|
-
}
|
|
77
|
-
return (0, import_utils.merge)(strategy, ...configs);
|
|
78
|
-
}
|
|
79
|
-
async env(definition, config) {
|
|
80
|
-
const env = typeof definition === "string" ? await this.parser.read(definition) : definition;
|
|
81
|
-
this.logger.trace("Environment variable extensions read: %o", definition);
|
|
82
|
-
const iter = /* @__PURE__ */ __name(async (obj, parent) => {
|
|
83
|
-
const data = await Promise.all(
|
|
84
|
-
Object.entries(obj).map(async ([key, value]) => {
|
|
85
|
-
const location = [...parent ?? [], key];
|
|
86
|
-
if (typeof value === "string") {
|
|
87
|
-
return [{ key: location, env: value }];
|
|
88
|
-
} else if (typeof value === "object") {
|
|
89
|
-
let extensions;
|
|
90
|
-
if (import_config.ConfigEnvKeys.ELEMENT in value) {
|
|
91
|
-
extensions = await iter(value[import_config.ConfigEnvKeys.ELEMENT], [...location, import_config.ConfigEnvKeys.ELEMENT]);
|
|
92
|
-
this.logger.trace("Expanding location to elements: %s -> %s", location, extensions.map((extension) => extension.key.join(".")).join(", "));
|
|
93
|
-
}
|
|
94
|
-
if (import_config.ConfigEnvKeys.NAME in value && import_config.ConfigEnvKeys.PARSER in value) {
|
|
95
|
-
const variable = [
|
|
96
|
-
{
|
|
97
|
-
key: location,
|
|
98
|
-
env: value[import_config.ConfigEnvKeys.NAME],
|
|
99
|
-
parser: value[import_config.ConfigEnvKeys.PARSER],
|
|
100
|
-
extensions
|
|
101
|
-
}
|
|
102
|
-
];
|
|
103
|
-
return variable;
|
|
104
|
-
} else {
|
|
105
|
-
return iter(value, location);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
})
|
|
109
|
-
);
|
|
110
|
-
return data.flatMap((d) => d).filter(Boolean);
|
|
111
|
-
}, "iter");
|
|
112
|
-
const parsed = await iter(env);
|
|
113
|
-
const cb = /* @__PURE__ */ __name((config2, variable, data) => {
|
|
114
|
-
if (variable.parser) {
|
|
115
|
-
try {
|
|
116
|
-
data = this.parser.parse(variable.parser, data);
|
|
117
|
-
} catch (e) {
|
|
118
|
-
this.logger.trace("Can not parse environment environment variable for config: %s -> %s with %s", variable.key.join("."), variable.env, variable.parser);
|
|
119
|
-
throw e;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
this.logger.trace("Overwriting config with environment variable: %s -> %s", variable.key.join("."), variable.env);
|
|
123
|
-
return import_object_path_immutable.default.set(config2, variable.key, data);
|
|
124
|
-
}, "cb");
|
|
125
|
-
parsed.forEach((variable) => {
|
|
126
|
-
let data;
|
|
127
|
-
data = process.env[variable.env];
|
|
128
|
-
if (data) {
|
|
129
|
-
config = cb(config, variable, data);
|
|
130
|
-
}
|
|
131
|
-
if (variable.extensions && variable.extensions.length > 0) {
|
|
132
|
-
const timeout = 6e4;
|
|
133
|
-
const startedAt = Date.now();
|
|
134
|
-
for (let i = 0; i < Infinity; i++) {
|
|
135
|
-
if (Date.now() - startedAt > timeout) {
|
|
136
|
-
throw new Error(`Timed-out in ${timeout}ms while looking for element environment variables.`);
|
|
137
|
-
}
|
|
138
|
-
const extensions = variable.extensions.map((extension) => {
|
|
139
|
-
const clone = JSON.parse(JSON.stringify(extension));
|
|
140
|
-
clone.env = clone.env.replace(import_config.ConfigEnvKeys.ELEMENT_REPLACER, i.toString());
|
|
141
|
-
clone.key[clone.key.findIndex((value) => value === import_config.ConfigEnvKeys.ELEMENT)] = i.toString();
|
|
142
|
-
data = process.env[clone.env];
|
|
143
|
-
if (!data) {
|
|
144
|
-
this.logger.trace("No extension for environment variable: %s -> %s", clone.key.join("."), clone.env);
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
config = cb(config, clone, data);
|
|
148
|
-
return true;
|
|
149
|
-
}).filter(Boolean);
|
|
150
|
-
if (extensions.length === 0) {
|
|
151
|
-
this.logger.trace("No more extensions for environment variables: %s -> %d", variable.key.join("."), i);
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
return config;
|
|
158
|
-
}
|
|
159
|
-
async write(path, data) {
|
|
160
|
-
return this.parser.write(path, data);
|
|
161
|
-
}
|
|
162
|
-
recalculate() {
|
|
163
|
-
this.isVerbose = (0, import_utils.isVerbose)(this.logLevel);
|
|
164
|
-
this.isDebug = (0, import_utils.isDebug)(this.logLevel);
|
|
165
|
-
this.isSilent = (0, import_utils.isSilent)(this.logLevel);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
__name(ConfigService, "ConfigService");
|
|
169
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
170
|
-
0 && (module.exports = {
|
|
171
|
-
ConfigService
|
|
172
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export { ConfigIterator, GlobalConfig } from './config.interface.js';
|
|
2
|
-
export { a as ConfigService } from '../../base.command-d3038122.js';
|
|
3
|
-
import '../../utils/logger/logger.constants.js';
|
|
4
|
-
import '@oclif/core';
|
|
5
|
-
import 'listr2';
|
|
6
|
-
import '../../utils/logger/logger.js';
|
|
7
|
-
import '../../utils/logger/logger.interface.js';
|
|
8
|
-
import 'winston';
|
|
9
|
-
import '../fs/filesystem.service.js';
|
|
10
|
-
import 'fs-extra';
|
|
11
|
-
import '../../utils/defaults.js';
|
|
12
|
-
import '../parser/parser.service.js';
|
|
13
|
-
import '../parser/parser.interface.js';
|
|
14
|
-
import '../../interfaces/class.interface.js';
|
|
15
|
-
import '../locker/locker.interface.js';
|
|
16
|
-
import '../../utils/merge.constants.js';
|
|
17
|
-
import '../store/store.service.js';
|
|
18
|
-
import '../store/store.interface.js';
|
|
19
|
-
import '../validator/validator.service.js';
|
|
20
|
-
import '../validator/validator.interface.js';
|
|
21
|
-
import 'class-transformer';
|
|
22
|
-
import 'class-validator';
|
|
23
|
-
import '../../interfaces/oclif.interface.js';
|
|
24
|
-
import '@oclif/core/lib/interfaces';
|
package/dist/lib/config/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var config_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(config_exports);
|
|
17
|
-
__reExport(config_exports, require("./config.interface"), module.exports);
|
|
18
|
-
__reExport(config_exports, require("./config.service"), module.exports);
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
export { default as fs } from 'fs-extra';
|
|
3
|
-
|
|
4
|
-
declare class FileSystemService {
|
|
5
|
-
private static instance;
|
|
6
|
-
private logger;
|
|
7
|
-
constructor();
|
|
8
|
-
exists(path: string): boolean;
|
|
9
|
-
stats(path: string): fs.Stats;
|
|
10
|
-
dirname(path: string): string;
|
|
11
|
-
extname(path: string): string;
|
|
12
|
-
read(file: string): Promise<string>;
|
|
13
|
-
readSync(file: string): string;
|
|
14
|
-
write(file: string, data: string | Buffer, options?: fs.WriteFileOptions): Promise<void>;
|
|
15
|
-
writeSync(file: string, data: string | Buffer, options?: fs.WriteFileOptions): void;
|
|
16
|
-
append(file: string, data: string | Buffer, options?: fs.WriteFileOptions): Promise<void>;
|
|
17
|
-
appendSync(file: string, data: string | Buffer): void;
|
|
18
|
-
remove(file: string, options?: fs.RmOptions): Promise<void>;
|
|
19
|
-
removeSync(file: string, options?: fs.RmOptions): void;
|
|
20
|
-
emptyDir(directory: string): Promise<void>;
|
|
21
|
-
emptyDirSync(directory: string): void;
|
|
22
|
-
removeDir(directory: string): Promise<void>;
|
|
23
|
-
removeDirSync(directory: string): void;
|
|
24
|
-
mkdir(directory: string): Promise<void>;
|
|
25
|
-
mkdirSync(directory: string): void;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export { FileSystemService };
|