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
package/dist/augments/fs.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.systemRootPath = void 0;
|
|
4
|
-
exports.removeDirectory = removeDirectory;
|
|
5
|
-
exports.readAllDirContents = readAllDirContents;
|
|
6
|
-
exports.writeFiles = writeFiles;
|
|
7
|
-
exports.recursivelyUpwardsSearchForDir = recursivelyUpwardsSearchForDir;
|
|
8
|
-
const common_1 = require("@augment-vir/common");
|
|
9
|
-
const fs_1 = require("fs");
|
|
10
|
-
const fs_extra_1 = require("fs-extra");
|
|
11
|
-
const promises_1 = require("fs/promises");
|
|
12
|
-
const path_1 = require("path");
|
|
13
|
-
async function removeDirectory(dirPath) {
|
|
14
|
-
await (0, promises_1.rm)(dirPath, {
|
|
15
|
-
force: true,
|
|
16
|
-
recursive: true,
|
|
17
|
-
maxRetries: 3,
|
|
18
|
-
retryDelay: 100,
|
|
19
|
-
});
|
|
20
|
-
if ((0, fs_1.existsSync)(dirPath)) {
|
|
21
|
-
// try... again? Cause Windows sucks.
|
|
22
|
-
await (0, fs_extra_1.remove)(dirPath);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.systemRootPath = (0, path_1.parse)(process.cwd()).root;
|
|
26
|
-
async function readAllDirContents({ dir, recursive = false, }) {
|
|
27
|
-
const fileNames = await (0, promises_1.readdir)(dir);
|
|
28
|
-
const allFileContents = await Promise.all(fileNames.map(async (fileName) => {
|
|
29
|
-
const filePath = (0, path_1.join)(dir, fileName);
|
|
30
|
-
const isFile = (await (0, promises_1.stat)(filePath)).isFile();
|
|
31
|
-
return isFile
|
|
32
|
-
? (await (0, promises_1.readFile)(filePath)).toString()
|
|
33
|
-
: recursive
|
|
34
|
-
? await readAllDirContents({ dir: filePath, recursive })
|
|
35
|
-
: '';
|
|
36
|
-
}));
|
|
37
|
-
const mappedFileContents = fileNames.reduce((accum, fileName, index) => {
|
|
38
|
-
const fileContents = allFileContents[index] ?? '';
|
|
39
|
-
accum[fileName] = fileContents;
|
|
40
|
-
return accum;
|
|
41
|
-
}, {});
|
|
42
|
-
return mappedFileContents;
|
|
43
|
-
}
|
|
44
|
-
async function writeFiles(dir, allFileContents) {
|
|
45
|
-
await (0, common_1.awaitedForEach)(Object.keys(allFileContents), async (fileOrDirName) => {
|
|
46
|
-
const value = allFileContents[fileOrDirName];
|
|
47
|
-
const currentPath = (0, path_1.join)(dir, fileOrDirName);
|
|
48
|
-
if (typeof value === 'string') {
|
|
49
|
-
await (0, promises_1.writeFile)(currentPath, value);
|
|
50
|
-
}
|
|
51
|
-
else if (!value) {
|
|
52
|
-
throw new Error(`Failed to find file file under "${fileOrDirName}"`);
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
await writeFiles(currentPath, value);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
async function recursivelyUpwardsSearchForDir(startDirPath, check) {
|
|
60
|
-
if (!(0, fs_1.existsSync)(startDirPath) || !startDirPath) {
|
|
61
|
-
throw new Error(`Could not search in "${startDirPath}": it does not exist.`);
|
|
62
|
-
}
|
|
63
|
-
if (check(startDirPath)) {
|
|
64
|
-
return startDirPath;
|
|
65
|
-
}
|
|
66
|
-
const parent = (0, path_1.dirname)(startDirPath);
|
|
67
|
-
if (parent === startDirPath) {
|
|
68
|
-
throw new Error(`Cannot recurse any higher, already at "${parent}"`);
|
|
69
|
-
}
|
|
70
|
-
return recursivelyUpwardsSearchForDir(parent, check);
|
|
71
|
-
}
|
package/dist/augments/git.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function doChangesExist(repoDirPath: string): Promise<boolean>;
|
package/dist/augments/git.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.doChangesExist = doChangesExist;
|
|
4
|
-
const node_js_1 = require("@augment-vir/node-js");
|
|
5
|
-
async function doChangesExist(repoDirPath) {
|
|
6
|
-
const getChangesCommand = `git status --porcelain=v1 2>/dev/null`;
|
|
7
|
-
const getChangesOutput = await (0, node_js_1.runShellCommand)(getChangesCommand, {
|
|
8
|
-
cwd: repoDirPath,
|
|
9
|
-
rejectOnError: true,
|
|
10
|
-
});
|
|
11
|
-
return !!getChangesOutput.stdout;
|
|
12
|
-
}
|
package/dist/augments/json.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function jsonParseOrUndefined(input: string): any | undefined;
|
package/dist/augments/json.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.jsonParseOrUndefined = jsonParseOrUndefined;
|
|
4
|
-
function jsonParseOrUndefined(input) {
|
|
5
|
-
try {
|
|
6
|
-
return JSON.parse(input);
|
|
7
|
-
}
|
|
8
|
-
catch (error) {
|
|
9
|
-
return undefined;
|
|
10
|
-
}
|
|
11
|
-
}
|
package/dist/augments/npm.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { RequiredAndNotNullBy } from '@augment-vir/common';
|
|
2
|
-
import type { PackageJson } from 'type-fest';
|
|
3
|
-
export type CleanPackageJson = Readonly<RequiredAndNotNullBy<PackageJson.PackageJsonStandard, 'name' | 'version'> & {
|
|
4
|
-
workspaces?: ReadonlyArray<string>;
|
|
5
|
-
}>;
|
|
6
|
-
export declare function findTopLevelPackageJsonFile(startDir: string): string | undefined;
|
|
7
|
-
export declare function readPackageJson(packageJsonPath: string): Promise<CleanPackageJson>;
|
|
8
|
-
export declare function readTopLevelPackageJson(startDir: string): Promise<Readonly<{
|
|
9
|
-
packageJson: CleanPackageJson;
|
|
10
|
-
path: string;
|
|
11
|
-
}>>;
|
package/dist/augments/npm.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findTopLevelPackageJsonFile = findTopLevelPackageJsonFile;
|
|
4
|
-
exports.readPackageJson = readPackageJson;
|
|
5
|
-
exports.readTopLevelPackageJson = readTopLevelPackageJson;
|
|
6
|
-
const common_1 = require("@augment-vir/common");
|
|
7
|
-
const fs_1 = require("fs");
|
|
8
|
-
const promises_1 = require("fs/promises");
|
|
9
|
-
const path_1 = require("path");
|
|
10
|
-
const fs_2 = require("./fs");
|
|
11
|
-
function findTopLevelPackageJsonFile(startDir) {
|
|
12
|
-
if (startDir === fs_2.systemRootPath) {
|
|
13
|
-
return undefined;
|
|
14
|
-
}
|
|
15
|
-
const topLevelPath = findTopLevelPackageJsonFile((0, path_1.dirname)(startDir));
|
|
16
|
-
const currentLevelPath = (0, path_1.join)(startDir, 'package.json');
|
|
17
|
-
if (topLevelPath) {
|
|
18
|
-
return topLevelPath;
|
|
19
|
-
}
|
|
20
|
-
else if ((0, fs_1.existsSync)(currentLevelPath)) {
|
|
21
|
-
return currentLevelPath;
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
return undefined;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
async function readPackageJson(packageJsonPath) {
|
|
28
|
-
let parsed;
|
|
29
|
-
try {
|
|
30
|
-
parsed = JSON.parse((await (0, promises_1.readFile)(packageJsonPath)).toString());
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
throw new Error(`Failed to read package json file "${packageJsonPath}": ${(0, common_1.extractErrorMessage)(error)}`);
|
|
34
|
-
}
|
|
35
|
-
if (!parsed.name) {
|
|
36
|
-
throw new Error(`Missing package name from "${packageJsonPath}"`);
|
|
37
|
-
}
|
|
38
|
-
if (!parsed.version) {
|
|
39
|
-
throw new Error(`Missing package version from "${packageJsonPath}"`);
|
|
40
|
-
}
|
|
41
|
-
return parsed;
|
|
42
|
-
}
|
|
43
|
-
async function readTopLevelPackageJson(startDir) {
|
|
44
|
-
const topLevelPackageJsonPath = findTopLevelPackageJsonFile(startDir);
|
|
45
|
-
if (!topLevelPackageJsonPath) {
|
|
46
|
-
throw new Error(`Failed to find package.json path in any ancestor directories from "${startDir}"`);
|
|
47
|
-
}
|
|
48
|
-
return {
|
|
49
|
-
packageJson: await readPackageJson(topLevelPackageJsonPath),
|
|
50
|
-
path: topLevelPackageJsonPath,
|
|
51
|
-
};
|
|
52
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Overwrite } from '@augment-vir/common';
|
|
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
|
-
export declare function deeplyCombineObjects<OriginalObjectGeneric extends object, OverwriteObjectGeneric extends object>(originalObject: OriginalObjectGeneric, overwriteObject: OverwriteObjectGeneric): Overwrite<OriginalObjectGeneric, OverwriteObjectGeneric>;
|
|
4
|
-
export declare function filterToDifferentValues<T extends object>(baseObject: T, changedObject: T): Partial<T>;
|
package/dist/augments/object.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.filterObject = filterObject;
|
|
4
|
-
exports.deeplyCombineObjects = deeplyCombineObjects;
|
|
5
|
-
exports.filterToDifferentValues = filterToDifferentValues;
|
|
6
|
-
const common_1 = require("@augment-vir/common");
|
|
7
|
-
function filterObject(fullObject, callback) {
|
|
8
|
-
return (0, common_1.getObjectTypedKeys)(fullObject).reduce((accum, key) => {
|
|
9
|
-
const value = fullObject[key];
|
|
10
|
-
if (callback(value, key, fullObject)) {
|
|
11
|
-
accum[key] = value;
|
|
12
|
-
}
|
|
13
|
-
return accum;
|
|
14
|
-
}, {});
|
|
15
|
-
}
|
|
16
|
-
function deeplyCombineObjects(originalObject, overwriteObject) {
|
|
17
|
-
return (0, common_1.getObjectTypedKeys)(overwriteObject).reduce((accum, currentKey) => {
|
|
18
|
-
const currentNewValue = overwriteObject[currentKey];
|
|
19
|
-
const currentOldValue = (0, common_1.typedHasProperty)(originalObject, currentKey) && originalObject[currentKey];
|
|
20
|
-
if ((0, common_1.isObject)(currentOldValue) && (0, common_1.isObject)(currentNewValue)) {
|
|
21
|
-
accum[currentKey] = deeplyCombineObjects(currentOldValue, currentNewValue);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
accum[currentKey] = currentNewValue;
|
|
25
|
-
}
|
|
26
|
-
return accum;
|
|
27
|
-
}, originalObject);
|
|
28
|
-
}
|
|
29
|
-
function filterToDifferentValues(baseObject, changedObject) {
|
|
30
|
-
return (0, common_1.getObjectTypedKeys)(baseObject).reduce((accum, key) => {
|
|
31
|
-
const beforeValue = baseObject[key];
|
|
32
|
-
const afterValue = changedObject[key];
|
|
33
|
-
if ((0, common_1.isObject)(beforeValue) && (0, common_1.isObject)(afterValue)) {
|
|
34
|
-
const innerDiff = filterToDifferentValues(beforeValue, afterValue);
|
|
35
|
-
if (Object.keys(innerDiff).length) {
|
|
36
|
-
accum[key] = filterToDifferentValues(beforeValue, afterValue);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
else if (beforeValue !== afterValue) {
|
|
40
|
-
accum[key] = afterValue;
|
|
41
|
-
}
|
|
42
|
-
return accum;
|
|
43
|
-
}, {});
|
|
44
|
-
}
|
package/dist/augments/path.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getFirstPartOfPath(inputPath: string): string;
|
package/dist/augments/path.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFirstPartOfPath = getFirstPartOfPath;
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
function getFirstPartOfPath(inputPath) {
|
|
6
|
-
const split = inputPath.split(path_1.sep);
|
|
7
|
-
const firstPart = split[0];
|
|
8
|
-
if (!firstPart) {
|
|
9
|
-
throw new Error(`First path of path was empty from "${inputPath}"`);
|
|
10
|
-
}
|
|
11
|
-
return firstPart;
|
|
12
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function formatCode(text: string, filePath: string): Promise<string>;
|
|
@@ -1,52 +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.formatCode = formatCode;
|
|
27
|
-
const fs_1 = require("fs");
|
|
28
|
-
const path_1 = require("path");
|
|
29
|
-
async function formatCode(text, filePath) {
|
|
30
|
-
try {
|
|
31
|
-
// if prettier isn't installed yet this will fail
|
|
32
|
-
const { format: prettierFormat } = await Promise.resolve().then(() => __importStar(require('prettier')));
|
|
33
|
-
const repoPrettierRc = (await Promise.resolve(`${findNearestConfig(process.cwd())}`).then(s => __importStar(require(s)))).default;
|
|
34
|
-
const repoConfig = repoPrettierRc;
|
|
35
|
-
return prettierFormat(text, {
|
|
36
|
-
...repoConfig,
|
|
37
|
-
filepath: filePath,
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
return text;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
function findNearestConfig(dir) {
|
|
45
|
-
const currentDirConfig = (0, path_1.join)(dir, '.prettierrc.js');
|
|
46
|
-
if ((0, fs_1.existsSync)(currentDirConfig)) {
|
|
47
|
-
return currentDirConfig;
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
return findNearestConfig((0, path_1.dirname)(dir));
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function sanitizeStringForRegExpCreation(inputString: string): string;
|
package/dist/augments/regexp.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sanitizeStringForRegExpCreation = sanitizeStringForRegExpCreation;
|
|
4
|
-
function sanitizeStringForRegExpCreation(inputString) {
|
|
5
|
-
return inputString.replace(/\//g, '\\/').replace(/(\(|\)|\[|\]|\.|\}|\{|\||\+)/g, '\\$1');
|
|
6
|
-
}
|
package/dist/augments/string.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ensureNonEmptyString = ensureNonEmptyString;
|
|
4
|
-
function ensureNonEmptyString(inputString) {
|
|
5
|
-
if (!inputString) {
|
|
6
|
-
throw new Error(`Expected a non-empty string.`);
|
|
7
|
-
}
|
|
8
|
-
return inputString;
|
|
9
|
-
}
|
package/dist/augments/type.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type Constructor<T> = new (...args: any[]) => T;
|
package/dist/augments/type.js
DELETED
|
@@ -1,62 +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.withTypescriptConfigFile = withTypescriptConfigFile;
|
|
27
|
-
exports.compileTs = compileTs;
|
|
28
|
-
const promises_1 = require("fs/promises");
|
|
29
|
-
const path_1 = require("path");
|
|
30
|
-
async function withTypescriptConfigFile(configPath, callback) {
|
|
31
|
-
const tempFilePath = createOutfilePath(configPath);
|
|
32
|
-
try {
|
|
33
|
-
await compileTs({ inputPath: configPath, outputPath: tempFilePath });
|
|
34
|
-
const loadedConfig = require(tempFilePath);
|
|
35
|
-
return callback(loadedConfig);
|
|
36
|
-
}
|
|
37
|
-
finally {
|
|
38
|
-
try {
|
|
39
|
-
await (0, promises_1.unlink)(tempFilePath);
|
|
40
|
-
}
|
|
41
|
-
catch (error) { }
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
function createOutfilePath(inputFilePath) {
|
|
45
|
-
return (0, path_1.join)((0, path_1.dirname)(inputFilePath), [
|
|
46
|
-
'generated-config',
|
|
47
|
-
(0, path_1.basename)(inputFilePath).replace(/\.ts$/, '.cjs'),
|
|
48
|
-
].join('-'));
|
|
49
|
-
}
|
|
50
|
-
async function compileTs({ inputPath, outputPath, }) {
|
|
51
|
-
const outfile = outputPath || createOutfilePath(inputPath);
|
|
52
|
-
await (await Promise.resolve().then(() => __importStar(require('esbuild')))).build({
|
|
53
|
-
entryPoints: [inputPath],
|
|
54
|
-
outfile,
|
|
55
|
-
write: true,
|
|
56
|
-
target: ['node20'],
|
|
57
|
-
platform: 'node',
|
|
58
|
-
bundle: false,
|
|
59
|
-
format: 'cjs',
|
|
60
|
-
});
|
|
61
|
-
return outfile;
|
|
62
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { NpmDepTypeEnum } from '../api/command/define-command-inputs';
|
|
2
|
-
export declare const compileCommandDefinition: {
|
|
3
|
-
commandName: "compile";
|
|
4
|
-
subCommandDescriptions: {
|
|
5
|
-
readonly check: "Run type checking without emitting compiled files.";
|
|
6
|
-
};
|
|
7
|
-
configFiles: {
|
|
8
|
-
readonly tsConfig: {
|
|
9
|
-
readonly copyFromInternalPath: string;
|
|
10
|
-
readonly copyToPathRelativeToRepoDir: "tsconfig.json";
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
npmDeps: readonly [{
|
|
14
|
-
readonly name: "typescript";
|
|
15
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
16
|
-
}];
|
|
17
|
-
} & {
|
|
18
|
-
allAvailableSubCommands: readonly "check"[];
|
|
19
|
-
subCommands: import("../api/command/define-command-inputs").SubCommandsMap<{
|
|
20
|
-
commandName: "compile";
|
|
21
|
-
subCommandDescriptions: {
|
|
22
|
-
readonly check: "Run type checking without emitting compiled files.";
|
|
23
|
-
};
|
|
24
|
-
configFiles: {
|
|
25
|
-
readonly tsConfig: {
|
|
26
|
-
readonly copyFromInternalPath: string;
|
|
27
|
-
readonly copyToPathRelativeToRepoDir: "tsconfig.json";
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
npmDeps: readonly [{
|
|
31
|
-
readonly name: "typescript";
|
|
32
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
33
|
-
}];
|
|
34
|
-
}>;
|
|
35
|
-
} & {
|
|
36
|
-
executor: import("..").CommandExecutor<{
|
|
37
|
-
commandName: "compile";
|
|
38
|
-
subCommandDescriptions: {
|
|
39
|
-
readonly check: "Run type checking without emitting compiled files.";
|
|
40
|
-
};
|
|
41
|
-
configFiles: {
|
|
42
|
-
readonly tsConfig: {
|
|
43
|
-
readonly copyFromInternalPath: string;
|
|
44
|
-
readonly copyToPathRelativeToRepoDir: "tsconfig.json";
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
npmDeps: readonly [{
|
|
48
|
-
readonly name: "typescript";
|
|
49
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
50
|
-
}];
|
|
51
|
-
}>;
|
|
52
|
-
createDescription: import("..").CreateDescriptionsCallback<{
|
|
53
|
-
commandName: "compile";
|
|
54
|
-
subCommandDescriptions: {
|
|
55
|
-
readonly check: "Run type checking without emitting compiled files.";
|
|
56
|
-
};
|
|
57
|
-
configFiles: {
|
|
58
|
-
readonly tsConfig: {
|
|
59
|
-
readonly copyFromInternalPath: string;
|
|
60
|
-
readonly copyToPathRelativeToRepoDir: "tsconfig.json";
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
npmDeps: readonly [{
|
|
64
|
-
readonly name: "typescript";
|
|
65
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
66
|
-
}];
|
|
67
|
-
}>;
|
|
68
|
-
extend: import("../api/command/define-command").ExtendCallback<{
|
|
69
|
-
commandName: "compile";
|
|
70
|
-
subCommandDescriptions: {
|
|
71
|
-
readonly check: "Run type checking without emitting compiled files.";
|
|
72
|
-
};
|
|
73
|
-
configFiles: {
|
|
74
|
-
readonly tsConfig: {
|
|
75
|
-
readonly copyFromInternalPath: string;
|
|
76
|
-
readonly copyToPathRelativeToRepoDir: "tsconfig.json";
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
npmDeps: readonly [{
|
|
80
|
-
readonly name: "typescript";
|
|
81
|
-
readonly type: NpmDepTypeEnum.Dev;
|
|
82
|
-
}];
|
|
83
|
-
}>;
|
|
84
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.compileCommandDefinition = void 0;
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
const define_command_1 = require("../api/command/define-command");
|
|
6
|
-
const define_command_inputs_1 = require("../api/command/define-command-inputs");
|
|
7
|
-
const package_paths_1 = require("../file-paths/package-paths");
|
|
8
|
-
exports.compileCommandDefinition = (0, define_command_1.defineCommand)({
|
|
9
|
-
commandName: 'compile',
|
|
10
|
-
subCommandDescriptions: {
|
|
11
|
-
check: 'Run type checking without emitting compiled files.',
|
|
12
|
-
},
|
|
13
|
-
configFiles: {
|
|
14
|
-
tsConfig: {
|
|
15
|
-
copyFromInternalPath: (0, path_1.join)(package_paths_1.virmatorConfigsDir, 'tsconfig.json'),
|
|
16
|
-
copyToPathRelativeToRepoDir: 'tsconfig.json',
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
npmDeps: [
|
|
20
|
-
{ name: 'typescript', type: define_command_inputs_1.NpmDepTypeEnum.Dev },
|
|
21
|
-
],
|
|
22
|
-
}, ({ commandName, packageBinName }) => {
|
|
23
|
-
return {
|
|
24
|
-
sections: [
|
|
25
|
-
{
|
|
26
|
-
title: '',
|
|
27
|
-
content: `compile typescript files
|
|
28
|
-
Pass any extra tsc flags to this command.`,
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
examples: [
|
|
32
|
-
{
|
|
33
|
-
title: `no extra flags`,
|
|
34
|
-
content: `${packageBinName} ${commandName}`,
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
title: `one extra flag`,
|
|
38
|
-
content: `${packageBinName} ${commandName} --noEmit`,
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
};
|
|
42
|
-
}, async (inputs) => {
|
|
43
|
-
const shouldNotEmit = inputs.filteredInputArgs.join(' ').includes('--noEmit') ||
|
|
44
|
-
inputs.inputSubCommands.includes(inputs.subCommands.check);
|
|
45
|
-
const noEmit = shouldNotEmit ? '--noEmit' : '';
|
|
46
|
-
const mainCommand = await (0, package_paths_1.getNpmBinPath)({
|
|
47
|
-
repoDir: inputs.repoDir,
|
|
48
|
-
command: 'tsc',
|
|
49
|
-
packageDirPath: inputs.packageDir,
|
|
50
|
-
});
|
|
51
|
-
return {
|
|
52
|
-
args: [
|
|
53
|
-
`rm -rf dist && ${mainCommand}`,
|
|
54
|
-
noEmit,
|
|
55
|
-
...inputs.filteredInputArgs.map((arg) => `"${arg}"`),
|
|
56
|
-
],
|
|
57
|
-
};
|
|
58
|
-
});
|