virmator 1.4.4 → 2.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/.cspell.json +1 -0
- package/.github/workflows/virmator-tests.yml +1 -1
- package/.prettierignore +3 -2
- package/README.md +159 -1
- package/dist/cli/cli-util/cli-color.js +5 -1
- package/dist/cli/cli-util/cli-flags.js +7 -10
- package/dist/cli/cli-util/get-all-command-output.d.ts +4 -3
- package/dist/cli/cli-util/shell-command-wrapper.d.ts +1 -1
- package/dist/cli/cli-util/shell-command-wrapper.js +2 -2
- package/dist/cli/cli-util/update-configs.js +6 -5
- package/dist/cli/cli.js +1 -1
- package/dist/cli/commands/all-cli-commands.d.ts +2 -0
- package/dist/cli/commands/all-cli-commands.js +31 -27
- package/dist/cli/commands/cli-command.d.ts +10 -1
- package/dist/cli/commands/cli-command.js +1 -1
- package/dist/cli/commands/description-printing.d.ts +10 -0
- package/dist/cli/commands/description-printing.js +149 -0
- package/dist/cli/commands/implementations/code-in-markdown.command.js +29 -22
- package/dist/cli/commands/implementations/compile.command.js +20 -8
- package/dist/cli/commands/implementations/format.command.js +54 -40
- package/dist/cli/commands/implementations/init.command.js +13 -4
- package/dist/cli/commands/implementations/spellcheck.command.js +10 -1
- package/dist/cli/commands/implementations/test.command.js +23 -26
- package/dist/cli/commands/implementations/update-all-configs.command.js +23 -14
- package/dist/cli/commands/implementations/update-bare-configs.command.js +23 -15
- package/dist/cli/commands/run-command.js +2 -3
- package/dist/cli/config/config-key.d.ts +9 -9
- package/dist/cli/config/config-key.js +4 -4
- package/dist/cli/config/config-paths.js +1 -1
- package/dist/cli/config/config-read.js +1 -2
- package/dist/cli/config/copy-config.js +3 -3
- package/dist/cli/config/create-default-package-json.js +2 -2
- package/dist/cli/config/extendable-config.js +3 -3
- package/dist/errors/cli-command-error.js +3 -3
- package/dist/errors/cli-flag-error.js +3 -3
- package/dist/errors/config-file-error.js +1 -4
- package/dist/exportable-jest-config/jest-config-path.d.ts +1 -0
- package/dist/exportable-jest-config/jest-config-path.js +6 -0
- package/dist/exportable-jest-config/separate-jest-configs/jest-config.d.ts +3 -0
- package/dist/exportable-jest-config/separate-jest-configs/jest-config.js +25 -0
- package/dist/exportable-jest-config/separate-jest-configs/jest-setup.d.ts +1 -0
- package/dist/exportable-jest-config/separate-jest-configs/jest-setup.js +11 -0
- package/dist/file-paths/virmator-repo-paths.js +4 -4
- package/dist/file-paths/{virmator-test-repos-paths.d.ts → virmator-test-file-paths.d.ts} +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -0
- package/dist/jest/jest-config.d.ts +3 -0
- package/dist/jest/jest-config.js +12 -0
- package/package.json +29 -23
- package/separate-configs/gitignore.txt +2 -0
- package/separate-configs/jest/jest-config.ts +26 -0
- package/separate-configs/jest/jest-setup.ts +12 -0
- package/separate-configs/npmignore.txt +7 -4
- package/tsconfig.json +13 -6
- package/dist/file-paths/virmator-test-repos-paths.js +0 -56
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.copyConfig = void 0;
|
|
4
|
-
const
|
|
4
|
+
const node_only_1 = require("augment-vir/dist/node-only");
|
|
5
5
|
const fs_extra_1 = require("fs-extra");
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const config_file_error_1 = require("../../errors/config-file-error");
|
|
@@ -39,7 +39,7 @@ async function copyConfig({ configKey, forceExtendableConfig, repoDir, }) {
|
|
|
39
39
|
if (!repoConfigExists) {
|
|
40
40
|
// if extender config file does not exist, create it
|
|
41
41
|
const extenderContents = await (0, config_read_1.readUpdatedVirmatorConfigFile)(configKey, repoDir, true);
|
|
42
|
-
await (0,
|
|
42
|
+
await (0, node_only_1.writeFileAndDir)(repoConfigPath, extenderContents);
|
|
43
43
|
}
|
|
44
44
|
const repoExtendableConfigPath = (0, path_1.join)(repoDir, (0, extendable_config_1.getExtendableBaseConfigName)(configKey));
|
|
45
45
|
const repoExtendableConfigExists = (0, fs_extra_1.existsSync)(repoExtendableConfigPath);
|
|
@@ -89,7 +89,7 @@ async function copyConfig({ configKey, forceExtendableConfig, repoDir, }) {
|
|
|
89
89
|
outputFilePath = repoConfigPath;
|
|
90
90
|
}
|
|
91
91
|
if (shouldWriteConfig) {
|
|
92
|
-
await (0,
|
|
92
|
+
await (0, node_only_1.writeFileAndDir)(outputFilePath, virmatorConfigContents);
|
|
93
93
|
}
|
|
94
94
|
return {
|
|
95
95
|
logs,
|
|
@@ -4,13 +4,13 @@ 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 promises_1 = require("fs/promises");
|
|
8
8
|
const path_1 = require("path");
|
|
9
9
|
const simple_git_1 = __importDefault(require("simple-git"));
|
|
10
10
|
const config_key_1 = require("./config-key");
|
|
11
11
|
const config_paths_1 = require("./config-paths");
|
|
12
12
|
async function createDefaultPackageJson(repoDir) {
|
|
13
|
-
const virmatorPackageJson = JSON.parse((await (0,
|
|
13
|
+
const virmatorPackageJson = JSON.parse((await (0, promises_1.readFile)((0, config_paths_1.getVirmatorConfigFilePath)(config_key_1.ConfigKey.PackageJson, false))).toString());
|
|
14
14
|
const gitProperties = await getGitProperties(repoDir);
|
|
15
15
|
return {
|
|
16
16
|
...virmatorPackageJson,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isConfigExtending = exports.isExtendableConfig = exports.getExtendableBaseConfigName = exports.ExtendableConfig = void 0;
|
|
4
|
-
const
|
|
4
|
+
const augment_vir_1 = require("augment-vir");
|
|
5
5
|
const config_key_1 = require("./config-key");
|
|
6
6
|
const extendableConfigFileMap = {
|
|
7
7
|
[config_key_1.ConfigKey.Prettier]: '.prettierrc-base.js',
|
|
8
8
|
[config_key_1.ConfigKey.Cspell]: '.cspell-base.json',
|
|
9
9
|
[config_key_1.ConfigKey.TsConfig]: 'tsconfig-base.json',
|
|
10
10
|
};
|
|
11
|
-
exports.ExtendableConfig = (0,
|
|
11
|
+
exports.ExtendableConfig = (0, augment_vir_1.getObjectTypedKeys)(extendableConfigFileMap).reduce((accum, key) => {
|
|
12
12
|
accum[key] = key;
|
|
13
13
|
return accum;
|
|
14
14
|
}, {});
|
|
@@ -23,7 +23,7 @@ function isExtendableConfig(ConfigKey) {
|
|
|
23
23
|
if (!ConfigKey) {
|
|
24
24
|
return false;
|
|
25
25
|
}
|
|
26
|
-
return (0,
|
|
26
|
+
return (0, augment_vir_1.isEnumValue)(ConfigKey, exports.ExtendableConfig);
|
|
27
27
|
}
|
|
28
28
|
exports.isExtendableConfig = isExtendableConfig;
|
|
29
29
|
function isConfigExtending(key, contents) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VirmatorCliCommandError = void 0;
|
|
4
|
-
const
|
|
4
|
+
const augment_vir_1 = require("augment-vir");
|
|
5
5
|
const cli_command_name_1 = require("../cli/cli-util/cli-command-name");
|
|
6
6
|
class VirmatorCliCommandError extends Error {
|
|
7
|
+
name = 'VirmatorCliCommandError';
|
|
7
8
|
constructor(message) {
|
|
8
|
-
super(`${message}\nExpected one of the following: ${(0,
|
|
9
|
-
this.name = 'VirmatorCliCommandError';
|
|
9
|
+
super(`${message}\nExpected one of the following: ${(0, augment_vir_1.getEnumTypedValues)(cli_command_name_1.CliCommandName).join(', ')}`);
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
exports.VirmatorCliCommandError = VirmatorCliCommandError;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CliFlagError = void 0;
|
|
4
|
-
const
|
|
4
|
+
const augment_vir_1 = require("augment-vir");
|
|
5
5
|
const cli_flags_1 = require("../cli/cli-util/cli-flags");
|
|
6
6
|
class CliFlagError extends Error {
|
|
7
|
+
name = 'CliFlagError';
|
|
7
8
|
constructor(invalidFlags) {
|
|
8
|
-
super(`Invalid flags given: ${invalidFlags.join(',')}\nValid flags: ${(0,
|
|
9
|
-
this.name = 'CliFlagError';
|
|
9
|
+
super(`Invalid flags given: ${invalidFlags.join(',')}\nValid flags: ${(0, augment_vir_1.getObjectTypedKeys)(cli_flags_1.defaultCliFlags).join(',')}`);
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
exports.CliFlagError = CliFlagError;
|
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ConfigFileError = void 0;
|
|
4
4
|
class ConfigFileError extends Error {
|
|
5
|
-
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.name = 'ConfigFileError';
|
|
8
|
-
}
|
|
5
|
+
name = 'ConfigFileError';
|
|
9
6
|
}
|
|
10
7
|
exports.ConfigFileError = ConfigFileError;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const virmatorJestConfigFilePath: string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.virmatorJestConfigFilePath = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const virmator_repo_paths_1 = require("../file-paths/virmator-repo-paths");
|
|
6
|
+
exports.virmatorJestConfigFilePath = (0, path_1.join)(virmator_repo_paths_1.virmatorRootDir, virmator_repo_paths_1.relativeSeparateConfigsDir, 'jest', 'jest-config.ts');
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.virmatorJestConfig = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const cwd = process.cwd();
|
|
6
|
+
exports.virmatorJestConfig = {
|
|
7
|
+
preset: 'ts-jest',
|
|
8
|
+
testEnvironment: 'node',
|
|
9
|
+
verbose: false,
|
|
10
|
+
rootDir: cwd,
|
|
11
|
+
silent: false,
|
|
12
|
+
modulePathIgnorePatterns: ['.*.type.test.ts$'],
|
|
13
|
+
roots: [(0, path_1.join)(cwd, 'src')],
|
|
14
|
+
setupFilesAfterEnv: [(0, path_1.join)(__dirname, 'jest-setup.ts')],
|
|
15
|
+
globals: {
|
|
16
|
+
'ts-jest': {
|
|
17
|
+
tsconfig: (0, path_1.join)(cwd, 'tsconfig.json'),
|
|
18
|
+
diagnostics: {
|
|
19
|
+
warnOnly: true,
|
|
20
|
+
ignoreCodes: ['TS151001'],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
exports.default = exports.virmatorJestConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const console_1 = require("@jest/console");
|
|
4
|
+
function simpleFormatter(type, message) {
|
|
5
|
+
const consoleIndent = ' ';
|
|
6
|
+
return message
|
|
7
|
+
.split(/\n/)
|
|
8
|
+
.map((line) => consoleIndent + line)
|
|
9
|
+
.join('\n');
|
|
10
|
+
}
|
|
11
|
+
global.console = new console_1.CustomConsole(process.stdout, process.stderr, simpleFormatter);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getNpmBinPath = exports.relativeSeparateConfigsDir = exports.extenderConfigsDir = exports.virmatorDistDir = exports.virmatorRootDir = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const node_only_1 = require("augment-vir/dist/node-only");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
exports.virmatorRootDir = __dirname.replace(/(?:src|node_modules\/dist|dist).*/, '');
|
|
8
8
|
exports.virmatorDistDir = (0, path_1.join)(exports.virmatorRootDir, 'dist');
|
|
@@ -11,9 +11,9 @@ exports.relativeSeparateConfigsDir = 'separate-configs';
|
|
|
11
11
|
const virmatorNodeBin = (0, path_1.join)(exports.virmatorRootDir, 'node_modules', '.bin');
|
|
12
12
|
function getNpmBinPath(command) {
|
|
13
13
|
const virmatorBinPath = (0, path_1.join)(virmatorNodeBin, command);
|
|
14
|
-
const actualBinPath = (0,
|
|
14
|
+
const actualBinPath = (0, fs_1.existsSync)(virmatorBinPath)
|
|
15
15
|
? virmatorBinPath
|
|
16
16
|
: (0, path_1.join)(exports.virmatorRootDir, '..', '.bin', command);
|
|
17
|
-
return (0,
|
|
17
|
+
return (0, node_only_1.interpolationSafeWindowsPath)(actualBinPath);
|
|
18
18
|
}
|
|
19
19
|
exports.getNpmBinPath = getNpmBinPath;
|
|
@@ -18,6 +18,7 @@ export declare const testTestPaths: {
|
|
|
18
18
|
validRepo: string;
|
|
19
19
|
invalidRepo: string;
|
|
20
20
|
multiRepo: string;
|
|
21
|
+
runInBandTestRepo: string;
|
|
21
22
|
};
|
|
22
23
|
export declare const spellcheckTestPaths: {
|
|
23
24
|
validRepo: string;
|
|
@@ -30,3 +31,4 @@ export declare const updateBareConfigsTestPaths: {
|
|
|
30
31
|
export declare const updateAllConfigsTestPaths: {
|
|
31
32
|
fullPackageJsonRepo: string;
|
|
32
33
|
};
|
|
34
|
+
export declare const virmatorReadme: string;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.virmatorJestConfig = void 0;
|
|
4
|
+
/** This is exported so that it can be extended if needed. */
|
|
5
|
+
var jest_config_1 = require("./exportable-jest-config/separate-jest-configs/jest-config");
|
|
6
|
+
Object.defineProperty(exports, "virmatorJestConfig", { enumerable: true, get: function () { return jest_config_1.virmatorJestConfig; } });
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jest_config_1 = require("../exportable-jest-config/separate-jest-configs/jest-config");
|
|
4
|
+
const virmatorInternalTestingConfig = {
|
|
5
|
+
...jest_config_1.virmatorJestConfig,
|
|
6
|
+
testTimeout: 30000,
|
|
7
|
+
modulePathIgnorePatterns: [
|
|
8
|
+
...jest_config_1.virmatorJestConfig.modulePathIgnorePatterns,
|
|
9
|
+
'test-files',
|
|
10
|
+
],
|
|
11
|
+
};
|
|
12
|
+
exports.default = virmatorInternalTestingConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "virmator",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Handle all the stuffs in one package.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
"name": "electrovir",
|
|
24
24
|
"url": "https://github.com/electrovir"
|
|
25
25
|
},
|
|
26
|
+
"main": "dist/index.js",
|
|
27
|
+
"types": "dist/index.d.ts",
|
|
26
28
|
"bin": "dist/cli/cli.js",
|
|
27
29
|
"scripts": {
|
|
28
30
|
"compile": "rm -rf dist && tsc && chmod +x dist/cli/cli.js",
|
|
@@ -30,35 +32,39 @@
|
|
|
30
32
|
"format:base": "prettier \"./**/*.+(ts|json|html|css|md|js)\"",
|
|
31
33
|
"format:check": "npm run format:base -- --check",
|
|
32
34
|
"prepublishOnly": "npm install && npm run test:full",
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"test
|
|
37
|
-
"test:
|
|
35
|
+
"readme:check": "npm run compile && ts-node -r tsconfig-paths/register src/scripts/save-help-message.ts check && md-code --check README.md",
|
|
36
|
+
"readme:update": "npm run compile && ts-node -r tsconfig-paths/register src/scripts/save-help-message.ts && md-code README.md",
|
|
37
|
+
"spellcheck": "cspell \"{*,.*,**/{.*,*}/**/{.*,*}}\" --exclude \"test-files/spellcheck/invalid-spellcheck-repo/**/*\" --exclude \"extender-configs\"",
|
|
38
|
+
"test": "npm install && npm run compile && jest --runInBand --config ./src/jest/jest-config.ts",
|
|
39
|
+
"test:full": "npm run test && npm run spellcheck -- --no-progress && npm run format:check && npm run readme:check",
|
|
40
|
+
"test:help": "ts-node -r tsconfig-paths/register src/cli/cli.ts --help"
|
|
38
41
|
},
|
|
39
42
|
"dependencies": {
|
|
43
|
+
"@types/jest": "27.4.1",
|
|
40
44
|
"ansi-styles": "5.2.0",
|
|
41
|
-
"augment-vir": "
|
|
42
|
-
"cspell": "
|
|
43
|
-
"fs-extra": "
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"prettier
|
|
47
|
-
"prettier-plugin-
|
|
48
|
-
"prettier-plugin-
|
|
49
|
-
"prettier-plugin-
|
|
50
|
-
"prettier-plugin-
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
45
|
+
"augment-vir": "1.7.0",
|
|
46
|
+
"cspell": "5.19.2",
|
|
47
|
+
"fs-extra": "10.0.1",
|
|
48
|
+
"jest": "27.5.1",
|
|
49
|
+
"markdown-code-example-inserter": "0.1.7",
|
|
50
|
+
"prettier": "2.6.0",
|
|
51
|
+
"prettier-plugin-jsdoc": "0.3.31",
|
|
52
|
+
"prettier-plugin-multiline-arrays": "0.0.4",
|
|
53
|
+
"prettier-plugin-organize-imports": "2.3.4",
|
|
54
|
+
"prettier-plugin-packagejson": "2.2.16",
|
|
55
|
+
"prettier-plugin-sort-json": "0.0.2",
|
|
56
|
+
"simple-git": "3.4.0",
|
|
57
|
+
"ts-jest": "27.1.3",
|
|
58
|
+
"ts-node": "10.7.0",
|
|
59
|
+
"tsconfig-paths": "3.14.0",
|
|
60
|
+
"typescript": "4.6.2"
|
|
54
61
|
},
|
|
55
62
|
"devDependencies": {
|
|
56
|
-
"@types/fs-extra": "
|
|
57
|
-
"@types/node": "
|
|
58
|
-
"ts-node": "^10.5.0"
|
|
63
|
+
"@types/fs-extra": "9.0.13",
|
|
64
|
+
"@types/node": "17.0.21"
|
|
59
65
|
},
|
|
60
66
|
"engines": {
|
|
61
|
-
"node": ">=
|
|
67
|
+
"node": ">=14",
|
|
62
68
|
"npm": ">=7"
|
|
63
69
|
}
|
|
64
70
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {join} from 'path';
|
|
2
|
+
import {InitialOptionsTsJest} from 'ts-jest';
|
|
3
|
+
|
|
4
|
+
const cwd = process.cwd();
|
|
5
|
+
|
|
6
|
+
export const virmatorJestConfig: InitialOptionsTsJest = {
|
|
7
|
+
preset: 'ts-jest',
|
|
8
|
+
testEnvironment: 'node',
|
|
9
|
+
verbose: false,
|
|
10
|
+
rootDir: cwd,
|
|
11
|
+
silent: false,
|
|
12
|
+
modulePathIgnorePatterns: ['.*.type.test.ts$'],
|
|
13
|
+
roots: [join(cwd, 'src')],
|
|
14
|
+
setupFilesAfterEnv: [join(__dirname, 'jest-setup.ts')],
|
|
15
|
+
globals: {
|
|
16
|
+
'ts-jest': {
|
|
17
|
+
tsconfig: join(cwd, 'tsconfig.json'),
|
|
18
|
+
diagnostics: {
|
|
19
|
+
warnOnly: true,
|
|
20
|
+
ignoreCodes: ['TS151001'],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default virmatorJestConfig;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {CustomConsole, LogMessage, LogType} from '@jest/console';
|
|
2
|
+
|
|
3
|
+
function simpleFormatter(type: LogType, message: LogMessage): string {
|
|
4
|
+
const consoleIndent = ' ';
|
|
5
|
+
|
|
6
|
+
return message
|
|
7
|
+
.split(/\n/)
|
|
8
|
+
.map((line) => consoleIndent + line)
|
|
9
|
+
.join('\n');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
global.console = new CustomConsole(process.stdout, process.stderr, simpleFormatter);
|
|
@@ -8,12 +8,15 @@
|
|
|
8
8
|
.vscode/
|
|
9
9
|
*.test.d.ts
|
|
10
10
|
*.test.js
|
|
11
|
+
*.test.ts
|
|
12
|
+
dist/readme-examples/
|
|
13
|
+
dist/scripts/
|
|
11
14
|
dist/test/
|
|
15
|
+
dist/vite/
|
|
16
|
+
index.html
|
|
17
|
+
public/
|
|
12
18
|
scripts/
|
|
13
|
-
snowpack.config.js
|
|
14
|
-
snowpack.config.mjs
|
|
15
19
|
src/
|
|
16
|
-
|
|
17
|
-
test-repos/
|
|
20
|
+
test-files/
|
|
18
21
|
tsconfig-base.json
|
|
19
22
|
tsconfig.json
|
package/tsconfig.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"alwaysStrict": true,
|
|
4
|
+
"baseUrl": ".",
|
|
4
5
|
"declaration": true,
|
|
5
6
|
"esModuleInterop": true,
|
|
6
7
|
"exactOptionalPropertyTypes": true,
|
|
7
8
|
"forceConsistentCasingInFileNames": true,
|
|
8
|
-
"module": "
|
|
9
|
+
"module": "CommonJS",
|
|
10
|
+
"moduleResolution": "Node",
|
|
9
11
|
"noImplicitAny": true,
|
|
10
12
|
"noImplicitOverride": true,
|
|
11
13
|
"noImplicitReturns": true,
|
|
@@ -16,13 +18,18 @@
|
|
|
16
18
|
"skipDefaultLibCheck": true,
|
|
17
19
|
"skipLibCheck": true,
|
|
18
20
|
"strict": true,
|
|
19
|
-
"target": "
|
|
21
|
+
"target": "ESNext",
|
|
20
22
|
"useUnknownInCatchVariables": true
|
|
21
23
|
},
|
|
22
24
|
"exclude": [
|
|
23
|
-
"node_modules",
|
|
24
25
|
"dist",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
26
|
+
"node_modules",
|
|
27
|
+
"separate-configs",
|
|
28
|
+
"test-files"
|
|
29
|
+
],
|
|
30
|
+
"ts-node": {
|
|
31
|
+
"compilerOptions": {
|
|
32
|
+
"module": "CommonJS"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
28
35
|
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateAllConfigsTestPaths = exports.updateBareConfigsTestPaths = exports.spellcheckTestPaths = exports.testTestPaths = exports.testCompilePaths = exports.testFormatPaths = exports.getCommandTestRepoDir = exports.createNodeModulesSymLinkForTests = void 0;
|
|
4
|
-
const node_1 = require("augment-vir/dist/node");
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
const cli_command_name_1 = require("../cli/cli-util/cli-command-name");
|
|
7
|
-
const virmator_repo_paths_1 = require("./virmator-repo-paths");
|
|
8
|
-
async function createNodeModulesSymLinkForTests(dir) {
|
|
9
|
-
const symlinkPath = (0, path_1.join)(dir, 'node_modules');
|
|
10
|
-
await (0, node_1.createSymLink)((0, path_1.join)(virmator_repo_paths_1.virmatorRootDir, 'node_modules'), symlinkPath);
|
|
11
|
-
return symlinkPath;
|
|
12
|
-
}
|
|
13
|
-
exports.createNodeModulesSymLinkForTests = createNodeModulesSymLinkForTests;
|
|
14
|
-
const testRepos = (0, path_1.join)(virmator_repo_paths_1.virmatorRootDir, 'test-repos');
|
|
15
|
-
function getCommandTestRepoDir(command) {
|
|
16
|
-
return (0, path_1.join)(testRepos, command);
|
|
17
|
-
}
|
|
18
|
-
exports.getCommandTestRepoDir = getCommandTestRepoDir;
|
|
19
|
-
const formatTestRepos = getCommandTestRepoDir(cli_command_name_1.CliCommandName.Format);
|
|
20
|
-
const invalidFormatRepo = (0, path_1.join)(formatTestRepos, 'invalid-format-repo');
|
|
21
|
-
exports.testFormatPaths = {
|
|
22
|
-
validRepo: (0, path_1.join)(formatTestRepos, 'valid-format-repo'),
|
|
23
|
-
invalidRepo: invalidFormatRepo,
|
|
24
|
-
invalidSourceFile: (0, path_1.join)(invalidFormatRepo, 'invalid-format.ts'),
|
|
25
|
-
};
|
|
26
|
-
const compileTestRepos = getCommandTestRepoDir(cli_command_name_1.CliCommandName.Compile);
|
|
27
|
-
const validCompileRepo = (0, path_1.join)(compileTestRepos, 'valid-compile-repo');
|
|
28
|
-
const invalidCompileRepo = (0, path_1.join)(compileTestRepos, 'invalid-compile-repo');
|
|
29
|
-
exports.testCompilePaths = {
|
|
30
|
-
validRepo: validCompileRepo,
|
|
31
|
-
validSourceFile: (0, path_1.join)(validCompileRepo, 'blah.ts'),
|
|
32
|
-
compiledValidSourceFile: (0, path_1.join)(validCompileRepo, 'blah.js'),
|
|
33
|
-
invalidRepo: invalidCompileRepo,
|
|
34
|
-
invalidSourceFile: (0, path_1.join)(invalidCompileRepo, 'bad-blah.ts'),
|
|
35
|
-
compiledInvalidSourceFile: (0, path_1.join)(invalidCompileRepo, 'bad-blah.js'),
|
|
36
|
-
};
|
|
37
|
-
const testTestRepos = getCommandTestRepoDir(cli_command_name_1.CliCommandName.Test);
|
|
38
|
-
exports.testTestPaths = {
|
|
39
|
-
validRepo: (0, path_1.join)(testTestRepos, 'valid-test-repo'),
|
|
40
|
-
invalidRepo: (0, path_1.join)(testTestRepos, 'invalid-test-repo'),
|
|
41
|
-
multiRepo: (0, path_1.join)(testTestRepos, 'multi-test-repo'),
|
|
42
|
-
};
|
|
43
|
-
const spellcheckTestRepos = getCommandTestRepoDir(cli_command_name_1.CliCommandName.SpellCheck);
|
|
44
|
-
exports.spellcheckTestPaths = {
|
|
45
|
-
validRepo: (0, path_1.join)(spellcheckTestRepos, 'valid-spellcheck-repo'),
|
|
46
|
-
invalidRepo: (0, path_1.join)(spellcheckTestRepos, 'invalid-spellcheck-repo'),
|
|
47
|
-
hiddenStuffRepo: (0, path_1.join)(spellcheckTestRepos, 'hidden-stuff-spellcheck-repo'),
|
|
48
|
-
};
|
|
49
|
-
const updateBareConfigsTestRepos = getCommandTestRepoDir(cli_command_name_1.CliCommandName.UpdateBareConfigs);
|
|
50
|
-
exports.updateBareConfigsTestPaths = {
|
|
51
|
-
emptyRepo: (0, path_1.join)(updateBareConfigsTestRepos, 'empty-update-bare-configs-repo'),
|
|
52
|
-
};
|
|
53
|
-
const updateAllConfigsTestRepos = getCommandTestRepoDir(cli_command_name_1.CliCommandName.UpdateAllConfigs);
|
|
54
|
-
exports.updateAllConfigsTestPaths = {
|
|
55
|
-
fullPackageJsonRepo: (0, path_1.join)(updateAllConfigsTestRepos, 'full-package-json-repo'),
|
|
56
|
-
};
|