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

ckeditor / ckeditor5-package-generator / #765

pending completion
#765

travis-ci

117 of 117 branches covered (100.0%)

Branch coverage included in aggregate %.

416 of 416 relevant lines covered (100.0%)

8.97 hits per line

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

100.0
/packages/ckeditor5-package-generator/lib/utils/initialize-git-repository.js
1
/**
2
 * @license Copyright (c) 2020-2025, CKSource Holding sp. z o.o. All rights reserved.
3
 * For licensing, see LICENSE.md.
4
 */
5

6
import fs from 'node:fs';
7
import upath from 'upath';
8
import { execSync } from 'node:child_process';
5✔
9

5✔
10
/**
5✔
11
 * @param {string} directoryPath
12
 * @param {Logger} logger
13
 */
14
export default function initializeGitRepository( directoryPath, logger ) {
15
        logger.process( 'Initializing Git repository...' );
16

5✔
17
        const options = {
4✔
18
                stdio: 'ignore',
19
                cwd: directoryPath
4✔
20
        };
21

22
        execSync( 'git init', options );
23

24
        try {
4✔
25
                execSync( 'git add -A', options );
26
                execSync( 'git commit -m "Initialize the repository using CKEditor 5 Package Generator."', options );
4✔
27
        } catch {
4✔
28
                // Remove the `.git` directory in case of an error. It may happen that the developer didn't configure Git yet.
4✔
29
                // We could have resolved the error ourselves.
30
                // See: https://github.com/ember-cli/ember-cli/blob/3192a441e13ec7e88c71d480778971d81bfa436c/lib/tasks/git-init.js#L49-L66.
31
                fs.rmSync( upath.join( directoryPath, '.git' ), { recursive: true, force: true } );
32
        }
33
}
1✔
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

© 2025 Coveralls, Inc