virmator 4.3.4 → 5.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 +4 -3
- package/base-configs/base-mocharc.js +1 -1
- package/base-configs/base-tsconfig.json +0 -5
- package/dist/api/command/command-configs.js +3 -3
- package/dist/api/command/command-mapping.d.ts +1 -1
- package/dist/api/command/command-messages.js +3 -3
- package/dist/api/command/command-to-help-message.js +11 -10
- package/dist/api/command/define-command.js +3 -3
- package/dist/api/config/copy-config.js +5 -5
- package/dist/api/create-virmator.js +2 -2
- package/dist/api/run-command/check-npm-deps.js +9 -10
- package/dist/api/run-command/run-command-executor.js +6 -7
- package/dist/api/run-command/run-extended-virmator.js +3 -3
- package/dist/api/run-command/run-shell-command.d.ts +1 -1
- package/dist/api/run-command/run-shell-command.js +2 -2
- package/dist/augments/fs.js +2 -2
- package/dist/augments/git.js +2 -2
- package/dist/augments/npm.d.ts +2 -2
- package/dist/augments/npm.js +2 -2
- package/dist/augments/object.d.ts +1 -1
- package/dist/augments/object.js +7 -7
- package/dist/augments/prettier.js +1 -1
- package/dist/commands/extra-configs/combine-json-config.js +2 -2
- package/dist/commands/extra-configs/combine-text-config.js +2 -2
- package/dist/commands/extra-configs/create-default-package-json.js +4 -4
- package/dist/commands/format.command.js +3 -3
- package/dist/commands/frontend.command.d.ts +1 -1
- package/dist/commands/frontend.command.js +1 -1
- package/dist/commands/publish.command.js +13 -13
- package/dist/commands/test.command.d.ts +1 -1
- package/dist/commands/test.command.js +1 -1
- package/dist/compiled-base-configs/vite-always-reload-plugin.js +2 -2
- package/dist/file-paths/package-paths.js +4 -4
- package/dist/index.d.ts +2 -3
- package/dist/index.js +0 -1
- package/dist/scripts/save-help-message.js +2 -2
- package/package.json +21 -20
- package/dist/api/cli-color.d.ts +0 -9
- package/dist/api/cli-color.js +0 -13
package/README.md
CHANGED
|
@@ -82,14 +82,15 @@ Any other arguments encountered between the operation command (if provided) and
|
|
|
82
82
|
|
|
83
83
|
```
|
|
84
84
|
virmator format
|
|
85
|
-
|
|
85
|
+
virmator format
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
- examples with extra Prettier flags:
|
|
89
|
+
|
|
89
90
|
```
|
|
90
91
|
virmator format --ignore-path .prettierignore
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
virmator format --ignore-path .prettierignore
|
|
93
|
+
virmator format --ignore-path .prettierignore --file-types md json
|
|
93
94
|
```
|
|
94
95
|
|
|
95
96
|
### check
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.extractAllConfigs = void 0;
|
|
4
|
-
const
|
|
4
|
+
const common_1 = require("@augment-vir/common");
|
|
5
5
|
function extractAllConfigs(commandMapping) {
|
|
6
|
-
const configFiles = (0,
|
|
7
|
-
.map((commandDefinition) => (0,
|
|
6
|
+
const configFiles = (0, common_1.getObjectTypedValues)(commandMapping)
|
|
7
|
+
.map((commandDefinition) => (0, common_1.getObjectTypedValues)(commandDefinition.configFiles))
|
|
8
8
|
.flat();
|
|
9
9
|
return configFiles;
|
|
10
10
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrayElement } from 'augment-vir';
|
|
1
|
+
import { ArrayElement } from '@augment-vir/common';
|
|
2
2
|
import { CommandDefinition } from './define-command';
|
|
3
3
|
export type CommandMapping = Record<string, CommandDefinition>;
|
|
4
4
|
export declare function commandsToMapping(commands: ReadonlyArray<CommandDefinition>): Readonly<CommandMapping>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCommandResultMessage = void 0;
|
|
4
|
-
const
|
|
4
|
+
const node_js_1 = require("@augment-vir/node-js");
|
|
5
5
|
function getCommandResultMessage(commandName, success) {
|
|
6
|
-
const specificColor = success ?
|
|
6
|
+
const specificColor = success ? node_js_1.logColors.success : node_js_1.logColors.error;
|
|
7
7
|
const specificPhrase = success ? 'succeeded' : 'failed';
|
|
8
|
-
return `${
|
|
8
|
+
return `${node_js_1.logColors.bold}${specificColor}${commandName} ${specificPhrase}.${node_js_1.logColors.reset}`;
|
|
9
9
|
}
|
|
10
10
|
exports.getCommandResultMessage = getCommandResultMessage;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.commandToHelpString = exports.flagToHelpString = exports.generateHelpMessage = exports.HelpMessageSyntax = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const common_1 = require("@augment-vir/common");
|
|
5
|
+
const node_js_1 = require("@augment-vir/node-js");
|
|
6
6
|
var HelpMessageSyntax;
|
|
7
7
|
(function (HelpMessageSyntax) {
|
|
8
8
|
HelpMessageSyntax["Cli"] = "cli";
|
|
9
9
|
HelpMessageSyntax["Markdown"] = "markdown";
|
|
10
10
|
})(HelpMessageSyntax = exports.HelpMessageSyntax || (exports.HelpMessageSyntax = {}));
|
|
11
11
|
function generateHelpMessage(packageBinName, commandDefinitions, syntax, cliWrapIfMoreThanThisManyColumns = 100) {
|
|
12
|
-
const commandsMessage = [...(0,
|
|
12
|
+
const commandsMessage = [...(0, common_1.getObjectTypedKeys)(commandDefinitions)]
|
|
13
13
|
.sort()
|
|
14
14
|
.map((commandName) => {
|
|
15
15
|
const commandDefinition = commandDefinitions[commandName];
|
|
@@ -27,11 +27,11 @@ function generateHelpMessage(packageBinName, commandDefinitions, syntax, cliWrap
|
|
|
27
27
|
exports.generateHelpMessage = generateHelpMessage;
|
|
28
28
|
const formatting = ((input) => input)({
|
|
29
29
|
h1: {
|
|
30
|
-
[HelpMessageSyntax.Cli]: `${
|
|
30
|
+
[HelpMessageSyntax.Cli]: `${node_js_1.logColors.info}`,
|
|
31
31
|
[HelpMessageSyntax.Markdown]: '# ',
|
|
32
32
|
},
|
|
33
33
|
h2: {
|
|
34
|
-
[HelpMessageSyntax.Cli]: `${
|
|
34
|
+
[HelpMessageSyntax.Cli]: `${node_js_1.logColors.bold}${node_js_1.logColors.info}`,
|
|
35
35
|
[HelpMessageSyntax.Markdown]: '## ',
|
|
36
36
|
},
|
|
37
37
|
h3: {
|
|
@@ -39,7 +39,7 @@ const formatting = ((input) => input)({
|
|
|
39
39
|
[HelpMessageSyntax.Markdown]: '### ',
|
|
40
40
|
},
|
|
41
41
|
reset: {
|
|
42
|
-
[HelpMessageSyntax.Cli]: `${
|
|
42
|
+
[HelpMessageSyntax.Cli]: `${node_js_1.logColors.reset}`,
|
|
43
43
|
[HelpMessageSyntax.Markdown]: '',
|
|
44
44
|
},
|
|
45
45
|
indent: {
|
|
@@ -93,7 +93,7 @@ function commandToHelpString(packageBinName, commandDefinition, syntax) {
|
|
|
93
93
|
}
|
|
94
94
|
exports.commandToHelpString = commandToHelpString;
|
|
95
95
|
function subCommandDescriptionsToMessage(subCommandDescriptions, syntax) {
|
|
96
|
-
return (0,
|
|
96
|
+
return (0, common_1.getObjectTypedKeys)(subCommandDescriptions).reduce((accum, currentKey, index) => {
|
|
97
97
|
const keyDescription = subCommandDescriptions[currentKey];
|
|
98
98
|
const leadingLine = index > 0 ? '\n\n' : '';
|
|
99
99
|
const fullDescription = `${leadingLine}${formatWithSyntax('h3', syntax)}${currentKey}${formatWithSyntax('colon', syntax)}\n${indent(2, syntax)}${keyDescription}`;
|
|
@@ -110,7 +110,8 @@ function sectionToString(section, extraIndent, syntax, bullets) {
|
|
|
110
110
|
const header = bullets ? '' : format('h3');
|
|
111
111
|
const title = section.title ? `${sectionIndent}${header}${section.title}${separator}` : '';
|
|
112
112
|
if (bullets && syntax === HelpMessageSyntax.Markdown) {
|
|
113
|
-
|
|
113
|
+
const isBlock = section.content.includes('\n');
|
|
114
|
+
return `${format('bullet')}${title}${isBlock ? '\n' : ''}${code(section.content, isBlock, syntax === HelpMessageSyntax.Markdown && isBlock ? ' ' : '', syntax)}`;
|
|
114
115
|
}
|
|
115
116
|
else {
|
|
116
117
|
const contentIndent = section.title ? indent(3 + extraIndent, syntax) : sectionIndent;
|
|
@@ -142,7 +143,7 @@ ${commandsText}`;
|
|
|
142
143
|
}
|
|
143
144
|
function getIndent(line) {
|
|
144
145
|
var _a;
|
|
145
|
-
return (_a = (0,
|
|
146
|
+
return (_a = (0, common_1.safeMatch)(line, /^(\s*)/)[0]) !== null && _a !== void 0 ? _a : '';
|
|
146
147
|
}
|
|
147
148
|
function wrapLines(input, limit) {
|
|
148
149
|
var _a, _b;
|
|
@@ -158,7 +159,7 @@ function wrapLines(input, limit) {
|
|
|
158
159
|
let wrappedPart = line.slice(limit);
|
|
159
160
|
// didn't wrap on a space, we need to shift a word down
|
|
160
161
|
if (!newLine.endsWith(' ') && !wrappedPart.startsWith(' ')) {
|
|
161
|
-
const lastWord = (_b = (0,
|
|
162
|
+
const lastWord = (_b = (0, common_1.safeMatch)(newLine, /(\s\S+$)/)[0]) !== null && _b !== void 0 ? _b : '';
|
|
162
163
|
lines[index] = newLine.slice(0, -1 * lastWord.length).trimEnd();
|
|
163
164
|
wrappedPart = `${lastWord}${wrappedPart.trim()}`;
|
|
164
165
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defineCommand = void 0;
|
|
4
|
-
const
|
|
4
|
+
const common_1 = require("@augment-vir/common");
|
|
5
5
|
function defineCommand(defineCommandInputs, createDescription, inputExecutor) {
|
|
6
|
-
const allAvailableSubCommands = (0,
|
|
7
|
-
const subCommands = (0,
|
|
6
|
+
const allAvailableSubCommands = (0, common_1.getObjectTypedKeys)(defineCommandInputs.subCommandDescriptions);
|
|
7
|
+
const subCommands = (0, common_1.mapObjectValues)(defineCommandInputs.subCommandDescriptions, (key) => key);
|
|
8
8
|
const init = {
|
|
9
9
|
...defineCommandInputs,
|
|
10
10
|
allAvailableSubCommands,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.copyAllConfigFiles = exports.copyConfig = exports.CopyConfigOperation = void 0;
|
|
4
|
-
const
|
|
4
|
+
const common_1 = require("@augment-vir/common");
|
|
5
|
+
const node_js_1 = require("@augment-vir/node-js");
|
|
5
6
|
const fs_1 = require("fs");
|
|
6
7
|
const promises_1 = require("fs/promises");
|
|
7
8
|
const path_1 = require("path");
|
|
8
|
-
const cli_color_1 = require("../cli-color");
|
|
9
9
|
const config_paths_1 = require("./config-paths");
|
|
10
10
|
var CopyConfigOperation;
|
|
11
11
|
(function (CopyConfigOperation) {
|
|
@@ -69,7 +69,7 @@ const failedOperation = {
|
|
|
69
69
|
/** Returns success state. True if success, false is errors were encountered. */
|
|
70
70
|
async function copyAllConfigFiles(inputs) {
|
|
71
71
|
const errors = [];
|
|
72
|
-
await (0,
|
|
72
|
+
await (0, common_1.awaitedForEach)(inputs.configFiles.sort((a, b) => {
|
|
73
73
|
const aName = (0, path_1.basename)(a.copyToPathRelativeToRepoDir || a.copyFromInternalPath);
|
|
74
74
|
const bName = (0, path_1.basename)(b.copyToPathRelativeToRepoDir || b.copyFromInternalPath);
|
|
75
75
|
return aName.localeCompare(bName);
|
|
@@ -82,11 +82,11 @@ async function copyAllConfigFiles(inputs) {
|
|
|
82
82
|
packageDir: inputs.packageDir,
|
|
83
83
|
});
|
|
84
84
|
if (result.shouldWrite) {
|
|
85
|
-
inputs.logging.stdout(`${
|
|
85
|
+
inputs.logging.stdout(`${node_js_1.logColors.info}Successfully ${successfulOperation[inputs.operation]}${node_js_1.logColors.reset} ${(0, path_1.basename)(result.copiedToPath)}`);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
catch (error) {
|
|
89
|
-
const copyError = new Error(`${
|
|
89
|
+
const copyError = new Error(`${node_js_1.logColors.error}Failed to ${failedOperation[inputs.operation]}${node_js_1.logColors.reset} ${(0, path_1.basename)(configFile.copyToPathRelativeToRepoDir || configFile.copyFromInternalPath)}: ${(0, common_1.extractErrorMessage)(error)}`);
|
|
90
90
|
errors.push(copyError);
|
|
91
91
|
}
|
|
92
92
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createVirmator = void 0;
|
|
4
|
-
const
|
|
4
|
+
const common_1 = require("@augment-vir/common");
|
|
5
5
|
const command_configs_1 = require("./command/command-configs");
|
|
6
6
|
const command_mapping_1 = require("./command/command-mapping");
|
|
7
7
|
const command_to_help_message_1 = require("./command/command-to-help-message");
|
|
@@ -36,7 +36,7 @@ function createVirmator(inputs) {
|
|
|
36
36
|
await run(process.argv, process.cwd());
|
|
37
37
|
}
|
|
38
38
|
catch (error) {
|
|
39
|
-
console.error((0,
|
|
39
|
+
console.error((0, common_1.extractErrorMessage)(error));
|
|
40
40
|
process.exit(1);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -24,14 +24,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.updateDepsAsNeeded = void 0;
|
|
27
|
-
const
|
|
28
|
-
const
|
|
27
|
+
const common_1 = require("@augment-vir/common");
|
|
28
|
+
const node_js_1 = require("@augment-vir/node-js");
|
|
29
29
|
const fs_1 = require("fs");
|
|
30
30
|
const promises_1 = require("fs/promises");
|
|
31
31
|
const path_1 = require("path");
|
|
32
32
|
const semver = __importStar(require("semver"));
|
|
33
33
|
const fs_2 = require("../../augments/fs");
|
|
34
|
-
const cli_color_1 = require("../cli-color");
|
|
35
34
|
async function updateDepsAsNeeded(inputs) {
|
|
36
35
|
try {
|
|
37
36
|
const upgradeVersions = await getVersionsToUpgradeTo(inputs);
|
|
@@ -48,23 +47,23 @@ async function updateDepsAsNeeded(inputs) {
|
|
|
48
47
|
return undefined;
|
|
49
48
|
}
|
|
50
49
|
})
|
|
51
|
-
.filter(
|
|
52
|
-
await (0,
|
|
50
|
+
.filter(common_1.isTruthy);
|
|
51
|
+
await (0, common_1.awaitedForEach)(depsToUpdate, async (depDetails) => {
|
|
53
52
|
const depToInstall = `${depDetails.npmDep}@${depDetails.version}`;
|
|
54
|
-
console.info(`${
|
|
55
|
-
await (0,
|
|
53
|
+
console.info(`${node_js_1.logColors.info}Installing ${depToInstall}...`);
|
|
54
|
+
await (0, node_js_1.runShellCommand)(`npm i -D ${depToInstall}`, {
|
|
56
55
|
cwd: inputs.repoDir,
|
|
57
56
|
rejectOnError: true,
|
|
58
57
|
});
|
|
59
58
|
});
|
|
60
59
|
}
|
|
61
60
|
catch (error) {
|
|
62
|
-
throw new Error(`Failed to update deps: ${(0,
|
|
61
|
+
throw new Error(`Failed to update deps: ${(0, common_1.extractErrorMessage)(error)}`);
|
|
63
62
|
}
|
|
64
63
|
}
|
|
65
64
|
exports.updateDepsAsNeeded = updateDepsAsNeeded;
|
|
66
65
|
async function getVersionsToUpgradeTo({ repoDir, packageDir, npmDeps, packageBinName, }) {
|
|
67
|
-
const packageName = (await (0,
|
|
66
|
+
const packageName = (await (0, node_js_1.runShellCommand)(`cut -d "=" -f 2 <<< $(npm run env | grep "npm_package_name")`, {
|
|
68
67
|
cwd: repoDir,
|
|
69
68
|
rejectOnError: true,
|
|
70
69
|
})).stdout.trim();
|
|
@@ -99,7 +98,7 @@ async function findDepsListWithPackageName(repoDir, packageName) {
|
|
|
99
98
|
if (!(0, fs_1.existsSync)((0, path_1.join)(repoDir, 'package.json'))) {
|
|
100
99
|
return findDepsListWithPackageName((0, path_1.dirname)(repoDir), packageName);
|
|
101
100
|
}
|
|
102
|
-
const listedDeps = await (0,
|
|
101
|
+
const listedDeps = await (0, node_js_1.runShellCommand)(`npm list --depth=0 -json`, {
|
|
103
102
|
cwd: repoDir,
|
|
104
103
|
rejectOnError: true,
|
|
105
104
|
});
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.runCommandExecutor = exports.createCommandString = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const common_1 = require("@augment-vir/common");
|
|
5
|
+
const node_js_1 = require("@augment-vir/node-js");
|
|
6
6
|
const path_1 = require("path");
|
|
7
|
-
const cli_color_1 = require("../cli-color");
|
|
8
7
|
const command_executor_1 = require("../command/command-executor");
|
|
9
8
|
const copy_config_1 = require("../config/copy-config");
|
|
10
9
|
const run_shell_command_1 = require("./run-shell-command");
|
|
@@ -18,14 +17,14 @@ function createCommandString(executorOutput) {
|
|
|
18
17
|
arg = arg.arg;
|
|
19
18
|
}
|
|
20
19
|
}
|
|
21
|
-
return (0,
|
|
20
|
+
return (0, node_js_1.interpolationSafeWindowsPath)(arg);
|
|
22
21
|
});
|
|
23
|
-
const commandString = `${executorOutput.mainCommand} ${args.filter(
|
|
22
|
+
const commandString = `${executorOutput.mainCommand} ${args.filter(common_1.isTruthy).join(' ')}`;
|
|
24
23
|
return commandString;
|
|
25
24
|
}
|
|
26
25
|
exports.createCommandString = createCommandString;
|
|
27
26
|
async function runCommandExecutor(commandDefinition, commandInputs) {
|
|
28
|
-
console.info(`${
|
|
27
|
+
console.info(`${node_js_1.logColors.info}running ${commandDefinition.commandName}...${node_js_1.logColors.reset}`);
|
|
29
28
|
await (0, copy_config_1.copyAllConfigFiles)({
|
|
30
29
|
logging: commandInputs.logging,
|
|
31
30
|
configFiles: Object.values(commandDefinition.configFiles),
|
|
@@ -39,7 +38,7 @@ async function runCommandExecutor(commandDefinition, commandInputs) {
|
|
|
39
38
|
}
|
|
40
39
|
else {
|
|
41
40
|
const commandString = createCommandString(executorOutput);
|
|
42
|
-
console.log(`${
|
|
41
|
+
console.log(`${node_js_1.logColors.faint}${(0, node_js_1.toPosixPath)((0, path_1.relative)(process.cwd(), commandString))}${node_js_1.logColors.reset}`);
|
|
43
42
|
const commandResult = await (0, run_shell_command_1.runVirmatorShellCommand)(commandString, {
|
|
44
43
|
repoDir: commandInputs.repoDir,
|
|
45
44
|
logging: commandInputs.logging,
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.runExtendedVirmator = void 0;
|
|
4
|
-
const
|
|
4
|
+
const common_1 = require("@augment-vir/common");
|
|
5
5
|
const command_logging_1 = require("../command/command-logging");
|
|
6
6
|
const command_messages_1 = require("../command/command-messages");
|
|
7
7
|
const check_npm_deps_1 = require("./check-npm-deps");
|
|
8
8
|
const extract_arguments_1 = require("./extract-arguments");
|
|
9
9
|
const run_command_executor_1 = require("./run-command-executor");
|
|
10
10
|
function availableCommandsString(commandMapping) {
|
|
11
|
-
return `\nAvailable commands:\n ${(0,
|
|
11
|
+
return `\nAvailable commands:\n ${(0, common_1.getObjectTypedKeys)(commandMapping).join(', ')}\n`;
|
|
12
12
|
}
|
|
13
13
|
function getValidCommandDefinition(binName, commandMapping, givenCommandName) {
|
|
14
14
|
if (!givenCommandName) {
|
|
15
15
|
throw new Error(`Missing command name as first input to ${binName}.${availableCommandsString(commandMapping)}`);
|
|
16
16
|
}
|
|
17
17
|
const commandDefinition = commandMapping[givenCommandName];
|
|
18
|
-
if (!(0,
|
|
18
|
+
if (!(0, common_1.typedHasProperty)(commandMapping, givenCommandName) || !commandDefinition) {
|
|
19
19
|
throw new Error(`Invalid command "${givenCommandName} for ${binName}.${availableCommandsString(commandMapping)}"`);
|
|
20
20
|
}
|
|
21
21
|
return commandDefinition;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.runVirmatorShellCommand = void 0;
|
|
4
|
-
const
|
|
4
|
+
const node_js_1 = require("@augment-vir/node-js");
|
|
5
5
|
const command_logging_1 = require("../command/command-logging");
|
|
6
6
|
function logWrapper(handleLog, logTransformer) {
|
|
7
7
|
return (input) => {
|
|
@@ -13,7 +13,7 @@ function logWrapper(handleLog, logTransformer) {
|
|
|
13
13
|
}
|
|
14
14
|
async function runVirmatorShellCommand(command, { repoDir: cwd, logging, logTransforms }) {
|
|
15
15
|
var _a, _b;
|
|
16
|
-
const shellResults = await (0,
|
|
16
|
+
const shellResults = await (0, node_js_1.runShellCommand)(command, {
|
|
17
17
|
cwd,
|
|
18
18
|
stdoutCallback: logWrapper(logging.stdout, (_a = logTransforms === null || logTransforms === void 0 ? void 0 : logTransforms.stdout) !== null && _a !== void 0 ? _a : command_logging_1.identityCommandLogTransform),
|
|
19
19
|
stderrCallback: logWrapper(logging.stderr, (_b = logTransforms === null || logTransforms === void 0 ? void 0 : logTransforms.stderr) !== null && _b !== void 0 ? _b : command_logging_1.identityCommandLogTransform),
|
package/dist/augments/fs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.recursivelyUpwardsSearchForDir = exports.writeFiles = exports.readAllDirContents = exports.systemRootPath = void 0;
|
|
4
|
-
const
|
|
4
|
+
const common_1 = require("@augment-vir/common");
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const promises_1 = require("fs/promises");
|
|
7
7
|
const path_1 = require("path");
|
|
@@ -27,7 +27,7 @@ async function readAllDirContents({ dir, recursive = false, }) {
|
|
|
27
27
|
}
|
|
28
28
|
exports.readAllDirContents = readAllDirContents;
|
|
29
29
|
async function writeFiles(dir, allFileContents) {
|
|
30
|
-
await (0,
|
|
30
|
+
await (0, common_1.awaitedForEach)(Object.keys(allFileContents), async (fileOrDirName) => {
|
|
31
31
|
const value = allFileContents[fileOrDirName];
|
|
32
32
|
const currentPath = (0, path_1.join)(dir, fileOrDirName);
|
|
33
33
|
if (typeof value === 'string') {
|
package/dist/augments/git.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.doChangesExist = void 0;
|
|
4
|
-
const
|
|
4
|
+
const node_js_1 = require("@augment-vir/node-js");
|
|
5
5
|
async function doChangesExist(repoDirPath) {
|
|
6
6
|
const getChangesCommand = `git status --porcelain=v1 2>/dev/null`;
|
|
7
|
-
const getChangesOutput = await (0,
|
|
7
|
+
const getChangesOutput = await (0, node_js_1.runShellCommand)(getChangesCommand, {
|
|
8
8
|
cwd: repoDirPath,
|
|
9
9
|
rejectOnError: true,
|
|
10
10
|
});
|
package/dist/augments/npm.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RequiredAndNotNullBy } from 'augment-vir';
|
|
2
|
-
import { PackageJson } from 'type-fest';
|
|
1
|
+
import { RequiredAndNotNullBy } from '@augment-vir/common';
|
|
2
|
+
import type { PackageJson } from 'type-fest';
|
|
3
3
|
export type CleanPackageJson = Readonly<RequiredAndNotNullBy<PackageJson.PackageJsonStandard, 'name' | 'version'> & {
|
|
4
4
|
workspaces?: ReadonlyArray<string>;
|
|
5
5
|
}>;
|
package/dist/augments/npm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.readTopLevelPackageJson = exports.readPackageJson = exports.findTopLevelPackageJsonFile = void 0;
|
|
4
|
-
const
|
|
4
|
+
const common_1 = require("@augment-vir/common");
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const promises_1 = require("fs/promises");
|
|
7
7
|
const path_1 = require("path");
|
|
@@ -29,7 +29,7 @@ async function readPackageJson(packageJsonPath) {
|
|
|
29
29
|
parsed = JSON.parse((await (0, promises_1.readFile)(packageJsonPath)).toString());
|
|
30
30
|
}
|
|
31
31
|
catch (error) {
|
|
32
|
-
throw new Error(`Failed to read package json file "${packageJsonPath}": ${(0,
|
|
32
|
+
throw new Error(`Failed to read package json file "${packageJsonPath}": ${(0, common_1.extractErrorMessage)(error)}`);
|
|
33
33
|
}
|
|
34
34
|
if (!parsed.name) {
|
|
35
35
|
throw new Error(`Missing package name from "${packageJsonPath}"`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Overwrite } from 'augment-vir';
|
|
1
|
+
import { Overwrite } from '@augment-vir/common';
|
|
2
2
|
export declare function filterObject<T extends object>(fullObject: Readonly<T>, callback: (value: T[keyof T], key: keyof T, fullObject: Readonly<T>) => boolean): Partial<T>;
|
|
3
3
|
export declare function deeplyCombineObjects<OriginalObjectGeneric extends object, OverwriteObjectGeneric extends object>(originalObject: OriginalObjectGeneric, overwriteObject: OverwriteObjectGeneric): Overwrite<OriginalObjectGeneric, OverwriteObjectGeneric>;
|
|
4
4
|
export declare function filterToDifferentValues<T extends object>(baseObject: T, changedObject: T): Partial<T>;
|
package/dist/augments/object.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.filterToDifferentValues = exports.deeplyCombineObjects = exports.filterObject = void 0;
|
|
4
|
-
const
|
|
4
|
+
const common_1 = require("@augment-vir/common");
|
|
5
5
|
function filterObject(fullObject, callback) {
|
|
6
|
-
return (0,
|
|
6
|
+
return (0, common_1.getObjectTypedKeys)(fullObject).reduce((accum, key) => {
|
|
7
7
|
const value = fullObject[key];
|
|
8
8
|
if (callback(value, key, fullObject)) {
|
|
9
9
|
accum[key] = value;
|
|
@@ -13,10 +13,10 @@ function filterObject(fullObject, callback) {
|
|
|
13
13
|
}
|
|
14
14
|
exports.filterObject = filterObject;
|
|
15
15
|
function deeplyCombineObjects(originalObject, overwriteObject) {
|
|
16
|
-
return (0,
|
|
16
|
+
return (0, common_1.getObjectTypedKeys)(overwriteObject).reduce((accum, currentKey) => {
|
|
17
17
|
const currentNewValue = overwriteObject[currentKey];
|
|
18
|
-
const currentOldValue = (0,
|
|
19
|
-
if ((0,
|
|
18
|
+
const currentOldValue = (0, common_1.typedHasProperty)(originalObject, currentKey) && originalObject[currentKey];
|
|
19
|
+
if ((0, common_1.isObject)(currentOldValue) && (0, common_1.isObject)(currentNewValue)) {
|
|
20
20
|
accum[currentKey] = deeplyCombineObjects(currentOldValue, currentNewValue);
|
|
21
21
|
}
|
|
22
22
|
else {
|
|
@@ -27,10 +27,10 @@ function deeplyCombineObjects(originalObject, overwriteObject) {
|
|
|
27
27
|
}
|
|
28
28
|
exports.deeplyCombineObjects = deeplyCombineObjects;
|
|
29
29
|
function filterToDifferentValues(baseObject, changedObject) {
|
|
30
|
-
return (0,
|
|
30
|
+
return (0, common_1.getObjectTypedKeys)(baseObject).reduce((accum, key) => {
|
|
31
31
|
const beforeValue = baseObject[key];
|
|
32
32
|
const afterValue = changedObject[key];
|
|
33
|
-
if ((0,
|
|
33
|
+
if ((0, common_1.isObject)(beforeValue) && (0, common_1.isObject)(afterValue)) {
|
|
34
34
|
const innerDiff = filterToDifferentValues(beforeValue, afterValue);
|
|
35
35
|
if (Object.keys(innerDiff).length) {
|
|
36
36
|
accum[key] = filterToDifferentValues(beforeValue, afterValue);
|
|
@@ -31,7 +31,7 @@ async function formatCode(text, filePath) {
|
|
|
31
31
|
try {
|
|
32
32
|
// if prettier isn't installed yet this will fail
|
|
33
33
|
const { format: prettierFormat } = await Promise.resolve().then(() => __importStar(require('prettier')));
|
|
34
|
-
const repoPrettierRc = await (_a = findNearestConfig(process.cwd()), Promise.resolve().then(() => __importStar(require(_a))));
|
|
34
|
+
const repoPrettierRc = (await (_a = findNearestConfig(process.cwd()), Promise.resolve().then(() => __importStar(require(_a))))).default;
|
|
35
35
|
const repoConfig = repoPrettierRc;
|
|
36
36
|
return prettierFormat(text, {
|
|
37
37
|
...repoConfig,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.combineJsonConfig = void 0;
|
|
4
|
-
const
|
|
4
|
+
const common_1 = require("@augment-vir/common");
|
|
5
5
|
const object_1 = require("../../augments/object");
|
|
6
6
|
const prettier_1 = require("../../augments/prettier");
|
|
7
7
|
async function combineJsonConfig(...[newConfigContents, existingConfigContents,]) {
|
|
@@ -11,7 +11,7 @@ async function combineJsonConfig(...[newConfigContents, existingConfigContents,]
|
|
|
11
11
|
}
|
|
12
12
|
catch (error) { }
|
|
13
13
|
const newJson = JSON.parse(newConfigContents);
|
|
14
|
-
if (!oldJson || !(0,
|
|
14
|
+
if (!oldJson || !(0, common_1.isObject)(oldJson)) {
|
|
15
15
|
return stringify(newJson);
|
|
16
16
|
}
|
|
17
17
|
return stringify((0, object_1.deeplyCombineObjects)(oldJson, newJson));
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.combineTextConfig = void 0;
|
|
4
|
-
const
|
|
4
|
+
const common_1 = require("@augment-vir/common");
|
|
5
5
|
function splitContentsIntoArrayOfLines(input) {
|
|
6
6
|
return input
|
|
7
7
|
.split('\n')
|
|
8
8
|
.map((line) => line.trim())
|
|
9
|
-
.filter(
|
|
9
|
+
.filter(common_1.isTruthy)
|
|
10
10
|
.sort();
|
|
11
11
|
}
|
|
12
12
|
function combineTextConfig(...[newConfigContents, existingConfigContents,]) {
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createDefaultPackageJson = void 0;
|
|
7
|
-
const
|
|
7
|
+
const common_1 = require("@augment-vir/common");
|
|
8
8
|
const path_1 = require("path");
|
|
9
9
|
const simple_git_1 = __importDefault(require("simple-git"));
|
|
10
10
|
const json_1 = require("../../augments/json");
|
|
@@ -12,11 +12,11 @@ const prettier_1 = require("../../augments/prettier");
|
|
|
12
12
|
async function createDefaultPackageJson(copyFromContents, existingConfigContents, repoDir) {
|
|
13
13
|
var _a;
|
|
14
14
|
const baseVirmatorPackageJson = JSON.parse(copyFromContents);
|
|
15
|
-
if (!(0,
|
|
15
|
+
if (!(0, common_1.isObject)(baseVirmatorPackageJson)) {
|
|
16
16
|
throw new Error(`Failed to parse virmator's config version of package json file.`);
|
|
17
17
|
}
|
|
18
18
|
const currentRepoPackageJson = (_a = (0, json_1.jsonParseOrUndefined)(existingConfigContents)) !== null && _a !== void 0 ? _a : {};
|
|
19
|
-
if (!(0,
|
|
19
|
+
if (!(0, common_1.isObject)(currentRepoPackageJson)) {
|
|
20
20
|
throw new Error(`Failed to parse current repo's package json file.`);
|
|
21
21
|
}
|
|
22
22
|
const combinedScripts = combineScripts(baseVirmatorPackageJson, currentRepoPackageJson);
|
|
@@ -35,7 +35,7 @@ function combineScripts(virmatorPackageJson, currentRepoPackageJson) {
|
|
|
35
35
|
const scripts = {
|
|
36
36
|
...currentRepoPackageJson.scripts,
|
|
37
37
|
};
|
|
38
|
-
(0,
|
|
38
|
+
(0, common_1.getObjectTypedKeys)(virmatorPackageJson.scripts).forEach((key) => {
|
|
39
39
|
const virmatorValue = virmatorPackageJson.scripts[key];
|
|
40
40
|
const currentRepoValue = scripts[key];
|
|
41
41
|
if (virmatorValue &&
|
|
@@ -79,13 +79,13 @@ exports.formatCommandDefinition = (0, define_command_1.defineCommand)({
|
|
|
79
79
|
{
|
|
80
80
|
title: 'fixes formatting for files',
|
|
81
81
|
content: `${packageBinName} ${commandName}
|
|
82
|
-
|
|
82
|
+
${packageBinName} ${commandName}`,
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
85
|
title: `examples with extra Prettier flags`,
|
|
86
86
|
content: `${packageBinName} ${commandName} --ignore-path .prettierignore
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
${packageBinName} ${commandName} --ignore-path .prettierignore
|
|
88
|
+
${packageBinName} ${commandName} --ignore-path .prettierignore ${filesMarkerArg} md json`,
|
|
89
89
|
},
|
|
90
90
|
],
|
|
91
91
|
};
|
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.publishCommandDefinition = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const common_1 = require("@augment-vir/common");
|
|
8
|
+
const node_js_1 = require("@augment-vir/node-js");
|
|
9
9
|
const fs_1 = require("fs");
|
|
10
10
|
const promises_1 = require("fs/promises");
|
|
11
11
|
const glob_1 = __importDefault(require("glob"));
|
|
@@ -46,7 +46,7 @@ exports.publishCommandDefinition = (0, define_command_1.defineCommand)({
|
|
|
46
46
|
await bumpPackageVersion(packageJson, packageJsonPath);
|
|
47
47
|
}
|
|
48
48
|
await updateWorkspaceVersions(packageJsonPath, workspaceDirs);
|
|
49
|
-
await (0,
|
|
49
|
+
await (0, node_js_1.runShellCommand)(`npm i`, {
|
|
50
50
|
rejectOnError: true,
|
|
51
51
|
cwd: (0, path_1.dirname)(packageJsonPath),
|
|
52
52
|
});
|
|
@@ -60,19 +60,19 @@ async function updateGit(packageJsonPath) {
|
|
|
60
60
|
const newVersion = (await (0, npm_1.readPackageJson)(packageJsonPath)).version;
|
|
61
61
|
const packageDirPath = (0, path_1.dirname)(packageJsonPath);
|
|
62
62
|
if (await (0, git_1.doChangesExist)(packageDirPath)) {
|
|
63
|
-
await (0,
|
|
63
|
+
await (0, node_js_1.runShellCommand)(`git commit -a --amend --no-edit`, {
|
|
64
64
|
cwd: packageDirPath,
|
|
65
65
|
rejectOnError: true,
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
await (0,
|
|
68
|
+
await (0, node_js_1.runShellCommand)(`git tag v${newVersion} && git push && git push --tags`, {
|
|
69
69
|
cwd: packageDirPath,
|
|
70
70
|
rejectOnError: true,
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
async function updateWorkspaceVersions(packageJsonPath, workspaceDirPaths) {
|
|
74
74
|
const newVersion = (await (0, npm_1.readPackageJson)(packageJsonPath)).version;
|
|
75
|
-
await (0,
|
|
75
|
+
await (0, common_1.awaitedForEach)(workspaceDirPaths, async (workspacePath) => {
|
|
76
76
|
const workspacePackageJsonPath = (0, path_1.join)(workspacePath, 'package.json');
|
|
77
77
|
const workspacePackageJson = await (0, npm_1.readPackageJson)(workspacePackageJsonPath);
|
|
78
78
|
const newWorkspacePackageJson = { ...workspacePackageJson };
|
|
@@ -83,11 +83,11 @@ async function updateWorkspaceVersions(packageJsonPath, workspaceDirPaths) {
|
|
|
83
83
|
async function publishPackages(workspaceDirPaths, packageJsonPath) {
|
|
84
84
|
const packagePath = (0, path_1.dirname)(packageJsonPath);
|
|
85
85
|
if (workspaceDirPaths.length) {
|
|
86
|
-
await (0,
|
|
86
|
+
await (0, common_1.awaitedForEach)(workspaceDirPaths, async (workspaceDirPath) => {
|
|
87
87
|
const workspacePackageJson = await (0, npm_1.readPackageJson)((0, path_1.join)(workspaceDirPath, 'package.json'));
|
|
88
88
|
if (!workspacePackageJson.private) {
|
|
89
89
|
console.info(`\nPublishing ${(0, path_1.basename)(workspaceDirPath)}`);
|
|
90
|
-
await (0,
|
|
90
|
+
await (0, node_js_1.runShellCommand)(`npm publish`, {
|
|
91
91
|
rejectOnError: true,
|
|
92
92
|
cwd: workspaceDirPath,
|
|
93
93
|
hookUpToConsole: true,
|
|
@@ -100,7 +100,7 @@ async function publishPackages(workspaceDirPaths, packageJsonPath) {
|
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
else {
|
|
103
|
-
await (0,
|
|
103
|
+
await (0, node_js_1.runShellCommand)(`npm publish`, {
|
|
104
104
|
rejectOnError: true,
|
|
105
105
|
cwd: packagePath,
|
|
106
106
|
hookUpToConsole: true,
|
|
@@ -119,7 +119,7 @@ async function isCurrentVersionPublished(packageJson, workspaceDirs) {
|
|
|
119
119
|
return arePublished.some((entry) => entry) || (await isPublished(packageJson));
|
|
120
120
|
}
|
|
121
121
|
async function isPublished({ name, version }) {
|
|
122
|
-
const output = await (0,
|
|
122
|
+
const output = await (0, node_js_1.runShellCommand)(`npm show ${name}@${version}`);
|
|
123
123
|
return output.exitCode === 0;
|
|
124
124
|
}
|
|
125
125
|
// this is just used to ensure we have every release type
|
|
@@ -132,14 +132,14 @@ const releaseTypesObject = {
|
|
|
132
132
|
prepatch: 'prepatch',
|
|
133
133
|
prerelease: 'prerelease',
|
|
134
134
|
};
|
|
135
|
-
const releaseTypeOptions = (0,
|
|
136
|
-
const releaseTypeMessage = `Choose a release type: ${(0,
|
|
135
|
+
const releaseTypeOptions = (0, common_1.getObjectTypedKeys)(releaseTypesObject);
|
|
136
|
+
const releaseTypeMessage = `Choose a release type: ${(0, common_1.joinWithFinalConjunction)(releaseTypeOptions, 'or')}:`;
|
|
137
137
|
async function bumpPackageVersion(packageJson, packageJsonPath) {
|
|
138
138
|
const releaseType = (await (0, console_1.askQuestionUntilConditionMet)({
|
|
139
139
|
conditionCallback: (input) => {
|
|
140
140
|
return releaseTypeOptions.includes(input.toLowerCase());
|
|
141
141
|
},
|
|
142
|
-
invalidInputMessage: `Invalid release type. Expected ${(0,
|
|
142
|
+
invalidInputMessage: `Invalid release type. Expected ${(0, common_1.joinWithFinalConjunction)(releaseTypeOptions, 'or')}.`,
|
|
143
143
|
questionToAsk: releaseTypeMessage,
|
|
144
144
|
timeoutMs: 0,
|
|
145
145
|
}));
|
|
@@ -11,5 +11,5 @@ export declare const testCommandDefinition: import("../api/command/define-comman
|
|
|
11
11
|
readonly copyToPathRelativeToRepoDir: string;
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
-
npmDeps: readonly ["@istanbuljs/nyc-config-typescript", "@types/chai", "@types/mocha", "chai", "istanbul-smart-text-reporter", "mocha-spec-reporter-with-file-names", "mocha", "nyc", "
|
|
14
|
+
npmDeps: readonly ["@istanbuljs/nyc-config-typescript", "@types/chai", "@types/mocha", "chai", "istanbul-smart-text-reporter", "mocha-spec-reporter-with-file-names", "mocha", "nyc", "tsx"];
|
|
15
15
|
}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.alwaysReloadPlugin = void 0;
|
|
4
|
-
const
|
|
4
|
+
const node_js_1 = require("@augment-vir/node-js");
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
/**
|
|
@@ -53,7 +53,7 @@ function alwaysReloadPlugin(config = {}) {
|
|
|
53
53
|
type: 'full-reload',
|
|
54
54
|
path: '*',
|
|
55
55
|
});
|
|
56
|
-
logger.info(`${
|
|
56
|
+
logger.info(`${node_js_1.logColors.success}page reload ${node_js_1.logColors.faint}${(0, path_1.relative)(root, path)}${node_js_1.logColors.reset}`, { clear: true, timestamp: true });
|
|
57
57
|
/**
|
|
58
58
|
* Debounce reloads calls so that they don't get spammed. If you're saving
|
|
59
59
|
* faster than this, then what the heck are you doing anyway?
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getNpmBinPath = exports.virmatorConfigs = exports.virmatorConfigsDir = exports.virmatorPackageDir = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const common_1 = require("@augment-vir/common");
|
|
5
|
+
const node_js_1 = require("@augment-vir/node-js");
|
|
6
6
|
const fs_1 = require("fs");
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
const fs_2 = require("../augments/fs");
|
|
@@ -34,10 +34,10 @@ async function getNpmBinPath(repoDir, command) {
|
|
|
34
34
|
if (!(0, fs_1.existsSync)(actualBinPath)) {
|
|
35
35
|
throw new Error(`Discovered bin path for "${command}" does not actually exist: "${actualBinPath}". Started at "${startSearchDirPath}".`);
|
|
36
36
|
}
|
|
37
|
-
return (0,
|
|
37
|
+
return (0, node_js_1.interpolationSafeWindowsPath)(actualBinPath);
|
|
38
38
|
}
|
|
39
39
|
catch (error) {
|
|
40
|
-
throw new Error(`Failed to find npm bin path for "${command}": ${(0,
|
|
40
|
+
throw new Error(`Failed to find npm bin path for "${command}": ${(0, common_1.extractErrorMessage)(error)}. Started at "${startSearchDirPath}".`);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
exports.getNpmBinPath = getNpmBinPath;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from './api/cli-color';
|
|
2
1
|
export * from './api/command/command-description';
|
|
3
2
|
export * from './api/command/command-executor';
|
|
4
3
|
export * from './api/command/command-help';
|
|
@@ -63,7 +62,7 @@ export declare const virmator: Readonly<{
|
|
|
63
62
|
readonly copyToPathRelativeToRepoDir: string;
|
|
64
63
|
};
|
|
65
64
|
};
|
|
66
|
-
npmDeps: readonly ["vite", "
|
|
65
|
+
npmDeps: readonly ["vite", "@augment-vir/node-js"];
|
|
67
66
|
}> | import("./api/command/define-command").CommandDefinition<{
|
|
68
67
|
commandName: "init";
|
|
69
68
|
subCommandDescriptions: {
|
|
@@ -99,7 +98,7 @@ export declare const virmator: Readonly<{
|
|
|
99
98
|
readonly copyToPathRelativeToRepoDir: string;
|
|
100
99
|
};
|
|
101
100
|
};
|
|
102
|
-
npmDeps: readonly ["@istanbuljs/nyc-config-typescript", "@types/chai", "@types/mocha", "chai", "istanbul-smart-text-reporter", "mocha-spec-reporter-with-file-names", "mocha", "nyc", "
|
|
101
|
+
npmDeps: readonly ["@istanbuljs/nyc-config-typescript", "@types/chai", "@types/mocha", "chai", "istanbul-smart-text-reporter", "mocha-spec-reporter-with-file-names", "mocha", "nyc", "tsx"];
|
|
103
102
|
}> | import("./api/command/define-command").CommandDefinition<{
|
|
104
103
|
commandName: "test-web";
|
|
105
104
|
subCommandDescriptions: {};
|
package/dist/index.js
CHANGED
|
@@ -27,7 +27,6 @@ const test_web_command_1 = require("./commands/test-web.command");
|
|
|
27
27
|
const test_command_1 = require("./commands/test.command");
|
|
28
28
|
const update_configs_command_1 = require("./commands/update-configs.command");
|
|
29
29
|
const package_paths_1 = require("./file-paths/package-paths");
|
|
30
|
-
__exportStar(require("./api/cli-color"), exports);
|
|
31
30
|
__exportStar(require("./api/command/command-description"), exports);
|
|
32
31
|
__exportStar(require("./api/command/command-executor"), exports);
|
|
33
32
|
__exportStar(require("./api/command/command-help"), exports);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const node_js_1 = require("@augment-vir/node-js");
|
|
3
4
|
const promises_1 = require("fs/promises");
|
|
4
5
|
const __1 = require("..");
|
|
5
|
-
const cli_color_1 = require("../api/cli-color");
|
|
6
6
|
const command_to_help_message_1 = require("../api/command/command-to-help-message");
|
|
7
7
|
const prettier_1 = require("../augments/prettier");
|
|
8
8
|
const virmator_test_file_paths_1 = require("../test/virmator-test-file-paths");
|
|
@@ -22,7 +22,7 @@ async function main(args) {
|
|
|
22
22
|
const wasReadmeChanged = formattedReadme !== originalReadme;
|
|
23
23
|
await (0, promises_1.writeFile)(virmator_test_file_paths_1.virmatorReadme, originalReadme);
|
|
24
24
|
if (wasReadmeChanged) {
|
|
25
|
-
console.info(`${
|
|
25
|
+
console.info(`${node_js_1.logColors.bold}${node_js_1.logColors.error}README usage message is not up to date.${node_js_1.logColors.reset}\nRun ${node_js_1.logColors.info}npm run docs:update${node_js_1.logColors.reset} to update.\n`);
|
|
26
26
|
throw new Error(`README not up to date.`);
|
|
27
27
|
}
|
|
28
28
|
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "virmator",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Handle
|
|
3
|
+
"version": "5.0.0",
|
|
4
|
+
"description": "Handle common package configs, commands, and dependencies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
7
|
-
"
|
|
8
|
-
"
|
|
7
|
+
"config",
|
|
8
|
+
"configs",
|
|
9
9
|
"formatting",
|
|
10
|
+
"publish",
|
|
10
11
|
"spellcheck",
|
|
11
|
-
"
|
|
12
|
+
"template",
|
|
13
|
+
"vir"
|
|
12
14
|
],
|
|
13
15
|
"homepage": "https://github.com/electrovir/virmator",
|
|
14
16
|
"bugs": {
|
|
@@ -28,8 +30,8 @@
|
|
|
28
30
|
"bin": "dist/cli.js",
|
|
29
31
|
"scripts": {
|
|
30
32
|
"compile": "rm -rf dist && tsc",
|
|
31
|
-
"docs:check": "npm run compile &&
|
|
32
|
-
"docs:update": "npm run compile &&
|
|
33
|
+
"docs:check": "npm run compile && tsx src/scripts/save-help-message.ts check && md-code --check README.md",
|
|
34
|
+
"docs:update": "npm run compile && tsx src/scripts/save-help-message.ts && md-code README.md",
|
|
33
35
|
"format": "npm run format:base -- --write --list-different",
|
|
34
36
|
"format:base": "prettier \"./**/*.+(ts|json|html|css|md|js)\"",
|
|
35
37
|
"prepublishOnly": "npm run test:all",
|
|
@@ -37,15 +39,16 @@
|
|
|
37
39
|
"test": "bash src/scripts/run-tests.sh",
|
|
38
40
|
"test:all": "npm run test && npm run spellcheck -- --no-progress && npm run test:format && npm run docs:check",
|
|
39
41
|
"test:format": "npm run format:base -- --check",
|
|
40
|
-
"test:help": "
|
|
42
|
+
"test:help": "tsx src/cli/cli.ts --help",
|
|
41
43
|
"test:types": "tsc --noEmit"
|
|
42
44
|
},
|
|
43
45
|
"dependencies": {
|
|
46
|
+
"@augment-vir/common": "^4.6.1",
|
|
47
|
+
"@augment-vir/node-js": "^4.6.1",
|
|
44
48
|
"ansi-colors": "^4.1.3",
|
|
45
|
-
"augment-vir": "^3.1.2",
|
|
46
49
|
"glob": "^8.0.3",
|
|
47
50
|
"semver": "^7.3.8",
|
|
48
|
-
"simple-git": "^3.15.
|
|
51
|
+
"simple-git": "^3.15.1"
|
|
49
52
|
},
|
|
50
53
|
"devDependencies": {
|
|
51
54
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
@@ -53,18 +56,16 @@
|
|
|
53
56
|
"@types/chai": "^4.3.4",
|
|
54
57
|
"@types/fs-extra": "^9.0.13",
|
|
55
58
|
"@types/glob": "^8.0.0",
|
|
56
|
-
"@types/mocha": "^10.0.
|
|
57
|
-
"@types/node": "^18.11.
|
|
59
|
+
"@types/mocha": "^10.0.1",
|
|
60
|
+
"@types/node": "^18.11.10",
|
|
58
61
|
"@types/semver": "^7.3.13",
|
|
59
62
|
"@web/dev-server-esbuild": "^0.3.3",
|
|
60
63
|
"@web/test-runner": "^0.15.0",
|
|
61
64
|
"@web/test-runner-commands": "^0.6.5",
|
|
62
65
|
"@web/test-runner-playwright": "^0.9.0",
|
|
63
|
-
"ansi-colors": "^4.1.3",
|
|
64
|
-
"augment-vir": "^3.1.2",
|
|
65
66
|
"chai": "^4.3.7",
|
|
66
|
-
"cspell": "^6.
|
|
67
|
-
"fs-extra": "^
|
|
67
|
+
"cspell": "^6.15.1",
|
|
68
|
+
"fs-extra": "^11.1.0",
|
|
68
69
|
"istanbul-smart-text-reporter": "^1.0.0",
|
|
69
70
|
"markdown-code-example-inserter": "^0.1.11",
|
|
70
71
|
"mocha": "^10.1.0",
|
|
@@ -73,13 +74,13 @@
|
|
|
73
74
|
"prettier": "^2.8.0",
|
|
74
75
|
"prettier-plugin-jsdoc": "^0.4.2",
|
|
75
76
|
"prettier-plugin-multiline-arrays": "^1.1.1",
|
|
76
|
-
"prettier-plugin-organize-imports": "^3.2.
|
|
77
|
+
"prettier-plugin-organize-imports": "^3.2.1",
|
|
77
78
|
"prettier-plugin-packagejson": "^2.3.0",
|
|
78
79
|
"prettier-plugin-sort-json": "^0.0.3",
|
|
79
80
|
"prettier-plugin-toml": "^0.3.1",
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"type-fest": "^3.
|
|
81
|
+
"tsconfig-paths": "^4.1.1",
|
|
82
|
+
"tsx": "^3.12.1",
|
|
83
|
+
"type-fest": "^3.3.0",
|
|
83
84
|
"typescript": "^4.9.3",
|
|
84
85
|
"vite": "^3.2.4"
|
|
85
86
|
},
|
package/dist/api/cli-color.d.ts
DELETED
package/dist/api/cli-color.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Color = void 0;
|
|
4
|
-
const ansi_colors_1 = require("ansi-colors");
|
|
5
|
-
exports.Color = {
|
|
6
|
-
Info: ansi_colors_1.styles.blue.open,
|
|
7
|
-
Faint: ansi_colors_1.styles.gray.open,
|
|
8
|
-
Fail: ansi_colors_1.styles.red.open,
|
|
9
|
-
Warn: ansi_colors_1.styles.yellow.open,
|
|
10
|
-
Success: ansi_colors_1.styles.green.open,
|
|
11
|
-
Reset: ansi_colors_1.styles.reset.open,
|
|
12
|
-
Bold: ansi_colors_1.styles.bold.open,
|
|
13
|
-
};
|