@inlang/sdk 0.28.0 → 0.28.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"listProjects.d.ts","sourceRoot":"","sources":["../src/listProjects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAEnD,eAAO,MAAM,YAAY,cACb,iBAAiB,QACtB,MAAM,KACV,QAAQ,MAAM;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CAwCxC,CAAA"}
1
+ {"version":3,"file":"listProjects.d.ts","sourceRoot":"","sources":["../src/listProjects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAInD,eAAO,MAAM,YAAY,cACb,iBAAiB,QACtB,MAAM,KACV,QAAQ,MAAM;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CAwCxC,CAAA"}
@@ -1,3 +1,4 @@
1
+ const ignores = ["node_modules", ".git"];
1
2
  export const listProjects = async (nodeishFs, from) => {
2
3
  // !TODO: Remove this limit once we introduce caching
3
4
  const recursionLimit = 5;
@@ -12,7 +13,7 @@ export const listProjects = async (nodeishFs, from) => {
12
13
  try {
13
14
  const stats = await nodeishFs.stat(filePath);
14
15
  if (stats.isDirectory()) {
15
- if (file === "node_modules") {
16
+ if (ignores.includes(file)) {
16
17
  continue;
17
18
  }
18
19
  if (file.endsWith(".inlang")) {
@@ -48,7 +48,10 @@ describe("listProjects", () => {
48
48
  });
49
49
  it("should not crash on broken symlinks as cal.com has", async () => {
50
50
  const ciTestRepo = JSON.parse(readFileSync("./mocks/ci-test-repo-no-shallow.json", { encoding: "utf-8" }));
51
- const repo = await mockRepo({ fromSnapshot: ciTestRepo });
51
+ const repo = await mockRepo({
52
+ fromSnapshot: ciTestRepo,
53
+ repoOptions: { experimentalFeatures: { lixCommit: true, lazyClone: false } },
54
+ });
52
55
  repo.checkout({ branch: "test-symlink" });
53
56
  const link = await repo.nodeishFs.readlink("test-symlink-not-existing-target");
54
57
  expect(link).toBe("/test-symlink-not-existing-target//.././no-exist");
@@ -202,7 +202,7 @@ describe("initialization", () => {
202
202
  });
203
203
  it("should reuse projectId on existing projectid", async () => {
204
204
  const repo = await mockRepo({ fromSnapshot: ciTestRepoSnapshot });
205
- repo.nodeishFs.writeFile("/project.inlang/project_id", "testId");
205
+ await repo.nodeishFs.writeFile("/project.inlang/project_id", "testId");
206
206
  const result = await tryCatch(() => loadProject({
207
207
  projectPath: "/project.inlang",
208
208
  repo,
@@ -1 +1 @@
1
- {"version":3,"file":"maybeCreateFirstProjectId.d.ts","sourceRoot":"","sources":["../../src/migrations/maybeCreateFirstProjectId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAGhD;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAAC,IAAI,EAAE;IACrD,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,UAAU,CAAA;CACjB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBhB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAAE,IAAI,CAAC,EAAE,UAAU,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,+BAUvF"}
1
+ {"version":3,"file":"maybeCreateFirstProjectId.d.ts","sourceRoot":"","sources":["../../src/migrations/maybeCreateFirstProjectId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAGhD;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAAC,IAAI,EAAE;IACrD,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,UAAU,CAAA;CACjB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBhB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAAE,IAAI,CAAC,EAAE,UAAU,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,+BAUvF"}
@@ -20,7 +20,11 @@ export async function maybeCreateFirstProjectId(args) {
20
20
  if (error.code === "ENOENT" && args.repo) {
21
21
  const projectId = await generateProjectId({ repo: args.repo, projectPath: args.projectPath });
22
22
  if (projectId) {
23
- await args.repo.nodeishFs.writeFile(args.projectPath + "/project_id", projectId);
23
+ await args.repo.nodeishFs
24
+ .writeFile(args.projectPath + "/project_id", projectId)
25
+ .catch((error) => {
26
+ console.error("Failed to write project_id", error);
27
+ });
24
28
  }
25
29
  }
26
30
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@inlang/sdk",
3
3
  "type": "module",
4
- "version": "0.28.0",
4
+ "version": "0.28.2",
5
5
  "license": "Apache-2.0",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -33,16 +33,16 @@
33
33
  "solid-js": "1.6.12",
34
34
  "throttle-debounce": "^5.0.0",
35
35
  "@inlang/json-types": "1.1.0",
36
- "@inlang/language-tag": "1.5.1",
37
36
  "@inlang/message": "2.1.0",
38
- "@inlang/module": "1.2.8",
37
+ "@inlang/language-tag": "1.5.1",
39
38
  "@inlang/message-lint-rule": "1.4.5",
40
- "@inlang/plugin": "2.4.8",
39
+ "@inlang/plugin": "2.4.9",
41
40
  "@inlang/project-settings": "2.4.0",
42
- "@inlang/result": "1.1.0",
41
+ "@inlang/module": "1.2.9",
43
42
  "@inlang/translatable": "1.3.1",
44
- "@lix-js/fs": "0.6.0",
45
- "@lix-js/client": "0.9.0"
43
+ "@inlang/result": "1.1.0",
44
+ "@lix-js/client": "1.1.0",
45
+ "@lix-js/fs": "1.0.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/debug": "^4.1.12",
@@ -62,7 +62,10 @@ describe("listProjects", () => {
62
62
  const ciTestRepo: Snapshot = JSON.parse(
63
63
  readFileSync("./mocks/ci-test-repo-no-shallow.json", { encoding: "utf-8" })
64
64
  )
65
- const repo = await mockRepo({ fromSnapshot: ciTestRepo })
65
+ const repo = await mockRepo({
66
+ fromSnapshot: ciTestRepo,
67
+ repoOptions: { experimentalFeatures: { lixCommit: true, lazyClone: false } },
68
+ })
66
69
  repo.checkout({ branch: "test-symlink" })
67
70
 
68
71
  const link = await repo.nodeishFs.readlink("test-symlink-not-existing-target")
@@ -1,5 +1,7 @@
1
1
  import type { NodeishFilesystem } from "@lix-js/fs"
2
2
 
3
+ const ignores = ["node_modules", ".git"]
4
+
3
5
  export const listProjects = async (
4
6
  nodeishFs: NodeishFilesystem,
5
7
  from: string
@@ -20,7 +22,7 @@ export const listProjects = async (
20
22
  try {
21
23
  const stats = await nodeishFs.stat(filePath)
22
24
  if (stats.isDirectory()) {
23
- if (file === "node_modules") {
25
+ if (ignores.includes(file)) {
24
26
  continue
25
27
  }
26
28
 
@@ -253,7 +253,7 @@ describe("initialization", () => {
253
253
  it("should reuse projectId on existing projectid", async () => {
254
254
  const repo = await mockRepo({ fromSnapshot: ciTestRepoSnapshot })
255
255
 
256
- repo.nodeishFs.writeFile("/project.inlang/project_id", "testId")
256
+ await repo.nodeishFs.writeFile("/project.inlang/project_id", "testId")
257
257
 
258
258
  const result = await tryCatch(() =>
259
259
  loadProject({
@@ -24,7 +24,11 @@ export async function maybeCreateFirstProjectId(args: {
24
24
  if (error.code === "ENOENT" && args.repo) {
25
25
  const projectId = await generateProjectId({ repo: args.repo, projectPath: args.projectPath })
26
26
  if (projectId) {
27
- await args.repo.nodeishFs.writeFile(args.projectPath + "/project_id", projectId)
27
+ await args.repo.nodeishFs
28
+ .writeFile(args.projectPath + "/project_id", projectId)
29
+ .catch((error) => {
30
+ console.error("Failed to write project_id", error)
31
+ })
28
32
  }
29
33
  }
30
34
  }