virmator 4.2.7 → 4.2.9
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/configs/configs/vite.config.ts +5 -7
- package/configs/package.json +1 -0
- package/configs/tsconfig.json +1 -1
- package/dist/api/command/command-to-help-message.js +1 -1
- package/dist/api/command/define-command-inputs.d.ts +1 -1
- package/dist/api/run-command/extract-arguments.d.ts +1 -1
- package/dist/api/run-command/run-extended-virmator.js +1 -1
- package/dist/augments/array.d.ts +1 -1
- package/dist/augments/object.js +1 -1
- package/dist/commands/frontend.command.js +1 -1
- package/dist/compiled-base-configs/base-vite.d.ts +1 -0
- package/dist/compiled-base-configs/base-vite.js +10 -0
- package/dist/compiled-base-configs/vite-always-reload-plugin.d.ts +11 -0
- package/{base-configs/vite-always-reload-plugin.ts → dist/compiled-base-configs/vite-always-reload-plugin.js} +22 -33
- package/package.json +6 -5
- package/base-configs/base-vite.ts +0 -11
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import {baseViteConfig} from 'virmator/dist/compiled-base-configs/base-vite';
|
|
2
|
+
import {defineConfig} from 'vite';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
...
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export default viteConfig;
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
...baseViteConfig,
|
|
6
|
+
});
|
package/configs/package.json
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
"compile": "rm -rf dist && virmator compile",
|
|
8
8
|
"docs:update": "virmator code-in-markdown",
|
|
9
9
|
"format": "virmator format",
|
|
10
|
+
"prepack": "npm run compile",
|
|
10
11
|
"prepublishOnly": "npm run compile && npm run test:all",
|
|
11
12
|
"preview": "virmator frontend preview",
|
|
12
13
|
"spellcheck": "virmator spellcheck",
|
package/configs/tsconfig.json
CHANGED
|
@@ -9,7 +9,7 @@ var HelpMessageSyntax;
|
|
|
9
9
|
HelpMessageSyntax["Markdown"] = "markdown";
|
|
10
10
|
})(HelpMessageSyntax = exports.HelpMessageSyntax || (exports.HelpMessageSyntax = {}));
|
|
11
11
|
function generateHelpMessage(packageBinName, commandDefinitions, syntax, cliWrapIfMoreThanThisManyColumns = 100) {
|
|
12
|
-
const commandsMessage = (0, augment_vir_1.getObjectTypedKeys)(commandDefinitions)
|
|
12
|
+
const commandsMessage = [...(0, augment_vir_1.getObjectTypedKeys)(commandDefinitions)]
|
|
13
13
|
.sort()
|
|
14
14
|
.map((commandName) => {
|
|
15
15
|
const commandDefinition = commandDefinitions[commandName];
|
|
@@ -6,7 +6,7 @@ export declare type DefineCommandInputs<CommandName extends string = string> = R
|
|
|
6
6
|
npmDeps: ReadonlyArray<string>;
|
|
7
7
|
}>;
|
|
8
8
|
export declare type SharedExecutorInputsAndCommandDefinition<DefineCommandInputsGeneric extends DefineCommandInputs> = DefineCommandInputsGeneric & {
|
|
9
|
-
allAvailableSubCommands:
|
|
9
|
+
allAvailableSubCommands: ReadonlyArray<keyof DefineCommandInputsGeneric['subCommandDescriptions']>;
|
|
10
10
|
subCommands: SubCommandsMap<DefineCommandInputsGeneric>;
|
|
11
11
|
};
|
|
12
12
|
export declare type SubCommandsMap<DefineCommandInputsGeneric extends DefineCommandInputs> = {
|
|
@@ -3,4 +3,4 @@ export declare type ExtractSubCommandsOutput<T> = {
|
|
|
3
3
|
subCommands: T[];
|
|
4
4
|
filteredArgs: string[];
|
|
5
5
|
};
|
|
6
|
-
export declare function extractSubCommands<T>(allArgs: string
|
|
6
|
+
export declare function extractSubCommands<T>(allArgs: ReadonlyArray<string>, availableSubCommands: ReadonlyArray<T>): ExtractSubCommandsOutput<T>;
|
|
@@ -15,7 +15,7 @@ function getValidCommandDefinition(binName, commandMapping, givenCommandName) {
|
|
|
15
15
|
throw new Error(`Missing command name as first input to ${binName}.${availableCommandsString(commandMapping)}`);
|
|
16
16
|
}
|
|
17
17
|
const commandDefinition = commandMapping[givenCommandName];
|
|
18
|
-
if (!(0, augment_vir_1.
|
|
18
|
+
if (!(0, augment_vir_1.typedHasProperty)(commandMapping, givenCommandName) || !commandDefinition) {
|
|
19
19
|
throw new Error(`Invalid command "${givenCommandName} for ${binName}.${availableCommandsString(commandMapping)}"`);
|
|
20
20
|
}
|
|
21
21
|
return commandDefinition;
|
package/dist/augments/array.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function isInTypedArray<T>(input: any, array: T
|
|
1
|
+
export declare function isInTypedArray<T>(input: any, array: ReadonlyArray<T>): input is T;
|
package/dist/augments/object.js
CHANGED
|
@@ -15,7 +15,7 @@ exports.filterObject = filterObject;
|
|
|
15
15
|
function deeplyCombineObjects(originalObject, overwriteObject) {
|
|
16
16
|
return (0, augment_vir_1.getObjectTypedKeys)(overwriteObject).reduce((accum, currentKey) => {
|
|
17
17
|
const currentNewValue = overwriteObject[currentKey];
|
|
18
|
-
const currentOldValue = (0, augment_vir_1.
|
|
18
|
+
const currentOldValue = (0, augment_vir_1.typedHasProperty)(originalObject, currentKey) && originalObject[currentKey];
|
|
19
19
|
if ((0, augment_vir_1.isObject)(currentOldValue) && (0, augment_vir_1.isObject)(currentNewValue)) {
|
|
20
20
|
accum[currentKey] = deeplyCombineObjects(currentOldValue, currentNewValue);
|
|
21
21
|
}
|
|
@@ -43,7 +43,7 @@ exports.frontendCommandDefinition = (0, define_command_1.defineCommand)({
|
|
|
43
43
|
})}`
|
|
44
44
|
: '';
|
|
45
45
|
const viteBinPath = await (0, package_paths_1.getNpmBinPath)(inputs.repoDir, 'vite');
|
|
46
|
-
const removeOutput = needToBuild ? 'rm -rf dist' : '';
|
|
46
|
+
const removeOutput = needToBuild ? 'rm -rf dist ' : '';
|
|
47
47
|
const mainCommand = `${removeOutput}${viteBinPath}`;
|
|
48
48
|
const subCommandArgs = needToBuild
|
|
49
49
|
? [
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const baseViteConfig: import("vite").UserConfigExport;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.baseViteConfig = void 0;
|
|
4
|
+
const vite_1 = require("vite");
|
|
5
|
+
const vite_always_reload_plugin_1 = require("./vite-always-reload-plugin");
|
|
6
|
+
exports.baseViteConfig = (0, vite_1.defineConfig)({
|
|
7
|
+
clearScreen: false,
|
|
8
|
+
plugins: [(0, vite_always_reload_plugin_1.alwaysReloadPlugin)()],
|
|
9
|
+
root: process.cwd(),
|
|
10
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PluginOption } from 'vite';
|
|
2
|
+
/**
|
|
3
|
+
* There are similar plugins out there that try to do this but they aren't aggressive enough. This
|
|
4
|
+
* plugin literally always reloads on save, no questions asked.
|
|
5
|
+
*/
|
|
6
|
+
export declare function alwaysReloadPlugin(config?: Partial<{
|
|
7
|
+
exclusions: string[];
|
|
8
|
+
/** Inclusions apply after exclusions so they will override exclusions. */
|
|
9
|
+
inclusions: string[];
|
|
10
|
+
root: string;
|
|
11
|
+
}>): PluginOption;
|
|
@@ -1,52 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.alwaysReloadPlugin = void 0;
|
|
4
|
+
const ansi_colors_1 = require("ansi-colors");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const path_1 = require("path");
|
|
6
7
|
/**
|
|
7
8
|
* Include actual paths and symlinked target paths if they exist.
|
|
8
9
|
*
|
|
9
10
|
* This is needed because when removing files from the watcher, sym links have be removed with the
|
|
10
11
|
* path to the symlink itself AND the path to the symlink target or the path will still be watched.
|
|
11
12
|
*/
|
|
12
|
-
function mapToActualPaths(paths
|
|
13
|
+
function mapToActualPaths(paths) {
|
|
13
14
|
return paths.reduce((accum, path) => {
|
|
14
|
-
if (existsSync(path)) {
|
|
15
|
-
if (lstatSync(path).isSymbolicLink()) {
|
|
15
|
+
if ((0, fs_1.existsSync)(path)) {
|
|
16
|
+
if ((0, fs_1.lstatSync)(path).isSymbolicLink()) {
|
|
16
17
|
console.info('reading symlink from', path);
|
|
17
18
|
// sym links AND the original path both need to be included
|
|
18
|
-
return accum.concat(readlinkSync(path), path);
|
|
19
|
-
}
|
|
19
|
+
return accum.concat((0, fs_1.readlinkSync)(path), path);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
20
22
|
return accum.concat(path);
|
|
21
23
|
}
|
|
22
|
-
}
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
23
26
|
return accum;
|
|
24
27
|
}
|
|
25
|
-
}, []
|
|
28
|
+
}, []);
|
|
26
29
|
}
|
|
27
|
-
|
|
28
30
|
/**
|
|
29
31
|
* There are similar plugins out there that try to do this but they aren't aggressive enough. This
|
|
30
32
|
* plugin literally always reloads on save, no questions asked.
|
|
31
33
|
*/
|
|
32
|
-
|
|
33
|
-
config: Partial<{
|
|
34
|
-
exclusions: string[];
|
|
35
|
-
/** Inclusions apply after exclusions so they will override exclusions. */
|
|
36
|
-
inclusions: string[];
|
|
37
|
-
root: string;
|
|
38
|
-
}> = {},
|
|
39
|
-
): PluginOption {
|
|
34
|
+
function alwaysReloadPlugin(config = {}) {
|
|
40
35
|
return {
|
|
41
36
|
name: 'alwaysReloadPlugin',
|
|
42
37
|
apply: 'serve',
|
|
43
|
-
config: () => ({server: {watch: {disableGlobbing: false}}}),
|
|
44
|
-
configureServer({watcher, ws, config: {logger}}) {
|
|
45
|
-
const {root = process.cwd(), inclusions = [], exclusions = []} = config;
|
|
38
|
+
config: () => ({ server: { watch: { disableGlobbing: false } } }),
|
|
39
|
+
configureServer({ watcher, ws, config: { logger } }) {
|
|
40
|
+
const { root = process.cwd(), inclusions = [], exclusions = [] } = config;
|
|
46
41
|
let callingAlready = false;
|
|
47
42
|
let loggedAlready = false;
|
|
48
|
-
|
|
49
|
-
const reloadCallback = (path: string) => {
|
|
43
|
+
const reloadCallback = (path) => {
|
|
50
44
|
if (!loggedAlready) {
|
|
51
45
|
loggedAlready = true;
|
|
52
46
|
// log watched stuff so that we can make sure it's not watching too much
|
|
@@ -59,12 +53,7 @@ export function alwaysReloadPlugin(
|
|
|
59
53
|
type: 'full-reload',
|
|
60
54
|
path: '*',
|
|
61
55
|
});
|
|
62
|
-
logger.info(
|
|
63
|
-
`${styles.green.open}page reload ${styles.dim.open}${relative(root, path)}${
|
|
64
|
-
styles.reset.open
|
|
65
|
-
}`,
|
|
66
|
-
{clear: true, timestamp: true},
|
|
67
|
-
);
|
|
56
|
+
logger.info(`${ansi_colors_1.styles.green.open}page reload ${ansi_colors_1.styles.dim.open}${(0, path_1.relative)(root, path)}${ansi_colors_1.styles.reset.open}`, { clear: true, timestamp: true });
|
|
68
57
|
/**
|
|
69
58
|
* Debounce reloads calls so that they don't get spammed. If you're saving
|
|
70
59
|
* faster than this, then what the heck are you doing anyway?
|
|
@@ -74,7 +63,6 @@ export function alwaysReloadPlugin(
|
|
|
74
63
|
}, 100);
|
|
75
64
|
}
|
|
76
65
|
};
|
|
77
|
-
|
|
78
66
|
if (exclusions.length) {
|
|
79
67
|
watcher.unwatch(mapToActualPaths(exclusions));
|
|
80
68
|
// ignore macOS file system metadata stuff
|
|
@@ -90,3 +78,4 @@ export function alwaysReloadPlugin(
|
|
|
90
78
|
},
|
|
91
79
|
};
|
|
92
80
|
}
|
|
81
|
+
exports.alwaysReloadPlugin = alwaysReloadPlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "virmator",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.9",
|
|
4
4
|
"description": "Handle all the stuffs in one package.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"compile": "rm -rf dist && tsc",
|
|
31
31
|
"format": "npm run format:base -- --write --list-different",
|
|
32
32
|
"format:base": "prettier \"./**/*.+(ts|json|html|css|md|js)\"",
|
|
33
|
+
"prepack": "npm run compile",
|
|
33
34
|
"prepublishOnly": "npm run test:all",
|
|
34
35
|
"readme:check": "npm run compile && ts-node -r tsconfig-paths/register src/scripts/save-help-message.ts check && md-code --check README.md",
|
|
35
36
|
"readme:update": "npm run compile && ts-node -r tsconfig-paths/register src/scripts/save-help-message.ts && md-code README.md",
|
|
@@ -42,7 +43,7 @@
|
|
|
42
43
|
},
|
|
43
44
|
"dependencies": {
|
|
44
45
|
"ansi-colors": "^4.1.3",
|
|
45
|
-
"augment-vir": "
|
|
46
|
+
"augment-vir": "3.0.2",
|
|
46
47
|
"semver": "7.3.8",
|
|
47
48
|
"simple-git": "3.14.1"
|
|
48
49
|
},
|
|
@@ -52,18 +53,18 @@
|
|
|
52
53
|
"@types/chai": "4.3.3",
|
|
53
54
|
"@types/fs-extra": "^9.0.13",
|
|
54
55
|
"@types/mocha": "10.0.0",
|
|
55
|
-
"@types/node": "18.8.
|
|
56
|
+
"@types/node": "18.8.5",
|
|
56
57
|
"@types/semver": "7.3.12",
|
|
57
58
|
"@web/dev-server-esbuild": "0.3.2",
|
|
58
59
|
"@web/test-runner": "0.14.0",
|
|
59
60
|
"@web/test-runner-commands": "0.6.5",
|
|
60
61
|
"@web/test-runner-playwright": "0.8.10",
|
|
61
62
|
"ansi-colors": "4.1.3",
|
|
62
|
-
"augment-vir": "
|
|
63
|
+
"augment-vir": "3.0.2",
|
|
63
64
|
"chai": "4.3.6",
|
|
64
65
|
"cspell": "6.12.0",
|
|
65
66
|
"fs-extra": "^10.1.0",
|
|
66
|
-
"istanbul-smart-text-reporter": "^0.0.
|
|
67
|
+
"istanbul-smart-text-reporter": "^0.0.1",
|
|
67
68
|
"markdown-code-example-inserter": "0.1.11",
|
|
68
69
|
"mocha": "10.0.0",
|
|
69
70
|
"mocha-spec-reporter-with-file-names": "^0.0.0",
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import {dirname} from 'path';
|
|
2
|
-
import {UserConfig} from 'vite';
|
|
3
|
-
import {alwaysReloadPlugin} from './vite-always-reload-plugin';
|
|
4
|
-
|
|
5
|
-
const viteConfig: UserConfig = {
|
|
6
|
-
clearScreen: false,
|
|
7
|
-
plugins: [alwaysReloadPlugin()],
|
|
8
|
-
root: dirname(__dirname),
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default viteConfig;
|