@appium/docutils 0.1.6 → 0.2.1
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 +2 -5
- package/build/lib/build/mkdocs.d.ts +58 -0
- package/build/lib/build/mkdocs.d.ts.map +1 -0
- package/build/lib/build/mkdocs.js +80 -0
- package/build/lib/build/mkdocs.js.map +1 -0
- package/build/lib/build/typedoc.d.ts +55 -0
- package/build/lib/build/typedoc.d.ts.map +1 -0
- package/build/lib/build/typedoc.js +120 -0
- package/build/lib/build/typedoc.js.map +1 -0
- package/build/lib/build-api.d.ts +18 -0
- package/build/lib/build-api.d.ts.map +1 -0
- package/build/lib/build-api.js +75 -0
- package/build/lib/build-api.js.map +1 -0
- package/build/lib/build.d.ts +21 -0
- package/build/lib/build.d.ts.map +1 -0
- package/build/lib/build.js +71 -0
- package/build/lib/build.js.map +1 -0
- package/build/lib/builder/deploy.d.ts +89 -0
- package/build/lib/builder/deploy.d.ts.map +1 -0
- package/build/lib/builder/deploy.js +105 -0
- package/build/lib/builder/deploy.js.map +1 -0
- package/build/lib/builder/index.d.ts +5 -0
- package/build/lib/builder/index.d.ts.map +1 -0
- package/build/lib/builder/index.js +21 -0
- package/build/lib/builder/index.js.map +1 -0
- package/build/lib/builder/nav.d.ts +81 -0
- package/build/lib/builder/nav.d.ts.map +1 -0
- package/build/lib/builder/nav.js +280 -0
- package/build/lib/builder/nav.js.map +1 -0
- package/build/lib/builder/reference.d.ts +57 -0
- package/build/lib/builder/reference.d.ts.map +1 -0
- package/build/lib/builder/reference.js +129 -0
- package/build/lib/builder/reference.js.map +1 -0
- package/build/lib/builder/site.d.ts +55 -0
- package/build/lib/builder/site.d.ts.map +1 -0
- package/build/lib/builder/site.js +81 -0
- package/build/lib/builder/site.js.map +1 -0
- package/build/lib/cli/command/build.d.ts +178 -0
- package/build/lib/cli/command/build.d.ts.map +1 -0
- package/build/lib/cli/command/build.js +223 -0
- package/build/lib/cli/command/build.js.map +1 -0
- package/build/lib/cli/command/deploy.d.ts +1 -0
- package/build/lib/cli/command/deploy.d.ts.map +1 -0
- package/build/lib/cli/command/deploy.js +2 -0
- package/build/lib/cli/command/deploy.js.map +1 -0
- package/build/lib/cli/command/index.d.ts +4 -0
- package/build/lib/cli/command/index.d.ts.map +1 -0
- package/build/lib/cli/command/index.js +13 -0
- package/build/lib/cli/command/index.js.map +1 -0
- package/build/lib/cli/command/init.d.ts +143 -0
- package/build/lib/cli/command/init.d.ts.map +1 -0
- package/build/lib/cli/command/init.js +164 -0
- package/build/lib/cli/command/init.js.map +1 -0
- package/build/lib/cli/command/validate.d.ts +76 -0
- package/build/lib/cli/command/validate.d.ts.map +1 -0
- package/build/lib/cli/command/validate.js +115 -0
- package/build/lib/cli/command/validate.js.map +1 -0
- package/build/lib/cli/command-init.d.ts +143 -0
- package/build/lib/cli/command-init.d.ts.map +1 -0
- package/build/lib/cli/command-init.js +164 -0
- package/build/lib/cli/command-init.js.map +1 -0
- package/build/lib/cli/command-validate.d.ts +52 -0
- package/build/lib/cli/command-validate.d.ts.map +1 -0
- package/build/lib/cli/command-validate.js +66 -0
- package/build/lib/cli/command-validate.js.map +1 -0
- package/build/lib/cli/config.d.ts +28 -0
- package/build/lib/cli/config.d.ts.map +1 -0
- package/build/lib/cli/config.js +114 -0
- package/build/lib/cli/config.js.map +1 -0
- package/build/lib/cli/index.d.ts +13 -0
- package/build/lib/cli/index.d.ts.map +1 -0
- package/build/lib/cli/index.js +91 -0
- package/build/lib/cli/index.js.map +1 -0
- package/build/lib/cli/init.d.ts +143 -0
- package/build/lib/cli/init.d.ts.map +1 -0
- package/build/lib/cli/init.js +164 -0
- package/build/lib/cli/init.js.map +1 -0
- package/build/lib/cli/options.d.ts +1 -0
- package/build/lib/cli/options.d.ts.map +1 -0
- package/build/lib/cli/options.js +2 -0
- package/build/lib/cli/options.js.map +1 -0
- package/build/lib/cli/validate.d.ts +1 -0
- package/build/lib/cli/validate.d.ts.map +1 -0
- package/build/lib/cli/validate.js +2 -0
- package/build/lib/cli/validate.js.map +1 -0
- package/build/lib/cli.d.ts +10 -0
- package/build/lib/cli.d.ts.map +1 -0
- package/build/lib/cli.js +328 -0
- package/build/lib/cli.js.map +1 -0
- package/build/lib/constants.d.ts +125 -0
- package/build/lib/constants.d.ts.map +1 -0
- package/build/lib/constants.js +133 -0
- package/build/lib/constants.js.map +1 -0
- package/build/lib/error.d.ts +3 -0
- package/build/lib/error.d.ts.map +1 -0
- package/build/lib/error.js +7 -0
- package/build/lib/error.js.map +1 -0
- package/build/lib/fs.d.ts +142 -0
- package/build/lib/fs.d.ts.map +1 -0
- package/build/lib/fs.js +237 -0
- package/build/lib/fs.js.map +1 -0
- package/build/lib/index.d.ts +5 -2
- package/build/lib/index.d.ts.map +1 -1
- package/build/lib/index.js +4 -1
- package/build/lib/index.js.map +1 -1
- package/build/lib/init-task.d.ts +49 -0
- package/build/lib/init-task.d.ts.map +1 -0
- package/build/lib/init-task.js +95 -0
- package/build/lib/init-task.js.map +1 -0
- package/build/lib/init.d.ts +202 -0
- package/build/lib/init.d.ts.map +1 -0
- package/build/lib/init.js +225 -0
- package/build/lib/init.js.map +1 -0
- package/build/lib/io.d.ts +1 -0
- package/build/lib/io.d.ts.map +1 -0
- package/build/lib/io.js +2 -0
- package/build/lib/io.js.map +1 -0
- package/build/lib/logger.d.ts +17 -2
- package/build/lib/logger.d.ts.map +1 -1
- package/build/lib/logger.js +187 -2
- package/build/lib/logger.js.map +1 -1
- package/build/lib/mike.d.ts +3 -0
- package/build/lib/mike.d.ts.map +1 -1
- package/build/lib/mike.js +4 -0
- package/build/lib/mike.js.map +1 -1
- package/build/lib/mkdocs.d.ts +51 -12
- package/build/lib/mkdocs.d.ts.map +1 -1
- package/build/lib/mkdocs.js +64 -32
- package/build/lib/mkdocs.js.map +1 -1
- package/build/lib/model.d.ts +80 -0
- package/build/lib/model.d.ts.map +1 -0
- package/build/lib/model.js +8 -0
- package/build/lib/model.js.map +1 -0
- package/build/lib/nav.d.ts +47 -0
- package/build/lib/nav.d.ts.map +1 -0
- package/build/lib/nav.js +132 -0
- package/build/lib/nav.js.map +1 -0
- package/build/lib/scaffold.d.ts +95 -0
- package/build/lib/scaffold.d.ts.map +1 -0
- package/build/lib/scaffold.js +103 -0
- package/build/lib/scaffold.js.map +1 -0
- package/build/lib/test.d.ts +9 -0
- package/build/lib/test.d.ts.map +1 -0
- package/build/lib/test.js +2 -0
- package/build/lib/test.js.map +1 -0
- package/build/lib/typedoc.d.ts +55 -0
- package/build/lib/typedoc.d.ts.map +1 -0
- package/build/lib/typedoc.js +122 -0
- package/build/lib/typedoc.js.map +1 -0
- package/build/lib/types.d.ts +52 -0
- package/build/lib/types.d.ts.map +1 -0
- package/build/lib/types.js +7 -0
- package/build/lib/types.js.map +1 -0
- package/build/lib/util.d.ts +42 -0
- package/build/lib/util.d.ts.map +1 -0
- package/build/lib/util.js +56 -0
- package/build/lib/util.js.map +1 -0
- package/build/lib/validate.d.ts +218 -0
- package/build/lib/validate.d.ts.map +1 -0
- package/build/lib/validate.js +501 -0
- package/build/lib/validate.js.map +1 -0
- package/build/lib/validation/base-validator.d.ts +218 -0
- package/build/lib/validation/base-validator.d.ts.map +1 -0
- package/build/lib/validation/base-validator.js +453 -0
- package/build/lib/validation/base-validator.js.map +1 -0
- package/build/lib/validation/mkdocs-validator.d.ts +5 -0
- package/build/lib/validation/mkdocs-validator.d.ts.map +1 -0
- package/build/lib/validation/mkdocs-validator.js +54 -0
- package/build/lib/validation/mkdocs-validator.js.map +1 -0
- package/build/lib/validation/python-validator.d.ts +1 -0
- package/build/lib/validation/python-validator.d.ts.map +1 -0
- package/build/lib/validation/python-validator.js +2 -0
- package/build/lib/validation/python-validator.js.map +1 -0
- package/build/lib/validation/python.d.ts +1 -0
- package/build/lib/validation/python.d.ts.map +1 -0
- package/build/lib/validation/python.js +2 -0
- package/build/lib/validation/python.js.map +1 -0
- package/build/lib/validation/validate.d.ts +221 -0
- package/build/lib/validation/validate.d.ts.map +1 -0
- package/build/lib/validation/validate.js +508 -0
- package/build/lib/validation/validate.js.map +1 -0
- package/build/lib/validation/validator.d.ts +220 -0
- package/build/lib/validation/validator.d.ts.map +1 -0
- package/build/lib/validation/validator.js +470 -0
- package/build/lib/validation/validator.js.map +1 -0
- package/lib/builder/deploy.ts +223 -0
- package/lib/builder/index.ts +4 -0
- package/lib/builder/nav.ts +399 -0
- package/lib/builder/reference.ts +191 -0
- package/lib/builder/site.ts +143 -0
- package/lib/cli/command/build.ts +229 -0
- package/lib/cli/command/index.ts +3 -0
- package/lib/cli/command/init.ts +166 -0
- package/lib/cli/command/validate.ts +122 -0
- package/lib/cli/config.ts +89 -0
- package/lib/cli/index.ts +88 -0
- package/lib/constants.ts +150 -0
- package/lib/error.ts +1 -0
- package/lib/fs.ts +274 -0
- package/lib/index.ts +5 -0
- package/lib/init.ts +319 -0
- package/lib/logger.ts +198 -0
- package/lib/mike.js +4 -0
- package/lib/model.ts +92 -0
- package/lib/scaffold.ts +225 -0
- package/lib/util.ts +76 -0
- package/lib/validate.ts +728 -0
- package/package.json +38 -6
- package/requirements.txt +4 -0
- package/tsconfig.json +2 -1
- package/build/tsconfig.tsbuildinfo +0 -1
- package/lib/index.js +0 -2
- package/lib/logger.js +0 -3
- package/lib/mkdocs.js +0 -43
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scaffolding functions for CLI `init` command
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { Simplify } from 'type-fest';
|
|
7
|
+
import { ScaffoldTaskOptions } from './scaffold';
|
|
8
|
+
/**
|
|
9
|
+
* Function which scaffolds a `tsconfig.json` file
|
|
10
|
+
*/
|
|
11
|
+
export declare const initTsConfigJson: import("./scaffold").ScaffoldTask<InitTsConfigOptions, import("type-fest/source/jsonify").JsonifyObject<Simplify<{} & {
|
|
12
|
+
$schema?: string | undefined;
|
|
13
|
+
compilerOptions?: import("type-fest").TsConfigJson.CompilerOptions | undefined;
|
|
14
|
+
watchOptions?: import("type-fest").TsConfigJson.WatchOptions | undefined;
|
|
15
|
+
typeAcquisition?: import("type-fest").TsConfigJson.TypeAcquisition | undefined;
|
|
16
|
+
compileOnSave?: boolean | undefined;
|
|
17
|
+
extends?: string | undefined;
|
|
18
|
+
files?: string[] | undefined;
|
|
19
|
+
exclude?: string[] | undefined;
|
|
20
|
+
include?: string[] | undefined;
|
|
21
|
+
references?: import("type-fest").TsConfigJson.References[] | undefined;
|
|
22
|
+
}>>>;
|
|
23
|
+
/**
|
|
24
|
+
* Function which scaffolds a `typedoc.json` file
|
|
25
|
+
*/
|
|
26
|
+
export declare const initTypeDocJson: import("./scaffold").ScaffoldTask<InitTypeDocOptions, import("type-fest/source/jsonify").JsonifyObject<Simplify<{} & {
|
|
27
|
+
$schema?: string | undefined;
|
|
28
|
+
includes?: string | undefined;
|
|
29
|
+
extends?: string | undefined;
|
|
30
|
+
exclude?: string[] | undefined;
|
|
31
|
+
options?: string | undefined;
|
|
32
|
+
tsconfig?: string | undefined;
|
|
33
|
+
entryPoints?: string[] | undefined;
|
|
34
|
+
entryPointStrategy?: "Resolve" | "resolve" | "Expand" | "Packages" | "expand" | "packages" | undefined;
|
|
35
|
+
externalPattern?: string[] | undefined;
|
|
36
|
+
excludeExternals?: boolean | undefined;
|
|
37
|
+
excludeNotDocumented?: boolean | undefined;
|
|
38
|
+
excludeInternal?: boolean | undefined;
|
|
39
|
+
excludePrivate?: boolean | undefined;
|
|
40
|
+
excludeProtected?: boolean | undefined;
|
|
41
|
+
externalSymbolLinkMappings?: Record<string, Record<string, string>> | undefined;
|
|
42
|
+
media?: string | undefined;
|
|
43
|
+
out?: string | undefined;
|
|
44
|
+
json?: string | undefined;
|
|
45
|
+
pretty?: boolean | undefined;
|
|
46
|
+
emit?: "docs" | "both" | "none" | undefined;
|
|
47
|
+
theme?: string | undefined;
|
|
48
|
+
lightHighlightTheme?: import("shiki").Theme | undefined;
|
|
49
|
+
darkHighlightTheme?: import("shiki").Theme | undefined;
|
|
50
|
+
customCss?: string | undefined;
|
|
51
|
+
name?: string | undefined;
|
|
52
|
+
includeVersion?: boolean | undefined;
|
|
53
|
+
disableSources?: boolean | undefined;
|
|
54
|
+
basePath?: string | undefined;
|
|
55
|
+
excludeTags?: `@${string}`[] | undefined;
|
|
56
|
+
readme?: string | undefined;
|
|
57
|
+
cname?: string | undefined;
|
|
58
|
+
sourceLinkTemplate?: string | undefined;
|
|
59
|
+
gitRevision?: string | undefined;
|
|
60
|
+
gitRemote?: string | undefined;
|
|
61
|
+
htmlLang?: string | undefined;
|
|
62
|
+
githubPages?: boolean | undefined;
|
|
63
|
+
gaID?: string | undefined;
|
|
64
|
+
hideGenerator?: boolean | undefined;
|
|
65
|
+
searchInComments?: boolean | undefined;
|
|
66
|
+
cleanOutputDir?: boolean | undefined;
|
|
67
|
+
titleLink?: string | undefined;
|
|
68
|
+
navigationLinks?: Record<string, string> | undefined;
|
|
69
|
+
sidebarLinks?: Record<string, string> | undefined;
|
|
70
|
+
commentStyle?: "JSDoc" | "jsdoc" | "Block" | "Line" | "All" | "block" | "line" | "all" | undefined;
|
|
71
|
+
blockTags?: `@${string}`[] | undefined;
|
|
72
|
+
inlineTags?: `@${string}`[] | undefined;
|
|
73
|
+
modifierTags?: `@${string}`[] | undefined;
|
|
74
|
+
categorizeByGroup?: boolean | undefined;
|
|
75
|
+
defaultCategory?: string | undefined;
|
|
76
|
+
categoryOrder?: string[] | undefined;
|
|
77
|
+
sort?: ("source-order" | "alphabetical" | "enum-value-ascending" | "enum-value-descending" | "static-first" | "instance-first" | "visibility" | "required-first" | "kind")[] | undefined;
|
|
78
|
+
kindSortOrder?: ("Reference" | "All" | "Project" | "Module" | "Namespace" | "Enum" | "EnumMember" | "Variable" | "Function" | "Class" | "Interface" | "Constructor" | "Property" | "Method" | "CallSignature" | "IndexSignature" | "ConstructorSignature" | "Parameter" | "TypeLiteral" | "TypeParameter" | "Accessor" | "GetSignature" | "SetSignature" | "ObjectLiteral" | "TypeAlias" | "ClassOrInterface" | "VariableOrProperty" | "FunctionOrMethod" | "ClassMember" | "SomeSignature" | "SomeModule" | "SomeType" | "SomeValue" | "SomeMember" | "SomeExport" | "ExportContainer" | "Inheritable" | "ContainsCallSignatures" | "SignatureContainer")[] | undefined;
|
|
79
|
+
visibilityFilters?: {
|
|
80
|
+
[tag: `@${string}`]: boolean;
|
|
81
|
+
protected?: boolean | undefined;
|
|
82
|
+
private?: boolean | undefined;
|
|
83
|
+
inherited?: boolean | undefined;
|
|
84
|
+
external?: boolean | undefined;
|
|
85
|
+
} | undefined;
|
|
86
|
+
searchCategoryBoosts?: Record<string, number> | undefined;
|
|
87
|
+
searchGroupBoosts?: Record<string, number> | undefined;
|
|
88
|
+
watch?: boolean | undefined;
|
|
89
|
+
preserveWatchOutput?: boolean | undefined;
|
|
90
|
+
skipErrorChecking?: boolean | undefined;
|
|
91
|
+
help?: boolean | undefined;
|
|
92
|
+
version?: boolean | undefined;
|
|
93
|
+
showConfig?: boolean | undefined;
|
|
94
|
+
plugin?: string[] | undefined;
|
|
95
|
+
logLevel?: import("typedoc").LogLevel | "Verbose" | "Info" | "Warn" | "Error" | undefined;
|
|
96
|
+
treatWarningsAsErrors?: boolean | undefined;
|
|
97
|
+
intentionallyNotExported?: string[] | undefined;
|
|
98
|
+
validation?: boolean | Partial<import("typedoc").ValidationOptions> | undefined;
|
|
99
|
+
requiredToBeDocumented?: ("Reference" | "All" | "Project" | "Module" | "Namespace" | "Enum" | "EnumMember" | "Variable" | "Function" | "Class" | "Interface" | "Constructor" | "Property" | "Method" | "CallSignature" | "IndexSignature" | "ConstructorSignature" | "Parameter" | "TypeLiteral" | "TypeParameter" | "Accessor" | "GetSignature" | "SetSignature" | "ObjectLiteral" | "TypeAlias" | "ClassOrInterface" | "VariableOrProperty" | "FunctionOrMethod" | "ClassMember" | "SomeSignature" | "SomeModule" | "SomeType" | "SomeValue" | "SomeMember" | "SomeExport" | "ExportContainer" | "Inheritable" | "ContainsCallSignatures" | "SignatureContainer")[] | undefined;
|
|
100
|
+
}>>>;
|
|
101
|
+
/**
|
|
102
|
+
* Function which scaffolds an `mkdocs.yml` file
|
|
103
|
+
*/
|
|
104
|
+
export declare const initMkDocs: import("./scaffold").ScaffoldTask<InitMkDocsOptions, import("type-fest/source/jsonify").JsonifyObject<Simplify<{} & {
|
|
105
|
+
theme?: import("./model").MkDocsYmlTheme | undefined;
|
|
106
|
+
watch?: string[] | undefined;
|
|
107
|
+
copyright?: string | undefined;
|
|
108
|
+
dev_addr?: string | undefined;
|
|
109
|
+
docs_dir?: string | undefined;
|
|
110
|
+
extra_css?: string[] | undefined;
|
|
111
|
+
extra_javascript?: string[] | undefined;
|
|
112
|
+
extra_templates?: string[] | undefined;
|
|
113
|
+
extra?: Record<string, import("type-fest").JsonValue> | undefined;
|
|
114
|
+
hooks?: string[] | undefined;
|
|
115
|
+
INHERIT?: string | undefined;
|
|
116
|
+
markdown_extensions?: (string | Record<string, import("type-fest").JsonValue>)[] | undefined;
|
|
117
|
+
nav?: import("./model").MkDocsYmlNav | undefined;
|
|
118
|
+
plugins?: (string | Record<string, import("type-fest").JsonValue>)[] | undefined;
|
|
119
|
+
repo_name?: string | undefined;
|
|
120
|
+
repo_url?: string | undefined;
|
|
121
|
+
site_dir?: string | undefined;
|
|
122
|
+
site_name?: string | undefined;
|
|
123
|
+
site_description?: string | undefined;
|
|
124
|
+
strict?: boolean | undefined;
|
|
125
|
+
use_directory_urls?: boolean | undefined;
|
|
126
|
+
}>>>;
|
|
127
|
+
/**
|
|
128
|
+
* Installs Python dependencies
|
|
129
|
+
* @param opts Options
|
|
130
|
+
*/
|
|
131
|
+
export declare function initPython({ pythonPath, dryRun, }?: InitPythonOptions): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Options for {@linkcode initMkDocs}
|
|
134
|
+
*/
|
|
135
|
+
export interface InitMkDocsOptions extends ScaffoldTaskOptions {
|
|
136
|
+
copyright?: string;
|
|
137
|
+
repoName?: string;
|
|
138
|
+
repoUrl?: string;
|
|
139
|
+
siteDescription?: string;
|
|
140
|
+
siteName?: string;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Main handler for `init` command.
|
|
144
|
+
*
|
|
145
|
+
* This runs tasks in serial; it _could_ run in parallel, but it has deleterious effects upon
|
|
146
|
+
* console output which would need mitigation.
|
|
147
|
+
*/
|
|
148
|
+
export declare function init({ typescript, typedoc, python, tsconfigJson: tsconfigJsonPath, packageJson: packageJsonPath, overwrite, include, mkdocs, mkdocsYml: mkdocsYmlPath, siteName, repoName, repoUrl, copyright, dryRun, cwd, pythonPath, typedocJson: typeDocJsonPath, }?: InitOptions): Promise<void>;
|
|
149
|
+
export interface InitTypeDocOptions extends ScaffoldTaskOptions {
|
|
150
|
+
}
|
|
151
|
+
export interface InitTsConfigOptions extends ScaffoldTaskOptions {
|
|
152
|
+
/**
|
|
153
|
+
* List of source files (globs supported); typically `src` or `lib`
|
|
154
|
+
*/
|
|
155
|
+
include?: string[];
|
|
156
|
+
}
|
|
157
|
+
export interface InitPythonOptions extends ScaffoldTaskOptions {
|
|
158
|
+
/**
|
|
159
|
+
* Path to `python` (v3.x) executable
|
|
160
|
+
*/
|
|
161
|
+
pythonPath?: string;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Options for `init` command handler
|
|
165
|
+
*
|
|
166
|
+
* The props of the various "path" options are rewritten as `dest` for the scaffold tasks functions.
|
|
167
|
+
*/
|
|
168
|
+
export declare type InitOptions = Simplify<Omit<InitPythonOptions & InitTsConfigOptions & InitTypeDocOptions & InitMkDocsOptions, 'dest'> & {
|
|
169
|
+
/**
|
|
170
|
+
* If `true` will initialize a `tsconfig.json` file
|
|
171
|
+
*/
|
|
172
|
+
typescript?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* If `true` will initialize a `typedoc.json` file
|
|
175
|
+
*/
|
|
176
|
+
typedoc?: boolean;
|
|
177
|
+
/**
|
|
178
|
+
* If `true` will install Python deps
|
|
179
|
+
*/
|
|
180
|
+
python?: boolean;
|
|
181
|
+
/**
|
|
182
|
+
* If `true` will initialize a `mkdocs.yml` file
|
|
183
|
+
*/
|
|
184
|
+
mkdocs?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Path to new or existing `typedoc.json` file
|
|
187
|
+
*/
|
|
188
|
+
typedocJson?: string;
|
|
189
|
+
/**
|
|
190
|
+
* Path to new or existing `tsconfig.json` file
|
|
191
|
+
*/
|
|
192
|
+
tsconfigJson?: string;
|
|
193
|
+
/**
|
|
194
|
+
* Path to existing `package.json` file
|
|
195
|
+
*/
|
|
196
|
+
packageJson?: string;
|
|
197
|
+
/**
|
|
198
|
+
* Path to new or existing `mkdocs.yml` file
|
|
199
|
+
*/
|
|
200
|
+
mkdocsYml?: string;
|
|
201
|
+
}>;
|
|
202
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../lib/init.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AAEnC,OAAO,EAAqB,mBAAmB,EAAC,MAAM,YAAY,CAAC;AA0CnE;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;IAyB5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAI3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;IAiDtB,CAAC;AAEF;;;GAGG;AACH,wBAAsB,UAAU,CAAC,EAC/B,UAAwB,EACxB,MAAc,GACf,GAAE,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBxC;AAED;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,mBA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,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CACF,CAAC"}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Scaffolding functions for CLI `init` command
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
24
|
+
if (mod && mod.__esModule) return mod;
|
|
25
|
+
var result = {};
|
|
26
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
27
|
+
__setModuleDefault(result, mod);
|
|
28
|
+
return result;
|
|
29
|
+
};
|
|
30
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
31
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
|
+
};
|
|
33
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
+
exports.init = exports.initPython = exports.initMkDocs = exports.initTypeDocJson = exports.initTsConfigJson = void 0;
|
|
35
|
+
const JSON5 = __importStar(require("json5"));
|
|
36
|
+
const constants_1 = require("./constants");
|
|
37
|
+
const yaml_1 = __importDefault(require("yaml"));
|
|
38
|
+
const teen_process_1 = require("teen_process");
|
|
39
|
+
const error_1 = require("./error");
|
|
40
|
+
const scaffold_1 = require("./scaffold");
|
|
41
|
+
const logger_1 = __importDefault(require("./logger"));
|
|
42
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
43
|
+
const fs_1 = require("./fs");
|
|
44
|
+
/**
|
|
45
|
+
* Data for the base `mkdocs.yml` file
|
|
46
|
+
*/
|
|
47
|
+
const BASE_MKDOCS_YML = Object.freeze({
|
|
48
|
+
INHERIT: './node_modules/@appium/docutils/base-mkdocs.yml',
|
|
49
|
+
docs_dir: 'docs',
|
|
50
|
+
site_dir: 'site',
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* Data for the base `typedoc.json` file
|
|
54
|
+
*/
|
|
55
|
+
const BASE_TYPEDOC_JSON = Object.freeze({
|
|
56
|
+
$schema: 'https://typedoc.org/schema.json',
|
|
57
|
+
cleanOutputDir: true,
|
|
58
|
+
entryPointStrategy: 'packages',
|
|
59
|
+
theme: 'appium',
|
|
60
|
+
readme: 'none',
|
|
61
|
+
entryPoints: ['.'],
|
|
62
|
+
});
|
|
63
|
+
/**
|
|
64
|
+
* Data for the base `tsconfig.json` file
|
|
65
|
+
*/
|
|
66
|
+
const BASE_TSCONFIG_JSON = Object.freeze({
|
|
67
|
+
$schema: 'https://json.schemastore.org/tsconfig',
|
|
68
|
+
extends: '@appium/tsconfig/tsconfig.json',
|
|
69
|
+
compilerOptions: {
|
|
70
|
+
outDir: 'build',
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
const log = logger_1.default.withTag('init');
|
|
74
|
+
const dryRunLog = log.withTag('dry-run');
|
|
75
|
+
const DEFAULT_INCLUDE = ['lib', 'test', 'index.js'];
|
|
76
|
+
/**
|
|
77
|
+
* Function which scaffolds a `tsconfig.json` file
|
|
78
|
+
*/
|
|
79
|
+
exports.initTsConfigJson = (0, scaffold_1.createScaffoldTask)(constants_1.NAME_TSCONFIG_JSON, BASE_TSCONFIG_JSON, 'TypeScript configuration', {
|
|
80
|
+
/**
|
|
81
|
+
* Merges the contents of the `include` property with any passed on the CLI. If neither exists,
|
|
82
|
+
* uses the default set of includes.
|
|
83
|
+
* @param content Parsed and/or scaffolded `tsconfig.json`
|
|
84
|
+
* @param opts Options specific to this task
|
|
85
|
+
* @returns `tsconfig.json` content with potentially-modified `include` prop
|
|
86
|
+
*/
|
|
87
|
+
transform: (content, { include }) => {
|
|
88
|
+
include = [...(content.include ?? include ?? [])];
|
|
89
|
+
if (lodash_1.default.isEmpty(include)) {
|
|
90
|
+
include = [...DEFAULT_INCLUDE];
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
...content,
|
|
94
|
+
include: lodash_1.default.uniq(include),
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
deserialize: JSON5.parse,
|
|
98
|
+
serialize: fs_1.stringifyJson5,
|
|
99
|
+
});
|
|
100
|
+
/**
|
|
101
|
+
* Function which scaffolds a `typedoc.json` file
|
|
102
|
+
*/
|
|
103
|
+
exports.initTypeDocJson = (0, scaffold_1.createScaffoldTask)(constants_1.NAME_TYPEDOC_JSON, BASE_TYPEDOC_JSON, 'TypeDoc configuration');
|
|
104
|
+
/**
|
|
105
|
+
* Function which scaffolds an `mkdocs.yml` file
|
|
106
|
+
*/
|
|
107
|
+
exports.initMkDocs = (0, scaffold_1.createScaffoldTask)(constants_1.NAME_MKDOCS_YML, BASE_MKDOCS_YML, 'MkDocs configuration', {
|
|
108
|
+
deserialize: yaml_1.default.parse,
|
|
109
|
+
serialize: fs_1.stringifyYaml,
|
|
110
|
+
transform: (content, opts, pkg) => {
|
|
111
|
+
let siteName = opts.siteName ?? content.site_name;
|
|
112
|
+
if (!siteName) {
|
|
113
|
+
siteName = pkg.name ?? '(no name)';
|
|
114
|
+
if (siteName) {
|
|
115
|
+
log.info('Using site name from package.json: %s', siteName);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
let repoUrl = opts.repoUrl ?? content.repo_url;
|
|
119
|
+
if (!repoUrl) {
|
|
120
|
+
repoUrl = pkg.repository?.url;
|
|
121
|
+
if (repoUrl) {
|
|
122
|
+
log.info('Using repo URL from package.json: %s', repoUrl);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
let repoName = opts.repoName ?? content.repo_name;
|
|
126
|
+
if (repoUrl && !repoName) {
|
|
127
|
+
let { pathname } = new URL(repoUrl);
|
|
128
|
+
pathname = pathname.slice(1);
|
|
129
|
+
let [owner, repo] = pathname.split('/');
|
|
130
|
+
repo = repo.replace(/\.git$/, '');
|
|
131
|
+
repoName = [owner, repo].join('/');
|
|
132
|
+
if (repoName) {
|
|
133
|
+
log.info('Using repo name from package.json: %s', repoName);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
let siteDescription = opts.siteDescription ?? content.site_description;
|
|
137
|
+
if (!siteDescription) {
|
|
138
|
+
siteDescription = pkg.description;
|
|
139
|
+
if (siteDescription) {
|
|
140
|
+
log.info('Using site description URL from package.json: %s', siteDescription);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
...content,
|
|
145
|
+
site_name: siteName,
|
|
146
|
+
repo_url: repoUrl,
|
|
147
|
+
repo_name: repoName,
|
|
148
|
+
site_description: siteDescription,
|
|
149
|
+
};
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
/**
|
|
153
|
+
* Installs Python dependencies
|
|
154
|
+
* @param opts Options
|
|
155
|
+
*/
|
|
156
|
+
async function initPython({ pythonPath = constants_1.NAME_PYTHON, dryRun = false, } = {}) {
|
|
157
|
+
const args = ['-m', 'pip', 'install', '-r', constants_1.REQUIREMENTS_TXT_PATH];
|
|
158
|
+
if (dryRun) {
|
|
159
|
+
dryRunLog.info('Would execute command: %s %s', pythonPath, args.join(' '));
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
log.debug('Executing command: %s %s', pythonPath, args.join(' '));
|
|
163
|
+
log.info('Installing Python dependencies...');
|
|
164
|
+
try {
|
|
165
|
+
const result = await (0, teen_process_1.exec)(pythonPath, args, { shell: true });
|
|
166
|
+
const { code, stdout } = result;
|
|
167
|
+
if (code !== 0) {
|
|
168
|
+
throw new error_1.DocutilsError(`Could not install Python dependencies. Reason: ${stdout}`);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
catch (err) {
|
|
172
|
+
throw new error_1.DocutilsError(`Could not install Python dependencies. Reason: ${err.message}`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
log.success('Installed Python dependencies (or dependencies already installed)');
|
|
176
|
+
}
|
|
177
|
+
exports.initPython = initPython;
|
|
178
|
+
/**
|
|
179
|
+
* Main handler for `init` command.
|
|
180
|
+
*
|
|
181
|
+
* This runs tasks in serial; it _could_ run in parallel, but it has deleterious effects upon
|
|
182
|
+
* console output which would need mitigation.
|
|
183
|
+
*/
|
|
184
|
+
async function init({ typescript, typedoc, python, tsconfigJson: tsconfigJsonPath, packageJson: packageJsonPath, overwrite, include, mkdocs, mkdocsYml: mkdocsYmlPath, siteName, repoName, repoUrl, copyright, dryRun, cwd, pythonPath, typedocJson: typeDocJsonPath, } = {}) {
|
|
185
|
+
if (!typescript && typedoc) {
|
|
186
|
+
log.warn('Initialization of tsconfig.json disabled. TypeDoc requires a tsconfig.json; please ensure it exists');
|
|
187
|
+
}
|
|
188
|
+
if (typescript) {
|
|
189
|
+
await (0, exports.initTsConfigJson)({
|
|
190
|
+
dest: tsconfigJsonPath,
|
|
191
|
+
packageJson: packageJsonPath,
|
|
192
|
+
overwrite,
|
|
193
|
+
include,
|
|
194
|
+
dryRun,
|
|
195
|
+
cwd,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
if (typedoc) {
|
|
199
|
+
await (0, exports.initTypeDocJson)({
|
|
200
|
+
dest: typeDocJsonPath,
|
|
201
|
+
packageJson: packageJsonPath,
|
|
202
|
+
overwrite,
|
|
203
|
+
dryRun,
|
|
204
|
+
cwd,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
if (python) {
|
|
208
|
+
await initPython({ pythonPath, dryRun });
|
|
209
|
+
}
|
|
210
|
+
if (mkdocs) {
|
|
211
|
+
await (0, exports.initMkDocs)({
|
|
212
|
+
dest: mkdocsYmlPath,
|
|
213
|
+
cwd,
|
|
214
|
+
siteName,
|
|
215
|
+
repoUrl,
|
|
216
|
+
repoName,
|
|
217
|
+
copyright,
|
|
218
|
+
packageJson: packageJsonPath,
|
|
219
|
+
overwrite,
|
|
220
|
+
dryRun,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
exports.init = init;
|
|
225
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../lib/init.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,2CAMqB;AACrB,gDAAwB;AACxB,+CAAkC;AAElC,mCAAsC;AACtC,yCAAmE;AACnE,sDAA8B;AAE9B,oDAAuB;AACvB,6BAAmD;AAEnD;;GAEG;AACH,MAAM,eAAe,GAAwB,MAAM,CAAC,MAAM,CAAC;IACzD,OAAO,EAAE,iDAAiD;IAC1D,QAAQ,EAAE,MAAM;IAChB,QAAQ,EAAE,MAAM;CACjB,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,iBAAiB,GAA0B,MAAM,CAAC,MAAM,CAAC;IAC7D,OAAO,EAAE,iCAAiC;IAC1C,cAAc,EAAE,IAAI;IACpB,kBAAkB,EAAE,UAAU;IAC9B,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,CAAC,GAAG,CAAC;CACn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//# sourceMappingURL=io.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"io.d.ts","sourceRoot":"","sources":["../../lib/io.ts"],"names":[],"mappings":""}
|
package/build/lib/io.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"io.js","sourceRoot":"","sources":["../../lib/io.ts"],"names":[],"mappings":""}
|
package/build/lib/logger.d.ts
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* It's a logger.
|
|
3
|
+
*
|
|
4
|
+
* Since this is a CLI app only, it doesn't necessarily make sense to consume `@appium/support`'s logger.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import { Consola } from 'consola';
|
|
9
|
+
/**
|
|
10
|
+
* The logger from which all loggers are created. This one uses a unique tag and our custom reporter.
|
|
11
|
+
*/
|
|
12
|
+
declare const rootLogger: Consola;
|
|
13
|
+
/**
|
|
14
|
+
* The proxied root logger
|
|
15
|
+
* @see {createLogProxy}
|
|
16
|
+
*/
|
|
17
|
+
export default rootLogger;
|
|
3
18
|
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../lib/logger.
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../lib/logger.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAgB,EAKd,OAAO,EAGR,MAAM,SAAS,CAAC;AAuHjB;;GAEG;AACH,QAAA,MAAM,UAAU,SAEf,CAAC;AA6CF;;;GAGG;AACH,eAAe,UAAU,CAAC"}
|
package/build/lib/logger.js
CHANGED
|
@@ -1,5 +1,190 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* It's a logger.
|
|
4
|
+
*
|
|
5
|
+
* Since this is a CLI app only, it doesn't necessarily make sense to consume `@appium/support`'s logger.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
+
if (mod && mod.__esModule) return mod;
|
|
27
|
+
var result = {};
|
|
28
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
+
__setModuleDefault(result, mod);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
32
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
33
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
34
|
+
};
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
|
|
36
|
+
const figures_1 = __importDefault(require("figures"));
|
|
37
|
+
const log_symbols_1 = __importDefault(require("log-symbols"));
|
|
38
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
39
|
+
const consola_1 = __importStar(require("consola"));
|
|
40
|
+
const constants_1 = require("./constants");
|
|
41
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
42
|
+
/**
|
|
43
|
+
* This is a reporter for `consola` which uses some extra/custom icons and colors.
|
|
44
|
+
*
|
|
45
|
+
* @privateRemarks
|
|
46
|
+
* I did not like that the default `FancyReport` logs errors in _green_ without any sort of icon.
|
|
47
|
+
* Both `log-symbols` and `consola` consume `chalk`, so we do too. `consola` also depends on `figures`.
|
|
48
|
+
*/
|
|
49
|
+
class DocutilsReporter extends consola_1.FancyReporter {
|
|
50
|
+
/**
|
|
51
|
+
* Type guard to check if a log type has a color
|
|
52
|
+
* @param type A log type
|
|
53
|
+
*/
|
|
54
|
+
static hasTypeColor(type) {
|
|
55
|
+
return type in DocutilsReporter.TYPE_COLOR_MAP;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Type guard to check if a log level has a color
|
|
59
|
+
* @param level A log level
|
|
60
|
+
*/
|
|
61
|
+
static hasLevelColor(level) {
|
|
62
|
+
return level in DocutilsReporter.LEVEL_COLORS;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Type guard to check if a log type has an icon
|
|
66
|
+
* @param type A log type
|
|
67
|
+
*/
|
|
68
|
+
static hasTypeIcon(type) {
|
|
69
|
+
return type in DocutilsReporter.TYPE_ICONS;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Prefixes the logging output with colors and symbols, depending on contents of `logObj`.
|
|
73
|
+
* @param logObj Consola's log object
|
|
74
|
+
* @param isBadge {@linkcode FancyReporter} uses this; I think it depends on the terminal width
|
|
75
|
+
* @returns
|
|
76
|
+
*/
|
|
77
|
+
formatType(logObj, isBadge) {
|
|
78
|
+
const { TYPE_COLOR_MAP, LEVEL_COLORS, TYPE_ICONS, hasTypeColor, hasLevelColor, hasTypeIcon, DEFAULT_COLOR, } = DocutilsReporter;
|
|
79
|
+
let typeColor;
|
|
80
|
+
if (hasTypeColor(logObj.type)) {
|
|
81
|
+
typeColor = TYPE_COLOR_MAP[logObj.type];
|
|
82
|
+
}
|
|
83
|
+
else if (hasLevelColor(logObj.level)) {
|
|
84
|
+
typeColor = LEVEL_COLORS[logObj.level];
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
typeColor = ((this.options.secondaryColor ?? DEFAULT_COLOR));
|
|
88
|
+
}
|
|
89
|
+
if (isBadge) {
|
|
90
|
+
return chalk_1.default[('bg' + lodash_1.default.capitalize(typeColor))].black(` ${lodash_1.default.toUpper(logObj.type)}`);
|
|
91
|
+
}
|
|
92
|
+
const type = hasTypeIcon(logObj.type) ? TYPE_ICONS[logObj.type] : logObj.type;
|
|
93
|
+
return type ? chalk_1.default[typeColor](type) : '';
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Mapping of log types (the name of the logging method called) to chalk fg colors
|
|
98
|
+
*/
|
|
99
|
+
DocutilsReporter.TYPE_COLOR_MAP = {
|
|
100
|
+
info: 'cyan',
|
|
101
|
+
success: 'green',
|
|
102
|
+
error: 'red',
|
|
103
|
+
warn: 'yellow',
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Mapping of log levels to chalk fg colors
|
|
107
|
+
*/
|
|
108
|
+
DocutilsReporter.LEVEL_COLORS = {
|
|
109
|
+
0: 'red',
|
|
110
|
+
1: 'yellow',
|
|
111
|
+
2: 'white',
|
|
112
|
+
3: 'green',
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Mapping of log types to icons/symbols
|
|
116
|
+
*/
|
|
117
|
+
DocutilsReporter.TYPE_ICONS = {
|
|
118
|
+
info: log_symbols_1.default.info,
|
|
119
|
+
success: log_symbols_1.default.success,
|
|
120
|
+
error: log_symbols_1.default.error,
|
|
121
|
+
warn: log_symbols_1.default.warning,
|
|
122
|
+
debug: (0, figures_1.default)('›'),
|
|
123
|
+
trace: (0, figures_1.default)('›'),
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Default color to use if we can't find a color for the log type or level
|
|
127
|
+
*/
|
|
128
|
+
DocutilsReporter.DEFAULT_COLOR = 'grey';
|
|
129
|
+
/**
|
|
130
|
+
* The global log level
|
|
131
|
+
*
|
|
132
|
+
* "Global" inasmuch as any logger created from the root logger will use this level.
|
|
133
|
+
*/
|
|
134
|
+
let globalLevel = constants_1.LogLevelMap[constants_1.DEFAULT_LOG_LEVEL];
|
|
135
|
+
/**
|
|
136
|
+
* The logger from which all loggers are created. This one uses a unique tag and our custom reporter.
|
|
137
|
+
*/
|
|
138
|
+
const rootLogger = createLogProxy(consola_1.default.create({ defaults: { tag: 'docutils' }, reporters: [new DocutilsReporter()] }));
|
|
139
|
+
/**
|
|
140
|
+
* @summary Creates a log-level-propagating proxy for a {@linkcode Consola} logger.
|
|
141
|
+
* @description
|
|
142
|
+
* Alright. So when you create a new logger via {@linkcode Consola.create}, it's basically a clone
|
|
143
|
+
* of its parent with a new set of options.
|
|
144
|
+
*
|
|
145
|
+
* If we change the log level of the root logger (which we do: see `cli/index.ts`), we may (almost
|
|
146
|
+
* certainly) have
|
|
147
|
+
* child loggers which: a) have already been created and b) have inherited the old/default log level
|
|
148
|
+
* from the root logger. We don't _want_ that (though this is likely a reasonable use case) for our
|
|
149
|
+
* purposes.
|
|
150
|
+
*
|
|
151
|
+
* The implementation below solves the problem by maintaining its own singleton log level value, and
|
|
152
|
+
* intercepts the `level` property of any logger created from the root logger.
|
|
153
|
+
*
|
|
154
|
+
* There are other ways to go about this which may be better, but this seemed pretty straightforward.
|
|
155
|
+
*/
|
|
156
|
+
function createLogProxy(logger) {
|
|
157
|
+
return new Proxy(logger, {
|
|
158
|
+
get(target, prop, receiver) {
|
|
159
|
+
if (prop === 'level') {
|
|
160
|
+
return globalLevel;
|
|
161
|
+
}
|
|
162
|
+
if (prop === 'create') {
|
|
163
|
+
const create = Reflect.get(target, prop, receiver);
|
|
164
|
+
return (opts) => createLogProxy(create.call(receiver, opts));
|
|
165
|
+
}
|
|
166
|
+
if (prop === '_defaults') {
|
|
167
|
+
const defaults = Reflect.get(target, prop, receiver);
|
|
168
|
+
return { ...defaults, level: globalLevel };
|
|
169
|
+
}
|
|
170
|
+
return Reflect.get(target, prop, receiver);
|
|
171
|
+
},
|
|
172
|
+
set(target, prop, value, receiver) {
|
|
173
|
+
if (prop === 'level') {
|
|
174
|
+
globalLevel = value;
|
|
175
|
+
return true;
|
|
176
|
+
}
|
|
177
|
+
return Reflect.set(target, prop, value, receiver);
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* The proxied root logger
|
|
183
|
+
* @see {createLogProxy}
|
|
184
|
+
*/
|
|
185
|
+
exports.default = rootLogger;
|
|
186
|
+
// these are just type-sanity checks
|
|
187
|
+
DocutilsReporter.TYPE_COLOR_MAP;
|
|
188
|
+
DocutilsReporter.LEVEL_COLORS;
|
|
189
|
+
DocutilsReporter.TYPE_ICONS;
|
|
5
190
|
//# sourceMappingURL=logger.js.map
|