virmator 1.3.5 → 1.4.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 CHANGED
@@ -11,32 +11,47 @@
11
11
  "version": "0.2",
12
12
  "words": [
13
13
  "accum",
14
- "adipiscing",
15
- "amet",
16
- "andymckay",
17
14
  "argb",
18
15
  "autofix",
19
16
  "autofixable",
20
17
  "autofixing",
18
+ "browserconfig",
19
+ "combinator",
20
+ "combinators",
21
21
  "config's",
22
- "consectetur",
23
22
  "cpsell",
24
23
  "derp",
25
24
  "derpy",
26
25
  "electrovir",
26
+ "entrypoint",
27
27
  "entrypoints",
28
28
  "esbenp",
29
+ "estree",
30
+ "fleek",
29
31
  "gitattributes",
32
+ "globbing",
30
33
  "globstar",
34
+ "inconsolata",
35
+ "lexend",
36
+ "lfsr",
31
37
  "locationchange",
32
38
  "marvinpinto",
39
+ "mmultiline",
40
+ "monospace",
41
+ "msapplication",
42
+ "mstile",
33
43
  "nojekyll",
44
+ "noopener",
45
+ "noreferrer",
34
46
  "npmignore",
35
47
  "packagejson",
36
48
  "parens",
37
49
  "pdfs",
50
+ "postupgrade",
38
51
  "prettierignore",
39
52
  "prettierrc",
53
+ "preupgrade",
54
+ "protobuf",
40
55
  "pushstate",
41
56
  "replacestate",
42
57
  "repo's",
@@ -44,13 +59,17 @@
44
59
  "rgba",
45
60
  "stylelint",
46
61
  "stylelintrc",
47
- "subcommand",
62
+ "tabbable",
63
+ "tabindex",
48
64
  "thingie",
49
65
  "threejs",
50
66
  "transpiled",
51
67
  "transpiling",
52
68
  "typeof",
53
69
  "virmator's",
54
- "virmator"
70
+ "virmator",
71
+ "vite",
72
+ "vitejs",
73
+ "xlink"
55
74
  ]
56
75
  }
@@ -14,10 +14,10 @@ jobs:
14
14
  if: ${{ github.event.workflow_run.conclusion == 'success' }}
15
15
  steps:
16
16
  - uses: actions/checkout@v1
17
- - name: Use Node.js 14.x
17
+ - name: Use Node.js 16.x
18
18
  uses: actions/setup-node@v1
19
19
  with:
20
- node-version: 14.x
20
+ node-version: 16.x
21
21
  - name: run test
22
22
  run: |
23
23
  npm ci
@@ -26,18 +26,17 @@ jobs:
26
26
  id: vars
27
27
  run: |
28
28
  branchName="${GITHUB_REF#refs/*/}"
29
- echo ::set-output name=short_ref::"$branchName"
29
+ echo ::set-output name=prereleaseTagName::"$branchName-$GITHUB_SHA"
30
30
 
31
31
  originalTarName="$(npm pack)"
32
32
  packageName="$(npm -s run env echo '$npm_package_name')"
33
- timeStamp="$(date +%s)"
34
- newTarName="$packageName-$timeStamp.tgz"
33
+ newTarName="$packageName-$GITHUB_SHA.tgz"
35
34
  mv "$originalTarName" "$newTarName"
36
- echo ::set-output name=tar_name::"$newTarName"
35
+ echo ::set-output name=tarName::"$newTarName"
37
36
  - uses: 'marvinpinto/action-automatic-releases@latest'
38
37
  with:
39
38
  repo_token: '${{ secrets.GITHUB_TOKEN }}'
40
- automatic_release_tag: 'prerelease-${{ steps.vars.outputs.short_ref }}'
39
+ automatic_release_tag: 'prerelease-${{ steps.vars.outputs.prereleaseTagName }}'
41
40
  prerelease: true
42
41
  files: |
43
- ${{ steps.vars.outputs.tar_name }}
42
+ ${{ steps.vars.outputs.tarName }}
@@ -12,16 +12,27 @@ jobs:
12
12
 
13
13
  steps:
14
14
  - uses: actions/checkout@v1
15
- - name: Use Node.js 14.x
15
+ - name: Use Node.js 16.x
16
16
  uses: actions/setup-node@v1
17
17
  with:
18
- node-version: 14.x
18
+ node-version: 16.x
19
19
  - name: run test
20
20
  run: |
21
21
  npm ci
22
22
  npm run test:full
23
+ - name: pack and set vars
24
+ id: vars
25
+ run: |
26
+ tagName="${GITHUB_REF#refs/*/}"
27
+ originalTarName="$(npm pack)"
28
+ packageName="$(npm -s run env echo '$npm_package_name')"
29
+ newTarName="$packageName-$tagName.tgz"
30
+ mv "$originalTarName" "$newTarName"
31
+ echo ::set-output name=tarName::"$newTarName"
23
32
 
24
33
  - uses: 'marvinpinto/action-automatic-releases@latest'
25
34
  with:
26
35
  repo_token: '${{ secrets.GITHUB_TOKEN }}'
27
36
  prerelease: false
37
+ files: |
38
+ ${{ steps.vars.outputs.tarName }}
@@ -12,7 +12,7 @@ jobs:
12
12
  fail-fast: false
13
13
  matrix:
14
14
  os: [ubuntu-latest, windows-latest, macos-latest]
15
- node-version: [12.x, 14.x]
15
+ node-version: [12.x, 14.x, 16.x]
16
16
  steps:
17
17
  - uses: actions/checkout@v1
18
18
  - name: Use Node.js ${{ matrix.node-version }}
package/.prettierrc.js CHANGED
@@ -4,9 +4,11 @@ const path = require('path');
4
4
  const plugins = [
5
5
  'prettier-plugin-sort-json',
6
6
  'prettier-plugin-packagejson',
7
+ 'prettier-plugin-multiline-arrays',
7
8
  'prettier-plugin-organize-imports',
8
9
  'prettier-plugin-jsdoc',
9
10
  ].map((pluginName) => {
11
+ // account for installations where deps are flattened and installations where they're nested
10
12
  const defaultPath = `./node_modules/${pluginName}`;
11
13
  if (fs.existsSync(path.resolve(__dirname, defaultPath))) {
12
14
  return defaultPath;
@@ -15,10 +17,18 @@ const plugins = [
15
17
  }
16
18
  });
17
19
 
18
- module.exports = {
20
+ /**
21
+ * @typedef {import('prettier-plugin-multiline-arrays').MultilineArrayOptions} MultilineOptions
22
+ *
23
+ * @typedef {import('prettier').Options} PrettierOptions
24
+ * @type {PrettierOptions & MultilineOptions}
25
+ */
26
+ const prettierConfig = {
19
27
  arrowParens: 'always',
20
28
  bracketSpacing: false,
21
29
  endOfLine: 'lf',
30
+ // Arrays with just a single element don't wrap. But after that, they always wrap.
31
+ multilineArrayWrapThreshold: 1,
22
32
  htmlWhitespaceSensitivity: 'ignore',
23
33
  jsonRecursiveSort: true,
24
34
  bracketSameLine: false,
@@ -28,3 +38,5 @@ module.exports = {
28
38
  tabWidth: 4,
29
39
  trailingComma: 'all',
30
40
  };
41
+
42
+ module.exports = prettierConfig;
@@ -5,9 +5,9 @@ const node_1 = require("augment-vir/dist/node");
5
5
  const defaultFilter = (input) => input;
6
6
  function outputWrapper(callback, filter) {
7
7
  return (input) => {
8
- const stringInput = input.toString();
9
- if (filter(stringInput)) {
10
- callback(stringInput);
8
+ const callbackString = filter(input.toString());
9
+ if (callbackString) {
10
+ callback(callbackString);
11
11
  }
12
12
  };
13
13
  }
@@ -64,7 +64,7 @@ function runHelpCommand({ stdoutCallback }) {
64
64
  })
65
65
  .join('\n ');
66
66
  const helpMessage = `${cli_color_1.Color.Info} ${package_name_1.packageName} usage:${cli_color_1.Color.Reset}
67
- [npx] ${package_name_1.packageName} [--flags] command subcommand
67
+ [npx] ${package_name_1.packageName} [--flags] command subCommand
68
68
 
69
69
  npx is needed when the command is run directly from the terminal
70
70
  (not scoped within an npm script) unless the package has been globally installed
@@ -16,7 +16,17 @@ var FormatOperation;
16
16
  exports.defaultFormatArgs = {
17
17
  operation: FormatOperation.Write,
18
18
  prettierFlags: [],
19
- fileExtensions: ['ts', 'json', 'html', 'css', 'md', 'js', 'yml', 'yaml'],
19
+ fileExtensions: [
20
+ 'ts',
21
+ 'tsx',
22
+ 'json',
23
+ 'html',
24
+ 'css',
25
+ 'md',
26
+ 'js',
27
+ 'yml',
28
+ 'yaml',
29
+ ],
20
30
  };
21
31
  exports.filesMarkerArg = '--format-files';
22
32
  exports.formatImplementation = {
@@ -57,7 +67,10 @@ exports.formatImplementation = {
57
67
  ${package_name_1.packageName} ${cli_command_name_1.CliCommandName.Format} --ignore-path .prettierignore
58
68
  ${package_name_1.packageName} ${cli_command_name_1.CliCommandName.Format} ${FormatOperation.Write} --ignore-path .prettierignore
59
69
  ${package_name_1.packageName} ${cli_command_name_1.CliCommandName.Format} ${FormatOperation.Write} --ignore-path .prettierignore ${exports.filesMarkerArg} md json`,
60
- configKeys: [config_key_1.ConfigKey.Prettier],
70
+ configKeys: [
71
+ config_key_1.ConfigKey.Prettier,
72
+ config_key_1.ConfigKey.PrettierIgnore,
73
+ ],
61
74
  implementation: runFormatCommand,
62
75
  configFlagSupport: {
63
76
  [cli_flags_1.CliFlagName.NoWriteConfig]: true,
@@ -69,7 +82,11 @@ async function runFormatCommand(inputs) {
69
82
  const operationFlag = args.operation === FormatOperation.Check ? '--check' : '--write';
70
83
  const prettierCommand = `${prettierPath} --color ${args.prettierFlags.join(' ')} \"./**/*.+(${args.fileExtensions.join('|')})\" ${operationFlag}`;
71
84
  const results = await (0, shell_command_wrapper_1.runVirmatorShellCommand)(prettierCommand, inputs, {
72
- stdoutFilter: (stdout) => stdout.replace('Checking formatting...\n', ''),
85
+ stdoutFilter: (stdout) => stdout
86
+ // only relevant when running the check command
87
+ .replace('Checking formatting...\n', '')
88
+ // only relevant when running the check command
89
+ .replace('All matched files use Prettier code style!\n', ''),
73
90
  });
74
91
  return {
75
92
  success: !results.error,
@@ -34,7 +34,11 @@ async function runTestCommand(inputs) {
34
34
  ? (0, node_1.interpolationSafeWindowsPath)(inputs.rawArgs.join(' '))
35
35
  : `\"./dist/**/!(*.type).test.js\"`;
36
36
  const testCommand = `${testVirPath} ${args}`;
37
- const results = await (0, shell_command_wrapper_1.runVirmatorShellCommand)(testCommand, inputs);
37
+ const results = await (0, shell_command_wrapper_1.runVirmatorShellCommand)(testCommand, inputs, {
38
+ stdoutFilter: (logString) =>
39
+ // weird looking hex codes here are for color codes from test-vir
40
+ logString.replace('\x1B[1m\x1B[32mAll tests passed.\x1B[0m\n', ''),
41
+ });
38
42
  return {
39
43
  success: !results.error,
40
44
  };
@@ -7,7 +7,10 @@ const cli_command_name_1 = require("../../cli-util/cli-command-name");
7
7
  const cli_flags_1 = require("../../cli-util/cli-flags");
8
8
  const update_configs_1 = require("../../cli-util/update-configs");
9
9
  const config_key_1 = require("../../config/config-key");
10
- const exampleFlags = [config_key_1.ConfigKey.Cspell, config_key_1.ConfigKey.GitIgnore];
10
+ const exampleFlags = [
11
+ config_key_1.ConfigKey.Cspell,
12
+ config_key_1.ConfigKey.GitIgnore,
13
+ ];
11
14
  exports.updateAllConfigsCommandImplementation = {
12
15
  commandName: cli_command_name_1.CliCommandName.UpdateAllConfigs,
13
16
  description: `Update all config files.
@@ -7,7 +7,10 @@ const cli_command_name_1 = require("../../cli-util/cli-command-name");
7
7
  const cli_flags_1 = require("../../cli-util/cli-flags");
8
8
  const update_configs_1 = require("../../cli-util/update-configs");
9
9
  const config_key_1 = require("../../config/config-key");
10
- const exampleFlags = [config_key_1.BareConfigKey.GitIgnore, config_key_1.BareConfigKey.NpmIgnore];
10
+ const exampleFlags = [
11
+ config_key_1.BareConfigKey.GitIgnore,
12
+ config_key_1.BareConfigKey.NpmIgnore,
13
+ ];
11
14
  exports.updateBareConfigsCommandImplementation = {
12
15
  commandName: cli_command_name_1.CliCommandName.UpdateBareConfigs,
13
16
  description: `Update config files that aren't used in any ${package_name_1.packageName} commands,
@@ -17,7 +17,7 @@ async function runCommand(command, commandInput) {
17
17
  const defaultFlagSupport = {
18
18
  [cli_flags_1.CliFlagName.Silent]: true,
19
19
  [cli_flags_1.CliFlagName.Help]: true,
20
- [cli_flags_1.CliFlagName.ExtendableConfig]: !!((_a = commandImplementation.configKeys) === null || _a === void 0 ? void 0 : _a.every((configKey) => (0, extendable_config_1.isExtendableConfig)(configKey))),
20
+ [cli_flags_1.CliFlagName.ExtendableConfig]: !!((_a = commandImplementation.configKeys) === null || _a === void 0 ? void 0 : _a.some((configKey) => (0, extendable_config_1.isExtendableConfig)(configKey))),
21
21
  };
22
22
  const unsupportedFlagsInUse = (0, all_cli_commands_1.getUnsupportedFlags)(cliFlags, {
23
23
  ...defaultFlagSupport,
@@ -47,10 +47,10 @@ async function runCommand(command, commandInput) {
47
47
  ? cli_command_1.EmptyOutputCallbacks
48
48
  : {
49
49
  stdoutCallback: (input) => {
50
- console.info(input.replace(/\n\n$/, '\n'));
50
+ console.info(input.replace(/\n$/, ''));
51
51
  },
52
52
  stderrCallback: (input) => {
53
- console.error(input.replace(/\n\n$/, '\n'));
53
+ console.error(input.replace(/\n$/, ''));
54
54
  },
55
55
  };
56
56
  const commandResult = await commandImplementation.implementation({
@@ -6,7 +6,6 @@ export declare enum BareConfigKey {
6
6
  GitHubActionsPrerelease = "GitHubActionsPrerelease",
7
7
  GitIgnore = "GitIgnore",
8
8
  NpmIgnore = "NpmIgnore",
9
- PrettierIgnore = "PrettierIgnore",
10
9
  VsCodeSettings = "VsCodeSettings"
11
10
  }
12
11
  /** These are config files used by virmator commands. */
@@ -14,7 +13,8 @@ export declare enum CommandConfigKey {
14
13
  Cspell = "Cspell",
15
14
  Prettier = "Prettier",
16
15
  TsConfig = "TsConfig",
17
- PackageJson = "PackageJson"
16
+ PackageJson = "PackageJson",
17
+ PrettierIgnore = "PrettierIgnore"
18
18
  }
19
19
  export declare const ConfigKey: {
20
20
  GitAttributes: BareConfigKey.GitAttributes;
@@ -23,11 +23,11 @@ export declare const ConfigKey: {
23
23
  GitHubActionsPrerelease: BareConfigKey.GitHubActionsPrerelease;
24
24
  GitIgnore: BareConfigKey.GitIgnore;
25
25
  NpmIgnore: BareConfigKey.NpmIgnore;
26
- PrettierIgnore: BareConfigKey.PrettierIgnore;
27
26
  VsCodeSettings: BareConfigKey.VsCodeSettings;
28
27
  Cspell: CommandConfigKey.Cspell;
29
28
  Prettier: CommandConfigKey.Prettier;
30
29
  TsConfig: CommandConfigKey.TsConfig;
31
30
  PackageJson: CommandConfigKey.PackageJson;
31
+ PrettierIgnore: CommandConfigKey.PrettierIgnore;
32
32
  };
33
33
  export declare type ConfigKey = CommandConfigKey | BareConfigKey;
@@ -10,7 +10,6 @@ var BareConfigKey;
10
10
  BareConfigKey["GitHubActionsPrerelease"] = "GitHubActionsPrerelease";
11
11
  BareConfigKey["GitIgnore"] = "GitIgnore";
12
12
  BareConfigKey["NpmIgnore"] = "NpmIgnore";
13
- BareConfigKey["PrettierIgnore"] = "PrettierIgnore";
14
13
  BareConfigKey["VsCodeSettings"] = "VsCodeSettings";
15
14
  })(BareConfigKey = exports.BareConfigKey || (exports.BareConfigKey = {}));
16
15
  /** These are config files used by virmator commands. */
@@ -20,5 +19,6 @@ var CommandConfigKey;
20
19
  CommandConfigKey["Prettier"] = "Prettier";
21
20
  CommandConfigKey["TsConfig"] = "TsConfig";
22
21
  CommandConfigKey["PackageJson"] = "PackageJson";
22
+ CommandConfigKey["PrettierIgnore"] = "PrettierIgnore";
23
23
  })(CommandConfigKey = exports.CommandConfigKey || (exports.CommandConfigKey = {}));
24
24
  exports.ConfigKey = { ...CommandConfigKey, ...BareConfigKey };
@@ -58,7 +58,10 @@ async function updateVirmatorConfig(configKey, repoDir, extendable) {
58
58
  const repoFileLines = repoConfigContents.split('\n');
59
59
  const virmatorFileLines = virmatorConfigContents.split('\n');
60
60
  const filteredRepoFileLines = repoFileLines.filter((repoLine) => !virmatorFileLines.includes(repoLine));
61
- return [...virmatorFileLines, ...filteredRepoFileLines].join('\n');
61
+ return [
62
+ ...virmatorFileLines,
63
+ ...filteredRepoFileLines,
64
+ ].join('\n');
62
65
  }
63
66
  }
64
67
  break;
@@ -32,7 +32,7 @@ async function copyConfig({ configKey, forceExtendableConfig, repoDir, }) {
32
32
  log: `Config file not found, creating new file: ${repoConfigPath}\n${ifUndesiredMessage}`,
33
33
  });
34
34
  }
35
- if (shouldExtend) {
35
+ if (shouldExtend && (0, extendable_config_1.isExtendableConfig)(configKey)) {
36
36
  if (!(0, extendable_config_1.isExtendableConfig)(configKey)) {
37
37
  throw new config_file_error_1.ConfigFileError(`Extendable config files are not supported for ${configKey}`);
38
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "virmator",
3
- "version": "1.3.5",
3
+ "version": "1.4.0",
4
4
  "description": "Handle all the stuffs in one package.",
5
5
  "keywords": [
6
6
  "automation",
@@ -38,23 +38,24 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "ansi-styles": "5.2.0",
41
- "augment-vir": "^1.2.1",
42
- "cspell": "^5.12.3",
41
+ "augment-vir": "^1.4.3",
42
+ "cspell": "^5.18.4",
43
43
  "fs-extra": "^10.0.0",
44
44
  "markdown-code-example-inserter": "^0.1.5",
45
- "prettier": "^2.4.1",
46
- "prettier-plugin-jsdoc": "^0.3.24",
45
+ "prettier": "^2.5.1",
46
+ "prettier-plugin-jsdoc": "^0.3.30",
47
47
  "prettier-plugin-organize-imports": "^2.3.4",
48
- "prettier-plugin-packagejson": "^2.2.13",
48
+ "prettier-plugin-packagejson": "^2.2.15",
49
49
  "prettier-plugin-sort-json": "^0.0.2",
50
- "simple-git": "^2.46.0",
50
+ "simple-git": "^3.2.4",
51
51
  "test-vir": "^0.2.3",
52
- "typescript": "^4.4.4"
52
+ "typescript": "^4.5.5"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/fs-extra": "^9.0.13",
56
- "@types/node": "^16.11.1",
57
- "ts-node": "^10.3.0"
56
+ "@types/node": "^17.0.17",
57
+ "prettier-plugin-multiline-arrays": "^0.0.1",
58
+ "ts-node": "^10.5.0"
58
59
  },
59
60
  "engines": {
60
61
  "node": ">=12",
package/tsconfig.json CHANGED
@@ -19,5 +19,10 @@
19
19
  "target": "ES2018",
20
20
  "useUnknownInCatchVariables": true
21
21
  },
22
- "exclude": ["node_modules", "dist", "test-repos", "scripts"]
22
+ "exclude": [
23
+ "node_modules",
24
+ "dist",
25
+ "test-repos",
26
+ "scripts"
27
+ ]
23
28
  }