virmator 12.0.3 → 13.0.1
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 +224 -129
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +21 -5
- package/dist/index.d.ts +1416 -1310
- package/dist/index.js +25 -63
- package/dist/tests/test-virmator.mock.d.ts +3 -0
- package/dist/tests/test-virmator.mock.js +5 -0
- package/package.json +25 -69
- package/src/cli.ts +29 -0
- package/src/index.ts +26 -0
- package/src/tests/test-virmator.mock.ts +13 -0
- package/base-configs/base-cspell.js +0 -272
- package/base-configs/base-mocharc.cjs +0 -20
- package/base-configs/base-nyc.js +0 -40
- package/base-configs/base-prettierrc.js +0 -32
- package/base-configs/base-web-test-runner.mjs +0 -137
- package/base-configs/test-files-glob.js +0 -13
- package/base-configs/tsconfig.base.json +0 -32
- package/configs/.gitattributes +0 -2
- package/configs/.github/workflows/build-for-gh-pages.yml +0 -24
- package/configs/.github/workflows/tagged-release.yml +0 -41
- package/configs/.github/workflows/tests.yml +0 -25
- package/configs/.nvmrc +0 -1
- package/configs/.prettierignore +0 -11
- package/configs/.prettierrc.js +0 -13
- package/configs/.vscode/settings.json +0 -50
- package/configs/LICENSE-CC0 +0 -121
- package/configs/LICENSE-MIT +0 -21
- package/configs/configs/dep-cruiser.config.ts +0 -22
- package/configs/configs/mocha.config.cjs +0 -8
- package/configs/configs/ncu.config.ts +0 -12
- package/configs/configs/nyc.config.js +0 -7
- package/configs/configs/typedoc.config.ts +0 -20
- package/configs/configs/vite.config.ts +0 -14
- package/configs/configs/web-test-runner.config.mjs +0 -21
- package/configs/cspell.config.cjs +0 -11
- package/configs/dep-cruiser.config.ts +0 -22
- package/configs/gitignore.txt +0 -13
- package/configs/ncu.config.ts +0 -13
- package/configs/npmignore.txt +0 -26
- package/configs/package.json +0 -23
- package/configs/src/index.html +0 -12
- package/configs/src/ui/elements/vir-app.element.ts +0 -10
- package/configs/tsconfig.json +0 -16
- package/configs/www-static/_redirects +0 -1
- package/configs/www-static/index.css +0 -7
- package/cspell.config.cjs +0 -13
- package/dist/api/command/command-configs.d.ts +0 -3
- package/dist/api/command/command-configs.js +0 -10
- package/dist/api/command/command-description.d.ts +0 -8
- package/dist/api/command/command-description.js +0 -2
- package/dist/api/command/command-executor.d.ts +0 -30
- package/dist/api/command/command-executor.js +0 -6
- package/dist/api/command/command-help.d.ts +0 -8
- package/dist/api/command/command-help.js +0 -2
- package/dist/api/command/command-logging.d.ts +0 -11
- package/dist/api/command/command-logging.js +0 -17
- package/dist/api/command/command-mapping.d.ts +0 -7
- package/dist/api/command/command-mapping.js +0 -9
- package/dist/api/command/command-messages.d.ts +0 -1
- package/dist/api/command/command-messages.js +0 -9
- package/dist/api/command/command-to-help-message.d.ts +0 -9
- package/dist/api/command/command-to-help-message.js +0 -175
- package/dist/api/command/define-command-inputs.d.ts +0 -22
- package/dist/api/command/define-command-inputs.js +0 -8
- package/dist/api/command/define-command.d.ts +0 -22
- package/dist/api/command/define-command.js +0 -41
- package/dist/api/config/config-file-definition.d.ts +0 -15
- package/dist/api/config/config-file-definition.js +0 -2
- package/dist/api/config/config-paths.d.ts +0 -7
- package/dist/api/config/config-paths.js +0 -7
- package/dist/api/config/copy-config.d.ts +0 -27
- package/dist/api/config/copy-config.js +0 -98
- package/dist/api/create-virmator.d.ts +0 -8
- package/dist/api/create-virmator.js +0 -67
- package/dist/api/run-command/check-npm-deps.d.ts +0 -8
- package/dist/api/run-command/check-npm-deps.js +0 -111
- package/dist/api/run-command/extract-arguments.d.ts +0 -6
- package/dist/api/run-command/extract-arguments.js +0 -36
- package/dist/api/run-command/run-command-executor.d.ts +0 -5
- package/dist/api/run-command/run-command-executor.js +0 -50
- package/dist/api/run-command/run-extended-virmator.d.ts +0 -10
- package/dist/api/run-command/run-extended-virmator.js +0 -53
- package/dist/api/run-command/run-shell-command.d.ts +0 -8
- package/dist/api/run-command/run-shell-command.js +0 -21
- package/dist/api/virmator-types.d.ts +0 -18
- package/dist/api/virmator-types.js +0 -2
- package/dist/augments/array.d.ts +0 -1
- package/dist/augments/array.js +0 -6
- package/dist/augments/console.d.ts +0 -9
- package/dist/augments/console.js +0 -43
- package/dist/augments/fs.d.ts +0 -11
- package/dist/augments/fs.js +0 -71
- package/dist/augments/git.d.ts +0 -1
- package/dist/augments/git.js +0 -12
- package/dist/augments/json.d.ts +0 -1
- package/dist/augments/json.js +0 -11
- package/dist/augments/npm.d.ts +0 -11
- package/dist/augments/npm.js +0 -52
- package/dist/augments/object.d.ts +0 -4
- package/dist/augments/object.js +0 -44
- package/dist/augments/path.d.ts +0 -1
- package/dist/augments/path.js +0 -12
- package/dist/augments/prettier.d.ts +0 -1
- package/dist/augments/prettier.js +0 -52
- package/dist/augments/regexp.d.ts +0 -1
- package/dist/augments/regexp.js +0 -6
- package/dist/augments/string.d.ts +0 -2
- package/dist/augments/string.js +0 -9
- package/dist/augments/type.d.ts +0 -1
- package/dist/augments/type.js +0 -2
- package/dist/augments/typescript-config-file.d.ts +0 -5
- package/dist/augments/typescript-config-file.js +0 -62
- package/dist/commands/compile.command.d.ts +0 -84
- package/dist/commands/compile.command.js +0 -58
- package/dist/commands/deps.command.d.ts +0 -144
- package/dist/commands/deps.command.js +0 -208
- package/dist/commands/docs.command.d.ts +0 -99
- package/dist/commands/docs.command.js +0 -192
- package/dist/commands/extra-configs/all-extra-configs.d.ts +0 -2
- package/dist/commands/extra-configs/all-extra-configs.js +0 -71
- package/dist/commands/extra-configs/combine-json-config.d.ts +0 -2
- package/dist/commands/extra-configs/combine-json-config.js +0 -21
- package/dist/commands/extra-configs/combine-text-config.d.ts +0 -2
- package/dist/commands/extra-configs/combine-text-config.js +0 -26
- package/dist/commands/extra-configs/create-default-package-json.d.ts +0 -1
- package/dist/commands/extra-configs/create-default-package-json.js +0 -86
- package/dist/commands/format.command.d.ts +0 -215
- package/dist/commands/format.command.js +0 -157
- package/dist/commands/frontend.command.d.ts +0 -149
- package/dist/commands/frontend.command.js +0 -140
- package/dist/commands/init.command.d.ts +0 -163
- package/dist/commands/init.command.js +0 -53
- package/dist/commands/publish.command.d.ts +0 -33
- package/dist/commands/publish.command.js +0 -193
- package/dist/commands/spellcheck.command.d.ts +0 -74
- package/dist/commands/spellcheck.command.js +0 -60
- package/dist/commands/test-web.command.d.ts +0 -189
- package/dist/commands/test-web.command.js +0 -125
- package/dist/commands/test.command.d.ts +0 -224
- package/dist/commands/test.command.js +0 -100
- package/dist/commands/update-configs.command.d.ts +0 -33
- package/dist/commands/update-configs.command.js +0 -35
- package/dist/compiled-base-configs/base-dep-cruiser.config.d.ts +0 -195
- package/dist/compiled-base-configs/base-dep-cruiser.config.js +0 -206
- package/dist/compiled-base-configs/base-ncu.d.ts +0 -6
- package/dist/compiled-base-configs/base-ncu.js +0 -16
- package/dist/compiled-base-configs/base-typedoc.d.ts +0 -3
- package/dist/compiled-base-configs/base-typedoc.js +0 -36
- package/dist/compiled-base-configs/base-vite.d.ts +0 -27
- package/dist/compiled-base-configs/base-vite.js +0 -74
- package/dist/compiled-base-configs/vite-always-reload-plugin.d.ts +0 -10
- package/dist/compiled-base-configs/vite-always-reload-plugin.js +0 -99
- package/dist/file-paths/package-paths.d.ts +0 -12
- package/dist/file-paths/package-paths.js +0 -46
- package/dist/scripts/save-help-message.d.ts +0 -1
- package/dist/scripts/save-help-message.js +0 -33
- package/mocha.config.cjs +0 -16
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { NpmDepTypeEnum } from '../api/command/define-command-inputs';
|
|
2
|
-
export declare const depsCommandDefinition: {
|
|
3
|
-
commandName: "deps";
|
|
4
|
-
subCommandDescriptions: {
|
|
5
|
-
readonly check: "validate dependencies";
|
|
6
|
-
readonly upgrade: "upgrade npm dependencies";
|
|
7
|
-
readonly regen: "regenerate npm dependencies";
|
|
8
|
-
};
|
|
9
|
-
configFiles: {
|
|
10
|
-
readonly depCruiserConfig: {
|
|
11
|
-
readonly copyFromInternalPath: string;
|
|
12
|
-
readonly copyToPathRelativeToRepoDir: string;
|
|
13
|
-
};
|
|
14
|
-
readonly ncuConfig: {
|
|
15
|
-
readonly copyFromInternalPath: string;
|
|
16
|
-
readonly copyToPathRelativeToRepoDir: string;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
npmDeps: readonly [{
|
|
20
|
-
readonly name: "esbuild";
|
|
21
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
22
|
-
}, {
|
|
23
|
-
readonly name: "npm-check-updates";
|
|
24
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
25
|
-
}, {
|
|
26
|
-
readonly name: "dependency-cruiser";
|
|
27
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
28
|
-
}];
|
|
29
|
-
} & {
|
|
30
|
-
allAvailableSubCommands: readonly ("check" | "upgrade" | "regen")[];
|
|
31
|
-
subCommands: import("../api/command/define-command-inputs").SubCommandsMap<{
|
|
32
|
-
commandName: "deps";
|
|
33
|
-
subCommandDescriptions: {
|
|
34
|
-
readonly check: "validate dependencies";
|
|
35
|
-
readonly upgrade: "upgrade npm dependencies";
|
|
36
|
-
readonly regen: "regenerate npm dependencies";
|
|
37
|
-
};
|
|
38
|
-
configFiles: {
|
|
39
|
-
readonly depCruiserConfig: {
|
|
40
|
-
readonly copyFromInternalPath: string;
|
|
41
|
-
readonly copyToPathRelativeToRepoDir: string;
|
|
42
|
-
};
|
|
43
|
-
readonly ncuConfig: {
|
|
44
|
-
readonly copyFromInternalPath: string;
|
|
45
|
-
readonly copyToPathRelativeToRepoDir: string;
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
npmDeps: readonly [{
|
|
49
|
-
readonly name: "esbuild";
|
|
50
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
51
|
-
}, {
|
|
52
|
-
readonly name: "npm-check-updates";
|
|
53
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
54
|
-
}, {
|
|
55
|
-
readonly name: "dependency-cruiser";
|
|
56
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
57
|
-
}];
|
|
58
|
-
}>;
|
|
59
|
-
} & {
|
|
60
|
-
executor: import("..").CommandExecutor<{
|
|
61
|
-
commandName: "deps";
|
|
62
|
-
subCommandDescriptions: {
|
|
63
|
-
readonly check: "validate dependencies";
|
|
64
|
-
readonly upgrade: "upgrade npm dependencies";
|
|
65
|
-
readonly regen: "regenerate npm dependencies";
|
|
66
|
-
};
|
|
67
|
-
configFiles: {
|
|
68
|
-
readonly depCruiserConfig: {
|
|
69
|
-
readonly copyFromInternalPath: string;
|
|
70
|
-
readonly copyToPathRelativeToRepoDir: string;
|
|
71
|
-
};
|
|
72
|
-
readonly ncuConfig: {
|
|
73
|
-
readonly copyFromInternalPath: string;
|
|
74
|
-
readonly copyToPathRelativeToRepoDir: string;
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
npmDeps: readonly [{
|
|
78
|
-
readonly name: "esbuild";
|
|
79
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
80
|
-
}, {
|
|
81
|
-
readonly name: "npm-check-updates";
|
|
82
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
83
|
-
}, {
|
|
84
|
-
readonly name: "dependency-cruiser";
|
|
85
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
86
|
-
}];
|
|
87
|
-
}>;
|
|
88
|
-
createDescription: import("..").CreateDescriptionsCallback<{
|
|
89
|
-
commandName: "deps";
|
|
90
|
-
subCommandDescriptions: {
|
|
91
|
-
readonly check: "validate dependencies";
|
|
92
|
-
readonly upgrade: "upgrade npm dependencies";
|
|
93
|
-
readonly regen: "regenerate npm dependencies";
|
|
94
|
-
};
|
|
95
|
-
configFiles: {
|
|
96
|
-
readonly depCruiserConfig: {
|
|
97
|
-
readonly copyFromInternalPath: string;
|
|
98
|
-
readonly copyToPathRelativeToRepoDir: string;
|
|
99
|
-
};
|
|
100
|
-
readonly ncuConfig: {
|
|
101
|
-
readonly copyFromInternalPath: string;
|
|
102
|
-
readonly copyToPathRelativeToRepoDir: string;
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
npmDeps: readonly [{
|
|
106
|
-
readonly name: "esbuild";
|
|
107
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
108
|
-
}, {
|
|
109
|
-
readonly name: "npm-check-updates";
|
|
110
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
111
|
-
}, {
|
|
112
|
-
readonly name: "dependency-cruiser";
|
|
113
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
114
|
-
}];
|
|
115
|
-
}>;
|
|
116
|
-
extend: import("../api/command/define-command").ExtendCallback<{
|
|
117
|
-
commandName: "deps";
|
|
118
|
-
subCommandDescriptions: {
|
|
119
|
-
readonly check: "validate dependencies";
|
|
120
|
-
readonly upgrade: "upgrade npm dependencies";
|
|
121
|
-
readonly regen: "regenerate npm dependencies";
|
|
122
|
-
};
|
|
123
|
-
configFiles: {
|
|
124
|
-
readonly depCruiserConfig: {
|
|
125
|
-
readonly copyFromInternalPath: string;
|
|
126
|
-
readonly copyToPathRelativeToRepoDir: string;
|
|
127
|
-
};
|
|
128
|
-
readonly ncuConfig: {
|
|
129
|
-
readonly copyFromInternalPath: string;
|
|
130
|
-
readonly copyToPathRelativeToRepoDir: string;
|
|
131
|
-
};
|
|
132
|
-
};
|
|
133
|
-
npmDeps: readonly [{
|
|
134
|
-
readonly name: "esbuild";
|
|
135
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
136
|
-
}, {
|
|
137
|
-
readonly name: "npm-check-updates";
|
|
138
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
139
|
-
}, {
|
|
140
|
-
readonly name: "dependency-cruiser";
|
|
141
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
142
|
-
}];
|
|
143
|
-
}>;
|
|
144
|
-
};
|
|
@@ -1,208 +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.depsCommandDefinition = void 0;
|
|
27
|
-
const common_1 = require("@augment-vir/common");
|
|
28
|
-
const node_js_1 = require("@augment-vir/node-js");
|
|
29
|
-
const fs_1 = require("fs");
|
|
30
|
-
const promises_1 = require("fs/promises");
|
|
31
|
-
const mono_vir_1 = require("mono-vir");
|
|
32
|
-
const path_1 = require("path");
|
|
33
|
-
const define_command_1 = require("../api/command/define-command");
|
|
34
|
-
const define_command_inputs_1 = require("../api/command/define-command-inputs");
|
|
35
|
-
const fs_2 = require("../augments/fs");
|
|
36
|
-
const typescript_config_file_1 = require("../augments/typescript-config-file");
|
|
37
|
-
const package_paths_1 = require("../file-paths/package-paths");
|
|
38
|
-
exports.depsCommandDefinition = (0, define_command_1.defineCommand)({
|
|
39
|
-
commandName: 'deps',
|
|
40
|
-
subCommandDescriptions: {
|
|
41
|
-
check: 'validate dependencies',
|
|
42
|
-
upgrade: 'upgrade npm dependencies',
|
|
43
|
-
regen: 'regenerate npm dependencies',
|
|
44
|
-
},
|
|
45
|
-
configFiles: {
|
|
46
|
-
depCruiserConfig: {
|
|
47
|
-
copyFromInternalPath: (0, path_1.join)(package_paths_1.virmatorConfigsDir, 'configs', 'dep-cruiser.config.ts'),
|
|
48
|
-
copyToPathRelativeToRepoDir: (0, path_1.join)('configs', 'dep-cruiser.config.ts'),
|
|
49
|
-
},
|
|
50
|
-
ncuConfig: {
|
|
51
|
-
copyFromInternalPath: (0, path_1.join)(package_paths_1.virmatorConfigsDir, 'configs', 'ncu.config.ts'),
|
|
52
|
-
copyToPathRelativeToRepoDir: (0, path_1.join)('configs', 'ncu.config.ts'),
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
npmDeps: [
|
|
56
|
-
{ name: 'esbuild', type: define_command_inputs_1.NpmDepTypeEnum.Dev },
|
|
57
|
-
{ name: 'npm-check-updates', type: define_command_inputs_1.NpmDepTypeEnum.Dev },
|
|
58
|
-
{ name: 'dependency-cruiser', type: define_command_inputs_1.NpmDepTypeEnum.Dev },
|
|
59
|
-
],
|
|
60
|
-
}, ({ commandName, packageBinName, configFiles, subCommands }) => {
|
|
61
|
-
return {
|
|
62
|
-
sections: [
|
|
63
|
-
{
|
|
64
|
-
title: '',
|
|
65
|
-
content: 'Either upgrade or check dependencies',
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
title: 'check',
|
|
69
|
-
content: `Check that dependencies are all good via a default set of rules in ${configFiles.depCruiserConfig.copyToPathRelativeToRepoDir} and dependency-cruiser.`,
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
title: 'upgrade',
|
|
73
|
-
content: `Upgrade all packages using npm-check-updates and ${configFiles.ncuConfig.copyToPathRelativeToRepoDir}.`,
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
title: 'regen',
|
|
77
|
-
content: 'Regenerate all npm deps and package-lock.json',
|
|
78
|
-
},
|
|
79
|
-
],
|
|
80
|
-
examples: [
|
|
81
|
-
{
|
|
82
|
-
title: 'Upgrade deps',
|
|
83
|
-
content: `${packageBinName} ${commandName} ${subCommands.upgrade}`,
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
title: 'Check deps',
|
|
87
|
-
content: `${packageBinName} ${commandName} ${subCommands.check}`,
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
title: 'Check deps for a specific file',
|
|
91
|
-
content: `${packageBinName} ${commandName} ${subCommands.check} ./src/my-file.ts`,
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
title: 'Regen deps',
|
|
95
|
-
content: `${packageBinName} ${commandName} ${subCommands.regen}`,
|
|
96
|
-
},
|
|
97
|
-
],
|
|
98
|
-
};
|
|
99
|
-
}, async ({ inputSubCommands, subCommands, allAvailableSubCommands, commandName, repoDir, packageDir, configFiles, filteredInputArgs, logging, }) => {
|
|
100
|
-
const subCommandsErrorString = allAvailableSubCommands.join(',');
|
|
101
|
-
if (!(0, common_1.isLengthAtLeast)(inputSubCommands, 1)) {
|
|
102
|
-
throw new Error(`Missing sub command for '${commandName}' command: expected one of ${subCommandsErrorString}`);
|
|
103
|
-
}
|
|
104
|
-
else if (inputSubCommands.length > 1) {
|
|
105
|
-
throw new Error(`Too many sub commands given to '${commandName}' command, only one is allowed from: ${subCommandsErrorString}`);
|
|
106
|
-
}
|
|
107
|
-
else if (inputSubCommands[0] === subCommands.check) {
|
|
108
|
-
const depCruiserConfigPath = (0, path_1.join)(repoDir, configFiles.depCruiserConfig.copyToPathRelativeToRepoDir);
|
|
109
|
-
const compiledConfigPath = await (0, typescript_config_file_1.compileTs)({ inputPath: depCruiserConfigPath });
|
|
110
|
-
const depCruiseCommand = await (0, package_paths_1.getNpmBinPath)({
|
|
111
|
-
repoDir: repoDir,
|
|
112
|
-
command: 'depcruise',
|
|
113
|
-
packageDirPath: packageDir,
|
|
114
|
-
});
|
|
115
|
-
const npmWorkspaces = await (0, mono_vir_1.getNpmPackages)(repoDir);
|
|
116
|
-
const otherFlags = filteredInputArgs.filter((arg) => arg.startsWith('-') && arg !== '--serial');
|
|
117
|
-
const nonFlagInputs = filteredInputArgs.filter((arg) => !arg.startsWith('-'));
|
|
118
|
-
const serial = filteredInputArgs.some((arg) => arg === '--serial');
|
|
119
|
-
const pathsToCheck = nonFlagInputs.length ? nonFlagInputs : ['src'];
|
|
120
|
-
const monoVirCommands = npmWorkspaces.length && !nonFlagInputs.length
|
|
121
|
-
? [
|
|
122
|
-
'mono-vir',
|
|
123
|
-
serial ? 'for-each' : 'for-each-async',
|
|
124
|
-
]
|
|
125
|
-
: [];
|
|
126
|
-
return {
|
|
127
|
-
args: [
|
|
128
|
-
...monoVirCommands,
|
|
129
|
-
depCruiseCommand,
|
|
130
|
-
'--config',
|
|
131
|
-
compiledConfigPath,
|
|
132
|
-
...pathsToCheck,
|
|
133
|
-
...otherFlags,
|
|
134
|
-
].filter(common_1.isTruthy),
|
|
135
|
-
async postExecute() {
|
|
136
|
-
await (0, promises_1.unlink)(compiledConfigPath);
|
|
137
|
-
},
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
else if (inputSubCommands[0] === subCommands.upgrade) {
|
|
141
|
-
const ncuConfigPath = (0, path_1.join)(repoDir, configFiles.ncuConfig.copyToPathRelativeToRepoDir);
|
|
142
|
-
return await (0, typescript_config_file_1.withTypescriptConfigFile)(ncuConfigPath, async (loadedConfig) => {
|
|
143
|
-
const repoPackageJson = await (0, node_js_1.readPackageJson)(repoDir);
|
|
144
|
-
const config = loadedConfig.ncuConfig;
|
|
145
|
-
await (await Promise.resolve().then(() => __importStar(require('npm-check-updates')))).run({
|
|
146
|
-
...config,
|
|
147
|
-
cwd: repoDir,
|
|
148
|
-
workspaces: !!repoPackageJson.workspaces,
|
|
149
|
-
format: [],
|
|
150
|
-
}, {
|
|
151
|
-
cli: true,
|
|
152
|
-
});
|
|
153
|
-
return { success: true };
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
else if (inputSubCommands[0] === subCommands.regen) {
|
|
157
|
-
const allChildNodeModules = await (0, node_js_1.readDirRecursive)(repoDir);
|
|
158
|
-
const nodeModulesPaths = Array.from(new Set(allChildNodeModules
|
|
159
|
-
.filter((path) => path.includes('node_modules'))
|
|
160
|
-
.map((path) => path.replace(/([\\\/]|^)node_modules[\\\/].+$/, '$1node_modules'))));
|
|
161
|
-
const packageLockPath = (0, path_1.join)(repoDir, 'package-lock.json');
|
|
162
|
-
const removePackageLock = (0, fs_1.existsSync)(packageLockPath);
|
|
163
|
-
const logLines = [
|
|
164
|
-
'Removing node_modules:',
|
|
165
|
-
...nodeModulesPaths.map((nodeModulesPath) => ` ${nodeModulesPath}`),
|
|
166
|
-
removePackageLock ? '\nRemoving package-lock.json' : '',
|
|
167
|
-
].filter(common_1.isTruthy);
|
|
168
|
-
logging.stdout((0, node_js_1.toLogString)({
|
|
169
|
-
args: [
|
|
170
|
-
logLines.join('\n'),
|
|
171
|
-
],
|
|
172
|
-
colors: node_js_1.ColorKey.faint,
|
|
173
|
-
}));
|
|
174
|
-
let errorsHappened = false;
|
|
175
|
-
if (removePackageLock) {
|
|
176
|
-
try {
|
|
177
|
-
await (0, promises_1.unlink)(packageLockPath);
|
|
178
|
-
}
|
|
179
|
-
catch (error) {
|
|
180
|
-
errorsHappened = true;
|
|
181
|
-
logging.stderr('Failed to remove package-lock.json.');
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
await Promise.all(nodeModulesPaths.map(async (nodeModulesPath) => {
|
|
185
|
-
try {
|
|
186
|
-
await (0, fs_2.removeDirectory)(nodeModulesPath);
|
|
187
|
-
}
|
|
188
|
-
catch (error) {
|
|
189
|
-
errorsHappened = true;
|
|
190
|
-
logging.stderr('Failed to remove package-lock.json.');
|
|
191
|
-
}
|
|
192
|
-
}));
|
|
193
|
-
if (errorsHappened) {
|
|
194
|
-
return {
|
|
195
|
-
success: false,
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
return {
|
|
199
|
-
args: [
|
|
200
|
-
'npm',
|
|
201
|
-
'i',
|
|
202
|
-
],
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
throw new Error(`Invalid sub command for '${commandName}' given: got '${inputSubCommands[0]}' but expected one of ${subCommandsErrorString}`);
|
|
207
|
-
}
|
|
208
|
-
});
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { NpmDepTypeEnum } from '../api/command/define-command-inputs';
|
|
2
|
-
export declare const docsCommandDefinition: {
|
|
3
|
-
commandName: "docs";
|
|
4
|
-
subCommandDescriptions: {
|
|
5
|
-
readonly check: "Check that documentation is up-to-date.";
|
|
6
|
-
};
|
|
7
|
-
configFiles: {
|
|
8
|
-
readonly typeDocConfig: {
|
|
9
|
-
readonly copyFromInternalPath: string;
|
|
10
|
-
readonly copyToPathRelativeToRepoDir: string;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
npmDeps: readonly [{
|
|
14
|
-
readonly name: "markdown-code-example-inserter";
|
|
15
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
16
|
-
}, {
|
|
17
|
-
readonly name: "typedoc";
|
|
18
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
19
|
-
}];
|
|
20
|
-
} & {
|
|
21
|
-
allAvailableSubCommands: readonly "check"[];
|
|
22
|
-
subCommands: import("../api/command/define-command-inputs").SubCommandsMap<{
|
|
23
|
-
commandName: "docs";
|
|
24
|
-
subCommandDescriptions: {
|
|
25
|
-
readonly check: "Check that documentation is up-to-date.";
|
|
26
|
-
};
|
|
27
|
-
configFiles: {
|
|
28
|
-
readonly typeDocConfig: {
|
|
29
|
-
readonly copyFromInternalPath: string;
|
|
30
|
-
readonly copyToPathRelativeToRepoDir: string;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
npmDeps: readonly [{
|
|
34
|
-
readonly name: "markdown-code-example-inserter";
|
|
35
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
36
|
-
}, {
|
|
37
|
-
readonly name: "typedoc";
|
|
38
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
39
|
-
}];
|
|
40
|
-
}>;
|
|
41
|
-
} & {
|
|
42
|
-
executor: import("..").CommandExecutor<{
|
|
43
|
-
commandName: "docs";
|
|
44
|
-
subCommandDescriptions: {
|
|
45
|
-
readonly check: "Check that documentation is up-to-date.";
|
|
46
|
-
};
|
|
47
|
-
configFiles: {
|
|
48
|
-
readonly typeDocConfig: {
|
|
49
|
-
readonly copyFromInternalPath: string;
|
|
50
|
-
readonly copyToPathRelativeToRepoDir: string;
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
npmDeps: readonly [{
|
|
54
|
-
readonly name: "markdown-code-example-inserter";
|
|
55
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
56
|
-
}, {
|
|
57
|
-
readonly name: "typedoc";
|
|
58
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
59
|
-
}];
|
|
60
|
-
}>;
|
|
61
|
-
createDescription: import("..").CreateDescriptionsCallback<{
|
|
62
|
-
commandName: "docs";
|
|
63
|
-
subCommandDescriptions: {
|
|
64
|
-
readonly check: "Check that documentation is up-to-date.";
|
|
65
|
-
};
|
|
66
|
-
configFiles: {
|
|
67
|
-
readonly typeDocConfig: {
|
|
68
|
-
readonly copyFromInternalPath: string;
|
|
69
|
-
readonly copyToPathRelativeToRepoDir: string;
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
npmDeps: readonly [{
|
|
73
|
-
readonly name: "markdown-code-example-inserter";
|
|
74
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
75
|
-
}, {
|
|
76
|
-
readonly name: "typedoc";
|
|
77
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
78
|
-
}];
|
|
79
|
-
}>;
|
|
80
|
-
extend: import("../api/command/define-command").ExtendCallback<{
|
|
81
|
-
commandName: "docs";
|
|
82
|
-
subCommandDescriptions: {
|
|
83
|
-
readonly check: "Check that documentation is up-to-date.";
|
|
84
|
-
};
|
|
85
|
-
configFiles: {
|
|
86
|
-
readonly typeDocConfig: {
|
|
87
|
-
readonly copyFromInternalPath: string;
|
|
88
|
-
readonly copyToPathRelativeToRepoDir: string;
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
|
-
npmDeps: readonly [{
|
|
92
|
-
readonly name: "markdown-code-example-inserter";
|
|
93
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
94
|
-
}, {
|
|
95
|
-
readonly name: "typedoc";
|
|
96
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
97
|
-
}];
|
|
98
|
-
}>;
|
|
99
|
-
};
|
|
@@ -1,192 +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.docsCommandDefinition = void 0;
|
|
27
|
-
const node_js_1 = require("@augment-vir/node-js");
|
|
28
|
-
const path_1 = require("path");
|
|
29
|
-
const define_command_1 = require("../api/command/define-command");
|
|
30
|
-
const define_command_inputs_1 = require("../api/command/define-command-inputs");
|
|
31
|
-
const typescript_config_file_1 = require("../augments/typescript-config-file");
|
|
32
|
-
const package_paths_1 = require("../file-paths/package-paths");
|
|
33
|
-
exports.docsCommandDefinition = (0, define_command_1.defineCommand)({
|
|
34
|
-
commandName: 'docs',
|
|
35
|
-
subCommandDescriptions: {
|
|
36
|
-
check: 'Check that documentation is up-to-date.',
|
|
37
|
-
},
|
|
38
|
-
configFiles: {
|
|
39
|
-
typeDocConfig: {
|
|
40
|
-
copyFromInternalPath: (0, path_1.join)(package_paths_1.virmatorConfigsDir, 'configs', 'typedoc.config.ts'),
|
|
41
|
-
copyToPathRelativeToRepoDir: (0, path_1.join)('configs', 'typedoc.config.ts'),
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
npmDeps: [
|
|
45
|
-
{
|
|
46
|
-
name: 'markdown-code-example-inserter',
|
|
47
|
-
type: define_command_inputs_1.NpmDepTypeEnum.Dev,
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
name: 'typedoc',
|
|
51
|
-
type: define_command_inputs_1.NpmDepTypeEnum.Dev,
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
}, ({ commandName, packageBinName }) => {
|
|
55
|
-
return {
|
|
56
|
-
sections: [
|
|
57
|
-
{
|
|
58
|
-
title: '',
|
|
59
|
-
content: `This also inserts 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 -->\``,
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
title: '',
|
|
63
|
-
content: `By default this command parses all markdown files in the repo (ignoring node_modules). Specific markdown files can be parsed by giving ${packageBinName} extra parameters.`,
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
title: '',
|
|
67
|
-
content: `To check if files are up-to-date (rather than actually updating them), use the "check" sub-command.`,
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
examples: [
|
|
71
|
-
{
|
|
72
|
-
title: 'default experience (usually all you need)',
|
|
73
|
-
content: `${packageBinName} ${commandName}`,
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
title: 'checking if files are up-to-date',
|
|
77
|
-
content: `${packageBinName} ${commandName} check`,
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
title: 'override files to check to a single file',
|
|
81
|
-
content: `${packageBinName} ${commandName} only/this/one/file.md`,
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
title: 'override files to check to a group of files',
|
|
85
|
-
content: `${packageBinName} ${commandName} "only/this/dir/*.md"`,
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
};
|
|
89
|
-
}, async ({ repoDir, packageDir, configFiles, filteredInputArgs, inputSubCommands, subCommands, packageBinName, logging, }) => {
|
|
90
|
-
const packageJson = await (0, node_js_1.readPackageJson)(repoDir);
|
|
91
|
-
if (packageJson.private) {
|
|
92
|
-
logging.stdout('Package is private. Skipping doc check.');
|
|
93
|
-
return {
|
|
94
|
-
success: true,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
const typeDocConfigPath = (0, path_1.join)(repoDir, configFiles.typeDocConfig.copyToPathRelativeToRepoDir);
|
|
98
|
-
return await (0, typescript_config_file_1.withTypescriptConfigFile)(typeDocConfigPath, async (loadedConfig) => {
|
|
99
|
-
const containsManualMarkdownArgs = filteredInputArgs.some((arg) => arg.match(/\.md['"]?$/));
|
|
100
|
-
const args = containsManualMarkdownArgs
|
|
101
|
-
? filteredInputArgs
|
|
102
|
-
: [`\"./**/*.md\"`];
|
|
103
|
-
const isCheckingOnly = inputSubCommands.includes(subCommands.check);
|
|
104
|
-
const subCommand = isCheckingOnly ? '--check' : '';
|
|
105
|
-
const logTransforms = {
|
|
106
|
-
stderr: (stderrInput) => stderrInput.replace('Run without --check to update.', 'Run without the "check" sub-command in order to update.'),
|
|
107
|
-
};
|
|
108
|
-
const options = loadedConfig.typeDocConfig;
|
|
109
|
-
const typeDoc = await Promise.resolve().then(() => __importStar(require('typedoc')));
|
|
110
|
-
const checkTypeDocOptions = isCheckingOnly ? { emit: typeDoc.Configuration.EmitStrategy.none } : {};
|
|
111
|
-
if (!(await runTypeDoc({
|
|
112
|
-
...options,
|
|
113
|
-
...checkTypeDocOptions,
|
|
114
|
-
}, packageBinName, typeDoc))) {
|
|
115
|
-
return { success: false };
|
|
116
|
-
}
|
|
117
|
-
return {
|
|
118
|
-
logTransforms,
|
|
119
|
-
args: [
|
|
120
|
-
await (0, package_paths_1.getNpmBinPath)({
|
|
121
|
-
repoDir: repoDir,
|
|
122
|
-
command: 'md-code',
|
|
123
|
-
packageDirPath: packageDir,
|
|
124
|
-
}),
|
|
125
|
-
subCommand,
|
|
126
|
-
...args,
|
|
127
|
-
],
|
|
128
|
-
};
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
async function runTypeDoc(options, packageBinName, typeDoc) {
|
|
132
|
-
const app = await typeDoc.Application.bootstrapWithPlugins(options, [
|
|
133
|
-
new typeDoc.TypeDocReader(),
|
|
134
|
-
new typeDoc.PackageJsonReader(),
|
|
135
|
-
new typeDoc.TSConfigReader(),
|
|
136
|
-
]);
|
|
137
|
-
if (app.options.getValue('version')) {
|
|
138
|
-
console.info(app.toString());
|
|
139
|
-
return true;
|
|
140
|
-
}
|
|
141
|
-
else if (app.options.getValue('help')) {
|
|
142
|
-
console.info(app.options.getHelp);
|
|
143
|
-
return true;
|
|
144
|
-
}
|
|
145
|
-
else if (app.options.getValue('showConfig')) {
|
|
146
|
-
console.info(app.options.getRawValues());
|
|
147
|
-
return true;
|
|
148
|
-
}
|
|
149
|
-
else if (app.logger.hasErrors()) {
|
|
150
|
-
return false;
|
|
151
|
-
}
|
|
152
|
-
else if (app.options.getValue('treatWarningsAsErrors') && app.logger.hasWarnings()) {
|
|
153
|
-
return false;
|
|
154
|
-
}
|
|
155
|
-
else if (app.options.getValue('watch')) {
|
|
156
|
-
throw new Error(`TypeDoc watch mode not supported in ${packageBinName}. Run typedoc directly.`);
|
|
157
|
-
}
|
|
158
|
-
const project = await app.convert();
|
|
159
|
-
if (!project) {
|
|
160
|
-
return false;
|
|
161
|
-
}
|
|
162
|
-
else if (app.options.getValue('treatWarningsAsErrors') && app.logger.hasWarnings()) {
|
|
163
|
-
return false;
|
|
164
|
-
}
|
|
165
|
-
const preValidationWarnCount = app.logger.warningCount;
|
|
166
|
-
app.validate(project);
|
|
167
|
-
const hadValidationWarnings = app.logger.warningCount !== preValidationWarnCount;
|
|
168
|
-
if (app.logger.hasErrors()) {
|
|
169
|
-
return false;
|
|
170
|
-
}
|
|
171
|
-
else if (hadValidationWarnings &&
|
|
172
|
-
(app.options.getValue('treatWarningsAsErrors') ||
|
|
173
|
-
app.options.getValue('treatValidationWarningsAsErrors'))) {
|
|
174
|
-
return false;
|
|
175
|
-
}
|
|
176
|
-
else if (app.options.getValue('emit') !== 'none') {
|
|
177
|
-
const json = app.options.getValue('json');
|
|
178
|
-
if (!json || app.options.isSet('out')) {
|
|
179
|
-
await app.generateDocs(project, app.options.getValue('out'));
|
|
180
|
-
}
|
|
181
|
-
if (json) {
|
|
182
|
-
await app.generateJson(project, json);
|
|
183
|
-
}
|
|
184
|
-
if (app.logger.hasErrors()) {
|
|
185
|
-
return false;
|
|
186
|
-
}
|
|
187
|
-
else if (app.options.getValue('treatWarningsAsErrors') && app.logger.hasWarnings()) {
|
|
188
|
-
return false;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
return true;
|
|
192
|
-
}
|