virmator 2.0.5 → 3.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/.github/workflows/virmator-build-for-gh-pages.yml +24 -0
- package/.github/workflows/virmator-tagged-release.yml +6 -4
- package/.github/workflows/virmator-tests.yml +4 -3
- package/.mocharc.js +9 -0
- package/.prettierignore +2 -3
- package/README.md +67 -82
- package/configs/.cspell.json +4 -0
- package/configs/.gitattributes +1 -0
- package/configs/.mocharc.js +8 -0
- package/configs/.prettierignore +6 -0
- package/configs/.prettierrc.js +13 -0
- package/{.cspell.json → configs/.virmator/.cspell-base.json} +5 -0
- package/configs/.virmator/mocharc-base.js +15 -0
- package/configs/.virmator/prettierrc-base.js +62 -0
- package/{tsconfig.json → configs/.virmator/tsconfig-base.json} +12 -8
- package/configs/.virmator/vite-always-reload-plugin.ts +90 -0
- package/configs/.virmator/vite-base.ts +11 -0
- package/configs/.virmator/vite.config.ts +8 -0
- package/configs/.virmator/web-test-runner-base.mjs +29 -0
- package/configs/.virmator/web-test-runner.config.mjs +8 -0
- package/{.vscode → configs/.vscode}/settings.json +13 -0
- package/configs/gitignore.txt +6 -0
- package/configs/npmignore.txt +13 -0
- package/configs/package.json +16 -0
- package/configs/src/global.d.ts +5 -0
- package/configs/tsconfig.json +3 -0
- package/dist/api/virmator-wrapper.d.ts +5 -0
- package/dist/api/virmator-wrapper.js +9 -0
- package/dist/augments/array.d.ts +1 -0
- package/dist/augments/array.js +7 -0
- package/dist/augments/fs.d.ts +5 -0
- package/dist/augments/fs.js +30 -0
- package/dist/augments/json.d.ts +1 -0
- package/dist/augments/json.js +12 -0
- package/dist/augments/object.d.ts +1 -0
- package/dist/augments/object.js +14 -0
- package/dist/augments/regexp.d.ts +1 -0
- package/dist/augments/regexp.js +7 -0
- package/dist/augments/test.d.ts +2 -0
- package/dist/augments/test.js +8 -0
- package/dist/augments/type.d.ts +1 -0
- package/dist/augments/type.js +2 -0
- package/dist/cli/all-cli-command-definitions.d.ts +54 -0
- package/dist/cli/all-cli-command-definitions.js +76 -0
- package/dist/cli/cli-color.d.ts +8 -0
- package/dist/cli/cli-color.js +12 -0
- package/dist/cli/cli-command/cli-command-help.d.ts +8 -0
- package/dist/cli/cli-command/cli-command-help.js +2 -0
- package/dist/cli/{commands/description-printing.d.ts → cli-command/cli-command-to-help-message.d.ts} +3 -2
- package/dist/cli/{commands/description-printing.js → cli-command/cli-command-to-help-message.js} +55 -21
- package/dist/cli/cli-command/define-cli-command.d.ts +41 -0
- package/dist/cli/cli-command/define-cli-command.js +29 -0
- package/dist/cli/cli-command/run-shell-command.d.ts +8 -0
- package/dist/cli/cli-command/run-shell-command.js +23 -0
- package/dist/cli/cli-command-implementations/code-in-markdown.command.d.ts +6 -0
- package/dist/cli/cli-command-implementations/code-in-markdown.command.js +67 -0
- package/dist/cli/cli-command-implementations/compile.command.d.ts +6 -0
- package/dist/cli/cli-command-implementations/compile.command.js +44 -0
- package/dist/cli/cli-command-implementations/format.command.d.ts +6 -0
- package/dist/cli/cli-command-implementations/format.command.js +116 -0
- package/dist/cli/cli-command-implementations/frontend.command.d.ts +7 -0
- package/dist/cli/cli-command-implementations/frontend.command.js +45 -0
- package/dist/cli/cli-command-implementations/init.command.d.ts +4 -0
- package/dist/cli/cli-command-implementations/init.command.js +31 -0
- package/dist/cli/cli-command-implementations/spellcheck.command.d.ts +4 -0
- package/dist/cli/cli-command-implementations/spellcheck.command.js +40 -0
- package/dist/cli/cli-command-implementations/test-web.command.d.ts +4 -0
- package/dist/cli/cli-command-implementations/test-web.command.js +50 -0
- package/dist/cli/cli-command-implementations/test.command.d.ts +4 -0
- package/dist/cli/cli-command-implementations/test.command.js +53 -0
- package/dist/cli/cli-command-implementations/update-configs.command.d.ts +4 -0
- package/dist/cli/cli-command-implementations/update-configs.command.js +31 -0
- package/dist/cli/cli-flags/cli-flag-name.d.ts +4 -0
- package/dist/cli/cli-flags/cli-flag-name.js +8 -0
- package/dist/cli/cli-flags/cli-flag-values.d.ts +4 -0
- package/dist/cli/cli-flags/cli-flag-values.js +19 -0
- package/dist/cli/cli-messages.d.ts +6 -0
- package/dist/cli/cli-messages.js +19 -0
- package/dist/cli/cli.js +27 -20
- package/dist/cli/config/combine-text-config.d.ts +2 -0
- package/dist/cli/config/combine-text-config.js +27 -0
- package/dist/cli/config/config-files.d.ts +133 -0
- package/dist/cli/config/config-files.js +138 -0
- package/dist/cli/config/copy-config.d.ts +25 -13
- package/dist/cli/config/copy-config.js +86 -86
- package/dist/cli/config/create-default-package-json.d.ts +1 -16
- package/dist/cli/config/create-default-package-json.js +37 -12
- package/dist/cli/is-global.d.ts +1 -0
- package/dist/cli/is-global.js +10 -0
- package/dist/cli/parse-arguments.d.ts +8 -0
- package/dist/cli/parse-arguments.js +42 -0
- package/dist/cli/run-cli-command.d.ts +13 -0
- package/dist/cli/run-cli-command.js +52 -0
- package/dist/cli/run-command.test-helper.d.ts +28 -0
- package/dist/cli/run-command.test-helper.js +87 -0
- package/dist/errors/virmator-cli.error.d.ts +3 -0
- package/dist/errors/virmator-cli.error.js +10 -0
- package/dist/errors/virmator-config-file.error.d.ts +4 -0
- package/dist/errors/virmator-config-file.error.js +11 -0
- package/dist/errors/virmator-invalid-command.error.d.ts +5 -0
- package/dist/errors/virmator-invalid-command.error.js +11 -0
- package/dist/errors/virmator-invalid-flags.error.d.ts +5 -0
- package/dist/errors/virmator-invalid-flags.error.js +13 -0
- package/dist/file-paths/virmator-package-paths.d.ts +11 -0
- package/dist/file-paths/virmator-package-paths.js +31 -0
- package/dist/file-paths/virmator-test-file-paths.d.ts +17 -7
- package/dist/index.d.ts +1 -2
- package/dist/index.js +0 -4
- package/dist/logging.d.ts +10 -0
- package/dist/logging.js +9 -0
- package/package.json +28 -22
- package/.prettierrc.js +0 -40
- package/dist/augments/ansi-regex.d.ts +0 -1
- package/dist/augments/ansi-regex.js +0 -27
- package/dist/augments/string.d.ts +0 -1
- package/dist/augments/string.js +0 -8
- package/dist/cli/cli-util/cli-color.d.ts +0 -8
- package/dist/cli/cli-util/cli-color.js +0 -35
- package/dist/cli/cli-util/cli-command-name.d.ts +0 -11
- package/dist/cli/cli-util/cli-command-name.js +0 -15
- package/dist/cli/cli-util/cli-flags.d.ts +0 -18
- package/dist/cli/cli-util/cli-flags.js +0 -63
- package/dist/cli/cli-util/cli-messages.d.ts +0 -7
- package/dist/cli/cli-util/cli-messages.js +0 -19
- package/dist/cli/cli-util/get-all-command-output.d.ts +0 -7
- package/dist/cli/cli-util/get-all-command-output.js +0 -21
- package/dist/cli/cli-util/shell-command-wrapper.d.ts +0 -8
- package/dist/cli/cli-util/shell-command-wrapper.js +0 -25
- package/dist/cli/cli-util/update-configs.d.ts +0 -3
- package/dist/cli/cli-util/update-configs.js +0 -54
- package/dist/cli/commands/all-cli-commands.d.ts +0 -13
- package/dist/cli/commands/all-cli-commands.js +0 -99
- package/dist/cli/commands/cli-command.d.ts +0 -35
- package/dist/cli/commands/cli-command.js +0 -40
- package/dist/cli/commands/implementations/code-in-markdown.command.d.ts +0 -3
- package/dist/cli/commands/implementations/code-in-markdown.command.js +0 -54
- package/dist/cli/commands/implementations/compile.command.d.ts +0 -3
- package/dist/cli/commands/implementations/compile.command.js +0 -49
- package/dist/cli/commands/implementations/format.command.d.ts +0 -16
- package/dist/cli/commands/implementations/format.command.js +0 -143
- package/dist/cli/commands/implementations/init.command.d.ts +0 -3
- package/dist/cli/commands/implementations/init.command.js +0 -55
- package/dist/cli/commands/implementations/spellcheck.command.d.ts +0 -3
- package/dist/cli/commands/implementations/spellcheck.command.js +0 -35
- package/dist/cli/commands/implementations/test.command.d.ts +0 -3
- package/dist/cli/commands/implementations/test.command.js +0 -49
- package/dist/cli/commands/implementations/update-all-configs.command.d.ts +0 -3
- package/dist/cli/commands/implementations/update-all-configs.command.js +0 -46
- package/dist/cli/commands/implementations/update-bare-configs.command.d.ts +0 -3
- package/dist/cli/commands/implementations/update-bare-configs.command.js +0 -46
- package/dist/cli/commands/run-command.d.ts +0 -3
- package/dist/cli/commands/run-command.js +0 -65
- package/dist/cli/config/config-key.d.ts +0 -35
- package/dist/cli/config/config-key.js +0 -25
- package/dist/cli/config/config-paths.d.ts +0 -3
- package/dist/cli/config/config-paths.js +0 -69
- package/dist/cli/config/config-read.d.ts +0 -7
- package/dist/cli/config/config-read.js +0 -91
- package/dist/cli/config/extendable-config.d.ts +0 -12
- package/dist/cli/config/extendable-config.js +0 -45
- package/dist/errors/cli-command-error.d.ts +0 -4
- package/dist/errors/cli-command-error.js +0 -12
- package/dist/errors/cli-flag-error.d.ts +0 -4
- package/dist/errors/cli-flag-error.js +0 -12
- package/dist/errors/config-file-error.d.ts +0 -3
- package/dist/errors/config-file-error.js +0 -7
- package/dist/exportable-jest-config/jest-config.d.ts +0 -3
- package/dist/exportable-jest-config/jest-config.js +0 -23
- package/dist/exportable-jest-config/jest-setup.d.ts +0 -1
- package/dist/exportable-jest-config/jest-setup.js +0 -11
- package/dist/file-paths/virmator-repo-paths.d.ts +0 -5
- package/dist/file-paths/virmator-repo-paths.js +0 -19
- package/dist/jest/jest-config.d.ts +0 -3
- package/dist/jest/jest-config.js +0 -13
- package/extender-configs/.cspell.json +0 -3
- package/extender-configs/.prettierrc.js +0 -3
- package/extender-configs/tsconfig.json +0 -3
- package/separate-configs/.prettierignore +0 -3
- package/separate-configs/gitignore.txt +0 -4
- package/separate-configs/jest/jest-config.ts +0 -24
- package/separate-configs/jest/jest-setup.ts +0 -12
- package/separate-configs/npmignore.txt +0 -20
- package/separate-configs/package.json +0 -9
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ansiRegex = void 0;
|
|
4
|
-
// cspell:disable
|
|
5
|
-
/*
|
|
6
|
-
Copied from
|
|
7
|
-
https://github.com/chalk/ansi-regex/blob/1b337add136eb520764634a328e2f6354398eee5/index.js
|
|
8
|
-
because the published ansi-regex package exports this in a manner that Jest can't handle and the
|
|
9
|
-
latest version of the package that doesn't do that has a security vulnerability. The package has
|
|
10
|
-
the following license from
|
|
11
|
-
https://github.com/chalk/ansi-regex/blob/1b337add136eb520764634a328e2f6354398eee5/license
|
|
12
|
-
|
|
13
|
-
MIT License
|
|
14
|
-
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
15
|
-
|
|
16
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
17
|
-
|
|
18
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
21
|
-
*/
|
|
22
|
-
// cspell:enable
|
|
23
|
-
const patterns = [
|
|
24
|
-
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
|
|
25
|
-
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))',
|
|
26
|
-
];
|
|
27
|
-
exports.ansiRegex = new RegExp(patterns.join('|'), 'g');
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function stripColor(input: string): string;
|
package/dist/augments/string.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stripColor = void 0;
|
|
4
|
-
const ansi_regex_1 = require("./ansi-regex");
|
|
5
|
-
function stripColor(input) {
|
|
6
|
-
return input.replace(ansi_regex_1.ansiRegex, '');
|
|
7
|
-
}
|
|
8
|
-
exports.stripColor = stripColor;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.Color = void 0;
|
|
27
|
-
const styles = __importStar(require("ansi-styles"));
|
|
28
|
-
exports.Color = {
|
|
29
|
-
Info: styles.blue.open,
|
|
30
|
-
Fail: styles.red.open,
|
|
31
|
-
Warn: styles.yellow.open,
|
|
32
|
-
Success: styles.green.open,
|
|
33
|
-
Reset: styles.reset.close,
|
|
34
|
-
Bold: styles.bold.open,
|
|
35
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare enum CliCommandName {
|
|
2
|
-
Compile = "compile",
|
|
3
|
-
Format = "format",
|
|
4
|
-
Help = "help",
|
|
5
|
-
Init = "init",
|
|
6
|
-
SpellCheck = "spellcheck",
|
|
7
|
-
Test = "test",
|
|
8
|
-
CodeInMarkdown = "code-in-markdown",
|
|
9
|
-
UpdateAllConfigs = "update-all-configs",
|
|
10
|
-
UpdateBareConfigs = "update-bare-configs"
|
|
11
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CliCommandName = void 0;
|
|
4
|
-
var CliCommandName;
|
|
5
|
-
(function (CliCommandName) {
|
|
6
|
-
CliCommandName["Compile"] = "compile";
|
|
7
|
-
CliCommandName["Format"] = "format";
|
|
8
|
-
CliCommandName["Help"] = "help";
|
|
9
|
-
CliCommandName["Init"] = "init";
|
|
10
|
-
CliCommandName["SpellCheck"] = "spellcheck";
|
|
11
|
-
CliCommandName["Test"] = "test";
|
|
12
|
-
CliCommandName["CodeInMarkdown"] = "code-in-markdown";
|
|
13
|
-
CliCommandName["UpdateAllConfigs"] = "update-all-configs";
|
|
14
|
-
CliCommandName["UpdateBareConfigs"] = "update-bare-configs";
|
|
15
|
-
})(CliCommandName = exports.CliCommandName || (exports.CliCommandName = {}));
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { CliCommandName } from './cli-command-name';
|
|
2
|
-
export declare enum CliFlagName {
|
|
3
|
-
Help = "--help",
|
|
4
|
-
NoWriteConfig = "--no-write-config",
|
|
5
|
-
Silent = "--silent",
|
|
6
|
-
ExtendableConfig = "--extendable-config"
|
|
7
|
-
}
|
|
8
|
-
export declare type CliFlags = Record<CliFlagName, boolean>;
|
|
9
|
-
export declare const defaultCliFlags: Readonly<Required<Record<CliFlagName, false>>>;
|
|
10
|
-
export declare const flagDescriptions: Record<CliFlagName, string>;
|
|
11
|
-
export declare type ExtractedArguments = {
|
|
12
|
-
flags: CliFlags;
|
|
13
|
-
invalidFlags: string[];
|
|
14
|
-
args: string[];
|
|
15
|
-
command: CliCommandName | undefined;
|
|
16
|
-
};
|
|
17
|
-
export declare function fillInCliFlags(inputFlags?: Readonly<Partial<CliFlags>>): Readonly<Required<CliFlags>>;
|
|
18
|
-
export declare function extractArguments(args: string[]): Required<ExtractedArguments>;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.extractArguments = exports.fillInCliFlags = exports.flagDescriptions = exports.defaultCliFlags = exports.CliFlagName = void 0;
|
|
4
|
-
const augment_vir_1 = require("augment-vir");
|
|
5
|
-
const cli_command_name_1 = require("./cli-command-name");
|
|
6
|
-
var CliFlagName;
|
|
7
|
-
(function (CliFlagName) {
|
|
8
|
-
CliFlagName["Help"] = "--help";
|
|
9
|
-
CliFlagName["NoWriteConfig"] = "--no-write-config";
|
|
10
|
-
CliFlagName["Silent"] = "--silent";
|
|
11
|
-
CliFlagName["ExtendableConfig"] = "--extendable-config";
|
|
12
|
-
})(CliFlagName = exports.CliFlagName || (exports.CliFlagName = {}));
|
|
13
|
-
exports.defaultCliFlags = {
|
|
14
|
-
[CliFlagName.Silent]: false,
|
|
15
|
-
[CliFlagName.NoWriteConfig]: false,
|
|
16
|
-
[CliFlagName.Help]: false,
|
|
17
|
-
[CliFlagName.ExtendableConfig]: false,
|
|
18
|
-
};
|
|
19
|
-
exports.flagDescriptions = {
|
|
20
|
-
[CliFlagName.Silent]: 'Turns off most logging.',
|
|
21
|
-
[CliFlagName.NoWriteConfig]: `Prevents a command from overwriting its relevant config file (if one exists, which they usually do).`,
|
|
22
|
-
[CliFlagName.ExtendableConfig]: `Not supported by all commands. Rather than updating the current command's relevant config file directly, commands will write an extendable config file so that the user can extend and override config values.`,
|
|
23
|
-
[CliFlagName.Help]: 'Prints this help message.',
|
|
24
|
-
};
|
|
25
|
-
function fillInCliFlags(inputFlags) {
|
|
26
|
-
return { ...exports.defaultCliFlags, ...(inputFlags || {}) };
|
|
27
|
-
}
|
|
28
|
-
exports.fillInCliFlags = fillInCliFlags;
|
|
29
|
-
function extractArguments(args) {
|
|
30
|
-
const { inputFlags, invalidFlags, otherArgs, command } = args.reduce((accum, currentArg) => {
|
|
31
|
-
if ((0, augment_vir_1.isEnumValue)(currentArg, cli_command_name_1.CliCommandName) && !accum.command) {
|
|
32
|
-
accum.command = currentArg;
|
|
33
|
-
}
|
|
34
|
-
else if (currentArg.startsWith('--')) {
|
|
35
|
-
if ((0, augment_vir_1.isEnumValue)(currentArg, CliFlagName)) {
|
|
36
|
-
accum.inputFlags[currentArg] = true;
|
|
37
|
-
}
|
|
38
|
-
else if (!accum.command) {
|
|
39
|
-
accum.invalidFlags.push(currentArg);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
accum.otherArgs.push(currentArg);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
accum.otherArgs.push(currentArg);
|
|
47
|
-
}
|
|
48
|
-
return accum;
|
|
49
|
-
}, {
|
|
50
|
-
inputFlags: {},
|
|
51
|
-
invalidFlags: [],
|
|
52
|
-
otherArgs: [],
|
|
53
|
-
command: undefined,
|
|
54
|
-
});
|
|
55
|
-
const cliFlags = fillInCliFlags(inputFlags);
|
|
56
|
-
return {
|
|
57
|
-
flags: cliFlags,
|
|
58
|
-
invalidFlags,
|
|
59
|
-
args: otherArgs,
|
|
60
|
-
command,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
exports.extractArguments = extractArguments;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { CliCommandName } from './cli-command-name';
|
|
2
|
-
import { CliFlagName } from './cli-flags';
|
|
3
|
-
export declare const cliErrorMessages: {
|
|
4
|
-
missingCliCommand: string;
|
|
5
|
-
unsupportedCliFlag(command: CliCommandName, unsupportedFlagNames: CliFlagName[]): string;
|
|
6
|
-
};
|
|
7
|
-
export declare function getResultMessage(command: CliCommandName, success: boolean): string;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getResultMessage = exports.cliErrorMessages = void 0;
|
|
4
|
-
const cli_color_1 = require("./cli-color");
|
|
5
|
-
exports.cliErrorMessages = {
|
|
6
|
-
missingCliCommand: `Missing a command for virmator.`,
|
|
7
|
-
unsupportedCliFlag(command, unsupportedFlagNames) {
|
|
8
|
-
return `The ${command} command does not support: ${unsupportedFlagNames.join(', ')}`;
|
|
9
|
-
},
|
|
10
|
-
};
|
|
11
|
-
function getResultMessage(command, success) {
|
|
12
|
-
if (success) {
|
|
13
|
-
return `${cli_color_1.Color.Bold}${cli_color_1.Color.Success}${command} succeeded.${cli_color_1.Color.Reset}`;
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
return `${cli_color_1.Color.Bold}${cli_color_1.Color.Fail}${command} failed.${cli_color_1.Color.Reset}`;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.getResultMessage = getResultMessage;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { CliCommandResult, CommandFunctionInput } from '../commands/cli-command';
|
|
2
|
-
export declare type AllCommandOutput = {
|
|
3
|
-
stderr: string;
|
|
4
|
-
stdout: string;
|
|
5
|
-
} & CliCommandResult;
|
|
6
|
-
/** This is for testing purposes only. */
|
|
7
|
-
export declare function getAllCommandOutput(commandImplementation: (inputs: CommandFunctionInput) => Promise<CliCommandResult>, inputs: CommandFunctionInput): Promise<AllCommandOutput>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAllCommandOutput = void 0;
|
|
4
|
-
/** This is for testing purposes only. */
|
|
5
|
-
async function getAllCommandOutput(commandImplementation, inputs) {
|
|
6
|
-
const logs = {
|
|
7
|
-
stderr: [],
|
|
8
|
-
stdout: [],
|
|
9
|
-
};
|
|
10
|
-
const result = await commandImplementation({
|
|
11
|
-
...inputs,
|
|
12
|
-
stderrCallback: (stderr) => logs.stderr.push(stderr),
|
|
13
|
-
stdoutCallback: (stdout) => logs.stdout.push(stdout),
|
|
14
|
-
});
|
|
15
|
-
return {
|
|
16
|
-
stdout: logs.stdout.join(''),
|
|
17
|
-
stderr: logs.stderr.join(''),
|
|
18
|
-
...result,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
exports.getAllCommandOutput = getAllCommandOutput;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ShellOutput } from 'augment-vir/dist/node-only';
|
|
2
|
-
import { CommandFunctionInput } from '../commands/cli-command';
|
|
3
|
-
export declare type OutputFilter = (toPrint: string) => string;
|
|
4
|
-
export declare type Filters = {
|
|
5
|
-
stdoutFilter: OutputFilter;
|
|
6
|
-
stderrFilter: OutputFilter;
|
|
7
|
-
};
|
|
8
|
-
export declare function runVirmatorShellCommand(command: string, { repoDir: cwd, stdoutCallback, stderrCallback, }: Pick<CommandFunctionInput, 'repoDir' | 'stdoutCallback' | 'stderrCallback'>, { stdoutFilter, stderrFilter }?: Partial<Filters>): Promise<ShellOutput>;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runVirmatorShellCommand = void 0;
|
|
4
|
-
const node_only_1 = require("augment-vir/dist/node-only");
|
|
5
|
-
const defaultFilter = (input) => input;
|
|
6
|
-
function outputWrapper(callback, filter) {
|
|
7
|
-
return (input) => {
|
|
8
|
-
const callbackString = filter(input.toString());
|
|
9
|
-
if (callbackString) {
|
|
10
|
-
callback(callbackString);
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
async function runVirmatorShellCommand(command, { repoDir: cwd, stdoutCallback, stderrCallback, }, { stdoutFilter = defaultFilter, stderrFilter = defaultFilter } = {
|
|
15
|
-
stdoutFilter: defaultFilter,
|
|
16
|
-
stderrFilter: defaultFilter,
|
|
17
|
-
}) {
|
|
18
|
-
const shellResults = await (0, node_only_1.runShellCommand)(command, {
|
|
19
|
-
cwd,
|
|
20
|
-
stdoutCallback: outputWrapper(stdoutCallback, stdoutFilter),
|
|
21
|
-
stderrCallback: outputWrapper(stderrCallback, stderrFilter),
|
|
22
|
-
});
|
|
23
|
-
return shellResults;
|
|
24
|
-
}
|
|
25
|
-
exports.runVirmatorShellCommand = runVirmatorShellCommand;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { CliCommandResult, CommandFunctionInput } from '../commands/cli-command';
|
|
2
|
-
import { ConfigKey } from '../config/config-key';
|
|
3
|
-
export declare function updateConfigs<T extends ConfigKey>(configKeysEnum: Record<string, T>, commandInputs: CommandFunctionInput): Promise<CliCommandResult>;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateConfigs = void 0;
|
|
4
|
-
const augment_vir_1 = require("augment-vir");
|
|
5
|
-
const fs_1 = require("fs");
|
|
6
|
-
const cli_command_1 = require("../commands/cli-command");
|
|
7
|
-
const format_command_1 = require("../commands/implementations/format.command");
|
|
8
|
-
const copy_config_1 = require("../config/copy-config");
|
|
9
|
-
const extendable_config_1 = require("../config/extendable-config");
|
|
10
|
-
const cli_flags_1 = require("./cli-flags");
|
|
11
|
-
async function updateConfigs(configKeysEnum, commandInputs) {
|
|
12
|
-
const inputConfigFiles = (0, augment_vir_1.filterToEnumValues)(commandInputs.rawArgs, configKeysEnum);
|
|
13
|
-
const configFilesToCopy = inputConfigFiles.length
|
|
14
|
-
? inputConfigFiles
|
|
15
|
-
: (0, augment_vir_1.getEnumTypedValues)(configKeysEnum);
|
|
16
|
-
let writtenFileCount = 0;
|
|
17
|
-
const errors = [];
|
|
18
|
-
await Promise.all(configFilesToCopy.map(async (configKey) => {
|
|
19
|
-
try {
|
|
20
|
-
const { outputFilePath, didWrite } = await (0, copy_config_1.copyConfig)({
|
|
21
|
-
configKey,
|
|
22
|
-
forceExtendableConfig: commandInputs.cliFlags[cli_flags_1.CliFlagName.ExtendableConfig] &&
|
|
23
|
-
(0, extendable_config_1.isExtendableConfig)(configKey),
|
|
24
|
-
repoDir: commandInputs.repoDir,
|
|
25
|
-
});
|
|
26
|
-
if (!(0, fs_1.existsSync)(outputFilePath)) {
|
|
27
|
-
throw new Error(`Tried to write config file but it didn't actually get written: ${outputFilePath}`);
|
|
28
|
-
}
|
|
29
|
-
if (didWrite) {
|
|
30
|
-
await (0, format_command_1.runFormatCommand)({
|
|
31
|
-
rawArgs: [outputFilePath],
|
|
32
|
-
cliFlags: commandInputs.cliFlags,
|
|
33
|
-
repoDir: commandInputs.repoDir,
|
|
34
|
-
...cli_command_1.EmptyOutputCallbacks,
|
|
35
|
-
});
|
|
36
|
-
writtenFileCount++;
|
|
37
|
-
commandInputs.stdoutCallback(`Wrote ${configKey} to ${outputFilePath}`);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
errors.push(error);
|
|
42
|
-
commandInputs.stderrCallback(`Failed to write config file for ${configKey}`);
|
|
43
|
-
commandInputs.stderrCallback(String(error));
|
|
44
|
-
}
|
|
45
|
-
}));
|
|
46
|
-
if (!errors.length && !writtenFileCount) {
|
|
47
|
-
commandInputs.stdoutCallback('All configs up to date.');
|
|
48
|
-
}
|
|
49
|
-
return {
|
|
50
|
-
command: undefined,
|
|
51
|
-
success: !errors.length,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
exports.updateConfigs = updateConfigs;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { CliCommandName } from '../cli-util/cli-command-name';
|
|
2
|
-
import { CliFlagName, CliFlags } from '../cli-util/cli-flags';
|
|
3
|
-
import { CliCommandImplementation, CliCommandResult, CommandFunctionInput } from './cli-command';
|
|
4
|
-
import { MessageSyntax } from './description-printing';
|
|
5
|
-
export declare function getUnsupportedFlags(currentFlags: CliFlags, flagSupport: Record<CliFlagName, boolean>): CliFlagName[];
|
|
6
|
-
/**
|
|
7
|
-
* The Help command implementation is in this file because it both depends on allCliCommands and is
|
|
8
|
-
* depended on by allCliCommands.
|
|
9
|
-
*/
|
|
10
|
-
export declare const helpImplementation: CliCommandImplementation;
|
|
11
|
-
export declare function generateHelpMessage(syntax: MessageSyntax): string;
|
|
12
|
-
export declare function runHelpCommand({ stdoutCallback }: CommandFunctionInput): CliCommandResult;
|
|
13
|
-
export declare const allCliCommands: Readonly<Record<CliCommandName, CliCommandImplementation>>;
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.allCliCommands = exports.runHelpCommand = exports.generateHelpMessage = exports.helpImplementation = exports.getUnsupportedFlags = void 0;
|
|
4
|
-
const augment_vir_1 = require("augment-vir");
|
|
5
|
-
const cli_command_name_1 = require("../cli-util/cli-command-name");
|
|
6
|
-
const cli_flags_1 = require("../cli-util/cli-flags");
|
|
7
|
-
const description_printing_1 = require("./description-printing");
|
|
8
|
-
const code_in_markdown_command_1 = require("./implementations/code-in-markdown.command");
|
|
9
|
-
const compile_command_1 = require("./implementations/compile.command");
|
|
10
|
-
const format_command_1 = require("./implementations/format.command");
|
|
11
|
-
const init_command_1 = require("./implementations/init.command");
|
|
12
|
-
const spellcheck_command_1 = require("./implementations/spellcheck.command");
|
|
13
|
-
const test_command_1 = require("./implementations/test.command");
|
|
14
|
-
const update_all_configs_command_1 = require("./implementations/update-all-configs.command");
|
|
15
|
-
const update_bare_configs_command_1 = require("./implementations/update-bare-configs.command");
|
|
16
|
-
function createUnImplementedCommand(commandName) {
|
|
17
|
-
return {
|
|
18
|
-
commandName,
|
|
19
|
-
description: {
|
|
20
|
-
sections: [
|
|
21
|
-
{
|
|
22
|
-
title: '',
|
|
23
|
-
content: 'not implemented yet',
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
examples: [],
|
|
27
|
-
},
|
|
28
|
-
implementation: () => {
|
|
29
|
-
throw new Error('This command has not been implemented yet.');
|
|
30
|
-
},
|
|
31
|
-
configFlagSupport: {
|
|
32
|
-
[cli_flags_1.CliFlagName.NoWriteConfig]: false,
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function getUnsupportedFlags(currentFlags, flagSupport) {
|
|
37
|
-
return (0, augment_vir_1.getObjectTypedKeys)(currentFlags).filter((currentFlag) => {
|
|
38
|
-
if (currentFlags[currentFlag]) {
|
|
39
|
-
return !flagSupport[currentFlag];
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
// if the flag isn't included anyway then we don't care if it's supported or not
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
exports.getUnsupportedFlags = getUnsupportedFlags;
|
|
48
|
-
/**
|
|
49
|
-
* The Help command implementation is in this file because it both depends on allCliCommands and is
|
|
50
|
-
* depended on by allCliCommands.
|
|
51
|
-
*/
|
|
52
|
-
exports.helpImplementation = {
|
|
53
|
-
commandName: cli_command_name_1.CliCommandName.Help,
|
|
54
|
-
description: {
|
|
55
|
-
sections: [{ title: '', content: cli_flags_1.flagDescriptions[cli_flags_1.CliFlagName.Help] }],
|
|
56
|
-
examples: [],
|
|
57
|
-
},
|
|
58
|
-
implementation: runHelpCommand,
|
|
59
|
-
configFlagSupport: {
|
|
60
|
-
[cli_flags_1.CliFlagName.NoWriteConfig]: false,
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
function generateHelpMessage(syntax) {
|
|
64
|
-
const flagsMessage = (0, augment_vir_1.getEnumTypedValues)(cli_flags_1.CliFlagName)
|
|
65
|
-
.sort()
|
|
66
|
-
.map((flagName) => {
|
|
67
|
-
return (0, description_printing_1.flagToHelpString)(flagName, cli_flags_1.flagDescriptions[flagName], syntax);
|
|
68
|
-
})
|
|
69
|
-
.join('\n');
|
|
70
|
-
const commandsMessage = (0, augment_vir_1.getEnumTypedValues)(cli_command_name_1.CliCommandName)
|
|
71
|
-
.sort()
|
|
72
|
-
.map((commandName) => {
|
|
73
|
-
return (0, description_printing_1.commandToHelpString)(exports.allCliCommands[commandName], syntax);
|
|
74
|
-
})
|
|
75
|
-
.join('\n');
|
|
76
|
-
const helpMessage = (0, description_printing_1.combineHelpMessage)(flagsMessage, commandsMessage, syntax);
|
|
77
|
-
return helpMessage;
|
|
78
|
-
}
|
|
79
|
-
exports.generateHelpMessage = generateHelpMessage;
|
|
80
|
-
function runHelpCommand({ stdoutCallback }) {
|
|
81
|
-
stdoutCallback((0, description_printing_1.wrapLines)(generateHelpMessage(description_printing_1.MessageSyntax.Bash), 100));
|
|
82
|
-
return {
|
|
83
|
-
command: undefined,
|
|
84
|
-
success: true,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
exports.runHelpCommand = runHelpCommand;
|
|
88
|
-
exports.allCliCommands = {
|
|
89
|
-
// use createUnImplementedCommand when adding a new command that hasn't been implemented yet
|
|
90
|
-
[cli_command_name_1.CliCommandName.Compile]: compile_command_1.compileImplementation,
|
|
91
|
-
[cli_command_name_1.CliCommandName.Format]: format_command_1.formatImplementation,
|
|
92
|
-
[cli_command_name_1.CliCommandName.Help]: exports.helpImplementation,
|
|
93
|
-
[cli_command_name_1.CliCommandName.Init]: init_command_1.initCommandImplementation,
|
|
94
|
-
[cli_command_name_1.CliCommandName.SpellCheck]: spellcheck_command_1.spellcheckCommandImplementation,
|
|
95
|
-
[cli_command_name_1.CliCommandName.Test]: test_command_1.testCommandImplementation,
|
|
96
|
-
[cli_command_name_1.CliCommandName.UpdateAllConfigs]: update_all_configs_command_1.updateAllConfigsCommandImplementation,
|
|
97
|
-
[cli_command_name_1.CliCommandName.UpdateBareConfigs]: update_bare_configs_command_1.updateBareConfigsCommandImplementation,
|
|
98
|
-
[cli_command_name_1.CliCommandName.CodeInMarkdown]: code_in_markdown_command_1.codeInMarkdownCommandImplementation,
|
|
99
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { CliCommandName } from '../cli-util/cli-command-name';
|
|
2
|
-
import { CliFlagName, CliFlags } from '../cli-util/cli-flags';
|
|
3
|
-
import { CommandConfigKey } from '../config/config-key';
|
|
4
|
-
export declare type CliCommandResult = {
|
|
5
|
-
command: string | undefined;
|
|
6
|
-
success: boolean;
|
|
7
|
-
};
|
|
8
|
-
export declare function fillInCommandInput(commandInput?: PartialCommandFunctionInput | Partial<CommandFunctionInput>): Omit<CommandFunctionInput, 'stdoutCallback' | 'stderrCallback'>;
|
|
9
|
-
export declare type CommandFunctionInput = Readonly<{
|
|
10
|
-
rawArgs: string[];
|
|
11
|
-
cliFlags: Required<Readonly<CliFlags>>;
|
|
12
|
-
repoDir: string;
|
|
13
|
-
stdoutCallback: (stdout: string) => void;
|
|
14
|
-
stderrCallback: (stderr: string) => void;
|
|
15
|
-
}>;
|
|
16
|
-
export declare const EmptyOutputCallbacks: Pick<CommandFunctionInput, 'stdoutCallback' | 'stderrCallback'>;
|
|
17
|
-
export declare type PartialCommandFunctionInput = Omit<Partial<CommandFunctionInput>, 'cliFlags'> & {
|
|
18
|
-
rawCliFlags?: Partial<Readonly<CliFlags>>;
|
|
19
|
-
};
|
|
20
|
-
export declare type CliHelpSection = {
|
|
21
|
-
title: string;
|
|
22
|
-
content: string;
|
|
23
|
-
};
|
|
24
|
-
export declare type CliHelpDescription = {
|
|
25
|
-
sections: CliHelpSection[];
|
|
26
|
-
examples: CliHelpSection[];
|
|
27
|
-
};
|
|
28
|
-
export declare type CliCommandImplementation = Readonly<{
|
|
29
|
-
commandName: CliCommandName;
|
|
30
|
-
configKeys?: CommandConfigKey[];
|
|
31
|
-
description: CliHelpDescription;
|
|
32
|
-
implementation: CommandFunction;
|
|
33
|
-
configFlagSupport: Readonly<Omit<Record<CliFlagName, boolean>, CliFlagName.Silent | CliFlagName.Help | CliFlagName.ExtendableConfig>>;
|
|
34
|
-
}>;
|
|
35
|
-
export declare type CommandFunction = (input: CommandFunctionInput) => CliCommandResult | Promise<CliCommandResult>;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EmptyOutputCallbacks = exports.fillInCommandInput = void 0;
|
|
4
|
-
const repo_paths_1 = require("../../file-paths/repo-paths");
|
|
5
|
-
const cli_flags_1 = require("../cli-util/cli-flags");
|
|
6
|
-
function extractRawFlags(commandInput) {
|
|
7
|
-
if (!commandInput) {
|
|
8
|
-
return undefined;
|
|
9
|
-
}
|
|
10
|
-
else if ('cliFlags' in commandInput) {
|
|
11
|
-
return commandInput.cliFlags;
|
|
12
|
-
}
|
|
13
|
-
else if ('rawCliFlags' in commandInput) {
|
|
14
|
-
return commandInput.rawCliFlags;
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
return undefined;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
const defaultCommandFunctionInput = {
|
|
21
|
-
rawArgs: [],
|
|
22
|
-
cliFlags: (0, cli_flags_1.fillInCliFlags)(),
|
|
23
|
-
repoDir: repo_paths_1.repoRootDir,
|
|
24
|
-
};
|
|
25
|
-
function fillInCommandInput(commandInput) {
|
|
26
|
-
if (!commandInput) {
|
|
27
|
-
return defaultCommandFunctionInput;
|
|
28
|
-
}
|
|
29
|
-
const rawCliFlags = extractRawFlags(commandInput);
|
|
30
|
-
return {
|
|
31
|
-
rawArgs: commandInput?.rawArgs || defaultCommandFunctionInput.rawArgs,
|
|
32
|
-
cliFlags: (0, cli_flags_1.fillInCliFlags)(rawCliFlags),
|
|
33
|
-
repoDir: commandInput.repoDir || defaultCommandFunctionInput.repoDir,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
exports.fillInCommandInput = fillInCommandInput;
|
|
37
|
-
exports.EmptyOutputCallbacks = {
|
|
38
|
-
stdoutCallback: () => { },
|
|
39
|
-
stderrCallback: () => { },
|
|
40
|
-
};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { CliCommandImplementation, CliCommandResult, CommandFunctionInput } from '../cli-command';
|
|
2
|
-
export declare const codeInMarkdownCommandImplementation: CliCommandImplementation;
|
|
3
|
-
export declare function runCodeInMarkdownCommand(inputs: CommandFunctionInput): Promise<CliCommandResult>;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runCodeInMarkdownCommand = exports.codeInMarkdownCommandImplementation = void 0;
|
|
4
|
-
const node_only_1 = require("augment-vir/dist/node-only");
|
|
5
|
-
const virmator_repo_paths_1 = require("../../../file-paths/virmator-repo-paths");
|
|
6
|
-
const cli_command_name_1 = require("../../cli-util/cli-command-name");
|
|
7
|
-
const cli_flags_1 = require("../../cli-util/cli-flags");
|
|
8
|
-
const shell_command_wrapper_1 = require("../../cli-util/shell-command-wrapper");
|
|
9
|
-
exports.codeInMarkdownCommandImplementation = {
|
|
10
|
-
commandName: cli_command_name_1.CliCommandName.CodeInMarkdown,
|
|
11
|
-
description: {
|
|
12
|
-
sections: [
|
|
13
|
-
{
|
|
14
|
-
title: '',
|
|
15
|
-
content: `Insert code snippets into markdown files. This uses the markdown-code-example-inserter package to expand code link comments inside of markdown files to actual markdown code blocks. See that package's README for more details but the basics are that you need a comment that looks like the following in your markdown file for this to do anything: \`<!-- example-link: path/to/file.ts -->\``,
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
title: '',
|
|
19
|
-
content: `By default this command parses all markdown files in the repo (ignoring node_modules). Specific markdown files can be parsed by giving virmator extra parameters.`,
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
examples: [
|
|
23
|
-
{
|
|
24
|
-
title: 'default experience (usually all you need)',
|
|
25
|
-
content: `virmator ${cli_command_name_1.CliCommandName.CodeInMarkdown}`,
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
title: 'override files to check to a single file',
|
|
29
|
-
content: `virmator ${cli_command_name_1.CliCommandName.CodeInMarkdown} only/this/one/file.md`,
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
title: 'override files to check to a group of files',
|
|
33
|
-
content: `virmator ${cli_command_name_1.CliCommandName.CodeInMarkdown} "only/this/dir/*.md"`,
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
},
|
|
37
|
-
implementation: runCodeInMarkdownCommand,
|
|
38
|
-
configFlagSupport: {
|
|
39
|
-
[cli_flags_1.CliFlagName.NoWriteConfig]: false,
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
const mdCodePath = (0, virmator_repo_paths_1.getNpmBinPath)('md-code');
|
|
43
|
-
async function runCodeInMarkdownCommand(inputs) {
|
|
44
|
-
const args = inputs.rawArgs.length
|
|
45
|
-
? (0, node_only_1.interpolationSafeWindowsPath)(inputs.rawArgs.join(' '))
|
|
46
|
-
: `\"./**/*.md\"`;
|
|
47
|
-
const mdCodeCommand = `${mdCodePath} ${args}`;
|
|
48
|
-
const results = await (0, shell_command_wrapper_1.runVirmatorShellCommand)(mdCodeCommand, inputs);
|
|
49
|
-
return {
|
|
50
|
-
command: mdCodeCommand,
|
|
51
|
-
success: !results.error,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
exports.runCodeInMarkdownCommand = runCodeInMarkdownCommand;
|