oh-my-space 0.3.0 → 0.3.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.
Files changed (2) hide show
  1. package/dist/oms.js +26 -4
  2. package/package.json +2 -2
package/dist/oms.js CHANGED
@@ -11,6 +11,8 @@ const ALLOWED_TOP_KEYS = new Set(["repos"]);
11
11
  const ALLOWED_ITEM_KEYS = new Set(["alias", "url", "branch"]);
12
12
  const FETCH_REFSPEC = "+refs/heads/*:refs/remotes/origin/*";
13
13
  const GITIGNORE_ENTRY = "sources/";
14
+ const MIN_GIT_MAJOR = 2;
15
+ const MIN_GIT_MINOR = 40;
14
16
  const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
15
17
  const useColor = process.stdout.isTTY;
16
18
  const dim = (s) => (useColor ? `\x1b[2m${s}\x1b[0m` : s);
@@ -113,6 +115,19 @@ function runGit(cwd, args, inheritOutput = false) {
113
115
  function runBareGit(repoRoot, alias, args, inheritOutput = false) {
114
116
  return runGit(aliasDir(repoRoot, alias), ["-c", "safe.bareRepository=all", ...args], inheritOutput);
115
117
  }
118
+ function parseGitVersion(s) {
119
+ const m = s.match(/git version (\d+)\.(\d+)/);
120
+ if (!m)
121
+ return null;
122
+ return { major: Number.parseInt(m[1], 10), minor: Number.parseInt(m[2], 10) };
123
+ }
124
+ function isGitVersionSupported(v) {
125
+ if (v.major > MIN_GIT_MAJOR)
126
+ return true;
127
+ if (v.major < MIN_GIT_MAJOR)
128
+ return false;
129
+ return v.minor >= MIN_GIT_MINOR;
130
+ }
116
131
  function findWorkspaceRoot(options = {}) {
117
132
  let current = resolve(options.cwd ?? process.cwd());
118
133
  while (true) {
@@ -717,14 +732,21 @@ async function runDoctor() {
717
732
  encoding: "utf8",
718
733
  stdio: ["ignore", "pipe", "pipe"],
719
734
  });
720
- if (git.status === 0) {
721
- log.success(`git: ${git.stdout.trim()}`);
722
- }
723
- else {
735
+ if (git.status !== 0) {
724
736
  log.error("git: not found");
725
737
  return 1;
726
738
  }
739
+ log.success(`git: ${git.stdout.trim()}`);
727
740
  let warnings = 0;
741
+ const parsed = parseGitVersion(git.stdout);
742
+ if (!parsed) {
743
+ log.warn(`git: could not parse version from "${git.stdout.trim()}"; oms expects git >=${MIN_GIT_MAJOR}.${MIN_GIT_MINOR}.`);
744
+ warnings++;
745
+ }
746
+ else if (!isGitVersionSupported(parsed)) {
747
+ log.warn(`git ${parsed.major}.${parsed.minor} is older than the recommended ${MIN_GIT_MAJOR}.${MIN_GIT_MINOR}. oms uses "git worktree add --track -B" which may fail on older releases — upgrade git.`);
748
+ warnings++;
749
+ }
728
750
  if (hasLegacySubmoduleLayout(repoRoot, repos)) {
729
751
  log.warn('detected legacy submodule layout (.gitmodules registers sources/<alias>). See README "Migrating from 0.2.x".');
730
752
  warnings++;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oh-my-space",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "CLI for managing external source repositories declared in sources.yaml.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/divlook/oh-my-space",
@@ -40,7 +40,7 @@
40
40
  "prepack": "npm test",
41
41
  "changeset": "changeset",
42
42
  "version": "changeset version",
43
- "release": "npm test && npm publish --provenance --access public"
43
+ "release": "changeset publish"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@changesets/changelog-github": "^0.7.0",