virmator 4.3.3 → 4.3.4
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/base-configs/base-mocharc.js +1 -0
- package/base-configs/base-nyc.js +8 -4
- package/configs/gitignore.txt +1 -1
- package/configs/npmignore.txt +1 -1
- package/dist/api/command/command-description.d.ts +2 -2
- package/dist/api/command/command-executor.d.ts +8 -8
- package/dist/api/command/command-help.d.ts +2 -2
- package/dist/api/command/command-logging.d.ts +5 -5
- package/dist/api/command/command-mapping.d.ts +2 -2
- package/dist/api/command/define-command-inputs.d.ts +3 -3
- package/dist/api/command/define-command.d.ts +1 -1
- package/dist/api/config/config-file-definition.d.ts +2 -2
- package/dist/api/config/config-paths.d.ts +1 -1
- package/dist/api/config/copy-config.d.ts +3 -3
- package/dist/api/run-command/check-npm-deps.d.ts +1 -1
- package/dist/api/run-command/check-npm-deps.js +3 -0
- package/dist/api/run-command/extract-arguments.d.ts +1 -1
- package/dist/api/run-command/run-shell-command.d.ts +1 -1
- package/dist/api/virmator-types.d.ts +2 -2
- package/dist/augments/npm.d.ts +1 -1
- package/dist/augments/prettier.js +2 -1
- package/dist/augments/string.d.ts +1 -1
- package/dist/augments/type.d.ts +1 -1
- package/dist/commands/compile.command.js +1 -2
- package/package.json +6 -6
package/base-configs/base-nyc.js
CHANGED
|
@@ -5,19 +5,23 @@ function getBaseConfigWithCoveragePercent(percent) {
|
|
|
5
5
|
extends: '@istanbuljs/nyc-config-typescript',
|
|
6
6
|
all: true,
|
|
7
7
|
branches: percent,
|
|
8
|
+
clean: true,
|
|
8
9
|
cache: false,
|
|
9
10
|
instrument: true,
|
|
10
|
-
|
|
11
|
+
// use the reporter (istanbul-smart-text-reporter) to fail instead of printing errors for
|
|
12
|
+
// every message
|
|
13
|
+
checkCoverage: false,
|
|
11
14
|
exclude: [
|
|
12
15
|
'**/*.test.ts',
|
|
13
|
-
'
|
|
16
|
+
'**/*.example.ts',
|
|
14
17
|
'**/*.type.test.ts',
|
|
15
18
|
'**/*.test-helper.ts',
|
|
16
19
|
],
|
|
17
20
|
functions: percent,
|
|
18
|
-
include: 'src
|
|
21
|
+
include: ['src/**/*.ts'],
|
|
19
22
|
lines: percent,
|
|
20
|
-
|
|
23
|
+
// so we don't get error messages printed for every file
|
|
24
|
+
perFile: false,
|
|
21
25
|
reporter: [
|
|
22
26
|
'html',
|
|
23
27
|
'istanbul-smart-text-reporter',
|
package/configs/gitignore.txt
CHANGED
package/configs/npmignore.txt
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CommandDescription } from './command-help';
|
|
2
2
|
import { DefineCommandInputs, SubCommandsMap } from './define-command-inputs';
|
|
3
|
-
export
|
|
3
|
+
export type CreateDescriptionsInputs<DefineCommandInputsGeneric extends DefineCommandInputs> = Pick<DefineCommandInputsGeneric, 'commandName'> & {
|
|
4
4
|
packageBinName: string;
|
|
5
5
|
subCommands: SubCommandsMap<DefineCommandInputsGeneric>;
|
|
6
6
|
configFiles: DefineCommandInputsGeneric['configFiles'];
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type CreateDescriptionsCallback<DefineCommandInputsGeneric extends DefineCommandInputs> = (inputs: CreateDescriptionsInputs<DefineCommandInputsGeneric>) => CommandDescription;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ConfigFileDefinition } from '../config/config-file-definition';
|
|
2
2
|
import { CommandLogging, CommandLogTransforms } from './command-logging';
|
|
3
3
|
import { DefineCommandInputs, SharedExecutorInputsAndCommandDefinition } from './define-command-inputs';
|
|
4
|
-
export
|
|
4
|
+
export type CommandExecutorInputs<DefineCommandInputsGeneric extends DefineCommandInputs = DefineCommandInputs> = {
|
|
5
5
|
filteredInputArgs: string[];
|
|
6
6
|
inputSubCommands: (keyof DefineCommandInputsGeneric['subCommandDescriptions'])[];
|
|
7
7
|
repoDir: string;
|
|
@@ -9,20 +9,20 @@ export declare type CommandExecutorInputs<DefineCommandInputsGeneric extends Def
|
|
|
9
9
|
packageDir: string;
|
|
10
10
|
logging: CommandLogging;
|
|
11
11
|
};
|
|
12
|
-
export
|
|
13
|
-
export
|
|
12
|
+
export type CommandExecutorDefinitionInputs<DefineCommandInputsGeneric extends DefineCommandInputs = DefineCommandInputs> = CommandExecutorInputs<DefineCommandInputsGeneric> & SharedExecutorInputsAndCommandDefinition<DefineCommandInputsGeneric>;
|
|
13
|
+
export type DetailedArg = {
|
|
14
14
|
arg: string;
|
|
15
15
|
skipWindowsInterpolation: true;
|
|
16
16
|
};
|
|
17
|
-
export
|
|
17
|
+
export type SuccessOnlyExecutorOutput = {
|
|
18
18
|
success: boolean;
|
|
19
19
|
};
|
|
20
|
-
export
|
|
20
|
+
export type BashCommandExecutorOutput = {
|
|
21
21
|
mainCommand: string;
|
|
22
22
|
logTransforms?: CommandLogTransforms;
|
|
23
23
|
args: (string | DetailedArg)[];
|
|
24
24
|
};
|
|
25
25
|
export declare function isCompletedExecutor(executorOutput: CommandExecutorOutput): executorOutput is SuccessOnlyExecutorOutput;
|
|
26
|
-
export
|
|
27
|
-
export
|
|
28
|
-
export
|
|
26
|
+
export type CommandExecutorOutput = BashCommandExecutorOutput | SuccessOnlyExecutorOutput;
|
|
27
|
+
export type CommandExecutorDefinition<DefineCommandInputsGeneric extends DefineCommandInputs> = (inputs: CommandExecutorDefinitionInputs<DefineCommandInputsGeneric>) => Promise<CommandExecutorOutput> | CommandExecutorOutput;
|
|
28
|
+
export type CommandExecutor<DefineCommandInputsGeneric extends DefineCommandInputs> = (inputs: CommandExecutorInputs<DefineCommandInputsGeneric>) => Promise<CommandExecutorOutput> | CommandExecutorOutput;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type HelpSection = Readonly<{
|
|
2
2
|
title: string;
|
|
3
3
|
content: string;
|
|
4
4
|
}>;
|
|
5
|
-
export
|
|
5
|
+
export type CommandDescription = Readonly<{
|
|
6
6
|
sections: Readonly<HelpSection[]>;
|
|
7
7
|
examples: Readonly<HelpSection[]>;
|
|
8
8
|
}>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export type CommandLogCallback = (thingToLog: string) => void;
|
|
2
|
+
export type CommandLogging = {
|
|
3
3
|
stdout: CommandLogCallback;
|
|
4
4
|
stderr: CommandLogCallback;
|
|
5
5
|
};
|
|
6
6
|
export declare const noCommandLogging: Readonly<Required<CommandLogging>>;
|
|
7
7
|
export declare const defaultConsoleLogging: Readonly<Required<CommandLogging>>;
|
|
8
|
-
export
|
|
8
|
+
export type CommandLogs = Record<keyof CommandLogging, string>;
|
|
9
9
|
export declare const identityCommandLogTransform: CommandLogTransform;
|
|
10
|
-
export
|
|
11
|
-
export
|
|
10
|
+
export type CommandLogTransform = (thingToTransform: string) => string;
|
|
11
|
+
export type CommandLogTransforms = Partial<Record<keyof CommandLogging, CommandLogTransform>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ArrayElement } from 'augment-vir';
|
|
2
2
|
import { CommandDefinition } from './define-command';
|
|
3
|
-
export
|
|
3
|
+
export type CommandMapping = Record<string, CommandDefinition>;
|
|
4
4
|
export declare function commandsToMapping(commands: ReadonlyArray<CommandDefinition>): Readonly<CommandMapping>;
|
|
5
|
-
export
|
|
5
|
+
export type CommandDefinitionArrayToMapping<DefinitionArray extends ReadonlyArray<CommandDefinition>> = {
|
|
6
6
|
[CommandName in ArrayElement<DefinitionArray>['commandName']]: CommandDefinition;
|
|
7
7
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ConfigFileDefinition } from '../config/config-file-definition';
|
|
2
|
-
export
|
|
2
|
+
export type DefineCommandInputs<CommandName extends string = string> = Readonly<{
|
|
3
3
|
commandName: CommandName;
|
|
4
4
|
subCommandDescriptions: Readonly<Record<string, string>>;
|
|
5
5
|
configFiles: Readonly<Record<string, Readonly<ConfigFileDefinition>>>;
|
|
6
6
|
npmDeps: ReadonlyArray<string>;
|
|
7
7
|
}>;
|
|
8
|
-
export
|
|
8
|
+
export type SharedExecutorInputsAndCommandDefinition<DefineCommandInputsGeneric extends DefineCommandInputs> = DefineCommandInputsGeneric & {
|
|
9
9
|
allAvailableSubCommands: ReadonlyArray<keyof DefineCommandInputsGeneric['subCommandDescriptions']>;
|
|
10
10
|
subCommands: SubCommandsMap<DefineCommandInputsGeneric>;
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export type SubCommandsMap<DefineCommandInputsGeneric extends DefineCommandInputs> = {
|
|
13
13
|
[Prop in keyof DefineCommandInputsGeneric['subCommandDescriptions']]: Prop;
|
|
14
14
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CreateDescriptionsCallback } from './command-description';
|
|
2
2
|
import { CommandExecutor, CommandExecutorDefinition } from './command-executor';
|
|
3
3
|
import { DefineCommandInputs, SharedExecutorInputsAndCommandDefinition } from './define-command-inputs';
|
|
4
|
-
export
|
|
4
|
+
export type CommandDefinition<DefineCommandInputsGeneric extends DefineCommandInputs = DefineCommandInputs<string>> = SharedExecutorInputsAndCommandDefinition<DefineCommandInputsGeneric> & {
|
|
5
5
|
executor: CommandExecutor<DefineCommandInputsGeneric>;
|
|
6
6
|
createDescription: CreateDescriptionsCallback<DefineCommandInputsGeneric>;
|
|
7
7
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export type UpdateConfigCallback = (copyFromContents: string, existingConfigContents: string, repoDir: string) => string | Promise<string>;
|
|
2
|
+
export type ConfigFileDefinition = {
|
|
3
3
|
/** Path to the config file to copy. */
|
|
4
4
|
copyFromInternalPath: string;
|
|
5
5
|
/**
|
|
@@ -8,18 +8,18 @@ export declare enum CopyConfigOperation {
|
|
|
8
8
|
/** Only write the config file if it doesn't exist already or if it can be updated. */
|
|
9
9
|
Init = "init"
|
|
10
10
|
}
|
|
11
|
-
export
|
|
11
|
+
export type CopyConfigInputs = {
|
|
12
12
|
configFileDefinition: ConfigFileDefinition;
|
|
13
13
|
repoDir: string;
|
|
14
14
|
packageDir: string;
|
|
15
15
|
operation: CopyConfigOperation;
|
|
16
16
|
};
|
|
17
|
-
export
|
|
17
|
+
export type CopyConfigOutputs = {
|
|
18
18
|
copiedToPath: string;
|
|
19
19
|
shouldWrite: boolean;
|
|
20
20
|
};
|
|
21
21
|
export declare function copyConfig(inputs: CopyConfigInputs): Promise<CopyConfigOutputs>;
|
|
22
|
-
export
|
|
22
|
+
export type CopyAllConfigFilesInputs = Omit<CopyConfigInputs, 'configFileDefinition'> & {
|
|
23
23
|
logging: CommandLogging;
|
|
24
24
|
configFiles: ReadonlyArray<ConfigFileDefinition>;
|
|
25
25
|
};
|
|
@@ -118,6 +118,9 @@ function parseCurrentDeps(objectInput, packageName) {
|
|
|
118
118
|
}
|
|
119
119
|
function readDeps(rawDeps, packageName) {
|
|
120
120
|
var _a;
|
|
121
|
+
if (!rawDeps) {
|
|
122
|
+
return {};
|
|
123
|
+
}
|
|
121
124
|
const depsAndVersions = {};
|
|
122
125
|
const nestedDeps = (_a = rawDeps[packageName]) === null || _a === void 0 ? void 0 : _a.dependencies;
|
|
123
126
|
const deps = nestedDeps !== null && nestedDeps !== void 0 ? nestedDeps : rawDeps;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ShellOutput } from 'augment-vir/dist/cjs/node-only';
|
|
2
2
|
import { CommandLogging, CommandLogTransforms } from '../command/command-logging';
|
|
3
|
-
export
|
|
3
|
+
export type RunVirmatorShellCommandOptions = {
|
|
4
4
|
repoDir: string;
|
|
5
5
|
logging: CommandLogging;
|
|
6
6
|
logTransforms?: CommandLogTransforms | undefined;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { CommandDefinitionArrayToMapping, CommandMapping } from './command/command-mapping';
|
|
2
2
|
import { CommandDefinition } from './command/define-command';
|
|
3
3
|
import { ConfigFileDefinition } from './config/config-file-definition';
|
|
4
|
-
export
|
|
4
|
+
export type ExtendVirmatorInputs<CommandDefinitionsGeneric extends ReadonlyArray<CommandDefinition>> = Readonly<{
|
|
5
5
|
packageBinName: string;
|
|
6
6
|
packageRootDir: string;
|
|
7
7
|
commandDefinitions?: CommandDefinitionsGeneric;
|
|
8
8
|
}>;
|
|
9
|
-
export
|
|
9
|
+
export type ExtendedVirmator<CommandMappingGeneric extends Readonly<CommandMapping>> = Readonly<{
|
|
10
10
|
packageBinName: string;
|
|
11
11
|
cliHelpMessage: string;
|
|
12
12
|
markdownHelpMessage: string;
|
package/dist/augments/npm.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RequiredAndNotNullBy } from 'augment-vir';
|
|
2
2
|
import { PackageJson } from 'type-fest';
|
|
3
|
-
export
|
|
3
|
+
export type CleanPackageJson = Readonly<RequiredAndNotNullBy<PackageJson.PackageJsonStandard, 'name' | 'version'> & {
|
|
4
4
|
workspaces?: ReadonlyArray<string>;
|
|
5
5
|
}>;
|
|
6
6
|
export declare function findTopLevelPackageJsonFile(startDir: string): string | undefined;
|
|
@@ -22,6 +22,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var _a;
|
|
25
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
27
|
exports.formatCode = void 0;
|
|
27
28
|
const fs_1 = require("fs");
|
|
@@ -30,7 +31,7 @@ async function formatCode(text, filePath) {
|
|
|
30
31
|
try {
|
|
31
32
|
// if prettier isn't installed yet this will fail
|
|
32
33
|
const { format: prettierFormat } = await Promise.resolve().then(() => __importStar(require('prettier')));
|
|
33
|
-
const repoPrettierRc = await Promise.resolve().then(() => __importStar(require(
|
|
34
|
+
const repoPrettierRc = await (_a = findNearestConfig(process.cwd()), Promise.resolve().then(() => __importStar(require(_a))));
|
|
34
35
|
const repoConfig = repoPrettierRc;
|
|
35
36
|
return prettierFormat(text, {
|
|
36
37
|
...repoConfig,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type NonEmptyString<ExactStringGeneric extends string> = ExactStringGeneric extends '' ? never : ExactStringGeneric;
|
|
2
2
|
export declare function ensureNonEmptyString<StringGeneric extends string>(inputString: NonEmptyString<StringGeneric>): StringGeneric;
|
package/dist/augments/type.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type Constructor<T> = new (...args: any[]) => T;
|
|
@@ -39,9 +39,8 @@ exports.compileCommandDefinition = (0, define_command_1.defineCommand)({
|
|
|
39
39
|
}, async (inputs) => {
|
|
40
40
|
const shouldNotEmit = inputs.filteredInputArgs.join(' ').includes('--noEmit') ||
|
|
41
41
|
inputs.inputSubCommands.includes(inputs.subCommands.check);
|
|
42
|
-
const resetCommand = shouldNotEmit ? '' : 'rm -rf dist && ';
|
|
43
42
|
const noEmit = shouldNotEmit ? '--noEmit' : '';
|
|
44
|
-
const mainCommand =
|
|
43
|
+
const mainCommand = await (0, package_paths_1.getNpmBinPath)(inputs.repoDir, 'tsc');
|
|
45
44
|
return {
|
|
46
45
|
mainCommand,
|
|
47
46
|
args: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "virmator",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.4",
|
|
4
4
|
"description": "Handle all the stuffs in one package.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -63,14 +63,14 @@
|
|
|
63
63
|
"ansi-colors": "^4.1.3",
|
|
64
64
|
"augment-vir": "^3.1.2",
|
|
65
65
|
"chai": "^4.3.7",
|
|
66
|
-
"cspell": "^6.14.
|
|
66
|
+
"cspell": "^6.14.3",
|
|
67
67
|
"fs-extra": "^10.1.0",
|
|
68
|
-
"istanbul-smart-text-reporter": "^0.0
|
|
68
|
+
"istanbul-smart-text-reporter": "^1.0.0",
|
|
69
69
|
"markdown-code-example-inserter": "^0.1.11",
|
|
70
70
|
"mocha": "^10.1.0",
|
|
71
71
|
"mocha-spec-reporter-with-file-names": "^0.0.2",
|
|
72
72
|
"nyc": "^15.1.0",
|
|
73
|
-
"prettier": "^2.
|
|
73
|
+
"prettier": "^2.8.0",
|
|
74
74
|
"prettier-plugin-jsdoc": "^0.4.2",
|
|
75
75
|
"prettier-plugin-multiline-arrays": "^1.1.1",
|
|
76
76
|
"prettier-plugin-organize-imports": "^3.2.0",
|
|
@@ -80,8 +80,8 @@
|
|
|
80
80
|
"ts-node": "^10.9.1",
|
|
81
81
|
"tsconfig-paths": "^4.1.0",
|
|
82
82
|
"type-fest": "^3.2.0",
|
|
83
|
-
"typescript": "^4.
|
|
84
|
-
"vite": "^3.2.
|
|
83
|
+
"typescript": "^4.9.3",
|
|
84
|
+
"vite": "^3.2.4"
|
|
85
85
|
},
|
|
86
86
|
"engines": {
|
|
87
87
|
"node": ">=16",
|