Skip to content

Commit 403bba9

Browse files
fix(cli): rename bin entry from lingo.dev to lingo for Windows 11 compatibility (#1759)
* feat(cli): integrate glob package and add lingo.dev command script * feat(cli): add lingo.dev command script for Windows * chore(cli): remove incorrect lingo.dev command script for Windows * chore(cli): rename command script from lingo.dev to lingo * chore(cli): update command handling for Windows 11 bash compatibility --------- Co-authored-by: Max Prilutskiy <5614659+maxprilutskiy@users.noreply.github.com>
1 parent 9090d46 commit 403bba9

8 files changed

Lines changed: 22 additions & 12 deletions

File tree

.changeset/cute-icons-write.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"lingo.dev": minor
3+
---
4+
5+
Fix CLI command script for Windows 11 and Bash compatibility

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
}
109109
},
110110
"bin": {
111-
"lingo.dev": "./bin/cli.mjs"
111+
"lingo": "./bin/cli.mjs"
112112
},
113113
"files": [
114114
"bin",

packages/cli/src/cli/utils/buckets.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { describe, it, expect, vi } from "vitest";
22
import { getBuckets } from "./buckets";
3-
import { glob, Path } from "glob";
3+
import * as pkg from "glob";
4+
import type { Path } from "glob";
5+
const { glob } = pkg;
46

57
vi.mock("glob", () => ({
68
glob: {

packages/cli/src/cli/utils/buckets.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import _ from "lodash";
22
import path from "path";
3-
import { glob } from "glob";
3+
import * as pkg from "glob";
4+
const { glob } = pkg;
45
import { CLIError } from "./errors";
56
import {
67
I18nConfig,
@@ -159,11 +160,11 @@ function expandPlaceholderedGlob(
159160
const sourcePathChunk = sourcePathChunks[localeSegmentIndex];
160161
const regexp = new RegExp(
161162
"(" +
162-
pathPatternChunk
163-
.replaceAll(".", "\\.")
164-
.replaceAll("*", ".*")
165-
.replace("[locale]", `)${sourceLocale}(`) +
166-
")",
163+
pathPatternChunk
164+
.replaceAll(".", "\\.")
165+
.replaceAll("*", ".*")
166+
.replace("[locale]", `)${sourceLocale}(`) +
167+
")",
167168
);
168169
const match = sourcePathChunk.match(regexp);
169170
if (match) {

packages/cli/src/cli/utils/ensure-patterns.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import fs from "fs";
22
import path from "path";
3-
import { glob } from "glob";
43
import _ from "lodash";
54
import { LocaleCode, resolveLocaleCode } from "@lingo.dev/_spec";
65

packages/cli/src/cli/utils/find-locale-paths.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { describe, it, expect, vi, beforeEach } from "vitest";
2-
import { glob } from "glob";
2+
import * as pkg from "glob";
3+
const { glob } = pkg;
34
import findLocaleFiles from "./find-locale-paths";
45

56
vi.mock("glob", () => ({

packages/cli/src/cli/utils/find-locale-paths.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import fs from "fs";
22
import path from "path";
3-
import { glob } from "glob";
3+
import * as pkg from "glob";
4+
const { glob } = pkg;
45
import _ from "lodash";
56
import { LocaleCode, resolveLocaleCode } from "@lingo.dev/_spec";
67

@@ -60,7 +61,7 @@ function findLocaleFilesWithExtension(ext: string) {
6061
try {
6162
resolveLocaleCode(locale as LocaleCode);
6263
return { locale, file };
63-
} catch (e) {}
64+
} catch (e) { }
6465
}
6566
return { file, locale: null };
6667
})

packages/cli/tsup.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export default defineConfig({
3131
"@lingo.dev/_react",
3232
"@lingo.dev/_locales",
3333
"@lingo.dev/_logging",
34+
"glob",
3435
],
3536
outExtension: (ctx) => ({
3637
js: ctx.format === "cjs" ? ".cjs" : ".mjs",

0 commit comments

Comments
 (0)