tnp-core 21.0.166 → 21.0.167
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/VERIFIED-BUILD-DATA.jsonc +3 -3
- package/browser/package.json +1 -1
- package/browser-prod/package.json +1 -1
- package/full-dts/build-info._auto-generated_.d.ts +24 -0
- package/full-dts/config.d.ts +171 -0
- package/full-dts/constants.d.ts +306 -0
- package/full-dts/core-cli.d.ts +8 -0
- package/full-dts/core-config.d.ts +5 -0
- package/full-dts/core-imports.d.ts +71 -0
- package/full-dts/core-models.d.ts +313 -0
- package/full-dts/core-project.d.ts +6 -0
- package/full-dts/cross-platform-path.d.ts +5 -0
- package/full-dts/env/env.angular-node-app.d.ts +67 -0
- package/full-dts/env/env.docs-webapp.d.ts +67 -0
- package/full-dts/env/env.electron-app.d.ts +67 -0
- package/full-dts/env/env.mobile-app.d.ts +67 -0
- package/full-dts/env/env.npm-lib-and-cli-tool.d.ts +67 -0
- package/full-dts/env/env.vscode-plugin.d.ts +67 -0
- package/full-dts/env/index.d.ts +6 -0
- package/full-dts/framework-name.d.ts +3 -0
- package/full-dts/global-logs.d.ts +5 -0
- package/full-dts/global-spinner.d.ts +27 -0
- package/full-dts/global-storage.d.ts +17 -0
- package/full-dts/global-task-manager.d.ts +20 -0
- package/full-dts/helpers.d.ts +325 -0
- package/full-dts/index.d.ts +53 -0
- package/full-dts/jsonc-parser.d.ts +4 -0
- package/full-dts/lodash.namespace.d.ts +308 -0
- package/full-dts/lowdb/adapters/Memory.d.ts +11 -0
- package/full-dts/lowdb/adapters/client/LocalStorage.d.ts +4 -0
- package/full-dts/lowdb/adapters/client/SessionStorage.d.ts +4 -0
- package/full-dts/lowdb/adapters/client/WebStorage.d.ts +8 -0
- package/full-dts/lowdb/adapters/node/DataFile.d.ts +25 -0
- package/full-dts/lowdb/adapters/node/JSONFile.d.ts +8 -0
- package/full-dts/lowdb/adapters/node/TextFile.d.ts +17 -0
- package/full-dts/lowdb/adapters/node/steno.d.ts +13 -0
- package/full-dts/lowdb/browser.d.ts +3 -0
- package/full-dts/lowdb/core/Low.d.ts +24 -0
- package/full-dts/lowdb/examples/server.d.ts +0 -0
- package/full-dts/lowdb/index.d.ts +3 -0
- package/full-dts/lowdb/node.d.ts +4 -0
- package/full-dts/lowdb/presets/browser.d.ts +3 -0
- package/full-dts/lowdb/presets/node.d.ts +4 -0
- package/full-dts/node-chalk-mock.d.ts +2 -0
- package/full-dts/node-path-mock.d.ts +25 -0
- package/full-dts/public-api.d.ts +4 -0
- package/full-dts/required-global-npm-packages.d.ts +44 -0
- package/full-dts/start-cli.d.ts +7 -0
- package/full-dts/taon-state-machine.d.ts +23 -0
- package/full-dts/utils-binary.d.ts +68 -0
- package/full-dts/utils-cli.d.ts +41 -0
- package/full-dts/utils-dot-file.d.ts +17 -0
- package/full-dts/utils-env.d.ts +101 -0
- package/full-dts/utils-etc-hosts.d.ts +28 -0
- package/full-dts/utils-exec-proc-vscode.d.ts +62 -0
- package/full-dts/utils-exec-proc.d.ts +100 -0
- package/full-dts/utils-files-folders.d.ts +106 -0
- package/full-dts/utils-http.d.ts +188 -0
- package/full-dts/utils-i18n.d.ts +38 -0
- package/full-dts/utils-imports.d.ts +0 -0
- package/full-dts/utils-imports.test.d.ts +0 -0
- package/full-dts/utils-json.d.ts +37 -0
- package/full-dts/utils-jwt.d.ts +12 -0
- package/full-dts/utils-md-docs.d.ts +21 -0
- package/full-dts/utils-network.d.ts +79 -0
- package/full-dts/utils-os.d.ts +126 -0
- package/full-dts/utils-passwords.d.ts +8 -0
- package/full-dts/utils-process-logger.d.ts +97 -0
- package/full-dts/utils-process.d.ts +93 -0
- package/full-dts/utils-progress.d.ts +26 -0
- package/full-dts/utils-projects.d.ts +327 -0
- package/full-dts/utils-projects.test.d.ts +0 -0
- package/full-dts/utils-secret-env.d.ts +41 -0
- package/full-dts/utils-start-async.d.ts +67 -0
- package/full-dts/utils-stdin-stdout-logger.d.ts +9 -0
- package/full-dts/utils-string-regex.d.ts +11 -0
- package/full-dts/utils-sudo.d.ts +32 -0
- package/full-dts/utils-temp-folder.d.ts +29 -0
- package/full-dts/utils-terminal.d.ts +171 -0
- package/full-dts/utils-time.d.ts +16 -0
- package/full-dts/utils-wait-notifier.d.ts +11 -0
- package/full-dts/utils.d.ts +100 -0
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/config.d.ts +2 -2
- package/lib/core-imports.d.ts +1 -4
- package/lib/framework-name.d.ts +3 -3
- package/lib/package.json +1 -1
- package/lib/utils-binary.d.ts +1 -9
- package/lib-esm/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib-esm/lib/build-info._auto-generated_.js +1 -1
- package/lib-esm/lib/config.d.ts +2 -2
- package/lib-esm/lib/core-imports.d.ts +1 -4
- package/lib-esm/lib/framework-name.d.ts +3 -3
- package/lib-esm/lib/utils-binary.d.ts +1 -9
- package/lib-prod/build-info._auto-generated_.d.ts +1 -1
- package/lib-prod/build-info._auto-generated_.js +1 -1
- package/lib-prod/package.json +1 -1
- package/package.json +1 -1
- package/src.d.ts +1 -1
- package/websql/package.json +1 -1
- package/websql-prod/package.json +1 -1
- package/lib/jsonc-parse.test.d.ts +0 -1
- package/lib/utils-env.test.d.ts +0 -1
- package/lib/utils-json.test.d.ts +0 -1
- package/lib/utils-jwt.test.d.ts +0 -1
- package/lib/utils-md-docs.test.d.ts +0 -1
- package/lib/utils-progress.test.d.ts +0 -1
- /package/{lib-esm/lib/utils-imports.test.d.ts → full-dts/index._auto-generated_.d.ts} +0 -0
- /package/{lib-esm/lib/utils-projects.test.d.ts → full-dts/json10writer.d.ts} +0 -0
- /package/{lib-esm/lib → full-dts}/jsonc-parse.test.d.ts +0 -0
- /package/{lib-esm/lib/taon-state-machine.test.d.ts → full-dts/lowdb/examples/browser.d.ts} +0 -0
- /package/{lib/utils-imports.test.d.ts → full-dts/lowdb/examples/cli.d.ts} +0 -0
- /package/{lib/utils-projects.test.d.ts → full-dts/lowdb/examples/in-memory.d.ts} +0 -0
- /package/{lib → full-dts}/taon-state-machine.test.d.ts +0 -0
- /package/{lib-esm/lib → full-dts}/utils-env.test.d.ts +0 -0
- /package/{lib-esm/lib → full-dts}/utils-json.test.d.ts +0 -0
- /package/{lib-esm/lib → full-dts}/utils-jwt.test.d.ts +0 -0
- /package/{lib-esm/lib → full-dts}/utils-md-docs.test.d.ts +0 -0
- /package/{lib-esm/lib → full-dts}/utils-progress.test.d.ts +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare namespace UtilsCli {
|
|
2
|
+
/**
|
|
3
|
+
* Taon CLI specyfic mehtod for mesuring script execution time:
|
|
4
|
+
* from beginning of script to this moment.
|
|
5
|
+
*/
|
|
6
|
+
const getTimeFromThisCLIScriptStart: () => {
|
|
7
|
+
ms: string;
|
|
8
|
+
sec: string;
|
|
9
|
+
min: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Easy way to connect CLI commands to cli class methods.
|
|
14
|
+
*
|
|
15
|
+
* Example:
|
|
16
|
+
* in clic class
|
|
17
|
+
*
|
|
18
|
+
* $FirstCli {
|
|
19
|
+
* static [UtilsCliClassMethod.staticClassNameProperty] = '$FirstCli';
|
|
20
|
+
*
|
|
21
|
+
* @UtilsCliClassMethod.decoratorMethod('doSomething')
|
|
22
|
+
* doSomething() {
|
|
23
|
+
* console.log('doing something');
|
|
24
|
+
* }
|
|
25
|
+
* }
|
|
26
|
+
*
|
|
27
|
+
* UtilsCliClassMethod.getFrom($FirstCli.prototype.doSomething) // "firstcli:dosomething"
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
export declare namespace UtilsCliClassMethod {
|
|
31
|
+
const decoratorMethod: (methodName: string) => MethodDecorator;
|
|
32
|
+
const getFrom: <ARGS_TO_PARSE extends object = any>(ClassPrototypeMethodFnHere: Function, options?: {
|
|
33
|
+
globalMethod?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* arguments to parse into CLI format
|
|
36
|
+
* Example: { projectName: "myproj", envName: "prod" } => "--projectName=myproj --envName=prod"
|
|
37
|
+
* TODO @LAST add support for DEEP args parsing with lodash-walk-object
|
|
38
|
+
*/
|
|
39
|
+
argsToParse?: ARGS_TO_PARSE;
|
|
40
|
+
}) => string;
|
|
41
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare namespace UtilsDotFile {
|
|
2
|
+
const setValueToDotFile: (dotFileAbsPath: string | string[], key: string, value: string | number | boolean) => void;
|
|
3
|
+
const setCommentToKeyInDotFile: (dotFileAbsPath: string | string[], key: string, comment: string) => void;
|
|
4
|
+
const getValueFromDotFile: (dotFileAbsPath: string | string[], key: string) => string | number | boolean;
|
|
5
|
+
const addCommentAtTheBeginningOfDotFile: (dotFileAbsPath: string | string[], comment: string) => void;
|
|
6
|
+
const setValuesKeysFromObject: (dotFileAbsPath: string | string[], obj: Record<string, string | number | boolean>, options?: {
|
|
7
|
+
/**
|
|
8
|
+
* if true, it will overwrite existing keys
|
|
9
|
+
*/
|
|
10
|
+
setAsNewFile?: boolean;
|
|
11
|
+
}) => void;
|
|
12
|
+
const getValuesKeysAsJsonObject: <T = Record<string, string | number | boolean>>(dotFileAbsPath: string | string[]) => T;
|
|
13
|
+
/**
|
|
14
|
+
* @returns key|comment pairs as json object
|
|
15
|
+
*/
|
|
16
|
+
const getCommentsKeysAsJsonObject: <T = Record<string, string | undefined>>(dotFileAbsPath: string | string[]) => T;
|
|
17
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
export declare namespace UtilsEnv {
|
|
2
|
+
enum EnvironmentName {
|
|
3
|
+
/**
|
|
4
|
+
* Default environment, typically for artifact without application
|
|
5
|
+
* or for storing common data
|
|
6
|
+
*/
|
|
7
|
+
__ = "__",
|
|
8
|
+
/**
|
|
9
|
+
* Local development environment, typically the developer's machine.
|
|
10
|
+
*/
|
|
11
|
+
LOCALHOST = "localhost",
|
|
12
|
+
/**
|
|
13
|
+
* Development environment used by engineers to deploy and test new features.
|
|
14
|
+
*/
|
|
15
|
+
DEV = "dev",
|
|
16
|
+
/**
|
|
17
|
+
* Staging environment used for final validations before production.
|
|
18
|
+
*/
|
|
19
|
+
STAGE = "stage",
|
|
20
|
+
/**
|
|
21
|
+
* Production environment serving live users.
|
|
22
|
+
*/
|
|
23
|
+
PROD = "prod",
|
|
24
|
+
/**
|
|
25
|
+
* Cloudflare full backend/frontend deployment
|
|
26
|
+
*/
|
|
27
|
+
CLOUDFLARE = "cloudflare",
|
|
28
|
+
/**
|
|
29
|
+
* Taon cloud full backend/frontend deployment
|
|
30
|
+
*/
|
|
31
|
+
CLOUD = "cloud",
|
|
32
|
+
/**
|
|
33
|
+
* Automated test environment for running unit, integration, or automated tests.
|
|
34
|
+
*/
|
|
35
|
+
TEST = "test",
|
|
36
|
+
/**
|
|
37
|
+
* Quality assurance environment designated for manual and exploratory testing.
|
|
38
|
+
*/
|
|
39
|
+
QA = "qa",
|
|
40
|
+
/**
|
|
41
|
+
* Sandbox environment for experimenting and integration without affecting other environments.
|
|
42
|
+
*/
|
|
43
|
+
SANDBOX = "sandbox",
|
|
44
|
+
/**
|
|
45
|
+
* User Acceptance Testing environment where clients or stakeholders validate the release candidate.
|
|
46
|
+
*/
|
|
47
|
+
UAT = "uat",
|
|
48
|
+
/**
|
|
49
|
+
* Pre-production environment, closely mirroring production for final testing and validation.
|
|
50
|
+
*/
|
|
51
|
+
PREPROD = "preprod",
|
|
52
|
+
/**
|
|
53
|
+
* Demonstration environment specifically configured for client presentations and demos.
|
|
54
|
+
*/
|
|
55
|
+
DEMO = "demo",
|
|
56
|
+
/**
|
|
57
|
+
* Documentation environment for hosting and managing project documentation.
|
|
58
|
+
*/
|
|
59
|
+
DOCS = "docs",
|
|
60
|
+
/**
|
|
61
|
+
* Demonstration environment ONLY html files, typically used for static pages or documentation.
|
|
62
|
+
* This environment is not intended for dynamic content or server-side processing.
|
|
63
|
+
* Perfect to github pages or similar.
|
|
64
|
+
* It is not intended for production use and should not be used for any critical applications or services.
|
|
65
|
+
*/
|
|
66
|
+
STATIC_PAGES = "static-pages",
|
|
67
|
+
/**
|
|
68
|
+
* Continuous Integration environment used by CI/CD pipelines for automated builds and deployments.
|
|
69
|
+
*/
|
|
70
|
+
CI = "ci",
|
|
71
|
+
/**
|
|
72
|
+
* Training environment dedicated to internal team onboarding and training activities.
|
|
73
|
+
*/
|
|
74
|
+
TRAINING = "training",
|
|
75
|
+
/**
|
|
76
|
+
* Staging environment used for final validations before production.
|
|
77
|
+
*/
|
|
78
|
+
STAGING = "staging"
|
|
79
|
+
}
|
|
80
|
+
type EnvironmentNameTaon = `${EnvironmentName}`;
|
|
81
|
+
const EnvironmentNameArr: readonly EnvironmentNameTaon[];
|
|
82
|
+
function getTsFileName({ artifactName, envName, envNumber, }: {
|
|
83
|
+
artifactName: string;
|
|
84
|
+
envName: string;
|
|
85
|
+
envNumber?: string | number;
|
|
86
|
+
}): string;
|
|
87
|
+
/**
|
|
88
|
+
* @returns envName, envNumber from string that is container
|
|
89
|
+
* environment. Examples:
|
|
90
|
+
* - env.angular-node-app.dev.ts > envName: 'dev' , envNumber: undefined
|
|
91
|
+
* - env.angular-node-app.dev0.ts > envName: 'dev' , envNumber: 0
|
|
92
|
+
* - env.angular-node-app.dev3.ts > envName: 'dev' , envNumber: 3
|
|
93
|
+
* - env.prod.ts > envName: 'prod' , envNumber: undefined
|
|
94
|
+
* - env.prod2.tsx > envName: 'prod' , envNumber: 2
|
|
95
|
+
* - prod4 > envName: 'prod' , envNumber: 4
|
|
96
|
+
*/
|
|
97
|
+
function splitEnv(value: string): {
|
|
98
|
+
envName: string | EnvironmentNameTaon;
|
|
99
|
+
envNumber?: number | undefined;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { Subject } from 'rxjs';
|
|
3
|
+
export declare namespace UtilsEtcHosts {
|
|
4
|
+
const SIMULATE_DOMAIN_TAG = "@simulatedDomainByTaon";
|
|
5
|
+
interface EtchostEntry {
|
|
6
|
+
lineIp: string;
|
|
7
|
+
domains: string[];
|
|
8
|
+
comment: string;
|
|
9
|
+
}
|
|
10
|
+
const getPath: () => string;
|
|
11
|
+
const getLines: () => string[];
|
|
12
|
+
const getTokensData: (line: string) => {
|
|
13
|
+
comment: string;
|
|
14
|
+
domains: string[];
|
|
15
|
+
lineIp: string;
|
|
16
|
+
};
|
|
17
|
+
const specificEntryExists: (domain: string, ip: string) => boolean;
|
|
18
|
+
const getEntriesByDomain: (domain: string) => UtilsEtcHosts.EtchostEntry[];
|
|
19
|
+
const getEntryByComment: (commentOfEntry: string) => UtilsEtcHosts.EtchostEntry[];
|
|
20
|
+
/**
|
|
21
|
+
* Returns all host entries for a given IP address.
|
|
22
|
+
*/
|
|
23
|
+
const getEntriesByIp: (ip: string) => UtilsEtcHosts.EtchostEntry[];
|
|
24
|
+
const removeEntryByDomain: (domain: string) => void;
|
|
25
|
+
const simulateDomain: (domainOrDomains: string | string[], options?: {
|
|
26
|
+
triggerRevertChangesToEtcHosts?: Subject<void>;
|
|
27
|
+
}) => Promise<void>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { CancellationToken, OutputChannel, Progress } from 'vscode';
|
|
2
|
+
export type ExecVscodeProgress = {
|
|
3
|
+
value?: number;
|
|
4
|
+
message?: string;
|
|
5
|
+
type?: 'info' | 'warning' | 'error' | 'event';
|
|
6
|
+
};
|
|
7
|
+
export type ExecAsyncVscodeOptions = {
|
|
8
|
+
command: string;
|
|
9
|
+
cwd?: string;
|
|
10
|
+
env?: NodeJS.ProcessEnv;
|
|
11
|
+
outputChannel?: OutputChannel;
|
|
12
|
+
progress?: Progress<{
|
|
13
|
+
message?: string;
|
|
14
|
+
increment?: number;
|
|
15
|
+
}>;
|
|
16
|
+
cancellationToken?: CancellationToken;
|
|
17
|
+
showCommand?: boolean;
|
|
18
|
+
showOutput?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Maximum stdout or stderr buffered by exec().
|
|
21
|
+
*
|
|
22
|
+
* exec() can terminate the child when this is exceeded.
|
|
23
|
+
*/
|
|
24
|
+
maxBuffer?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Called for every ordinary stdout line.
|
|
27
|
+
*/
|
|
28
|
+
onStdoutLine?: (line: string) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Called for every ordinary stderr line.
|
|
31
|
+
*/
|
|
32
|
+
onStderrLine?: (line: string) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Parses a structured progress line.
|
|
35
|
+
*
|
|
36
|
+
* Return undefined when the line is ordinary output.
|
|
37
|
+
*/
|
|
38
|
+
parseProgress?: (line: string) => ExecVscodeProgress | undefined;
|
|
39
|
+
};
|
|
40
|
+
export type ExecAsyncVscodeResult = {
|
|
41
|
+
stdout: string;
|
|
42
|
+
stderr: string;
|
|
43
|
+
exitCode: number;
|
|
44
|
+
};
|
|
45
|
+
export declare class ExecAsyncVscodeError extends Error {
|
|
46
|
+
readonly command: string;
|
|
47
|
+
readonly cwd?: string;
|
|
48
|
+
readonly stdout: string;
|
|
49
|
+
readonly stderr: string;
|
|
50
|
+
readonly exitCode?: number;
|
|
51
|
+
readonly signal?: NodeJS.Signals;
|
|
52
|
+
constructor(options: {
|
|
53
|
+
command: string;
|
|
54
|
+
cwd?: string;
|
|
55
|
+
stdout: string;
|
|
56
|
+
stderr: string;
|
|
57
|
+
exitCode?: number;
|
|
58
|
+
signal?: NodeJS.Signals;
|
|
59
|
+
cause?: unknown;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
export declare function execAsyncVscode(options: ExecAsyncVscodeOptions): Promise<ExecAsyncVscodeResult>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
/**
|
|
3
|
+
* Async api for executing child processes
|
|
4
|
+
* (proper handling of stdout / stderr and options)
|
|
5
|
+
*/
|
|
6
|
+
export declare namespace UtilsExecProc {
|
|
7
|
+
interface ExecProcOptions {
|
|
8
|
+
cwd?: string;
|
|
9
|
+
shell?: boolean | string;
|
|
10
|
+
/**
|
|
11
|
+
* default true
|
|
12
|
+
* true -> good for long outputs
|
|
13
|
+
* false -> good for short outputs (speed things up)
|
|
14
|
+
*/
|
|
15
|
+
biggerBuffer?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* default true
|
|
18
|
+
*/
|
|
19
|
+
showOutputColor?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* default true
|
|
22
|
+
*/
|
|
23
|
+
showOutput?: boolean | 'stdoutOnly' | 'stderrOnly';
|
|
24
|
+
/**
|
|
25
|
+
* default process.env
|
|
26
|
+
*/
|
|
27
|
+
env?: {
|
|
28
|
+
[key: string]: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
interface ExecProcWaitUntilDoneOrThrow {
|
|
32
|
+
shell?: boolean | string;
|
|
33
|
+
/**
|
|
34
|
+
* default [0]
|
|
35
|
+
*/
|
|
36
|
+
successCode?: number[];
|
|
37
|
+
/**
|
|
38
|
+
* in stdout or stderr
|
|
39
|
+
*/
|
|
40
|
+
successOutputMessage?: string | string[] | {
|
|
41
|
+
stdout?: string | string[];
|
|
42
|
+
stderr?: string | string[];
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* in stdout or stderr
|
|
46
|
+
*/
|
|
47
|
+
failOutputMessage?: string | string[] | {
|
|
48
|
+
stdout?: string | string[];
|
|
49
|
+
stderr?: string | string[];
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* This class expose function that are usually needed when working
|
|
54
|
+
* with child processes (without digging into low level child_process module)
|
|
55
|
+
*/
|
|
56
|
+
class ExecProcResult {
|
|
57
|
+
protected readonly command: string;
|
|
58
|
+
protected readonly args: string[];
|
|
59
|
+
protected readonly execProcOptions: ExecProcOptions;
|
|
60
|
+
private stdoutFromCommand;
|
|
61
|
+
private stderrFromCommand;
|
|
62
|
+
private child;
|
|
63
|
+
private get maxBuffer();
|
|
64
|
+
private get env();
|
|
65
|
+
constructor(command: string, args: string[], execProcOptions?: ExecProcOptions);
|
|
66
|
+
getOutput(options?: {
|
|
67
|
+
shell?: boolean | string;
|
|
68
|
+
skipThrowingError?: boolean;
|
|
69
|
+
}): Promise<{
|
|
70
|
+
stdout: string;
|
|
71
|
+
stderr: string;
|
|
72
|
+
}>;
|
|
73
|
+
getStdoutWithoutShowingOrThrow(options?: {
|
|
74
|
+
shell?: boolean | string;
|
|
75
|
+
}): Promise<string>;
|
|
76
|
+
waitUntilDoneOrThrow(options?: ExecProcWaitUntilDoneOrThrow): Promise<boolean>;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* @TODO @IN_PROGRESS
|
|
80
|
+
*/
|
|
81
|
+
export const spawnAsync: (command: string, options?: ExecProcOptions) => ExecProcResult;
|
|
82
|
+
/**
|
|
83
|
+
* @TODO @IN_PROGRESS
|
|
84
|
+
*/
|
|
85
|
+
export const spawnAdminSudo: (command: string, options?: ExecProcOptions) => Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* @TODO @IN_PROGRESS
|
|
88
|
+
*/
|
|
89
|
+
export const executeUntilEndOrThrow: ({ command, cwd, shell, }: {
|
|
90
|
+
command: string;
|
|
91
|
+
cwd: string;
|
|
92
|
+
shell?: boolean;
|
|
93
|
+
}) => Promise<void>;
|
|
94
|
+
export const getStdoutWithoutShowingOrThrow: ({ command, cwd, shell, }: {
|
|
95
|
+
command: string;
|
|
96
|
+
cwd: string;
|
|
97
|
+
shell?: boolean;
|
|
98
|
+
}) => Promise<string>;
|
|
99
|
+
export {};
|
|
100
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { CopyOptionsSync } from 'fs-extra';
|
|
3
|
+
export declare namespace UtilsFilesFoldersSync {
|
|
4
|
+
const IGNORE_FOLDERS_FILES_PATTERNS: string[];
|
|
5
|
+
const readFile: (absoluteFilePath: string | string[], // @ts-ignore
|
|
6
|
+
options?: {
|
|
7
|
+
defaultValueWhenNotExists?: string | undefined;
|
|
8
|
+
notTrim?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Default false
|
|
11
|
+
*/
|
|
12
|
+
readImagesWithoutEncodingUtf8?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Default false
|
|
15
|
+
*/
|
|
16
|
+
forceReadWithoutEncodingUtf8?: boolean;
|
|
17
|
+
}) => string | undefined;
|
|
18
|
+
const writeFile: (absoluteFilePath: string | string[], input: string | object | Buffer, options?: {
|
|
19
|
+
/**
|
|
20
|
+
* Default false
|
|
21
|
+
* by default it will not write the file if the content is exactly the same
|
|
22
|
+
*/
|
|
23
|
+
overrideSameFile?: boolean;
|
|
24
|
+
preventParentFile?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Default false
|
|
27
|
+
*/
|
|
28
|
+
writeImagesWithoutEncodingUtf8?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Default false
|
|
31
|
+
*/
|
|
32
|
+
forceReadWithoutEncodingUtf8?: boolean;
|
|
33
|
+
}) => boolean;
|
|
34
|
+
interface UtilsFilesFoldersSyncGetFilesFromOptions {
|
|
35
|
+
recursive?: boolean;
|
|
36
|
+
followSymlinks?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* glob patterns to omit from result
|
|
39
|
+
*/
|
|
40
|
+
omitPatterns?: string[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* return absolute paths for files inside folder or link to folder
|
|
44
|
+
*/
|
|
45
|
+
const getFilesFrom: (folderOrLinkToFolder: string | string[], options?: UtilsFilesFoldersSyncGetFilesFromOptions) => string[];
|
|
46
|
+
/**
|
|
47
|
+
* return absolute paths for folders inside folder or link to folder
|
|
48
|
+
*/
|
|
49
|
+
const getFoldersFrom: (folderOrLinkToFolder: string | string[], options?: UtilsFilesFoldersSyncGetFilesFromOptions) => string[];
|
|
50
|
+
const copyFolder: (sourceDir: string | string[], destinationDir: string | string[], options?: {
|
|
51
|
+
filter?: CopyOptionsSync["filter"];
|
|
52
|
+
copySymlinksAsFiles?: boolean;
|
|
53
|
+
}) => void;
|
|
54
|
+
const copy: (sourceDir: string | string[], destinationDir: string | string[], options?: {
|
|
55
|
+
filter?: any;
|
|
56
|
+
overwrite?: boolean;
|
|
57
|
+
recursive?: boolean;
|
|
58
|
+
asSeparatedFiles?: boolean;
|
|
59
|
+
asSeparatedFilesAllowNotCopied?: boolean;
|
|
60
|
+
asSeparatedFilesSymlinkAsFile?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* folders to omit: example: ['src','node_modules']
|
|
63
|
+
*
|
|
64
|
+
* This option works only with omitFoldersBaseFolder
|
|
65
|
+
*/
|
|
66
|
+
omitFolders?: string[];
|
|
67
|
+
/**
|
|
68
|
+
* absolute path for base folder for omitFolder option
|
|
69
|
+
*/
|
|
70
|
+
omitFoldersBaseFolder?: string;
|
|
71
|
+
copySymlinksAsFiles?: boolean;
|
|
72
|
+
copySymlinksAsFilesDeleteUnexistedLinksFromSourceFirst?: boolean;
|
|
73
|
+
useTempFolder?: boolean;
|
|
74
|
+
dontAskOnError?: boolean;
|
|
75
|
+
} & CopyOptionsSync) => void;
|
|
76
|
+
const filterDontCopy: (basePathFoldersTosSkip: string[], projectOrBasepath: string) => (src: string, dest: string) => boolean;
|
|
77
|
+
const filterOnlyCopy: (basePathFoldersOnlyToInclude: string[], projectOrBasepath: string) => (src: string, dest: string) => boolean;
|
|
78
|
+
const copyFile: (sourcePath: string | string[], destinationPath: string | string[], options?: {
|
|
79
|
+
transformTextFn?: (input: string) => string;
|
|
80
|
+
debugMode?: boolean;
|
|
81
|
+
fast?: boolean;
|
|
82
|
+
dontCopySameContent?: boolean;
|
|
83
|
+
}) => boolean;
|
|
84
|
+
/**
|
|
85
|
+
* @deprecated use .copy and then .remove on
|
|
86
|
+
* source folder..
|
|
87
|
+
*
|
|
88
|
+
* This method is messing with parcel watcher
|
|
89
|
+
* (moved files are not detected)
|
|
90
|
+
*/
|
|
91
|
+
const move: (from: string, to: string, options?: {
|
|
92
|
+
purpose?: string;
|
|
93
|
+
}) => void;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* TODO @LAST @IN_PROGRESS
|
|
97
|
+
* - utils for files and folders operations
|
|
98
|
+
* - export when ready
|
|
99
|
+
* - should be ready for everything async refactor
|
|
100
|
+
*/
|
|
101
|
+
export declare namespace UtilsFilesFolders {
|
|
102
|
+
/**
|
|
103
|
+
* Patterns that should be always ignored
|
|
104
|
+
*/
|
|
105
|
+
const IGNORE_FOLDERS_FILES_PATTERNS: string[];
|
|
106
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
export declare namespace UtilsHttp {
|
|
2
|
+
type ParamType = 'Path' | 'Query' | 'Cookie' | 'Header' | 'Body';
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated
|
|
5
|
+
* known http code
|
|
6
|
+
*/
|
|
7
|
+
type Code = 200 | 400 | 401 | 404 | 500;
|
|
8
|
+
type Method = 'get' | 'post' | 'put' | 'delete' | 'patch' | 'head' | 'jsonp';
|
|
9
|
+
const HttpMethodArr: Method[];
|
|
10
|
+
function mimeType(type: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
|
|
13
|
+
*/
|
|
14
|
+
const mimeTypes: {
|
|
15
|
+
readonly '.aac': "audio/aac";
|
|
16
|
+
readonly '.abw': "application/x-abiword";
|
|
17
|
+
readonly '.arc': "application/x-freearc";
|
|
18
|
+
readonly '.avi': "video/x-msvideo";
|
|
19
|
+
readonly '.azw': "application/vnd.amazon.ebook";
|
|
20
|
+
readonly '.bin': "application/octet-stream";
|
|
21
|
+
readonly '.bmp': "image/bmp";
|
|
22
|
+
readonly '.bz': "application/x-bzip";
|
|
23
|
+
readonly '.bz2': "application/x-bzip2";
|
|
24
|
+
readonly '.csh': "application/x-csh";
|
|
25
|
+
readonly '.css': "text/css";
|
|
26
|
+
readonly '.csv': "text/csv";
|
|
27
|
+
readonly '.doc': "application/msword";
|
|
28
|
+
readonly '.docx': "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
29
|
+
readonly '.eot': "application/vnd.ms-fontobject";
|
|
30
|
+
readonly '.epub': "application/epub+zip";
|
|
31
|
+
readonly '.gz': "application/gzip";
|
|
32
|
+
readonly '.gif': "image/gif";
|
|
33
|
+
readonly '.htm': "text/html";
|
|
34
|
+
readonly '.html': "text/html";
|
|
35
|
+
readonly '.ico': "image/vnd.microsoft.icon";
|
|
36
|
+
readonly '.ics': "text/calendar";
|
|
37
|
+
readonly '.jar': "application/java-archive";
|
|
38
|
+
readonly '.jpeg': "image/jpeg";
|
|
39
|
+
readonly '.jpg': "image/jpeg";
|
|
40
|
+
readonly '.js': "text/javascript";
|
|
41
|
+
readonly '.json': "application/json";
|
|
42
|
+
readonly '.jsonld': "application/ld+json";
|
|
43
|
+
readonly '.mid': "application/midi";
|
|
44
|
+
readonly '.midi': "application/midi";
|
|
45
|
+
readonly '.mjs': "text/javascript";
|
|
46
|
+
readonly '.mp3': "audio/mpeg";
|
|
47
|
+
readonly '.mp4': "video/mp4";
|
|
48
|
+
readonly '.mpeg': "video/mpeg";
|
|
49
|
+
readonly '.mpkg': "application/vnd.apple.installer+xml";
|
|
50
|
+
readonly '.odp': "application/vnd.oasis.opendocument.presentation";
|
|
51
|
+
readonly '.ods': "application/vnd.oasis.opendocument.spreadsheet";
|
|
52
|
+
readonly '.odt': "application/vnd.oasis.opendocument.text";
|
|
53
|
+
readonly '.oga': "audio/ogg";
|
|
54
|
+
readonly '.ogg': "audio/ogg";
|
|
55
|
+
readonly '.ogv': "video/ogg";
|
|
56
|
+
readonly '.ogx': "application/ogg";
|
|
57
|
+
readonly '.opus': "audio/opus";
|
|
58
|
+
readonly '.otf': "font/otf";
|
|
59
|
+
readonly '.png': "image/png";
|
|
60
|
+
readonly '.pdf': "application/pdf";
|
|
61
|
+
readonly '.php': "application/php";
|
|
62
|
+
readonly '.ppt': "application/vnd.ms-powerpoint";
|
|
63
|
+
readonly '.pptx': "application/vnd.openxmlformats-officedocument.presentationml.presentation";
|
|
64
|
+
readonly '.rar': "application/vnd.rar";
|
|
65
|
+
readonly '.rtf': "application/rtf";
|
|
66
|
+
readonly '.sh': "application/x-sh";
|
|
67
|
+
readonly '.svg': "image/svg+xml";
|
|
68
|
+
readonly '.swf': "application/x-shockwave-flash";
|
|
69
|
+
readonly '.tar': "application/x-tar";
|
|
70
|
+
readonly '.tif': "image/tiff";
|
|
71
|
+
readonly '.tiff': "image/tiff";
|
|
72
|
+
readonly '.ts': "video/mp2t";
|
|
73
|
+
readonly '.ttf': "font/ttf";
|
|
74
|
+
readonly '.txt': "text/plain";
|
|
75
|
+
readonly '.vsd': "application/vnd.visio";
|
|
76
|
+
readonly '.wav': "audio/wav";
|
|
77
|
+
readonly '.weba': "audio/webm";
|
|
78
|
+
readonly '.webm': "video/webm";
|
|
79
|
+
readonly '.webp': "image/webp";
|
|
80
|
+
readonly '.woff': "font/woff";
|
|
81
|
+
readonly '.woff2': "font/woff2";
|
|
82
|
+
readonly '.xhtml': "application/xhtml+xml";
|
|
83
|
+
readonly '.xls': "application/vnd.ms-excel";
|
|
84
|
+
readonly '.xlsx': "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
85
|
+
readonly '.xml': "application/xml";
|
|
86
|
+
readonly '.xul': "application/vnd.mozilla.xul+xml";
|
|
87
|
+
readonly '.zip': "application/zip";
|
|
88
|
+
readonly '.3gp': "video/3gpp";
|
|
89
|
+
readonly '.3g2': "video/3gpp2";
|
|
90
|
+
readonly '.7z': "application/x-7z-compressed";
|
|
91
|
+
};
|
|
92
|
+
type MimeTypeExt = keyof typeof mimeTypes;
|
|
93
|
+
const MimeTypesObj: {
|
|
94
|
+
readonly '.aac': "audio/aac";
|
|
95
|
+
readonly '.abw': "application/x-abiword";
|
|
96
|
+
readonly '.arc': "application/x-freearc";
|
|
97
|
+
readonly '.avi': "video/x-msvideo";
|
|
98
|
+
readonly '.azw': "application/vnd.amazon.ebook";
|
|
99
|
+
readonly '.bin': "application/octet-stream";
|
|
100
|
+
readonly '.bmp': "image/bmp";
|
|
101
|
+
readonly '.bz': "application/x-bzip";
|
|
102
|
+
readonly '.bz2': "application/x-bzip2";
|
|
103
|
+
readonly '.csh': "application/x-csh";
|
|
104
|
+
readonly '.css': "text/css";
|
|
105
|
+
readonly '.csv': "text/csv";
|
|
106
|
+
readonly '.doc': "application/msword";
|
|
107
|
+
readonly '.docx': "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
108
|
+
readonly '.eot': "application/vnd.ms-fontobject";
|
|
109
|
+
readonly '.epub': "application/epub+zip";
|
|
110
|
+
readonly '.gz': "application/gzip";
|
|
111
|
+
readonly '.gif': "image/gif";
|
|
112
|
+
readonly '.htm': "text/html";
|
|
113
|
+
readonly '.html': "text/html";
|
|
114
|
+
readonly '.ico': "image/vnd.microsoft.icon";
|
|
115
|
+
readonly '.ics': "text/calendar";
|
|
116
|
+
readonly '.jar': "application/java-archive";
|
|
117
|
+
readonly '.jpeg': "image/jpeg";
|
|
118
|
+
readonly '.jpg': "image/jpeg";
|
|
119
|
+
readonly '.js': "text/javascript";
|
|
120
|
+
readonly '.json': "application/json";
|
|
121
|
+
readonly '.jsonld': "application/ld+json";
|
|
122
|
+
readonly '.mid': "application/midi";
|
|
123
|
+
readonly '.midi': "application/midi";
|
|
124
|
+
readonly '.mjs': "text/javascript";
|
|
125
|
+
readonly '.mp3': "audio/mpeg";
|
|
126
|
+
readonly '.mp4': "video/mp4";
|
|
127
|
+
readonly '.mpeg': "video/mpeg";
|
|
128
|
+
readonly '.mpkg': "application/vnd.apple.installer+xml";
|
|
129
|
+
readonly '.odp': "application/vnd.oasis.opendocument.presentation";
|
|
130
|
+
readonly '.ods': "application/vnd.oasis.opendocument.spreadsheet";
|
|
131
|
+
readonly '.odt': "application/vnd.oasis.opendocument.text";
|
|
132
|
+
readonly '.oga': "audio/ogg";
|
|
133
|
+
readonly '.ogg': "audio/ogg";
|
|
134
|
+
readonly '.ogv': "video/ogg";
|
|
135
|
+
readonly '.ogx': "application/ogg";
|
|
136
|
+
readonly '.opus': "audio/opus";
|
|
137
|
+
readonly '.otf': "font/otf";
|
|
138
|
+
readonly '.png': "image/png";
|
|
139
|
+
readonly '.pdf': "application/pdf";
|
|
140
|
+
readonly '.php': "application/php";
|
|
141
|
+
readonly '.ppt': "application/vnd.ms-powerpoint";
|
|
142
|
+
readonly '.pptx': "application/vnd.openxmlformats-officedocument.presentationml.presentation";
|
|
143
|
+
readonly '.rar': "application/vnd.rar";
|
|
144
|
+
readonly '.rtf': "application/rtf";
|
|
145
|
+
readonly '.sh': "application/x-sh";
|
|
146
|
+
readonly '.svg': "image/svg+xml";
|
|
147
|
+
readonly '.swf': "application/x-shockwave-flash";
|
|
148
|
+
readonly '.tar': "application/x-tar";
|
|
149
|
+
readonly '.tif': "image/tiff";
|
|
150
|
+
readonly '.tiff': "image/tiff";
|
|
151
|
+
readonly '.ts': "video/mp2t";
|
|
152
|
+
readonly '.ttf': "font/ttf";
|
|
153
|
+
readonly '.txt': "text/plain";
|
|
154
|
+
readonly '.vsd': "application/vnd.visio";
|
|
155
|
+
readonly '.wav': "audio/wav";
|
|
156
|
+
readonly '.weba': "audio/webm";
|
|
157
|
+
readonly '.webm': "video/webm";
|
|
158
|
+
readonly '.webp': "image/webp";
|
|
159
|
+
readonly '.woff': "font/woff";
|
|
160
|
+
readonly '.woff2': "font/woff2";
|
|
161
|
+
readonly '.xhtml': "application/xhtml+xml";
|
|
162
|
+
readonly '.xls': "application/vnd.ms-excel";
|
|
163
|
+
readonly '.xlsx': "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
164
|
+
readonly '.xml': "application/xml";
|
|
165
|
+
readonly '.xul': "application/vnd.mozilla.xul+xml";
|
|
166
|
+
readonly '.zip': "application/zip";
|
|
167
|
+
readonly '.3gp': "video/3gpp";
|
|
168
|
+
readonly '.3g2': "video/3gpp2";
|
|
169
|
+
readonly '.7z': "application/x-7z-compressed";
|
|
170
|
+
};
|
|
171
|
+
type ContentTypeKeys = keyof typeof mimeTypes;
|
|
172
|
+
type ContentType = (typeof mimeTypes)[ContentTypeKeys] | 'multipart/form-data';
|
|
173
|
+
/**
|
|
174
|
+
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types
|
|
175
|
+
*/
|
|
176
|
+
type MediaType = 'text' | 'image' | 'audio' | 'font' | 'video' | 'application' | 'multipart' | 'message' | 'model';
|
|
177
|
+
const MediaTypeAllArr: MediaType[];
|
|
178
|
+
interface UploadedBackendFile {
|
|
179
|
+
data: any | Buffer;
|
|
180
|
+
encoding: string;
|
|
181
|
+
md5: string;
|
|
182
|
+
tempFilePath: string;
|
|
183
|
+
mimetype: ContentType;
|
|
184
|
+
mv: (path: any, callback: any) => any;
|
|
185
|
+
name: string;
|
|
186
|
+
truncated: boolean;
|
|
187
|
+
}
|
|
188
|
+
}
|