@decaf-ts/cli 0.4.3 → 0.4.5
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/README.md +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/lib/CliWrapper.cjs +209 -90
- package/lib/CliWrapper.d.ts +28 -4
- package/lib/CliWrapper.js.map +1 -1
- package/lib/banners.cjs +194 -0
- package/lib/banners.d.ts +3 -0
- package/lib/banners.js.map +1 -0
- package/lib/demo/cli-module.cjs +9 -39
- package/lib/demo/cli-module.d.ts +0 -33
- package/lib/demo/cli-module.js.map +1 -1
- package/lib/environment.cjs +17 -0
- package/lib/environment.d.ts +17 -0
- package/lib/environment.js.map +1 -0
- package/lib/esm/CliWrapper.d.ts +28 -4
- package/lib/esm/CliWrapper.js +210 -91
- package/lib/esm/CliWrapper.js.map +1 -1
- package/lib/esm/banners.d.ts +3 -0
- package/lib/esm/banners.js +191 -0
- package/lib/esm/banners.js.map +1 -0
- package/lib/esm/demo/cli-module.d.ts +0 -33
- package/lib/esm/demo/cli-module.js +9 -39
- package/lib/esm/demo/cli-module.js.map +1 -1
- package/lib/esm/environment.d.ts +17 -0
- package/lib/esm/environment.js +11 -0
- package/lib/esm/environment.js.map +1 -0
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/logging.d.ts +3 -0
- package/lib/esm/logging.js +16 -0
- package/lib/esm/logging.js.map +1 -0
- package/lib/esm/slogans.d.ts +40 -0
- package/lib/esm/slogans.js +142 -0
- package/lib/esm/slogans.js.map +1 -0
- package/lib/esm/utils-module/cli-module.d.ts +2 -0
- package/lib/esm/utils-module/cli-module.js +77 -0
- package/lib/esm/utils-module/cli-module.js.map +1 -0
- package/lib/esm/utils.js +1 -1
- package/lib/esm/utils.js.map +1 -1
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/index.cjs +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js.map +1 -1
- package/lib/logging.cjs +19 -0
- package/lib/logging.d.ts +3 -0
- package/lib/logging.js.map +1 -0
- package/lib/slogans.cjs +150 -0
- package/lib/slogans.d.ts +40 -0
- package/lib/slogans.js.map +1 -0
- package/lib/utils-module/cli-module.cjs +83 -0
- package/lib/utils-module/cli-module.d.ts +2 -0
- package/lib/utils-module/cli-module.js.map +1 -0
- package/lib/utils.cjs +1 -1
- package/lib/utils.js.map +1 -1
- package/lib/version.cjs +1 -1
- package/lib/version.d.ts +1 -1
- package/package.json +3 -2
- package/workdocs/assets/slogans.json +194 -0
|
@@ -1,35 +1,2 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
-
/**
|
|
3
|
-
* @description Demo CLI module for Decaf libraries
|
|
4
|
-
* @summary A minimal implementation showing how to extend the Decaf CLI with custom commands.
|
|
5
|
-
* This module demonstrates the pattern for creating CLI modules that can be discovered and loaded by the Decaf CLI.
|
|
6
|
-
*
|
|
7
|
-
* @return {Command} The Command object to be added to the main Decaf CLI
|
|
8
|
-
*
|
|
9
|
-
* @function demo
|
|
10
|
-
* @memberOf module:CLI
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* // Run the demo command with an argument
|
|
14
|
-
* npx decaf demo command "something something"
|
|
15
|
-
*
|
|
16
|
-
* // Output:
|
|
17
|
-
* // executed demo command with type variable: something something
|
|
18
|
-
*
|
|
19
|
-
* @mermaid
|
|
20
|
-
* sequenceDiagram
|
|
21
|
-
* participant User
|
|
22
|
-
* participant CLI
|
|
23
|
-
* participant DemoModule
|
|
24
|
-
* participant Command
|
|
25
|
-
*
|
|
26
|
-
* User->>CLI: npx decaf demo command "arg"
|
|
27
|
-
* CLI->>DemoModule: Load module
|
|
28
|
-
* DemoModule->>Command: Create command
|
|
29
|
-
* Command->>Command: Configure action
|
|
30
|
-
* Command-->>DemoModule: Return command
|
|
31
|
-
* DemoModule-->>CLI: Return command
|
|
32
|
-
* CLI->>Command: Execute with args
|
|
33
|
-
* Command->>Console: Log output
|
|
34
|
-
*/
|
|
35
2
|
export default function demo(): Command;
|
|
@@ -1,43 +1,13 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*
|
|
9
|
-
* @function demo
|
|
10
|
-
* @memberOf module:CLI
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* // Run the demo command with an argument
|
|
14
|
-
* npx decaf demo command "something something"
|
|
15
|
-
*
|
|
16
|
-
* // Output:
|
|
17
|
-
* // executed demo command with type variable: something something
|
|
18
|
-
*
|
|
19
|
-
* @mermaid
|
|
20
|
-
* sequenceDiagram
|
|
21
|
-
* participant User
|
|
22
|
-
* participant CLI
|
|
23
|
-
* participant DemoModule
|
|
24
|
-
* participant Command
|
|
25
|
-
*
|
|
26
|
-
* User->>CLI: npx decaf demo command "arg"
|
|
27
|
-
* CLI->>DemoModule: Load module
|
|
28
|
-
* DemoModule->>Command: Create command
|
|
29
|
-
* Command->>Command: Configure action
|
|
30
|
-
* Command-->>DemoModule: Return command
|
|
31
|
-
* DemoModule-->>CLI: Return command
|
|
32
|
-
* CLI->>Command: Execute with args
|
|
33
|
-
* Command->>Console: Log output
|
|
34
|
-
*/
|
|
2
|
+
const runCommand = new Command("command")
|
|
3
|
+
.description("A demo command")
|
|
4
|
+
.argument("<type>")
|
|
5
|
+
.action(async (type) => {
|
|
6
|
+
console.log(`executed demo command with type variable: ${type}`);
|
|
7
|
+
});
|
|
35
8
|
export default function demo() {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
.action((args) => {
|
|
40
|
-
console.log(`executed demo command with type variable: ${args}`);
|
|
41
|
-
});
|
|
9
|
+
const demoCommand = new Command("demo").description("Demo commands");
|
|
10
|
+
demoCommand.addCommand(runCommand);
|
|
11
|
+
return demoCommand;
|
|
42
12
|
}
|
|
43
13
|
//# sourceMappingURL=cli-module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-module.js","sourceRoot":"","sources":["../../../src/demo/cli-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC
|
|
1
|
+
{"version":3,"file":"cli-module.js","sourceRoot":"","sources":["../../../src/demo/cli-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,UAAU,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC;KACtC,WAAW,CAAC,gBAAgB,CAAC;KAC7B,QAAQ,CAAC,QAAQ,CAAC;KAClB,MAAM,CAAC,KAAK,EAAE,IAAY,EAAE,EAAE;IAC7B,OAAO,CAAC,GAAG,CAAC,6CAA6C,IAAI,EAAE,CAAC,CAAC;AACnE,CAAC,CAAC,CAAC;AAEL,MAAM,CAAC,OAAO,UAAU,IAAI;IAC1B,MAAM,WAAW,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;IACrE,WAAW,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACnC,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LoggingConfig } from "@decaf-ts/logging";
|
|
2
|
+
export type DecafCliEnvironment = LoggingConfig & {
|
|
3
|
+
banner: boolean;
|
|
4
|
+
cliModuleRoot: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const DefaultCliEnvironment: DecafCliEnvironment;
|
|
7
|
+
export declare const DecafCLieEnvironment: object & LoggingConfig & {
|
|
8
|
+
env: any;
|
|
9
|
+
} & {
|
|
10
|
+
banner: boolean;
|
|
11
|
+
cliModuleRoot: string;
|
|
12
|
+
} & import("typed-object-accumulator").ObjectAccumulator<object & LoggingConfig & {
|
|
13
|
+
env: any;
|
|
14
|
+
} & {
|
|
15
|
+
banner: boolean;
|
|
16
|
+
cliModuleRoot: string;
|
|
17
|
+
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { LoggedEnvironment } from "@decaf-ts/logging";
|
|
3
|
+
const cliModuleRoot = process.env.CLI_MODULE_TOOT && process.env.CLI_MODULE_TOOT.length > 0
|
|
4
|
+
? path.resolve(process.env.CLI_MODULE_TOOT)
|
|
5
|
+
: process.cwd();
|
|
6
|
+
export const DefaultCliEnvironment = {
|
|
7
|
+
banner: true,
|
|
8
|
+
cliModuleRoot,
|
|
9
|
+
};
|
|
10
|
+
export const DecafCLieEnvironment = LoggedEnvironment.accumulate(DefaultCliEnvironment);
|
|
11
|
+
//# sourceMappingURL=environment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/environment.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAiB,MAAM,mBAAmB,CAAC;AAOrE,MAAM,aAAa,GACjB,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC;IACnE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;IAC3C,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;AAEpB,MAAM,CAAC,MAAM,qBAAqB,GAAwB;IACxD,MAAM,EAAE,IAAI;IACZ,aAAa;CACS,CAAC;AAEzB,MAAM,CAAC,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,UAAU,CAC9D,qBAAqB,CACtB,CAAC"}
|
package/lib/esm/index.d.ts
CHANGED
package/lib/esm/index.js
CHANGED
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAA6B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAA6B;AAC7B,iCAA8B;AAC9B;;;;;;;;;;;;;GAaG"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Logging } from "@decaf-ts/logging";
|
|
2
|
+
export function getCmdLogger(cmd) {
|
|
3
|
+
const inheritance = [cmd];
|
|
4
|
+
let parent = cmd.parent;
|
|
5
|
+
while (parent) {
|
|
6
|
+
inheritance.push(parent);
|
|
7
|
+
parent = parent.parent;
|
|
8
|
+
}
|
|
9
|
+
if (!parent)
|
|
10
|
+
throw new Error("Outshot the root parent. should not be possible");
|
|
11
|
+
const log = inheritance.reverse().reduce((accum, el) => {
|
|
12
|
+
return accum.for(el.name);
|
|
13
|
+
}, Logging.get());
|
|
14
|
+
return log;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=logging.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../../src/logging.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAU,MAAM,mBAAmB,CAAC;AAEpD,MAAM,UAAU,YAAY,CAAC,GAAY;IACvC,MAAM,WAAW,GAAU,CAAC,GAAG,CAAC,CAAC;IACjC,IAAI,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;IACxB,OAAO,MAAM,EAAE,CAAC;QACd,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACzB,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IACzB,CAAC;IACD,IAAI,CAAC,MAAM;QACT,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,MAAM,GAAG,GAAG,WAAW,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,KAAa,EAAE,EAAE,EAAE,EAAE;QAC7D,OAAO,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAClB,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Logger } from "@decaf-ts/logging";
|
|
2
|
+
/**
|
|
3
|
+
* @description Reads and parses slogans from workdocs/assets/slogans.json.
|
|
4
|
+
* @summary Attempts to read a slogans.json file from the workdocs/assets directory at the given base path and returns its parsed contents as an array.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} basePath - The base directory path where workdocs/assets/slogans.json should exist.
|
|
7
|
+
* @return {any[] | undefined} The parsed array from slogans.json, or undefined if the file doesn't exist.
|
|
8
|
+
*
|
|
9
|
+
* @function readSlogans
|
|
10
|
+
*
|
|
11
|
+
* @memberOf module:utils
|
|
12
|
+
*/
|
|
13
|
+
export declare function readSlogans(log: Logger, basePath: string): {
|
|
14
|
+
Slogan: string;
|
|
15
|
+
}[] | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* @description Collects slogans from a base path and all @decaf scoped packages.
|
|
18
|
+
* @summary Recursively collects slogans.json files from the given base path and all subdirectories under node_modules/@decaf/*. Results are stored in an object keyed by the package name (from package.json).
|
|
19
|
+
*
|
|
20
|
+
* @param {string} basePath - The base directory path to start collecting from.
|
|
21
|
+
* @return {Record<string, any[]>} An object mapping package names to their slogans arrays.
|
|
22
|
+
*
|
|
23
|
+
* @function collectSlogans
|
|
24
|
+
*
|
|
25
|
+
* @memberOf module:utils
|
|
26
|
+
*/
|
|
27
|
+
export declare function collectSlogans(log: Logger, basePath: string): Record<string, any[]>;
|
|
28
|
+
/**
|
|
29
|
+
* @description Flattens collected slogans with weighted selection for a priority package.
|
|
30
|
+
* @summary Given a collection of slogans and a priority package name, returns a flat array where slogans from the priority package have a 30-40% chance of appearing at any given position.
|
|
31
|
+
*
|
|
32
|
+
* @param {Record<string, any[]>} slogansMap - Object mapping package names to slogan arrays.
|
|
33
|
+
* @param {string} priorityPackage - The package name whose slogans should be prioritized.
|
|
34
|
+
* @return {any[]} A flat array of all slogans with weighted distribution.
|
|
35
|
+
*
|
|
36
|
+
* @function flattenSlogansWithPriority
|
|
37
|
+
*
|
|
38
|
+
* @memberOf module:utils
|
|
39
|
+
*/
|
|
40
|
+
export declare function flattenSlogansWithPriority(log: Logger, slogansMap: Record<string, any[]>, priorityPackage: string): any[];
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import { getPackage } from "@decaf-ts/utils";
|
|
4
|
+
/**
|
|
5
|
+
* @description Reads and parses slogans from workdocs/assets/slogans.json.
|
|
6
|
+
* @summary Attempts to read a slogans.json file from the workdocs/assets directory at the given base path and returns its parsed contents as an array.
|
|
7
|
+
*
|
|
8
|
+
* @param {string} basePath - The base directory path where workdocs/assets/slogans.json should exist.
|
|
9
|
+
* @return {any[] | undefined} The parsed array from slogans.json, or undefined if the file doesn't exist.
|
|
10
|
+
*
|
|
11
|
+
* @function readSlogans
|
|
12
|
+
*
|
|
13
|
+
* @memberOf module:utils
|
|
14
|
+
*/
|
|
15
|
+
export function readSlogans(log, basePath) {
|
|
16
|
+
log = log.for(readSlogans);
|
|
17
|
+
const slogansPath = path.join(basePath, "workdocs", "assets", "slogans.json");
|
|
18
|
+
try {
|
|
19
|
+
if (!fs.existsSync(slogansPath)) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
const content = fs.readFileSync(slogansPath);
|
|
23
|
+
return JSON.parse(content.toString());
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
log.error(`Failed to read slogans from ${slogansPath}`, error);
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @description Collects slogans from a base path and all @decaf scoped packages.
|
|
32
|
+
* @summary Recursively collects slogans.json files from the given base path and all subdirectories under node_modules/@decaf/*. Results are stored in an object keyed by the package name (from package.json).
|
|
33
|
+
*
|
|
34
|
+
* @param {string} basePath - The base directory path to start collecting from.
|
|
35
|
+
* @return {Record<string, any[]>} An object mapping package names to their slogans arrays.
|
|
36
|
+
*
|
|
37
|
+
* @function collectSlogans
|
|
38
|
+
*
|
|
39
|
+
* @memberOf module:utils
|
|
40
|
+
*/
|
|
41
|
+
export function collectSlogans(log, basePath) {
|
|
42
|
+
log = log.for(collectSlogans);
|
|
43
|
+
const result = {};
|
|
44
|
+
// Read slogans for the base path
|
|
45
|
+
const baseSlogans = readSlogans(log, basePath);
|
|
46
|
+
if (baseSlogans) {
|
|
47
|
+
try {
|
|
48
|
+
const pkgName = getPackage(basePath, "name");
|
|
49
|
+
result[pkgName] = baseSlogans;
|
|
50
|
+
log.verbose(`Collected ${baseSlogans.length} slogans from ${pkgName}`);
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
log.verbose(`Failed to get package name for base path: ${error}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// Check for @decaf/* packages in node_modules
|
|
57
|
+
const decafModulesPath = path.join(basePath, "node_modules", "@decaf-ts");
|
|
58
|
+
if (fs.existsSync(decafModulesPath)) {
|
|
59
|
+
try {
|
|
60
|
+
const decafPackages = fs.readdirSync(decafModulesPath, {
|
|
61
|
+
withFileTypes: true,
|
|
62
|
+
});
|
|
63
|
+
for (const pkg of decafPackages) {
|
|
64
|
+
if (!pkg.isDirectory())
|
|
65
|
+
continue;
|
|
66
|
+
const pkgPath = path.join(decafModulesPath, pkg.name);
|
|
67
|
+
const pkgSlogans = readSlogans(log, pkgPath);
|
|
68
|
+
if (pkgSlogans) {
|
|
69
|
+
try {
|
|
70
|
+
const pkgName = getPackage(pkgPath, "name");
|
|
71
|
+
result[pkgName] = pkgSlogans;
|
|
72
|
+
log.verbose(`Collected ${pkgSlogans.length} slogans from ${pkgName}`);
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
log.verbose(`Failed to get package name for ${pkgPath}: ${error}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
log.verbose(`Error reading @decaf-ts modules: ${error}`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* @description Flattens collected slogans with weighted selection for a priority package.
|
|
88
|
+
* @summary Given a collection of slogans and a priority package name, returns a flat array where slogans from the priority package have a 30-40% chance of appearing at any given position.
|
|
89
|
+
*
|
|
90
|
+
* @param {Record<string, any[]>} slogansMap - Object mapping package names to slogan arrays.
|
|
91
|
+
* @param {string} priorityPackage - The package name whose slogans should be prioritized.
|
|
92
|
+
* @return {any[]} A flat array of all slogans with weighted distribution.
|
|
93
|
+
*
|
|
94
|
+
* @function flattenSlogansWithPriority
|
|
95
|
+
*
|
|
96
|
+
* @memberOf module:utils
|
|
97
|
+
*/
|
|
98
|
+
export function flattenSlogansWithPriority(log, slogansMap, priorityPackage) {
|
|
99
|
+
log = log.for(flattenSlogansWithPriority);
|
|
100
|
+
const result = [];
|
|
101
|
+
const prioritySlogans = slogansMap[priorityPackage] || [];
|
|
102
|
+
const otherSlogans = [];
|
|
103
|
+
// Collect all non-priority slogans
|
|
104
|
+
for (const [pkgName, slogans] of Object.entries(slogansMap)) {
|
|
105
|
+
if (pkgName === priorityPackage)
|
|
106
|
+
continue;
|
|
107
|
+
otherSlogans.push(...slogans);
|
|
108
|
+
}
|
|
109
|
+
if (prioritySlogans.length === 0 && otherSlogans.length === 0) {
|
|
110
|
+
log.error("No slogans found to flatten");
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
113
|
+
if (prioritySlogans.length === 0) {
|
|
114
|
+
log.verbose(`package "${priorityPackage}" has no slogans, returning all other slogans`);
|
|
115
|
+
return otherSlogans;
|
|
116
|
+
}
|
|
117
|
+
if (otherSlogans.length === 0) {
|
|
118
|
+
log.debug("Only priority slogans available, returning them");
|
|
119
|
+
return prioritySlogans;
|
|
120
|
+
}
|
|
121
|
+
// Interleave with 30-40% chance for priority slogans
|
|
122
|
+
let priorityIndex = 0;
|
|
123
|
+
let otherIndex = 0;
|
|
124
|
+
const priorityWeight = 0.35; // 35% average chance
|
|
125
|
+
while (priorityIndex < prioritySlogans.length ||
|
|
126
|
+
otherIndex < otherSlogans.length) {
|
|
127
|
+
const usePriority = Math.random() < priorityWeight;
|
|
128
|
+
if (usePriority && priorityIndex < prioritySlogans.length) {
|
|
129
|
+
result.push(prioritySlogans[priorityIndex++]);
|
|
130
|
+
}
|
|
131
|
+
else if (otherIndex < otherSlogans.length) {
|
|
132
|
+
result.push(otherSlogans[otherIndex++]);
|
|
133
|
+
}
|
|
134
|
+
else if (priorityIndex < prioritySlogans.length) {
|
|
135
|
+
// Only priority slogans left
|
|
136
|
+
result.push(prioritySlogans[priorityIndex++]);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
log.debug(`Flattened ${result.length} slogans with priority for "${priorityPackage}"`);
|
|
140
|
+
return result;
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=slogans.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slogans.js","sourceRoot":"","sources":["../../src/slogans.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,WAAW,CACzB,GAAW,EACX,QAAgB;IAEhB,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC3B,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;IAE9E,IAAI,CAAC;Q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,UAAU,EAAE,CAAC,CAAC,CAAC;QAC1C,CAAC;aAAM,IAAI,aAAa,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC;YAClD,6BAA6B;YAC7B,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED,GAAG,CAAC,KAAK,CACP,aAAa,MAAM,CAAC,MAAM,+BAA+B,eAAe,GAAG,CAC5E,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { getCmdLogger } from "./../logging.js";
|
|
5
|
+
import { Metadata } from "@decaf-ts/decoration";
|
|
6
|
+
import { CliWrapper } from "./../CliWrapper.js";
|
|
7
|
+
import { toENVFormat } from "@decaf-ts/logging";
|
|
8
|
+
const libraries = new Command()
|
|
9
|
+
.name("libraries")
|
|
10
|
+
.description("outputs the installed decaf-ts libraries and their versions")
|
|
11
|
+
.option("--format [String]", "additional output formats (json, raw)")
|
|
12
|
+
.action(async (options) => {
|
|
13
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(process.cwd(), "package.json"), "utf-8"));
|
|
14
|
+
const version = pkg.version;
|
|
15
|
+
const log = getCmdLogger(libraries);
|
|
16
|
+
log.debug(`running with options: ${JSON.stringify(options)} for ${pkg.name} version ${version}`);
|
|
17
|
+
const { format } = options;
|
|
18
|
+
const libs = Metadata.libraries();
|
|
19
|
+
switch (format) {
|
|
20
|
+
case "json":
|
|
21
|
+
console.log(JSON.stringify(libs, null, 2));
|
|
22
|
+
break;
|
|
23
|
+
case "raw":
|
|
24
|
+
Object.entries(libs).forEach(([key, value]) => console.log(`${key}: ${value}`));
|
|
25
|
+
break;
|
|
26
|
+
default:
|
|
27
|
+
Object.entries(libs).forEach(([key, value]) => log.info(`${key}: ${value}`));
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
const environmentExport = new Command()
|
|
31
|
+
.name("environment-export")
|
|
32
|
+
.description("outputs currently enforced environment")
|
|
33
|
+
.option("--format [String]", "additional output formats (json, raw)")
|
|
34
|
+
.action(async (options) => {
|
|
35
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(process.cwd(), "package.json"), "utf-8"));
|
|
36
|
+
const version = pkg.version;
|
|
37
|
+
const log = getCmdLogger(environmentExport);
|
|
38
|
+
log.debug(`running with options: ${JSON.stringify(options)} for ${pkg.name} version ${version}`);
|
|
39
|
+
const { format } = options;
|
|
40
|
+
const env = CliWrapper.getEnv();
|
|
41
|
+
const flatten = (accum, obj, prefix = "") => {
|
|
42
|
+
Object.entries(obj).forEach(([key, value]) => {
|
|
43
|
+
const envKey = toENVFormat(key);
|
|
44
|
+
const fullKey = prefix ? `${prefix}__${envKey}` : envKey;
|
|
45
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
46
|
+
flatten(accum, value, fullKey);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
accum.push(`${fullKey}=${value}`);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
switch (format) {
|
|
54
|
+
case "json":
|
|
55
|
+
console.log(JSON.stringify(env, null, 2));
|
|
56
|
+
break;
|
|
57
|
+
case "raw": {
|
|
58
|
+
const str = [];
|
|
59
|
+
flatten(str, env);
|
|
60
|
+
console.log(str.join("\n"));
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
default: {
|
|
64
|
+
const str = [];
|
|
65
|
+
flatten(str, env);
|
|
66
|
+
str.forEach((s) => log.info(s));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
export default function utils() {
|
|
71
|
+
const utilsCmd = new Command()
|
|
72
|
+
.command("utils")
|
|
73
|
+
.description("utilitarian cli commands for the decaf-ts framework");
|
|
74
|
+
utilsCmd.addCommand(libraries);
|
|
75
|
+
return utilsCmd;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=cli-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-module.js","sourceRoot":"","sources":["../../../src/utils-module/cli-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,wBAAmB;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,2BAAsB;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,SAAS,GAAG,IAAI,OAAO,EAAE;KAC5B,IAAI,CAAC,WAAW,CAAC;KACjB,WAAW,CAAC,6DAA6D,CAAC;KAC1E,MAAM,CAAC,mBAAmB,EAAE,uCAAuC,CAAC;KACpE,MAAM,CAAC,KAAK,EAAE,OAAY,EAAE,EAAE;IAC7B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CACpB,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,CACnE,CAAC;IAEF,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;IAC5B,MAAM,GAAG,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IACpC,GAAG,CAAC,KAAK,CACP,yBAAyB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,GAAG,CAAC,IAAI,YAAY,OAAO,EAAE,CACtF,CAAC;IACF,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC3B,MAAM,IAAI,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;IAClC,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,MAAM;YACT,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C;IAED;;;;;;;OAOG;IACK,MAAM,CAAC,UAAU,CAAC,QAAgB;QACxC,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CACf,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAC7D,CAAC;QACJ,CAAC;QAAC,OAAO,CAAU,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,+BAA+B,QAAQ,KAAK,CAAC,EAAE,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,cAAc,CAAC,QAAgB;QACpC,OAAO,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAW,CAAC;IAC5D,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAC,QAAgB;QACjC,MAAM,IAAI,GAAI,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC1E,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC/B,CAAC;CACF"}
|
package/lib/esm/version.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @const VERSION
|
|
5
5
|
* @memberOf module:CLI
|
|
6
6
|
*/
|
|
7
|
-
export declare const VERSION = "0.4.
|
|
7
|
+
export declare const VERSION = "0.4.4";
|
|
8
8
|
/**
|
|
9
9
|
* @description Stores the current package version
|
|
10
10
|
* @summary A constant that holds the version string of the package, which is replaced during build
|
package/lib/esm/version.js
CHANGED
|
@@ -5,7 +5,7 @@ import { Metadata } from "@decaf-ts/decoration";
|
|
|
5
5
|
* @const VERSION
|
|
6
6
|
* @memberOf module:CLI
|
|
7
7
|
*/
|
|
8
|
-
export const VERSION = "0.4.
|
|
8
|
+
export const VERSION = "0.4.4";
|
|
9
9
|
/**
|
|
10
10
|
* @description Stores the current package version
|
|
11
11
|
* @summary A constant that holds the version string of the package, which is replaced during build
|
package/lib/index.cjs
CHANGED
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./CliWrapper.cjs"), exports);
|
|
18
|
+
__exportStar(require("./environment.cjs"), exports);
|
|
18
19
|
/**
|
|
19
20
|
* @description Decaf-ts' CLI module
|
|
20
21
|
* @summary This file will crawl the current working directory for files called {@link CLI_FILE_NAME}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAA6B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAA6B;AAC7B,oDAA8B;AAC9B;;;;;;;;;;;;;GAaG"}
|
package/lib/logging.cjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCmdLogger = getCmdLogger;
|
|
4
|
+
const logging_1 = require("@decaf-ts/logging");
|
|
5
|
+
function getCmdLogger(cmd) {
|
|
6
|
+
const inheritance = [cmd];
|
|
7
|
+
let parent = cmd.parent;
|
|
8
|
+
while (parent) {
|
|
9
|
+
inheritance.push(parent);
|
|
10
|
+
parent = parent.parent;
|
|
11
|
+
}
|
|
12
|
+
if (!parent)
|
|
13
|
+
throw new Error("Outshot the root parent. should not be possible");
|
|
14
|
+
const log = inheritance.reverse().reduce((accum, el) => {
|
|
15
|
+
return accum.for(el.name);
|
|
16
|
+
}, logging_1.Logging.get());
|
|
17
|
+
return log;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=logging.js.map
|
package/lib/logging.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../src/logging.ts"],"names":[],"mappings":";;AAGA,oCAaC;AAfD,+CAAoD;AAEpD,SAAgB,YAAY,CAAC,GAAY;IACvC,MAAM,WAAW,GAAU,CAAC,GAAG,CAAC,CAAC;IACjC,IAAI,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;IACxB,OAAO,MAAM,EAAE,CAAC;QACd,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACzB,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IACzB,CAAC;IACD,IAAI,CAAC,MAAM;QACT,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,MAAM,GAAG,GAAG,WAAW,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,KAAa,EAAE,EAAE,EAAE,EAAE;QAC7D,OAAO,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,EAAE,iBAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAClB,OAAO,GAAG,CAAC;AACb,CAAC"}
|