virmator 1.4.5 → 2.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/.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-flags.js +4 -7
- package/dist/cli/cli-util/get-all-command-output.d.ts +4 -3
- package/dist/cli/cli-util/update-configs.js +3 -2
- 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 +27 -23
- 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 +27 -20
- package/dist/cli/commands/implementations/compile.command.js +20 -8
- package/dist/cli/commands/implementations/format.command.js +51 -37
- 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 +22 -25
- package/dist/cli/commands/implementations/update-all-configs.command.js +22 -13
- package/dist/cli/commands/implementations/update-bare-configs.command.js +22 -14
- 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/create-default-package-json.js +2 -2
- package/dist/errors/cli-command-error.js +1 -1
- package/dist/errors/cli-flag-error.js +1 -1
- 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 +2 -2
- 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 +16 -10
- 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
|
@@ -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.0",
|
|
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,32 +32,36 @@
|
|
|
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
45
|
"augment-vir": "^1.5.1",
|
|
42
46
|
"cspell": "^5.19.2",
|
|
43
47
|
"fs-extra": "^10.0.1",
|
|
48
|
+
"jest": "^27.5.1",
|
|
44
49
|
"markdown-code-example-inserter": "^0.1.5",
|
|
45
|
-
"prettier": "^2.
|
|
50
|
+
"prettier": "^2.6.0",
|
|
46
51
|
"prettier-plugin-jsdoc": "^0.3.31",
|
|
47
52
|
"prettier-plugin-multiline-arrays": "^0.0.3",
|
|
48
53
|
"prettier-plugin-organize-imports": "^2.3.4",
|
|
49
54
|
"prettier-plugin-packagejson": "^2.2.16",
|
|
50
55
|
"prettier-plugin-sort-json": "^0.0.2",
|
|
51
56
|
"simple-git": "^3.4.0",
|
|
52
|
-
"
|
|
57
|
+
"ts-jest": "^27.1.3",
|
|
58
|
+
"ts-node": "^10.7.0",
|
|
59
|
+
"tsconfig-paths": "^3.14.0",
|
|
53
60
|
"typescript": "^4.6.2"
|
|
54
61
|
},
|
|
55
62
|
"devDependencies": {
|
|
56
63
|
"@types/fs-extra": "^9.0.13",
|
|
57
|
-
"@types/node": "^17.0.21"
|
|
58
|
-
"ts-node": "^10.7.0"
|
|
64
|
+
"@types/node": "^17.0.21"
|
|
59
65
|
},
|
|
60
66
|
"engines": {
|
|
61
67
|
"node": ">=12",
|
|
@@ -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
|
-
};
|