@storm-software/git-tools 2.126.0 → 2.127.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/bin/git.js CHANGED
@@ -36,6 +36,7 @@ import { existsSync, readFileSync, rmSync, readdirSync, writeFileSync, statSync,
36
36
  import wrap from 'word-wrap';
37
37
  import Path, { join as join$1, extname } from 'node:path';
38
38
  import { createProjectGraphAsync, readProjectsConfigurationFromProjectGraph } from 'nx/src/project-graph/project-graph.js';
39
+ import { resolveConfig, format } from 'prettier';
39
40
  import { parse as parse$1, Syntax } from '@textlint/markdown-to-ast';
40
41
  import anchor from 'anchor-markdown-header';
41
42
  import { Parser } from 'htmlparser2';
@@ -50,7 +51,6 @@ import chalk from 'chalk';
50
51
  import { printAndFlushChanges } from 'nx/src/command-line/release/utils/print-changes';
51
52
  import { createGitTagValues, handleDuplicateGitTags, createCommitMessageValues, isPrerelease, shouldPreferDockerVersionForReleaseGroup, ReleaseVersion, noDiffInChangelogMessage } from 'nx/src/command-line/release/utils/shared';
52
53
  import { interpolate } from 'nx/src/tasks-runner/utils';
53
- import { resolveConfig, format } from 'prettier';
54
54
  import { execCommand } from 'nx/src/command-line/release/utils/exec-command.js';
55
55
  import { getCommitHash, getLatestGitTagForPattern, getFirstGitCommit, gitPush, getGitDiff, parseCommits, gitAdd } from 'nx/src/command-line/release/utils/git';
56
56
  import { prerelease, major } from 'semver';
@@ -1278,11 +1278,11 @@ var formatCommitMessage = (state, workspaceConfig) => {
1278
1278
  const scope = workspaceConfig.variant !== "minimal" && typeof answers.scope === "string" && answers.scope ? answers.scope.trim() : "";
1279
1279
  const subject = answers.subject?.trim();
1280
1280
  const type = answers.type;
1281
- const format2 = config5.settings.format || (workspaceConfig.variant !== "minimal" ? "{type}({scope}): {emoji}{subject}" : "{type}: {emoji}{subject}");
1281
+ const format3 = config5.settings.format || (workspaceConfig.variant !== "minimal" ? "{type}({scope}): {emoji}{subject}" : "{type}: {emoji}{subject}");
1282
1282
  const body = answers.body && typeof answers.body === "string" ? wrap(answers.body || "", wrapOptions) : "";
1283
1283
  const breaking = answers.breakingBody && typeof answers.breakingBody === "string" ? wrap(answers.breakingBody || "", wrapOptions) : "";
1284
1284
  const issues = answers.issuesBody && typeof answers.issuesBody === "string" ? wrap(answers.issuesBody || "", wrapOptions) : "";
1285
- const head = format2.replace(/\{emoji\}/g, config5.settings.disableEmoji ? "" : `${emoji} `).replace(/\{scope\}/g, scope).replace(/\{subject\}/g, subject || "").replace(/\{type\}/g, type || "");
1285
+ const head = format3.replace(/\{emoji\}/g, config5.settings.disableEmoji ? "" : `${emoji} `).replace(/\{scope\}/g, scope).replace(/\{subject\}/g, subject || "").replace(/\{type\}/g, type || "");
1286
1286
  let msg = head;
1287
1287
  if (body) {
1288
1288
  msg += `
@@ -1595,45 +1595,53 @@ async function transformAndSave(files, mode = "github.com", maxHeaderLevel = 3,
1595
1595
  "--update-only flag is enabled. Only updating files that already have a TOC."
1596
1596
  );
1597
1597
  }
1598
- console.log("\n==================\n");
1599
- const transformed = files.map((x) => {
1600
- const result = transform(
1601
- readFileSync(x.path, "utf8"),
1602
- mode,
1603
- maxHeaderLevel,
1604
- title,
1605
- noTitle,
1606
- entryPrefix,
1607
- processAll,
1608
- updateOnly
1609
- );
1610
- result.path = x.path;
1611
- return result;
1612
- });
1613
- const changed = transformed.filter((x) => x.transformed);
1614
- const unchanged = transformed.filter((x) => {
1615
- return !x.transformed;
1616
- });
1617
- for (const x of unchanged) {
1618
- console.log('"%s" is up to date', x.path);
1619
- }
1620
- for (const x of changed) {
1621
- console.log('"%s" will be updated', x.path);
1622
- writeFileSync(x.path, x.data, "utf8");
1623
- }
1598
+ return Promise.all(
1599
+ files.map((x) => {
1600
+ const result = transform(
1601
+ readFileSync(x.path, "utf8"),
1602
+ mode,
1603
+ maxHeaderLevel,
1604
+ title,
1605
+ noTitle,
1606
+ entryPrefix,
1607
+ processAll,
1608
+ updateOnly
1609
+ );
1610
+ result.path = x.path;
1611
+ return result;
1612
+ }).filter((file) => file.transformed).map(async (file) => {
1613
+ console.log('Writting changes to "%s"', file.path);
1614
+ const prettierConfig = await resolveConfig(file.path, {
1615
+ useCache: true,
1616
+ editorconfig: true
1617
+ });
1618
+ return writeFile(
1619
+ file.path,
1620
+ await format(
1621
+ file.data,
1622
+ prettierConfig ? { ...prettierConfig, parser: "markdown" } : { parser: "markdown" }
1623
+ ),
1624
+ "utf8"
1625
+ );
1626
+ })
1627
+ );
1624
1628
  }
1625
1629
  var doctoc = (directory, mode = "github.com", maxHeaderLevel = 3, title = "## Table of Contents", noTitle = false, entryPrefix = void 0, processAll = false, updateOnly = false) => {
1626
1630
  let files = [];
1627
1631
  const stat = statSync(directory);
1628
1632
  if (stat.isDirectory()) {
1629
1633
  console.log(
1630
- '\nDocToccing "%s" and its sub directories for %s.',
1634
+ '\nCreating Table of Contents for "%s" and its sub directories for %s.',
1631
1635
  directory,
1632
1636
  mode
1633
1637
  );
1634
1638
  files = findMarkdownFiles(directory);
1635
1639
  } else {
1636
- console.log('\nDocToccing single file "%s" for %s.', directory, mode);
1640
+ console.log(
1641
+ '\nCreating Table of Contents for single file "%s" for %s.',
1642
+ directory,
1643
+ mode
1644
+ );
1637
1645
  files = [{ path: directory }];
1638
1646
  }
1639
1647
  transformAndSave(
@@ -1646,7 +1654,10 @@ var doctoc = (directory, mode = "github.com", maxHeaderLevel = 3, title = "## Ta
1646
1654
  processAll,
1647
1655
  updateOnly
1648
1656
  );
1649
- console.log("\nEverything is OK.");
1657
+ console.log(
1658
+ "\nCompleted generating Table of Contents for %s file(s).",
1659
+ files.length
1660
+ );
1650
1661
  };
1651
1662
  var markdownExts = [".md", ".markdown"];
1652
1663
  var ignoredDirs = [".", "..", ".git", "node_modules"];