@anvil-works/anvil-cli 0.7.1 → 0.7.3-canary.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/dist/cli.js +25 -10
- package/dist/index.js +25 -10
- package/dist/services/git.d.ts +3 -0
- package/dist/services/git.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -14642,9 +14642,16 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
14642
14642
|
return [];
|
|
14643
14643
|
}
|
|
14644
14644
|
}
|
|
14645
|
+
const external_timers_promises_namespaceObject = require("timers/promises");
|
|
14645
14646
|
class GitService {
|
|
14646
14647
|
git;
|
|
14647
14648
|
repoPath;
|
|
14649
|
+
static INDEX_LOCK_RETRY_DELAYS_MS = [
|
|
14650
|
+
25,
|
|
14651
|
+
50,
|
|
14652
|
+
100,
|
|
14653
|
+
200
|
|
14654
|
+
];
|
|
14648
14655
|
constructor(repoPath){
|
|
14649
14656
|
this.repoPath = external_path_default().resolve(repoPath);
|
|
14650
14657
|
this.git = esm_default(this.repoPath);
|
|
@@ -14814,21 +14821,29 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
14814
14821
|
}
|
|
14815
14822
|
}
|
|
14816
14823
|
async reset(ref, mode = "mixed") {
|
|
14817
|
-
|
|
14818
|
-
await this.git.reset([
|
|
14824
|
+
await this.runGitCommandWithIndexLockRetry("reset", ()=>this.git.reset([
|
|
14819
14825
|
`--${mode}`,
|
|
14820
14826
|
ref
|
|
14821
|
-
]);
|
|
14822
|
-
} catch (e) {
|
|
14823
|
-
throw errors_createGitError.commandFailed("reset", e.message);
|
|
14824
|
-
}
|
|
14827
|
+
]));
|
|
14825
14828
|
}
|
|
14826
14829
|
async checkout(paths) {
|
|
14827
|
-
|
|
14828
|
-
|
|
14830
|
+
await this.runGitCommandWithIndexLockRetry("checkout", ()=>this.git.checkout(paths));
|
|
14831
|
+
}
|
|
14832
|
+
async runGitCommandWithIndexLockRetry(command, operation) {
|
|
14833
|
+
let lastError;
|
|
14834
|
+
for(let attempt = 0; attempt <= GitService.INDEX_LOCK_RETRY_DELAYS_MS.length; attempt += 1)try {
|
|
14835
|
+
await operation();
|
|
14836
|
+
return;
|
|
14829
14837
|
} catch (e) {
|
|
14830
|
-
|
|
14838
|
+
lastError = e;
|
|
14839
|
+
if (!this.isIndexLockError(e) || attempt === GitService.INDEX_LOCK_RETRY_DELAYS_MS.length) throw errors_createGitError.commandFailed(command, e.message);
|
|
14840
|
+
await (0, external_timers_promises_namespaceObject.setTimeout)(GitService.INDEX_LOCK_RETRY_DELAYS_MS[attempt]);
|
|
14831
14841
|
}
|
|
14842
|
+
throw errors_createGitError.commandFailed(command, lastError.message);
|
|
14843
|
+
}
|
|
14844
|
+
isIndexLockError(error) {
|
|
14845
|
+
const message = error.message ?? "";
|
|
14846
|
+
return message.includes("Unable to create") && message.includes("index.lock") && message.includes("File exists");
|
|
14832
14847
|
}
|
|
14833
14848
|
async stash(message) {
|
|
14834
14849
|
try {
|
|
@@ -16700,7 +16715,7 @@ print(json.dumps({"issues": issues}))
|
|
|
16700
16715
|
].join(", ")}) or ${[
|
|
16701
16716
|
...DB_LINK_COLUMN_TYPES
|
|
16702
16717
|
].join(", ")}`);
|
|
16703
|
-
if (void 0 !== value.client_hidden && "boolean" != typeof value.client_hidden) validators_pushIssue(issues, `${path}.client_hidden`, "must be a boolean");
|
|
16718
|
+
if (void 0 !== value.client_hidden && null !== value.client_hidden && "boolean" != typeof value.client_hidden) validators_pushIssue(issues, `${path}.client_hidden`, "must be a boolean or null");
|
|
16704
16719
|
if (void 0 !== value.admin_ui && null !== value.admin_ui) if (validators_isPlainObject(value.admin_ui)) {
|
|
16705
16720
|
const ui = value.admin_ui;
|
|
16706
16721
|
if (void 0 !== ui.width && "number" != typeof ui.width) validators_pushIssue(issues, `${path}.admin_ui.width`, "must be a number");
|
package/dist/index.js
CHANGED
|
@@ -14671,9 +14671,16 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
14671
14671
|
force: true
|
|
14672
14672
|
});
|
|
14673
14673
|
}
|
|
14674
|
+
const external_timers_promises_namespaceObject = require("timers/promises");
|
|
14674
14675
|
class git_GitService {
|
|
14675
14676
|
git;
|
|
14676
14677
|
repoPath;
|
|
14678
|
+
static INDEX_LOCK_RETRY_DELAYS_MS = [
|
|
14679
|
+
25,
|
|
14680
|
+
50,
|
|
14681
|
+
100,
|
|
14682
|
+
200
|
|
14683
|
+
];
|
|
14677
14684
|
constructor(repoPath){
|
|
14678
14685
|
this.repoPath = external_path_default().resolve(repoPath);
|
|
14679
14686
|
this.git = esm_default(this.repoPath);
|
|
@@ -14843,21 +14850,29 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
14843
14850
|
}
|
|
14844
14851
|
}
|
|
14845
14852
|
async reset(ref, mode = "mixed") {
|
|
14846
|
-
|
|
14847
|
-
await this.git.reset([
|
|
14853
|
+
await this.runGitCommandWithIndexLockRetry("reset", ()=>this.git.reset([
|
|
14848
14854
|
`--${mode}`,
|
|
14849
14855
|
ref
|
|
14850
|
-
]);
|
|
14851
|
-
} catch (e) {
|
|
14852
|
-
throw errors_createGitError.commandFailed("reset", e.message);
|
|
14853
|
-
}
|
|
14856
|
+
]));
|
|
14854
14857
|
}
|
|
14855
14858
|
async checkout(paths) {
|
|
14856
|
-
|
|
14857
|
-
|
|
14859
|
+
await this.runGitCommandWithIndexLockRetry("checkout", ()=>this.git.checkout(paths));
|
|
14860
|
+
}
|
|
14861
|
+
async runGitCommandWithIndexLockRetry(command, operation) {
|
|
14862
|
+
let lastError;
|
|
14863
|
+
for(let attempt = 0; attempt <= git_GitService.INDEX_LOCK_RETRY_DELAYS_MS.length; attempt += 1)try {
|
|
14864
|
+
await operation();
|
|
14865
|
+
return;
|
|
14858
14866
|
} catch (e) {
|
|
14859
|
-
|
|
14867
|
+
lastError = e;
|
|
14868
|
+
if (!this.isIndexLockError(e) || attempt === git_GitService.INDEX_LOCK_RETRY_DELAYS_MS.length) throw errors_createGitError.commandFailed(command, e.message);
|
|
14869
|
+
await (0, external_timers_promises_namespaceObject.setTimeout)(git_GitService.INDEX_LOCK_RETRY_DELAYS_MS[attempt]);
|
|
14860
14870
|
}
|
|
14871
|
+
throw errors_createGitError.commandFailed(command, lastError.message);
|
|
14872
|
+
}
|
|
14873
|
+
isIndexLockError(error) {
|
|
14874
|
+
const message = error.message ?? "";
|
|
14875
|
+
return message.includes("Unable to create") && message.includes("index.lock") && message.includes("File exists");
|
|
14861
14876
|
}
|
|
14862
14877
|
async stash(message) {
|
|
14863
14878
|
try {
|
|
@@ -16729,7 +16744,7 @@ print(json.dumps({"issues": issues}))
|
|
|
16729
16744
|
].join(", ")}) or ${[
|
|
16730
16745
|
...DB_LINK_COLUMN_TYPES
|
|
16731
16746
|
].join(", ")}`);
|
|
16732
|
-
if (void 0 !== value.client_hidden && "boolean" != typeof value.client_hidden) validators_pushIssue(issues, `${path}.client_hidden`, "must be a boolean");
|
|
16747
|
+
if (void 0 !== value.client_hidden && null !== value.client_hidden && "boolean" != typeof value.client_hidden) validators_pushIssue(issues, `${path}.client_hidden`, "must be a boolean or null");
|
|
16733
16748
|
if (void 0 !== value.admin_ui && null !== value.admin_ui) if (validators_isPlainObject(value.admin_ui)) {
|
|
16734
16749
|
const ui = value.admin_ui;
|
|
16735
16750
|
if (void 0 !== ui.width && "number" != typeof ui.width) validators_pushIssue(issues, `${path}.admin_ui.width`, "must be a number");
|
package/dist/services/git.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export interface CommitInfo {
|
|
|
29
29
|
export declare class GitService {
|
|
30
30
|
private git;
|
|
31
31
|
private repoPath;
|
|
32
|
+
private static readonly INDEX_LOCK_RETRY_DELAYS_MS;
|
|
32
33
|
constructor(repoPath: string);
|
|
33
34
|
/**
|
|
34
35
|
* Get the underlying SimpleGit instance for advanced operations.
|
|
@@ -97,6 +98,8 @@ export declare class GitService {
|
|
|
97
98
|
* @throws {GitError} if git command fails
|
|
98
99
|
*/
|
|
99
100
|
checkout(paths: string[]): Promise<void>;
|
|
101
|
+
private runGitCommandWithIndexLockRetry;
|
|
102
|
+
private isIndexLockError;
|
|
100
103
|
/**
|
|
101
104
|
* Stash uncommitted changes (including untracked files).
|
|
102
105
|
* Returns true if anything was stashed, false if working tree was clean.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/services/git.ts"],"names":[],"mappings":"AAOA,OAAkB,EAAgB,SAAS,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/services/git.ts"],"names":[],"mappings":"AAOA,OAAkB,EAAgB,SAAS,EAAE,MAAM,YAAY,CAAC;AAIhE,MAAM,WAAW,SAAS;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAChD;AAED,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,qBAAa,UAAU;IACnB,OAAO,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