virmator 6.6.4 → 6.6.5

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.
@@ -5,10 +5,7 @@ export const ncuConfig: RunOptions = {
5
5
  upgrade: true,
6
6
  root: true,
7
7
  // exclude these
8
- reject: [
9
- // TypeScript 5.1.x is really messed up
10
- 'typescript',
11
- ],
8
+ reject: [],
12
9
  // include only these
13
10
  filter: [],
14
11
  };
@@ -7,8 +7,6 @@ export const ncuConfig: RunOptions = {
7
7
  // exclude these
8
8
  reject: [
9
9
  'glob',
10
- // TypeScript 5.1.x is really messed up
11
- 'typescript',
12
10
  ],
13
11
  // include only these
14
12
  filter: [],
@@ -7,7 +7,7 @@ var HelpMessageSyntax;
7
7
  (function (HelpMessageSyntax) {
8
8
  HelpMessageSyntax["Cli"] = "cli";
9
9
  HelpMessageSyntax["Markdown"] = "markdown";
10
- })(HelpMessageSyntax = exports.HelpMessageSyntax || (exports.HelpMessageSyntax = {}));
10
+ })(HelpMessageSyntax || (exports.HelpMessageSyntax = HelpMessageSyntax = {}));
11
11
  function generateHelpMessage(packageBinName, commandDefinitions, syntax, cliWrapIfMoreThanThisManyColumns = 100) {
12
12
  const commandsMessage = [...(0, common_1.getObjectTypedKeys)(commandDefinitions)]
13
13
  .sort()
@@ -15,7 +15,7 @@ var CopyConfigOperation;
15
15
  CopyConfigOperation["Overwrite"] = "overwrite";
16
16
  /** Only write the config file if it doesn't exist already or if it can be updated. */
17
17
  CopyConfigOperation["Init"] = "init";
18
- })(CopyConfigOperation = exports.CopyConfigOperation || (exports.CopyConfigOperation = {}));
18
+ })(CopyConfigOperation || (exports.CopyConfigOperation = CopyConfigOperation = {}));
19
19
  function checkIfShouldWrite({ configFileDefinition, operation, copyToPath, }) {
20
20
  const fileExists = (0, fs_1.existsSync)(copyToPath);
21
21
  switch (operation) {
@@ -10,7 +10,7 @@ export declare const frontendCommandDefinition: {
10
10
  readonly copyToPathRelativeToRepoDir: string;
11
11
  };
12
12
  };
13
- npmDeps: readonly ["vite", "@augment-vir/node-js", "vite-tsconfig-paths"];
13
+ npmDeps: readonly ["vite", "@augment-vir/node-js", "vite-tsconfig-paths", "esbuild"];
14
14
  } & {
15
15
  allAvailableSubCommands: readonly ("build" | "preview")[];
16
16
  subCommands: import("..").SubCommandsMap<{
@@ -25,7 +25,7 @@ export declare const frontendCommandDefinition: {
25
25
  readonly copyToPathRelativeToRepoDir: string;
26
26
  };
27
27
  };
28
- npmDeps: readonly ["vite", "@augment-vir/node-js", "vite-tsconfig-paths"];
28
+ npmDeps: readonly ["vite", "@augment-vir/node-js", "vite-tsconfig-paths", "esbuild"];
29
29
  }>;
30
30
  } & {
31
31
  executor: import("..").CommandExecutor<{
@@ -40,7 +40,7 @@ export declare const frontendCommandDefinition: {
40
40
  readonly copyToPathRelativeToRepoDir: string;
41
41
  };
42
42
  };
43
- npmDeps: readonly ["vite", "@augment-vir/node-js", "vite-tsconfig-paths"];
43
+ npmDeps: readonly ["vite", "@augment-vir/node-js", "vite-tsconfig-paths", "esbuild"];
44
44
  }>;
45
45
  createDescription: import("..").CreateDescriptionsCallback<{
46
46
  commandName: "frontend";
@@ -54,7 +54,7 @@ export declare const frontendCommandDefinition: {
54
54
  readonly copyToPathRelativeToRepoDir: string;
55
55
  };
56
56
  };
57
- npmDeps: readonly ["vite", "@augment-vir/node-js", "vite-tsconfig-paths"];
57
+ npmDeps: readonly ["vite", "@augment-vir/node-js", "vite-tsconfig-paths", "esbuild"];
58
58
  }>;
59
59
  extend: import("../api/command/define-command").ExtendCallback<{
60
60
  commandName: "frontend";
@@ -68,6 +68,6 @@ export declare const frontendCommandDefinition: {
68
68
  readonly copyToPathRelativeToRepoDir: string;
69
69
  };
70
70
  };
71
- npmDeps: readonly ["vite", "@augment-vir/node-js", "vite-tsconfig-paths"];
71
+ npmDeps: readonly ["vite", "@augment-vir/node-js", "vite-tsconfig-paths", "esbuild"];
72
72
  }>;
73
73
  };
@@ -1,6 +1,32 @@
1
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
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.frontendCommandDefinition = void 0;
27
+ const common_1 = require("@augment-vir/common");
28
+ const node_js_1 = require("@augment-vir/node-js");
29
+ const promises_1 = require("fs/promises");
4
30
  const path_1 = require("path");
5
31
  const define_command_1 = require("../api/command/define-command");
6
32
  const config_paths_1 = require("../api/config/config-paths");
@@ -21,6 +47,7 @@ exports.frontendCommandDefinition = (0, define_command_1.defineCommand)({
21
47
  'vite',
22
48
  '@augment-vir/node-js',
23
49
  'vite-tsconfig-paths',
50
+ 'esbuild',
24
51
  ],
25
52
  }, () => {
26
53
  return {
@@ -33,46 +60,70 @@ exports.frontendCommandDefinition = (0, define_command_1.defineCommand)({
33
60
  examples: [],
34
61
  };
35
62
  }, async (inputs) => {
36
- const needToBuild = !!inputs.inputSubCommands.length;
37
- const useDefaultConfigArgs = !inputs.filteredInputArgs.includes('--config');
38
- const configString = useDefaultConfigArgs
39
- ? `--config ${(0, config_paths_1.getCopyToPath)({
40
- repoDir: inputs.repoDir,
41
- configFileDefinition: inputs.configFiles.vite,
42
- packageDir: package_paths_1.virmatorPackageDir,
43
- })}`
44
- : '';
45
- const viteBinPath = await (0, package_paths_1.getNpmBinPath)({
63
+ const viteConfigPath = (0, config_paths_1.getCopyToPath)({
46
64
  repoDir: inputs.repoDir,
47
- command: 'vite',
48
- packageDirPath: inputs.packageDir,
65
+ configFileDefinition: inputs.configFiles.vite,
66
+ packageDir: package_paths_1.virmatorPackageDir,
49
67
  });
50
- const dirToDelete = needToBuild ? 'dist' : 'node_modules/.vite';
51
- const removeCommand = `node -e "require('fs').rmSync('${dirToDelete}', {recursive: true, force: true})" &&`;
52
- const mainCommand = `${removeCommand}${viteBinPath}`;
53
- const subCommandArgs = needToBuild
54
- ? [
55
- 'build',
56
- ...inputs.filteredInputArgs,
57
- '&&',
58
- 'cp dist/index.html dist/404.html',
59
- ]
60
- : inputs.filteredInputArgs;
61
- const previewCommandArgs = inputs.inputSubCommands.includes(inputs.subCommands.preview)
62
- ? [
63
- '&&',
68
+ const tempFilePath = (0, path_1.join)((0, path_1.dirname)(viteConfigPath), `config-output-${Date.now()}-${(0, node_js_1.randomString)()}.cjs`);
69
+ try {
70
+ const needToBuild = !!inputs.inputSubCommands.length;
71
+ const useDefaultConfigArgs = !inputs.filteredInputArgs.includes('--config');
72
+ const configString = useDefaultConfigArgs ? `--config ${viteConfigPath}` : '';
73
+ await (await Promise.resolve().then(() => __importStar(require('esbuild')))).build({
74
+ entryPoints: [viteConfigPath],
75
+ outfile: tempFilePath,
76
+ write: true,
77
+ target: ['node18'],
78
+ platform: 'node',
79
+ bundle: false,
80
+ format: 'cjs',
81
+ });
82
+ const viteConfigValues = require(tempFilePath).default;
83
+ const buildOutputPath = viteConfigValues?.build?.outDir || 'dist';
84
+ const viteBinPath = await (0, package_paths_1.getNpmBinPath)({
85
+ repoDir: inputs.repoDir,
86
+ command: 'vite',
87
+ packageDirPath: inputs.packageDir,
88
+ });
89
+ const removeCommand = needToBuild
90
+ ? `node -e "require('fs').rmSync('node_modules/.vite', {recursive: true, force: true})"`
91
+ : '';
92
+ const mainCommand = [
93
+ removeCommand,
64
94
  viteBinPath,
65
- 'preview',
66
- ...inputs.filteredInputArgs,
67
95
  ]
68
- : [];
69
- return {
70
- args: [
71
- mainCommand,
72
- '--force',
73
- configString,
74
- ...subCommandArgs,
75
- ...previewCommandArgs,
76
- ],
77
- };
96
+ .filter(common_1.isTruthy)
97
+ .join(' && ');
98
+ const indexPath = (0, path_1.join)(buildOutputPath, 'index.html');
99
+ const dist404Path = (0, path_1.join)(buildOutputPath, '404.html');
100
+ const subCommandArgs = needToBuild
101
+ ? [
102
+ 'build',
103
+ ...inputs.filteredInputArgs,
104
+ '&&',
105
+ `node -e "require('fs').copyFileSync('${indexPath}', '${dist404Path}')"`,
106
+ ]
107
+ : inputs.filteredInputArgs;
108
+ const previewCommandArgs = inputs.inputSubCommands.includes(inputs.subCommands.preview)
109
+ ? [
110
+ '&&',
111
+ viteBinPath,
112
+ 'preview',
113
+ ...inputs.filteredInputArgs,
114
+ ]
115
+ : [];
116
+ return {
117
+ args: [
118
+ mainCommand,
119
+ '--force',
120
+ configString,
121
+ ...subCommandArgs,
122
+ ...previewCommandArgs,
123
+ ],
124
+ };
125
+ }
126
+ finally {
127
+ await (0, promises_1.unlink)(tempFilePath);
128
+ }
78
129
  });
@@ -68,7 +68,7 @@ exports.upgradeDepsCommandDefinition = (0, define_command_1.defineCommand)({
68
68
  write: true,
69
69
  target: ['node18'],
70
70
  platform: 'node',
71
- bundle: true,
71
+ bundle: false,
72
72
  format: 'cjs',
73
73
  });
74
74
  const repoPackageJson = await (0, node_js_1.readPackageJson)(inputs.repoDir);
package/dist/index.d.ts CHANGED
@@ -230,7 +230,7 @@ export declare const virmator: Readonly<{
230
230
  readonly copyToPathRelativeToRepoDir: string;
231
231
  };
232
232
  };
233
- npmDeps: readonly ["vite", "@augment-vir/node-js", "vite-tsconfig-paths"];
233
+ npmDeps: readonly ["vite", "@augment-vir/node-js", "vite-tsconfig-paths", "esbuild"];
234
234
  } & {
235
235
  allAvailableSubCommands: readonly ("build" | "preview")[];
236
236
  subCommands: import("./api/command/define-command-inputs").SubCommandsMap<{
@@ -245,7 +245,7 @@ export declare const virmator: Readonly<{
245
245
  readonly copyToPathRelativeToRepoDir: string;
246
246
  };
247
247
  };
248
- npmDeps: readonly ["vite", "@augment-vir/node-js", "vite-tsconfig-paths"];
248
+ npmDeps: readonly ["vite", "@augment-vir/node-js", "vite-tsconfig-paths", "esbuild"];
249
249
  }>;
250
250
  } & {
251
251
  executor: import("./api/command/command-executor").CommandExecutor<{
@@ -260,7 +260,7 @@ export declare const virmator: Readonly<{
260
260
  readonly copyToPathRelativeToRepoDir: string;
261
261
  };
262
262
  };
263
- npmDeps: readonly ["vite", "@augment-vir/node-js", "vite-tsconfig-paths"];
263
+ npmDeps: readonly ["vite", "@augment-vir/node-js", "vite-tsconfig-paths", "esbuild"];
264
264
  }>;
265
265
  createDescription: import("./api/command/command-description").CreateDescriptionsCallback<{
266
266
  commandName: "frontend";
@@ -274,7 +274,7 @@ export declare const virmator: Readonly<{
274
274
  readonly copyToPathRelativeToRepoDir: string;
275
275
  };
276
276
  };
277
- npmDeps: readonly ["vite", "@augment-vir/node-js", "vite-tsconfig-paths"];
277
+ npmDeps: readonly ["vite", "@augment-vir/node-js", "vite-tsconfig-paths", "esbuild"];
278
278
  }>;
279
279
  extend: import("./api/command/define-command").ExtendCallback<{
280
280
  commandName: "frontend";
@@ -288,7 +288,7 @@ export declare const virmator: Readonly<{
288
288
  readonly copyToPathRelativeToRepoDir: string;
289
289
  };
290
290
  };
291
- npmDeps: readonly ["vite", "@augment-vir/node-js", "vite-tsconfig-paths"];
291
+ npmDeps: readonly ["vite", "@augment-vir/node-js", "vite-tsconfig-paths", "esbuild"];
292
292
  }>;
293
293
  }) | ({
294
294
  commandName: "init";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "virmator",
3
- "version": "6.6.4",
3
+ "version": "6.6.5",
4
4
  "description": "Handle common package configs, commands, and dependencies.",
5
5
  "keywords": [
6
6
  "automation",
@@ -43,40 +43,40 @@
43
43
  "test:types": "tsc --noEmit"
44
44
  },
45
45
  "dependencies": {
46
- "@augment-vir/common": "^14.2.2",
47
- "@augment-vir/node-js": "^14.2.2",
46
+ "@augment-vir/common": "^15.2.1",
47
+ "@augment-vir/node-js": "^15.2.1",
48
48
  "ansi-colors": "^4.1.3",
49
- "concurrently": "^8.1.0",
49
+ "concurrently": "^8.2.0",
50
50
  "glob": "^8.1.0",
51
- "glob-promise": "^6.0.2",
52
- "semver": "^7.5.1",
51
+ "glob-promise": "^6.0.3",
52
+ "semver": "^7.5.3",
53
53
  "simple-git": "^3.19.0",
54
- "type-fest": "^3.11.1"
54
+ "type-fest": "^3.12.0"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@electrovir/nyc": "15.1.0-fix0",
58
58
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
59
- "@open-wc/testing": "^3.1.8",
59
+ "@open-wc/testing": "^3.2.0",
60
60
  "@types/chai": "^4.3.5",
61
61
  "@types/fs-extra": "^11.0.1",
62
62
  "@types/glob": "^8.1.0",
63
63
  "@types/mocha": "^10.0.1",
64
- "@types/node": "^20.2.5",
64
+ "@types/node": "^20.3.1",
65
65
  "@types/semver": "^7.5.0",
66
66
  "@web/dev-server-esbuild": "^0.4.1",
67
67
  "@web/test-runner": "^0.16.1",
68
68
  "@web/test-runner-commands": "^0.7.0",
69
- "@web/test-runner-playwright": "^0.10.0",
69
+ "@web/test-runner-playwright": "^0.10.1",
70
70
  "@web/test-runner-visual-regression": "^0.8.0",
71
71
  "chai": "^4.3.7",
72
72
  "cspell": "^6.31.1",
73
- "esbuild": "^0.17.19",
73
+ "esbuild": "^0.18.7",
74
74
  "fs-extra": "^11.1.1",
75
75
  "istanbul-smart-text-reporter": "^1.1.2",
76
76
  "markdown-code-example-inserter": "^0.3.1",
77
77
  "mocha": "^10.2.0",
78
78
  "mocha-spec-reporter-with-file-names": "^0.0.3",
79
- "npm-check-updates": "^16.10.12",
79
+ "npm-check-updates": "^16.10.13",
80
80
  "prettier": "^2.8.8",
81
81
  "prettier-plugin-interpolated-html-tags": "^0.0.4",
82
82
  "prettier-plugin-jsdoc": "^0.4.2",
@@ -89,13 +89,16 @@
89
89
  "test-established-expectations": "^0.5.0",
90
90
  "ts-node": "^10.9.1",
91
91
  "tsconfig-paths": "^4.2.0",
92
- "typescript": "^5.0.4",
93
- "virmator": "^6.6.1",
92
+ "typescript": "^5.1.3",
93
+ "virmator": "^6.6.4",
94
94
  "vite": "^4.3.9",
95
95
  "vite-tsconfig-paths": "^4.2.0"
96
96
  },
97
97
  "engines": {
98
98
  "node": ">=16",
99
99
  "npm": ">=8"
100
+ },
101
+ "overrides": {
102
+ "semver": "^7.5.3"
100
103
  }
101
104
  }