virmator 4.0.0 → 4.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.
@@ -4,6 +4,7 @@ const baseConfig = {
4
4
  '.git/',
5
5
  '*.sqlite',
6
6
  '*.tgz',
7
+ 'coverage/',
7
8
  'dist/',
8
9
  'node_modules/',
9
10
  'package-lock.json',
@@ -18,7 +19,6 @@ const baseConfig = {
18
19
  'browserconfig',
19
20
  'combinator',
20
21
  'combinators',
21
- "config's",
22
22
  'cpsell',
23
23
  'derp',
24
24
  'derpy',
@@ -51,6 +51,7 @@ const baseConfig = {
51
51
  'packagejson',
52
52
  'parens',
53
53
  'pdfs',
54
+ 'postpack',
54
55
  'postupgrade',
55
56
  'prettierignore',
56
57
  'prettierrc',
@@ -58,7 +59,6 @@ const baseConfig = {
58
59
  'protobuf',
59
60
  'pushstate',
60
61
  'replacestate',
61
- "repo's",
62
62
  'repos',
63
63
  'rgba',
64
64
  'sonarjs',
@@ -72,11 +72,13 @@ const baseConfig = {
72
72
  'transpiled',
73
73
  'transpiling',
74
74
  'typeof',
75
- "virmator's",
76
75
  'virmator',
77
76
  'vite',
78
77
  'vitejs',
79
78
  'xlink',
79
+ "config's",
80
+ "repo's",
81
+ "virmator's",
80
82
  ],
81
83
  };
82
84
 
@@ -6,20 +6,20 @@ function toPosixPath(input) {
6
6
  }
7
7
 
8
8
  const posixDirname = path.posix.dirname(toPosixPath(__dirname));
9
+ const packageRoot = path.parse(__dirname).root;
10
+
11
+ function findClosestPackagePath(dirPath, packageName) {
12
+ const currentAttempt = path.join(dirPath, 'node_modules', packageName);
9
13
 
10
- function findClosestNodeModulesPath(dirPath = __dirname) {
11
- const currentAttempt = path.join(dirPath, 'node_modules');
12
14
  if (fs.existsSync(currentAttempt)) {
13
15
  return currentAttempt;
14
- } else if (dirPath === '/') {
15
- throw new Error(`Could not find node_modules directory.`);
16
+ } else if (dirPath === packageRoot) {
17
+ throw new Error(`Could not find ${packageName} package.`);
16
18
  } else {
17
- return findClosestNodeModulesPath(path.dirname(dirPath));
19
+ return findClosestPackagePath(path.dirname(dirPath), packageName);
18
20
  }
19
21
  }
20
22
 
21
- const nodeModules = toPosixPath(findClosestNodeModulesPath());
22
-
23
23
  const plugins = [
24
24
  'prettier-plugin-toml',
25
25
  'prettier-plugin-sort-json',
@@ -28,15 +28,10 @@ const plugins = [
28
28
  'prettier-plugin-organize-imports',
29
29
  'prettier-plugin-jsdoc',
30
30
  ].map((pluginName) => {
31
- // account for installations where node_modules is flattened and installations where it's nested
32
- const flattenedPath = path.posix.join(nodeModules, pluginName);
33
- const nestedPath = path.posix.join(nodeModules, 'virmator', 'node_modules', pluginName);
34
-
35
- if (fs.existsSync(flattenedPath)) {
36
- return path.posix.resolve(posixDirname, flattenedPath);
37
- } else {
38
- return path.posix.resolve(posixDirname, nestedPath);
39
- }
31
+ return path.posix.resolve(
32
+ posixDirname,
33
+ toPosixPath(findClosestPackagePath(__dirname, pluginName)),
34
+ );
40
35
  });
41
36
 
42
37
  /**
@@ -4,6 +4,7 @@
4
4
  "declaration": true,
5
5
  "esModuleInterop": true,
6
6
  "exactOptionalPropertyTypes": true,
7
+ "experimentalDecorators": true,
7
8
  "forceConsistentCasingInFileNames": true,
8
9
  "isolatedModules": true,
9
10
  "module": "CommonJS",
@@ -15,10 +16,8 @@
15
16
  "noImplicitReturns": true,
16
17
  "noImplicitThis": true,
17
18
  "noUncheckedIndexedAccess": true,
18
- "outDir": "../dist",
19
19
  "pretty": true,
20
20
  "resolveJsonModule": true,
21
- "rootDir": "../src",
22
21
  "skipDefaultLibCheck": true,
23
22
  "skipLibCheck": true,
24
23
  "strict": true,
@@ -1,3 +1,13 @@
1
1
  {
2
- "extends": "./node_modules/virmator/base-configs/base-tsconfig.json"
2
+ "extends": "./node_modules/virmator/base-configs/base-tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist",
5
+ "rootDir": "./src"
6
+ },
7
+ "exclude": [
8
+ "./configs/",
9
+ "./dist/",
10
+ "./node_modules/",
11
+ "./test-files/"
12
+ ]
3
13
  }
@@ -26,14 +26,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.formatCode = void 0;
27
27
  const fs_1 = require("fs");
28
28
  const path_1 = require("path");
29
- const prettier_1 = require("prettier");
30
29
  async function formatCode(text, filePath) {
31
- const repoPrettierRc = await Promise.resolve().then(() => __importStar(require(findNearestConfig(process.cwd()))));
32
- const repoConfig = repoPrettierRc;
33
- return (0, prettier_1.format)(text, {
34
- ...repoConfig,
35
- filepath: filePath,
36
- });
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().then(() => __importStar(require(findNearestConfig(process.cwd()))));
34
+ const repoConfig = repoPrettierRc;
35
+ return prettierFormat(text, {
36
+ ...repoConfig,
37
+ filepath: filePath,
38
+ });
39
+ }
40
+ catch (error) {
41
+ return text;
42
+ }
37
43
  }
38
44
  exports.formatCode = formatCode;
39
45
  function findNearestConfig(dir) {
@@ -16,6 +16,7 @@ exports.nonCommandConfigs = [
16
16
  copyFromInternalPath: (0, path_1.join)(package_paths_1.virmatorConfigsDir, '.nvmrc'),
17
17
  copyToPathRelativeToRepoDir: '.nvmrc',
18
18
  required: true,
19
+ updateExistingConfigFileCallback: (newContents) => newContents,
19
20
  },
20
21
  {
21
22
  copyFromInternalPath: (0, path_1.join)(package_paths_1.virmatorConfigsDir, 'gitignore.txt'),
@@ -8,5 +8,5 @@ export declare const testWebCommandDefinition: import("../api/command/define-com
8
8
  readonly required: true;
9
9
  };
10
10
  };
11
- npmDeps: readonly ["@open-wc/testing", "@web/dev-server-esbuild", "@web/test-runner", "@web/test-runner-commands", "@web/test-runner-playwright"];
11
+ npmDeps: readonly ["@open-wc/testing", "@types/mocha", "@web/dev-server-esbuild", "@web/test-runner-commands", "@web/test-runner-playwright", "@web/test-runner"];
12
12
  }>;
@@ -17,10 +17,11 @@ exports.testWebCommandDefinition = (0, define_command_1.defineCommand)({
17
17
  },
18
18
  npmDeps: [
19
19
  '@open-wc/testing',
20
+ '@types/mocha',
20
21
  '@web/dev-server-esbuild',
21
- '@web/test-runner',
22
22
  '@web/test-runner-commands',
23
23
  '@web/test-runner-playwright',
24
+ '@web/test-runner',
24
25
  ],
25
26
  }, ({ commandName, packageBinName, configFiles }) => {
26
27
  return {
package/dist/index.d.ts CHANGED
@@ -107,7 +107,7 @@ export declare const virmator: Readonly<{
107
107
  readonly required: true;
108
108
  };
109
109
  };
110
- npmDeps: readonly ["@open-wc/testing", "@web/dev-server-esbuild", "@web/test-runner", "@web/test-runner-commands", "@web/test-runner-playwright"];
110
+ npmDeps: readonly ["@open-wc/testing", "@types/mocha", "@web/dev-server-esbuild", "@web/test-runner-commands", "@web/test-runner-playwright", "@web/test-runner"];
111
111
  }> | import("./api/command/define-command").CommandDefinition<{
112
112
  commandName: "update-configs";
113
113
  subCommandDescriptions: {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "virmator",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "Handle all the stuffs in one package.",
5
5
  "keywords": [
6
6
  "automation",
@@ -31,6 +31,7 @@
31
31
  "format": "npm run format:base -- --write --list-different",
32
32
  "format:base": "prettier \"./**/*.+(ts|json|html|css|md|js)\"",
33
33
  "format:check": "npm run format:base -- --check",
34
+ "prepack": "npm run compile",
34
35
  "prepublishOnly": "npm run test:full",
35
36
  "readme:check": "npm run compile && ts-node -r tsconfig-paths/register src/scripts/save-help-message.ts check && md-code --check README.md",
36
37
  "readme:update": "npm run compile && ts-node -r tsconfig-paths/register src/scripts/save-help-message.ts && md-code README.md",