virmator 3.0.5 → 4.0.0
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 -14
- package/base-configs/base-cspell.js +83 -0
- package/base-configs/base-mocharc.js +14 -0
- package/{configs/.virmator/prettierrc-base.js → base-configs/base-prettierrc.js} +0 -0
- package/{configs/.virmator/tsconfig-base.json → base-configs/base-tsconfig.json} +0 -6
- package/{configs/.virmator/vite-base.ts → base-configs/base-vite.ts} +0 -0
- package/base-configs/test-files-glob.js +5 -0
- package/{configs/.virmator → base-configs}/vite-always-reload-plugin.ts +5 -3
- package/{configs/.virmator → base-configs}/web-test-runner-base.mjs +4 -5
- package/configs/.gitattributes +1 -0
- package/configs/.nvmrc +1 -0
- package/configs/.prettierignore +1 -1
- package/configs/.prettierrc.js +1 -1
- package/configs/{.mocharc.js → configs/.mocharc.js} +1 -1
- package/configs/{.virmator → configs}/vite.config.ts +1 -1
- package/configs/{.virmator → configs}/web-test-runner.config.mjs +1 -1
- package/configs/cspell.config.js +9 -0
- package/configs/gitignore.txt +1 -0
- package/configs/npmignore.txt +1 -0
- package/configs/package.json +9 -5
- package/configs/tsconfig.json +1 -1
- package/cspell.config.js +11 -0
- package/dist/{cli → api}/cli-color.d.ts +1 -0
- package/dist/{cli → api}/cli-color.js +1 -0
- package/dist/api/command/command-configs.d.ts +3 -0
- package/dist/api/command/command-configs.js +11 -0
- package/dist/api/command/command-description.d.ts +8 -0
- package/dist/{cli/cli-command/cli-command-help.js → api/command/command-description.js} +0 -0
- package/dist/api/command/command-executor.d.ts +28 -0
- package/dist/api/command/command-executor.js +7 -0
- package/dist/api/command/command-help.d.ts +8 -0
- package/dist/{package-name.js → api/command/command-help.js} +0 -2
- package/dist/api/command/command-logging.d.ts +11 -0
- package/dist/api/command/command-logging.js +17 -0
- package/dist/api/command/command-mapping.d.ts +7 -0
- package/dist/api/command/command-mapping.js +10 -0
- package/dist/api/command/command-messages.d.ts +1 -0
- package/dist/api/command/command-messages.js +10 -0
- package/dist/api/command/command-to-help-message.d.ts +9 -0
- package/dist/{cli/cli-command/cli-command-to-help-message.js → api/command/command-to-help-message.js} +41 -48
- package/dist/api/command/define-command-inputs.d.ts +14 -0
- package/dist/api/command/define-command-inputs.js +2 -0
- package/dist/api/command/define-command.d.ts +8 -0
- package/dist/api/command/define-command.js +25 -0
- package/dist/api/config/config-file-definition.d.ts +16 -0
- package/dist/api/config/config-file-definition.js +2 -0
- package/dist/api/config/config-paths.d.ts +7 -0
- package/dist/api/config/config-paths.js +8 -0
- package/dist/{cli → api}/config/copy-config.d.ts +5 -4
- package/dist/{cli → api}/config/copy-config.js +26 -28
- package/dist/api/create-virmator.d.ts +8 -0
- package/dist/api/create-virmator.js +65 -0
- package/dist/api/run-command/check-npm-deps.d.ts +7 -0
- package/dist/api/run-command/check-npm-deps.js +107 -0
- package/dist/api/run-command/extract-arguments.d.ts +6 -0
- package/dist/api/run-command/extract-arguments.js +37 -0
- package/dist/api/run-command/run-command-executor.d.ts +5 -0
- package/dist/api/run-command/run-command-executor.js +51 -0
- package/dist/api/run-command/run-extended-virmator.d.ts +10 -0
- package/dist/api/run-command/run-extended-virmator.js +53 -0
- package/dist/{cli/cli-command → api/run-command}/run-shell-command.d.ts +3 -3
- package/dist/{cli/cli-command → api/run-command}/run-shell-command.js +3 -3
- package/dist/api/virmator-types.d.ts +18 -0
- package/dist/api/virmator-types.js +2 -0
- package/dist/augments/fs.d.ts +5 -2
- package/dist/augments/fs.js +20 -8
- package/dist/augments/object.d.ts +3 -0
- package/dist/augments/object.js +33 -2
- package/dist/augments/path.d.ts +1 -0
- package/dist/augments/path.js +14 -0
- package/dist/augments/prettier.d.ts +1 -0
- package/dist/augments/prettier.js +47 -0
- package/dist/augments/string.d.ts +2 -0
- package/dist/augments/string.js +10 -0
- package/dist/augments/test.d.ts +2 -1
- package/dist/augments/test.js +7 -3
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +5 -0
- package/dist/{cli/cli-command-implementations → commands}/code-in-markdown.command.d.ts +3 -1
- package/dist/{cli/cli-command-implementations → commands}/code-in-markdown.command.js +23 -24
- package/dist/commands/compile.command.d.ts +14 -0
- package/dist/commands/compile.command.js +54 -0
- package/dist/commands/extra-configs/all-extra-configs.d.ts +2 -0
- package/dist/commands/extra-configs/all-extra-configs.js +44 -0
- package/dist/commands/extra-configs/combine-json-config.d.ts +2 -0
- package/dist/commands/extra-configs/combine-json-config.js +22 -0
- package/dist/commands/extra-configs/combine-text-config.d.ts +2 -0
- package/dist/{cli/config → commands/extra-configs}/combine-text-config.js +5 -5
- package/dist/{cli/config → commands/extra-configs}/create-default-package-json.d.ts +0 -0
- package/dist/{cli/config → commands/extra-configs}/create-default-package-json.js +30 -18
- package/dist/commands/format.command.d.ts +19 -0
- package/dist/{cli/cli-command-implementations → commands}/format.command.js +59 -33
- package/dist/commands/frontend.command.d.ts +15 -0
- package/dist/commands/frontend.command.js +78 -0
- package/dist/commands/init.command.d.ts +8 -0
- package/dist/commands/init.command.js +53 -0
- package/dist/commands/spellcheck.command.d.ts +12 -0
- package/dist/commands/spellcheck.command.js +54 -0
- package/dist/commands/test-web.command.d.ts +12 -0
- package/dist/commands/test-web.command.js +68 -0
- package/dist/commands/test.command.d.ts +12 -0
- package/dist/commands/test.command.js +67 -0
- package/dist/{cli/cli-command-implementations → commands}/update-configs.command.d.ts +3 -1
- package/dist/{cli/cli-command-implementations → commands}/update-configs.command.js +14 -10
- package/dist/file-paths/{virmator-package-paths.d.ts → package-paths.d.ts} +1 -1
- package/dist/file-paths/{virmator-package-paths.js → package-paths.js} +3 -4
- package/dist/index.d.ts +134 -1
- package/dist/index.js +55 -0
- package/dist/scripts/save-help-message.d.ts +1 -0
- package/dist/scripts/save-help-message.js +33 -0
- package/package.json +33 -28
- package/.gitattributes +0 -1
- package/.github/workflows/virmator-build-for-gh-pages.yml +0 -24
- package/.github/workflows/virmator-tagged-release.yml +0 -42
- package/.github/workflows/virmator-tests.yml +0 -26
- package/.mocharc.js +0 -9
- package/.prettierignore +0 -5
- package/configs/.cspell.json +0 -4
- package/configs/.virmator/.cspell-base.json +0 -81
- package/configs/.virmator/mocharc-base.js +0 -15
- package/configs/src/global.d.ts +0 -5
- package/dist/api/virmator-wrapper.d.ts +0 -5
- package/dist/api/virmator-wrapper.js +0 -9
- package/dist/cli/all-cli-command-definitions.d.ts +0 -56
- package/dist/cli/all-cli-command-definitions.js +0 -76
- package/dist/cli/cli-command/cli-command-help.d.ts +0 -8
- package/dist/cli/cli-command/cli-command-to-help-message.d.ts +0 -11
- package/dist/cli/cli-command/define-cli-command.d.ts +0 -41
- package/dist/cli/cli-command/define-cli-command.js +0 -29
- package/dist/cli/cli-command-implementations/compile.command.d.ts +0 -6
- package/dist/cli/cli-command-implementations/compile.command.js +0 -44
- package/dist/cli/cli-command-implementations/format.command.d.ts +0 -6
- package/dist/cli/cli-command-implementations/frontend.command.d.ts +0 -7
- package/dist/cli/cli-command-implementations/frontend.command.js +0 -45
- package/dist/cli/cli-command-implementations/init.command.d.ts +0 -6
- package/dist/cli/cli-command-implementations/init.command.js +0 -42
- package/dist/cli/cli-command-implementations/spellcheck.command.d.ts +0 -4
- package/dist/cli/cli-command-implementations/spellcheck.command.js +0 -40
- package/dist/cli/cli-command-implementations/test-web.command.d.ts +0 -4
- package/dist/cli/cli-command-implementations/test-web.command.js +0 -50
- package/dist/cli/cli-command-implementations/test.command.d.ts +0 -4
- package/dist/cli/cli-command-implementations/test.command.js +0 -53
- package/dist/cli/cli-flags/cli-flag-name.d.ts +0 -4
- package/dist/cli/cli-flags/cli-flag-name.js +0 -8
- package/dist/cli/cli-flags/cli-flag-values.d.ts +0 -4
- package/dist/cli/cli-flags/cli-flag-values.js +0 -19
- package/dist/cli/cli-messages.d.ts +0 -6
- package/dist/cli/cli-messages.js +0 -19
- package/dist/cli/cli.d.ts +0 -2
- package/dist/cli/cli.js +0 -54
- package/dist/cli/config/combine-text-config.d.ts +0 -2
- package/dist/cli/config/config-files.d.ts +0 -133
- package/dist/cli/config/config-files.js +0 -138
- package/dist/cli/is-global.d.ts +0 -1
- package/dist/cli/is-global.js +0 -10
- package/dist/cli/parse-arguments.d.ts +0 -8
- package/dist/cli/parse-arguments.js +0 -42
- package/dist/cli/run-cli-command.d.ts +0 -13
- package/dist/cli/run-cli-command.js +0 -52
- package/dist/cli/run-command.test-helper.d.ts +0 -28
- package/dist/cli/run-command.test-helper.js +0 -87
- package/dist/errors/virmator-cli.error.d.ts +0 -3
- package/dist/errors/virmator-cli.error.js +0 -10
- package/dist/errors/virmator-config-file.error.d.ts +0 -4
- package/dist/errors/virmator-config-file.error.js +0 -11
- package/dist/errors/virmator-invalid-command.error.d.ts +0 -5
- package/dist/errors/virmator-invalid-command.error.js +0 -11
- package/dist/errors/virmator-invalid-flags.error.d.ts +0 -5
- package/dist/errors/virmator-invalid-flags.error.js +0 -13
- package/dist/file-paths/repo-paths.d.ts +0 -2
- package/dist/file-paths/repo-paths.js +0 -6
- package/dist/file-paths/virmator-test-file-paths.d.ts +0 -44
- package/dist/logging.d.ts +0 -10
- package/dist/logging.js +0 -9
- package/dist/package-name.d.ts +0 -1
package/README.md
CHANGED
|
@@ -26,16 +26,6 @@ Below is full documentation for the cli, which is generated via the cli's `help`
|
|
|
26
26
|
|
|
27
27
|
`npx` is needed when the command is run directly from the terminal (not scoped within an npm script) unless the package has been globally installed (which will work just fine but I wouldn't recommend, simply because I prefer explicit dependencies).
|
|
28
28
|
|
|
29
|
-
# Available flags
|
|
30
|
-
|
|
31
|
-
## `--help`
|
|
32
|
-
|
|
33
|
-
Prints this help message.
|
|
34
|
-
|
|
35
|
-
## `--silent`
|
|
36
|
-
|
|
37
|
-
Turns off most logging.
|
|
38
|
-
|
|
39
29
|
# Available commands
|
|
40
30
|
|
|
41
31
|
## code-in-markdown
|
|
@@ -118,16 +108,13 @@ Builds and bundles the frontend for deployment.
|
|
|
118
108
|
|
|
119
109
|
Builds and previews the built output.
|
|
120
110
|
|
|
121
|
-
## help
|
|
122
|
-
|
|
123
|
-
Prints this help output.
|
|
124
|
-
|
|
125
111
|
## init
|
|
126
112
|
|
|
127
113
|
Initialize a repo with all virmator config files.
|
|
128
114
|
|
|
129
115
|
### Examples
|
|
130
116
|
|
|
117
|
+
- run init: `virmator init`
|
|
131
118
|
- run init and force all configs to be written: `virmator init force`
|
|
132
119
|
|
|
133
120
|
### force
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
const baseConfig = {
|
|
2
|
+
ignorePaths: [
|
|
3
|
+
'.DS_Store',
|
|
4
|
+
'.git/',
|
|
5
|
+
'*.sqlite',
|
|
6
|
+
'*.tgz',
|
|
7
|
+
'dist/',
|
|
8
|
+
'node_modules/',
|
|
9
|
+
'package-lock.json',
|
|
10
|
+
],
|
|
11
|
+
version: '0.2',
|
|
12
|
+
words: [
|
|
13
|
+
'accum',
|
|
14
|
+
'argb',
|
|
15
|
+
'autofix',
|
|
16
|
+
'autofixable',
|
|
17
|
+
'autofixing',
|
|
18
|
+
'browserconfig',
|
|
19
|
+
'combinator',
|
|
20
|
+
'combinators',
|
|
21
|
+
"config's",
|
|
22
|
+
'cpsell',
|
|
23
|
+
'derp',
|
|
24
|
+
'derpy',
|
|
25
|
+
'electrovir',
|
|
26
|
+
'entrypoint',
|
|
27
|
+
'entrypoints',
|
|
28
|
+
'esbenp',
|
|
29
|
+
'esbuild',
|
|
30
|
+
'esbuild',
|
|
31
|
+
'estree',
|
|
32
|
+
'fleek',
|
|
33
|
+
'gitattributes',
|
|
34
|
+
'globbing',
|
|
35
|
+
'globstar',
|
|
36
|
+
'inconsolata',
|
|
37
|
+
'jillsoffice',
|
|
38
|
+
'lexend',
|
|
39
|
+
'lfsr',
|
|
40
|
+
'locationchange',
|
|
41
|
+
'marvinpinto',
|
|
42
|
+
'mmultiline',
|
|
43
|
+
'mocharc',
|
|
44
|
+
'monospace',
|
|
45
|
+
'msapplication',
|
|
46
|
+
'mstile',
|
|
47
|
+
'nojekyll',
|
|
48
|
+
'noopener',
|
|
49
|
+
'noreferrer',
|
|
50
|
+
'npmignore',
|
|
51
|
+
'packagejson',
|
|
52
|
+
'parens',
|
|
53
|
+
'pdfs',
|
|
54
|
+
'postupgrade',
|
|
55
|
+
'prettierignore',
|
|
56
|
+
'prettierrc',
|
|
57
|
+
'preupgrade',
|
|
58
|
+
'protobuf',
|
|
59
|
+
'pushstate',
|
|
60
|
+
'replacestate',
|
|
61
|
+
"repo's",
|
|
62
|
+
'repos',
|
|
63
|
+
'rgba',
|
|
64
|
+
'sonarjs',
|
|
65
|
+
'stackoverflow',
|
|
66
|
+
'stylelint',
|
|
67
|
+
'stylelintrc',
|
|
68
|
+
'tabbable',
|
|
69
|
+
'tabindex',
|
|
70
|
+
'thingie',
|
|
71
|
+
'threejs',
|
|
72
|
+
'transpiled',
|
|
73
|
+
'transpiling',
|
|
74
|
+
'typeof',
|
|
75
|
+
"virmator's",
|
|
76
|
+
'virmator',
|
|
77
|
+
'vite',
|
|
78
|
+
'vitejs',
|
|
79
|
+
'xlink',
|
|
80
|
+
],
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
module.exports = {baseConfig};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const testFiles = require('./test-files-glob.js');
|
|
2
|
+
|
|
3
|
+
/** @type {import('mocha').MochaOptions} */
|
|
4
|
+
const mochaConfig = {
|
|
5
|
+
checkLeaks: true,
|
|
6
|
+
color: true,
|
|
7
|
+
parallel: true,
|
|
8
|
+
require: 'ts-node/register',
|
|
9
|
+
slow: 1_500, // ms
|
|
10
|
+
timeout: 60_000, // 1 minute in ms
|
|
11
|
+
...testFiles,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
module.exports = mochaConfig;
|
|
File without changes
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {styles} from 'ansi-colors';
|
|
2
2
|
import {existsSync, lstatSync, readlinkSync} from 'fs';
|
|
3
3
|
import {relative} from 'path';
|
|
4
4
|
import {PluginOption} from 'vite';
|
|
@@ -60,7 +60,9 @@ export function alwaysReloadPlugin(
|
|
|
60
60
|
path: '*',
|
|
61
61
|
});
|
|
62
62
|
logger.info(
|
|
63
|
-
`${
|
|
63
|
+
`${styles.green.open}page reload ${styles.dim.open}${relative(root, path)}${
|
|
64
|
+
styles.reset.open
|
|
65
|
+
}`,
|
|
64
66
|
{clear: true, timestamp: true},
|
|
65
67
|
);
|
|
66
68
|
/**
|
|
@@ -76,8 +78,8 @@ export function alwaysReloadPlugin(
|
|
|
76
78
|
if (exclusions.length) {
|
|
77
79
|
watcher.unwatch(mapToActualPaths(exclusions));
|
|
78
80
|
// ignore macOS file system metadata stuff
|
|
79
|
-
watcher.unwatch('./**/.DS_Store');
|
|
80
81
|
}
|
|
82
|
+
watcher.unwatch('./**/.DS_Store');
|
|
81
83
|
if (inclusions.length) {
|
|
82
84
|
watcher.add(inclusions);
|
|
83
85
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {esbuildPlugin} from '@web/dev-server-esbuild';
|
|
2
2
|
import {playwrightLauncher} from '@web/test-runner-playwright';
|
|
3
|
-
import
|
|
3
|
+
import testFiles from './test-files-glob.js';
|
|
4
4
|
|
|
5
5
|
/** @type {import('@web/test-runner').TestRunnerConfig} */
|
|
6
6
|
const webTestRunnerConfig = {
|
|
@@ -10,18 +10,17 @@ const webTestRunnerConfig = {
|
|
|
10
10
|
playwrightLauncher({product: 'webkit'}),
|
|
11
11
|
],
|
|
12
12
|
// 2 minutes cause GitHub Actions be slow
|
|
13
|
-
browserStartTimeout:
|
|
13
|
+
browserStartTimeout: 120_000,
|
|
14
14
|
concurrentBrowsers: 3,
|
|
15
15
|
coverage: true,
|
|
16
16
|
files: [
|
|
17
|
-
|
|
17
|
+
testFiles.spec,
|
|
18
18
|
],
|
|
19
19
|
nodeResolve: true,
|
|
20
20
|
plugins: [esbuildPlugin({ts: true})],
|
|
21
21
|
testFramework: {
|
|
22
22
|
config: {
|
|
23
|
-
|
|
24
|
-
// timeout: 100000,
|
|
23
|
+
timeout: 120_000,
|
|
25
24
|
},
|
|
26
25
|
},
|
|
27
26
|
};
|
package/configs/.gitattributes
CHANGED
package/configs/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
16
|
package/configs/.prettierignore
CHANGED
package/configs/.prettierrc.js
CHANGED
package/configs/gitignore.txt
CHANGED
package/configs/npmignore.txt
CHANGED
package/configs/package.json
CHANGED
|
@@ -3,14 +3,18 @@
|
|
|
3
3
|
"main": "dist/index.js",
|
|
4
4
|
"types": "dist/index.d.ts",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"
|
|
6
|
+
"build": "virmator frontend build",
|
|
7
|
+
"compile": "rm -rf dist && virmator compile",
|
|
8
|
+
"docs:check": "virmator code-in-markdown check",
|
|
7
9
|
"docs:update": "virmator code-in-markdown",
|
|
8
|
-
"format": "virmator format
|
|
10
|
+
"format": "virmator format",
|
|
9
11
|
"prepublishOnly": "npm run compile && npm run test:full",
|
|
12
|
+
"preview": "virmator frontend preview",
|
|
10
13
|
"spellcheck": "virmator spellcheck",
|
|
11
|
-
"start": "npm install &&
|
|
14
|
+
"start": "npm install && virmator frontend",
|
|
12
15
|
"test": "virmator test",
|
|
13
|
-
"test:full": "npm run test:types && npm test && npm run spellcheck && virmator format check",
|
|
14
|
-
"test:types": "tsc --noEmit"
|
|
16
|
+
"test:full": "npm run test:types && npm test && npm run spellcheck && virmator format check && npm run docs:check",
|
|
17
|
+
"test:types": "tsc --noEmit",
|
|
18
|
+
"test:web": "virmator test-web"
|
|
15
19
|
}
|
|
16
20
|
}
|
package/configs/tsconfig.json
CHANGED
package/cspell.config.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const {baseConfig} = require('./base-configs/base-cspell.js');
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
...baseConfig,
|
|
5
|
+
ignorePaths: [
|
|
6
|
+
...baseConfig.ignorePaths,
|
|
7
|
+
'./test-files/spellcheck/bad',
|
|
8
|
+
'./test-files/expected-output.json',
|
|
9
|
+
],
|
|
10
|
+
words: [...baseConfig.words],
|
|
11
|
+
};
|
|
@@ -4,6 +4,7 @@ exports.Color = void 0;
|
|
|
4
4
|
const ansi_colors_1 = require("ansi-colors");
|
|
5
5
|
exports.Color = {
|
|
6
6
|
Info: ansi_colors_1.styles.blue.open,
|
|
7
|
+
Faint: ansi_colors_1.styles.gray.open,
|
|
7
8
|
Fail: ansi_colors_1.styles.red.open,
|
|
8
9
|
Warn: ansi_colors_1.styles.yellow.open,
|
|
9
10
|
Success: ansi_colors_1.styles.green.open,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractAllConfigs = void 0;
|
|
4
|
+
const augment_vir_1 = require("augment-vir");
|
|
5
|
+
function extractAllConfigs(commandMapping) {
|
|
6
|
+
const configFiles = (0, augment_vir_1.getObjectTypedValues)(commandMapping)
|
|
7
|
+
.map((commandDefinition) => (0, augment_vir_1.getObjectTypedValues)(commandDefinition.configFiles))
|
|
8
|
+
.flat();
|
|
9
|
+
return configFiles;
|
|
10
|
+
}
|
|
11
|
+
exports.extractAllConfigs = extractAllConfigs;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CommandDescription } from './command-help';
|
|
2
|
+
import { DefineCommandInputs, SubCommandsMap } from './define-command-inputs';
|
|
3
|
+
export declare type CreateDescriptionsInputs<DefineCommandInputsGeneric extends DefineCommandInputs> = Pick<DefineCommandInputsGeneric, 'commandName'> & {
|
|
4
|
+
packageBinName: string;
|
|
5
|
+
subCommands: SubCommandsMap<DefineCommandInputsGeneric>;
|
|
6
|
+
configFiles: DefineCommandInputsGeneric['configFiles'];
|
|
7
|
+
};
|
|
8
|
+
export declare type CreateDescriptionsCallback<DefineCommandInputsGeneric extends DefineCommandInputs> = (inputs: CreateDescriptionsInputs<DefineCommandInputsGeneric>) => CommandDescription;
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ConfigFileDefinition } from '../config/config-file-definition';
|
|
2
|
+
import { CommandLogging, CommandLogTransforms } from './command-logging';
|
|
3
|
+
import { DefineCommandInputs, SharedExecutorInputsAndCommandDefinition } from './define-command-inputs';
|
|
4
|
+
export declare type CommandExecutorInputs<DefineCommandInputsGeneric extends DefineCommandInputs = DefineCommandInputs> = {
|
|
5
|
+
filteredInputArgs: string[];
|
|
6
|
+
inputSubCommands: (keyof DefineCommandInputsGeneric['subCommandDescriptions'])[];
|
|
7
|
+
repoDir: string;
|
|
8
|
+
allConfigs: ReadonlyArray<ConfigFileDefinition>;
|
|
9
|
+
packageDir: string;
|
|
10
|
+
logging: CommandLogging;
|
|
11
|
+
};
|
|
12
|
+
export declare type CommandExecutorDefinitionInputs<DefineCommandInputsGeneric extends DefineCommandInputs = DefineCommandInputs> = CommandExecutorInputs<DefineCommandInputsGeneric> & SharedExecutorInputsAndCommandDefinition<DefineCommandInputsGeneric>;
|
|
13
|
+
export declare type DetailedArg = {
|
|
14
|
+
arg: string;
|
|
15
|
+
skipWindowsInterpolation: true;
|
|
16
|
+
};
|
|
17
|
+
export declare type SuccessOnlyExecutorOutput = {
|
|
18
|
+
success: boolean;
|
|
19
|
+
};
|
|
20
|
+
export declare type BashCommandExecutorOutput = {
|
|
21
|
+
mainCommand: string;
|
|
22
|
+
logTransforms?: CommandLogTransforms;
|
|
23
|
+
args: (string | DetailedArg)[];
|
|
24
|
+
};
|
|
25
|
+
export declare function isCompletedExecutor(executorOutput: CommandExecutorOutput): executorOutput is SuccessOnlyExecutorOutput;
|
|
26
|
+
export declare type CommandExecutorOutput = BashCommandExecutorOutput | SuccessOnlyExecutorOutput;
|
|
27
|
+
export declare type CommandExecutorDefinition<DefineCommandInputsGeneric extends DefineCommandInputs> = (inputs: CommandExecutorDefinitionInputs<DefineCommandInputsGeneric>) => Promise<CommandExecutorOutput> | CommandExecutorOutput;
|
|
28
|
+
export declare type CommandExecutor<DefineCommandInputsGeneric extends DefineCommandInputs> = (inputs: CommandExecutorInputs<DefineCommandInputsGeneric>) => Promise<CommandExecutorOutput> | CommandExecutorOutput;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare type CommandLogCallback = (thingToLog: string) => void;
|
|
2
|
+
export declare type CommandLogging = {
|
|
3
|
+
stdout: CommandLogCallback;
|
|
4
|
+
stderr: CommandLogCallback;
|
|
5
|
+
};
|
|
6
|
+
export declare const noCommandLogging: Readonly<Required<CommandLogging>>;
|
|
7
|
+
export declare const defaultConsoleLogging: Readonly<Required<CommandLogging>>;
|
|
8
|
+
export declare type CommandLogs = Record<keyof CommandLogging, string>;
|
|
9
|
+
export declare const identityCommandLogTransform: CommandLogTransform;
|
|
10
|
+
export declare type CommandLogTransform = (thingToTransform: string) => string;
|
|
11
|
+
export declare type CommandLogTransforms = Partial<Record<keyof CommandLogging, CommandLogTransform>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.identityCommandLogTransform = exports.defaultConsoleLogging = exports.noCommandLogging = void 0;
|
|
4
|
+
exports.noCommandLogging = {
|
|
5
|
+
stderr: () => { },
|
|
6
|
+
stdout: () => { },
|
|
7
|
+
};
|
|
8
|
+
exports.defaultConsoleLogging = {
|
|
9
|
+
stdout: (input) => {
|
|
10
|
+
console.log(input.replace(/\n$/, ''));
|
|
11
|
+
},
|
|
12
|
+
stderr: (input) => {
|
|
13
|
+
console.error(input.replace(/\n$/, ''));
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
const identityCommandLogTransform = (input) => input;
|
|
17
|
+
exports.identityCommandLogTransform = identityCommandLogTransform;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ArrayElement } from 'augment-vir';
|
|
2
|
+
import { CommandDefinition } from './define-command';
|
|
3
|
+
export declare type CommandMapping = Record<string, CommandDefinition>;
|
|
4
|
+
export declare function commandsToMapping(commands: ReadonlyArray<CommandDefinition>): Readonly<CommandMapping>;
|
|
5
|
+
export declare type CommandDefinitionArrayToMapping<DefinitionArray extends ReadonlyArray<CommandDefinition>> = {
|
|
6
|
+
[CommandName in ArrayElement<DefinitionArray>['commandName']]: CommandDefinition;
|
|
7
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.commandsToMapping = void 0;
|
|
4
|
+
function commandsToMapping(commands) {
|
|
5
|
+
return commands.reduce((mapping, currentCommandDefinition) => {
|
|
6
|
+
mapping[currentCommandDefinition.commandName] = currentCommandDefinition;
|
|
7
|
+
return mapping;
|
|
8
|
+
}, {});
|
|
9
|
+
}
|
|
10
|
+
exports.commandsToMapping = commandsToMapping;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getCommandResultMessage(commandName: string, success: boolean): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCommandResultMessage = void 0;
|
|
4
|
+
const cli_color_1 = require("../cli-color");
|
|
5
|
+
function getCommandResultMessage(commandName, success) {
|
|
6
|
+
const specificColor = success ? cli_color_1.Color.Success : cli_color_1.Color.Fail;
|
|
7
|
+
const specificPhrase = success ? 'succeeded' : 'failed';
|
|
8
|
+
return `${cli_color_1.Color.Bold}${specificColor}${commandName} ${specificPhrase}.${cli_color_1.Color.Reset}`;
|
|
9
|
+
}
|
|
10
|
+
exports.getCommandResultMessage = getCommandResultMessage;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CommandMapping } from './command-mapping';
|
|
2
|
+
import { CommandDefinition } from './define-command';
|
|
3
|
+
export declare enum HelpMessageSyntax {
|
|
4
|
+
Cli = "cli",
|
|
5
|
+
Markdown = "markdown"
|
|
6
|
+
}
|
|
7
|
+
export declare function generateHelpMessage(packageBinName: string, commandDefinitions: Readonly<CommandMapping>, syntax: HelpMessageSyntax, cliWrapIfMoreThanThisManyColumns?: number): string;
|
|
8
|
+
export declare function flagToHelpString(flagName: string, description: string, syntax: HelpMessageSyntax): string;
|
|
9
|
+
export declare function commandToHelpString(packageBinName: string, commandDefinition: CommandDefinition, syntax: HelpMessageSyntax): string;
|