• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

electrode-io / electrode-native / 7575

08 Apr 2026 06:30AM UTC coverage: 56.617% (-11.2%) from 67.826%
7575

push

Azure Pipelines

r0h0gg6
Update lerna publish to avoid npm classic token deprec

3601 of 7762 branches covered (46.39%)

Branch coverage included in aggregate %.

9426 of 15247 relevant lines covered (61.82%)

523.13 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

10.2
/ern-cauldron-api/src/GitFileStore.ts
1
import BaseGit from './BaseGit';
4✔
2
import fs from 'fs-extra';
4✔
3
import path from 'path';
4✔
4
import { shell } from 'ern-core';
4✔
5
import { ICauldronFileStore } from './types';
6

7
export default class GitFileStore
4✔
8
  extends BaseGit
9
  implements ICauldronFileStore
10
{
11
  private readonly prefix: string;
12

13
  constructor({
14
    cauldronPath,
15
    repository,
16
    branch,
17
  }: {
18
    cauldronPath: string;
19
    repository?: string;
20
    branch: string;
21
  }) {
22
    super({ cauldronPath, repository, branch });
×
23
  }
24

25
  // ===========================================================
26
  // ICauldronFileAccess implementation
27
  // ===========================================================
28

29
  public async storeFile(
30
    filePath: string,
31
    content: string | Buffer,
32
    fileMode?: string,
33
  ) {
34
    await this.sync();
×
35
    const storeDirectoryPath = path.resolve(
×
36
      this.fsPath,
37
      path.dirname(filePath),
38
    );
39
    await fs.ensureDir(storeDirectoryPath);
×
40
    const pathToFile = path.resolve(
×
41
      storeDirectoryPath,
42
      path.basename(filePath),
43
    );
44
    await fs.writeFile(pathToFile, content, { flag: 'w' });
×
45
    if (fileMode) {
×
46
      shell.chmod(fileMode, pathToFile);
×
47
    }
48
    await this.git.add(pathToFile);
×
49
    if (!this.pendingTransaction) {
×
50
      await this.git.commit(`Add file ${filePath}`);
×
51
      await this.push();
×
52
    }
53
  }
54

55
  public async hasFile(filePath: string) {
56
    await this.sync();
×
57
    try {
×
58
      fs.statSync(this.pathToFile(filePath)).isFile();
×
59
      return true;
×
60
    } catch (e) {
61
      return false;
×
62
    }
63
  }
64

65
  public async getPathToFile(filePath: string): Promise<string | undefined> {
66
    await this.sync();
×
67
    if (await fs.pathExists(this.pathToFile(filePath))) {
×
68
      return this.pathToFile(filePath);
×
69
    }
70
  }
71

72
  public async getFile(filePath: string): Promise<Buffer | undefined> {
73
    await this.sync();
×
74
    if (await fs.pathExists(this.pathToFile(filePath))) {
×
75
      return fs.readFile(this.pathToFile(filePath));
×
76
    }
77
  }
78

79
  public async removeFile(filePath: string): Promise<boolean> {
80
    await this.sync();
×
81
    if (await fs.pathExists(this.pathToFile(filePath))) {
×
82
      await this.git.rm(this.pathToFile(filePath));
×
83
      if (!this.pendingTransaction) {
×
84
        await this.git.commit(`Remove file ${filePath}`);
×
85
        await this.push();
×
86
      }
87
      return true;
×
88
    }
89
    return false;
×
90
  }
91

92
  private pathToFile(filePath: string) {
93
    return path.join(this.fsPath, filePath);
×
94
  }
95
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc